feat(api): rename challenges => turnstile (#1589)

This commit is contained in:
stainless-app[bot] 2024-09-10 02:00:55 +00:00 committed by stainless-bot
parent 876ba1b567
commit 1447601752
16 changed files with 139 additions and 139 deletions

16
api.md
View file

@ -6016,24 +6016,24 @@ Methods:
- <code title="get /accounts/{account_id}/zt_risk_scoring/integrations/reference_id/{reference_id}">client.zero_trust.risk_scoring.integrations.references.<a href="./src/cloudflare/resources/zero_trust/risk_scoring/integrations/references.py">get</a>(reference_id, \*, account_id) -> <a href="./src/cloudflare/types/zero_trust/risk_scoring/integrations/reference_get_response.py">Optional</a></code>
# Challenges
# Turnstile
## Widgets
Types:
```python
from cloudflare.types.challenges import Widget, WidgetDomain, WidgetListResponse
from cloudflare.types.turnstile import Widget, WidgetDomain, WidgetListResponse
```
Methods:
- <code title="post /accounts/{account_id}/challenges/widgets">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_create_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/widget.py">Optional</a></code>
- <code title="put /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">update</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_update_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/widget.py">Optional</a></code>
- <code title="get /accounts/{account_id}/challenges/widgets">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_list_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/widget_list_response.py">SyncV4PagePaginationArray[WidgetListResponse]</a></code>
- <code title="delete /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">delete</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/challenges/widget.py">Optional</a></code>
- <code title="get /accounts/{account_id}/challenges/widgets/{sitekey}">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">get</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/challenges/widget.py">Optional</a></code>
- <code title="post /accounts/{account_id}/challenges/widgets/{sitekey}/rotate_secret">client.challenges.widgets.<a href="./src/cloudflare/resources/challenges/widgets.py">rotate_secret</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/challenges/widget_rotate_secret_params.py">params</a>) -> <a href="./src/cloudflare/types/challenges/widget.py">Optional</a></code>
- <code title="post /accounts/{account_id}/challenges/widgets">client.turnstile.widgets.<a href="./src/cloudflare/resources/turnstile/widgets.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/turnstile/widget_create_params.py">params</a>) -> <a href="./src/cloudflare/types/turnstile/widget.py">Optional</a></code>
- <code title="put /accounts/{account_id}/challenges/widgets/{sitekey}">client.turnstile.widgets.<a href="./src/cloudflare/resources/turnstile/widgets.py">update</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/turnstile/widget_update_params.py">params</a>) -> <a href="./src/cloudflare/types/turnstile/widget.py">Optional</a></code>
- <code title="get /accounts/{account_id}/challenges/widgets">client.turnstile.widgets.<a href="./src/cloudflare/resources/turnstile/widgets.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/turnstile/widget_list_params.py">params</a>) -> <a href="./src/cloudflare/types/turnstile/widget_list_response.py">SyncV4PagePaginationArray[WidgetListResponse]</a></code>
- <code title="delete /accounts/{account_id}/challenges/widgets/{sitekey}">client.turnstile.widgets.<a href="./src/cloudflare/resources/turnstile/widgets.py">delete</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/turnstile/widget.py">Optional</a></code>
- <code title="get /accounts/{account_id}/challenges/widgets/{sitekey}">client.turnstile.widgets.<a href="./src/cloudflare/resources/turnstile/widgets.py">get</a>(sitekey, \*, account_id) -> <a href="./src/cloudflare/types/turnstile/widget.py">Optional</a></code>
- <code title="post /accounts/{account_id}/challenges/widgets/{sitekey}/rotate_secret">client.turnstile.widgets.<a href="./src/cloudflare/resources/turnstile/widgets.py">rotate_secret</a>(sitekey, \*, account_id, \*\*<a href="src/cloudflare/types/turnstile/widget_rotate_secret_params.py">params</a>) -> <a href="./src/cloudflare/types/turnstile/widget.py">Optional</a></code>
# Hyperdrive

View file

@ -114,7 +114,7 @@ class Cloudflare(SyncAPIClient):
warp_connector: resources.WARPConnectorResource
workers_for_platforms: resources.WorkersForPlatformsResource
zero_trust: resources.ZeroTrustResource
challenges: resources.ChallengesResource
turnstile: resources.TurnstileResource
hyperdrive: resources.HyperdriveResource
rum: resources.RUMResource
vectorize: resources.VectorizeResource
@ -275,7 +275,7 @@ class Cloudflare(SyncAPIClient):
self.warp_connector = resources.WARPConnectorResource(self)
self.workers_for_platforms = resources.WorkersForPlatformsResource(self)
self.zero_trust = resources.ZeroTrustResource(self)
self.challenges = resources.ChallengesResource(self)
self.turnstile = resources.TurnstileResource(self)
self.hyperdrive = resources.HyperdriveResource(self)
self.rum = resources.RUMResource(self)
self.vectorize = resources.VectorizeResource(self)
@ -539,7 +539,7 @@ class AsyncCloudflare(AsyncAPIClient):
warp_connector: resources.AsyncWARPConnectorResource
workers_for_platforms: resources.AsyncWorkersForPlatformsResource
zero_trust: resources.AsyncZeroTrustResource
challenges: resources.AsyncChallengesResource
turnstile: resources.AsyncTurnstileResource
hyperdrive: resources.AsyncHyperdriveResource
rum: resources.AsyncRUMResource
vectorize: resources.AsyncVectorizeResource
@ -700,7 +700,7 @@ class AsyncCloudflare(AsyncAPIClient):
self.warp_connector = resources.AsyncWARPConnectorResource(self)
self.workers_for_platforms = resources.AsyncWorkersForPlatformsResource(self)
self.zero_trust = resources.AsyncZeroTrustResource(self)
self.challenges = resources.AsyncChallengesResource(self)
self.turnstile = resources.AsyncTurnstileResource(self)
self.hyperdrive = resources.AsyncHyperdriveResource(self)
self.rum = resources.AsyncRUMResource(self)
self.vectorize = resources.AsyncVectorizeResource(self)
@ -973,7 +973,7 @@ class CloudflareWithRawResponse:
self.warp_connector = resources.WARPConnectorResourceWithRawResponse(client.warp_connector)
self.workers_for_platforms = resources.WorkersForPlatformsResourceWithRawResponse(client.workers_for_platforms)
self.zero_trust = resources.ZeroTrustResourceWithRawResponse(client.zero_trust)
self.challenges = resources.ChallengesResourceWithRawResponse(client.challenges)
self.turnstile = resources.TurnstileResourceWithRawResponse(client.turnstile)
self.hyperdrive = resources.HyperdriveResourceWithRawResponse(client.hyperdrive)
self.rum = resources.RUMResourceWithRawResponse(client.rum)
self.vectorize = resources.VectorizeResourceWithRawResponse(client.vectorize)
@ -1077,7 +1077,7 @@ class AsyncCloudflareWithRawResponse:
client.workers_for_platforms
)
self.zero_trust = resources.AsyncZeroTrustResourceWithRawResponse(client.zero_trust)
self.challenges = resources.AsyncChallengesResourceWithRawResponse(client.challenges)
self.turnstile = resources.AsyncTurnstileResourceWithRawResponse(client.turnstile)
self.hyperdrive = resources.AsyncHyperdriveResourceWithRawResponse(client.hyperdrive)
self.rum = resources.AsyncRUMResourceWithRawResponse(client.rum)
self.vectorize = resources.AsyncVectorizeResourceWithRawResponse(client.vectorize)
@ -1181,7 +1181,7 @@ class CloudflareWithStreamedResponse:
client.workers_for_platforms
)
self.zero_trust = resources.ZeroTrustResourceWithStreamingResponse(client.zero_trust)
self.challenges = resources.ChallengesResourceWithStreamingResponse(client.challenges)
self.turnstile = resources.TurnstileResourceWithStreamingResponse(client.turnstile)
self.hyperdrive = resources.HyperdriveResourceWithStreamingResponse(client.hyperdrive)
self.rum = resources.RUMResourceWithStreamingResponse(client.rum)
self.vectorize = resources.VectorizeResourceWithStreamingResponse(client.vectorize)
@ -1291,7 +1291,7 @@ class AsyncCloudflareWithStreamedResponse:
client.workers_for_platforms
)
self.zero_trust = resources.AsyncZeroTrustResourceWithStreamingResponse(client.zero_trust)
self.challenges = resources.AsyncChallengesResourceWithStreamingResponse(client.challenges)
self.turnstile = resources.AsyncTurnstileResourceWithStreamingResponse(client.turnstile)
self.hyperdrive = resources.AsyncHyperdriveResourceWithStreamingResponse(client.hyperdrive)
self.rum = resources.AsyncRUMResourceWithStreamingResponse(client.rum)
self.vectorize = resources.AsyncVectorizeResourceWithStreamingResponse(client.vectorize)

View file

@ -328,6 +328,14 @@ from .registrar import (
RegistrarResourceWithStreamingResponse,
AsyncRegistrarResourceWithStreamingResponse,
)
from .turnstile import (
TurnstileResource,
AsyncTurnstileResource,
TurnstileResourceWithRawResponse,
AsyncTurnstileResourceWithRawResponse,
TurnstileResourceWithStreamingResponse,
AsyncTurnstileResourceWithStreamingResponse,
)
from .vectorize import (
VectorizeResource,
AsyncVectorizeResource,
@ -360,14 +368,6 @@ from .audit_logs import (
AuditLogsResourceWithStreamingResponse,
AsyncAuditLogsResourceWithStreamingResponse,
)
from .challenges import (
ChallengesResource,
AsyncChallengesResource,
ChallengesResourceWithRawResponse,
AsyncChallengesResourceWithRawResponse,
ChallengesResourceWithStreamingResponse,
AsyncChallengesResourceWithStreamingResponse,
)
from .hyperdrive import (
HyperdriveResource,
AsyncHyperdriveResource,
@ -1092,12 +1092,12 @@ __all__ = [
"AsyncZeroTrustResourceWithRawResponse",
"ZeroTrustResourceWithStreamingResponse",
"AsyncZeroTrustResourceWithStreamingResponse",
"ChallengesResource",
"AsyncChallengesResource",
"ChallengesResourceWithRawResponse",
"AsyncChallengesResourceWithRawResponse",
"ChallengesResourceWithStreamingResponse",
"AsyncChallengesResourceWithStreamingResponse",
"TurnstileResource",
"AsyncTurnstileResource",
"TurnstileResourceWithRawResponse",
"AsyncTurnstileResourceWithRawResponse",
"TurnstileResourceWithStreamingResponse",
"AsyncTurnstileResourceWithStreamingResponse",
"HyperdriveResource",
"AsyncHyperdriveResource",
"HyperdriveResourceWithRawResponse",

View file

@ -8,13 +8,13 @@ from .widgets import (
WidgetsResourceWithStreamingResponse,
AsyncWidgetsResourceWithStreamingResponse,
)
from .challenges import (
ChallengesResource,
AsyncChallengesResource,
ChallengesResourceWithRawResponse,
AsyncChallengesResourceWithRawResponse,
ChallengesResourceWithStreamingResponse,
AsyncChallengesResourceWithStreamingResponse,
from .turnstile import (
TurnstileResource,
AsyncTurnstileResource,
TurnstileResourceWithRawResponse,
AsyncTurnstileResourceWithRawResponse,
TurnstileResourceWithStreamingResponse,
AsyncTurnstileResourceWithStreamingResponse,
)
__all__ = [
@ -24,10 +24,10 @@ __all__ = [
"AsyncWidgetsResourceWithRawResponse",
"WidgetsResourceWithStreamingResponse",
"AsyncWidgetsResourceWithStreamingResponse",
"ChallengesResource",
"AsyncChallengesResource",
"ChallengesResourceWithRawResponse",
"AsyncChallengesResourceWithRawResponse",
"ChallengesResourceWithStreamingResponse",
"AsyncChallengesResourceWithStreamingResponse",
"TurnstileResource",
"AsyncTurnstileResource",
"TurnstileResourceWithRawResponse",
"AsyncTurnstileResourceWithRawResponse",
"TurnstileResourceWithStreamingResponse",
"AsyncTurnstileResourceWithStreamingResponse",
]

View file

@ -13,90 +13,90 @@ from .widgets import (
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
__all__ = ["ChallengesResource", "AsyncChallengesResource"]
__all__ = ["TurnstileResource", "AsyncTurnstileResource"]
class ChallengesResource(SyncAPIResource):
class TurnstileResource(SyncAPIResource):
@cached_property
def widgets(self) -> WidgetsResource:
return WidgetsResource(self._client)
@cached_property
def with_raw_response(self) -> ChallengesResourceWithRawResponse:
def with_raw_response(self) -> TurnstileResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
"""
return ChallengesResourceWithRawResponse(self)
return TurnstileResourceWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> ChallengesResourceWithStreamingResponse:
def with_streaming_response(self) -> TurnstileResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
"""
return ChallengesResourceWithStreamingResponse(self)
return TurnstileResourceWithStreamingResponse(self)
class AsyncChallengesResource(AsyncAPIResource):
class AsyncTurnstileResource(AsyncAPIResource):
@cached_property
def widgets(self) -> AsyncWidgetsResource:
return AsyncWidgetsResource(self._client)
@cached_property
def with_raw_response(self) -> AsyncChallengesResourceWithRawResponse:
def with_raw_response(self) -> AsyncTurnstileResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
"""
return AsyncChallengesResourceWithRawResponse(self)
return AsyncTurnstileResourceWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AsyncChallengesResourceWithStreamingResponse:
def with_streaming_response(self) -> AsyncTurnstileResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
"""
return AsyncChallengesResourceWithStreamingResponse(self)
return AsyncTurnstileResourceWithStreamingResponse(self)
class ChallengesResourceWithRawResponse:
def __init__(self, challenges: ChallengesResource) -> None:
self._challenges = challenges
class TurnstileResourceWithRawResponse:
def __init__(self, turnstile: TurnstileResource) -> None:
self._turnstile = turnstile
@cached_property
def widgets(self) -> WidgetsResourceWithRawResponse:
return WidgetsResourceWithRawResponse(self._challenges.widgets)
return WidgetsResourceWithRawResponse(self._turnstile.widgets)
class AsyncChallengesResourceWithRawResponse:
def __init__(self, challenges: AsyncChallengesResource) -> None:
self._challenges = challenges
class AsyncTurnstileResourceWithRawResponse:
def __init__(self, turnstile: AsyncTurnstileResource) -> None:
self._turnstile = turnstile
@cached_property
def widgets(self) -> AsyncWidgetsResourceWithRawResponse:
return AsyncWidgetsResourceWithRawResponse(self._challenges.widgets)
return AsyncWidgetsResourceWithRawResponse(self._turnstile.widgets)
class ChallengesResourceWithStreamingResponse:
def __init__(self, challenges: ChallengesResource) -> None:
self._challenges = challenges
class TurnstileResourceWithStreamingResponse:
def __init__(self, turnstile: TurnstileResource) -> None:
self._turnstile = turnstile
@cached_property
def widgets(self) -> WidgetsResourceWithStreamingResponse:
return WidgetsResourceWithStreamingResponse(self._challenges.widgets)
return WidgetsResourceWithStreamingResponse(self._turnstile.widgets)
class AsyncChallengesResourceWithStreamingResponse:
def __init__(self, challenges: AsyncChallengesResource) -> None:
self._challenges = challenges
class AsyncTurnstileResourceWithStreamingResponse:
def __init__(self, turnstile: AsyncTurnstileResource) -> None:
self._turnstile = turnstile
@cached_property
def widgets(self) -> AsyncWidgetsResourceWithStreamingResponse:
return AsyncWidgetsResourceWithStreamingResponse(self._challenges.widgets)
return AsyncWidgetsResourceWithStreamingResponse(self._turnstile.widgets)

View file

@ -23,15 +23,15 @@ from ..._response import (
from ..._wrappers import ResultWrapper
from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ..._base_client import AsyncPaginator, make_request_options
from ...types.challenges import (
from ...types.turnstile import (
widget_list_params,
widget_create_params,
widget_update_params,
widget_rotate_secret_params,
)
from ...types.challenges.widget import Widget
from ...types.challenges.widget_domain import WidgetDomain
from ...types.challenges.widget_list_response import WidgetListResponse
from ...types.turnstile.widget import Widget
from ...types.turnstile.widget_domain import WidgetDomain
from ...types.turnstile.widget_list_response import WidgetListResponse
__all__ = ["WidgetsResource", "AsyncWidgetsResource"]

View file

@ -10,7 +10,7 @@ import pytest
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from cloudflare.types.challenges import (
from cloudflare.types.turnstile import (
Widget,
WidgetListResponse,
)
@ -23,7 +23,7 @@ class TestWidgets:
@parametrize
def test_method_create(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.create(
widget = client.turnstile.widgets.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -33,7 +33,7 @@ class TestWidgets:
@parametrize
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.create(
widget = client.turnstile.widgets.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -51,7 +51,7 @@ class TestWidgets:
@parametrize
def test_raw_response_create(self, client: Cloudflare) -> None:
response = client.challenges.widgets.with_raw_response.create(
response = client.turnstile.widgets.with_raw_response.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -65,7 +65,7 @@ class TestWidgets:
@parametrize
def test_streaming_response_create(self, client: Cloudflare) -> None:
with client.challenges.widgets.with_streaming_response.create(
with client.turnstile.widgets.with_streaming_response.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -82,7 +82,7 @@ class TestWidgets:
@parametrize
def test_path_params_create(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.challenges.widgets.with_raw_response.create(
client.turnstile.widgets.with_raw_response.create(
account_id="",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -91,7 +91,7 @@ class TestWidgets:
@parametrize
def test_method_update(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.update(
widget = client.turnstile.widgets.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -102,7 +102,7 @@ class TestWidgets:
@parametrize
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.update(
widget = client.turnstile.widgets.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -116,7 +116,7 @@ class TestWidgets:
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
response = client.challenges.widgets.with_raw_response.update(
response = client.turnstile.widgets.with_raw_response.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -131,7 +131,7 @@ class TestWidgets:
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
with client.challenges.widgets.with_streaming_response.update(
with client.turnstile.widgets.with_streaming_response.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -149,7 +149,7 @@ class TestWidgets:
@parametrize
def test_path_params_update(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.challenges.widgets.with_raw_response.update(
client.turnstile.widgets.with_raw_response.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -158,7 +158,7 @@ class TestWidgets:
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
client.challenges.widgets.with_raw_response.update(
client.turnstile.widgets.with_raw_response.update(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -168,14 +168,14 @@ class TestWidgets:
@parametrize
def test_method_list(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.list(
widget = client.turnstile.widgets.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(SyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.list(
widget = client.turnstile.widgets.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
direction="asc",
order="id",
@ -186,7 +186,7 @@ class TestWidgets:
@parametrize
def test_raw_response_list(self, client: Cloudflare) -> None:
response = client.challenges.widgets.with_raw_response.list(
response = client.turnstile.widgets.with_raw_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -197,7 +197,7 @@ class TestWidgets:
@parametrize
def test_streaming_response_list(self, client: Cloudflare) -> None:
with client.challenges.widgets.with_streaming_response.list(
with client.turnstile.widgets.with_streaming_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
assert not response.is_closed
@ -211,13 +211,13 @@ class TestWidgets:
@parametrize
def test_path_params_list(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.challenges.widgets.with_raw_response.list(
client.turnstile.widgets.with_raw_response.list(
account_id="",
)
@parametrize
def test_method_delete(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.delete(
widget = client.turnstile.widgets.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -225,7 +225,7 @@ class TestWidgets:
@parametrize
def test_raw_response_delete(self, client: Cloudflare) -> None:
response = client.challenges.widgets.with_raw_response.delete(
response = client.turnstile.widgets.with_raw_response.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -237,7 +237,7 @@ class TestWidgets:
@parametrize
def test_streaming_response_delete(self, client: Cloudflare) -> None:
with client.challenges.widgets.with_streaming_response.delete(
with client.turnstile.widgets.with_streaming_response.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
@ -252,20 +252,20 @@ class TestWidgets:
@parametrize
def test_path_params_delete(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.challenges.widgets.with_raw_response.delete(
client.turnstile.widgets.with_raw_response.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
client.challenges.widgets.with_raw_response.delete(
client.turnstile.widgets.with_raw_response.delete(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@parametrize
def test_method_get(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.get(
widget = client.turnstile.widgets.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -273,7 +273,7 @@ class TestWidgets:
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
response = client.challenges.widgets.with_raw_response.get(
response = client.turnstile.widgets.with_raw_response.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -285,7 +285,7 @@ class TestWidgets:
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
with client.challenges.widgets.with_streaming_response.get(
with client.turnstile.widgets.with_streaming_response.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
@ -300,20 +300,20 @@ class TestWidgets:
@parametrize
def test_path_params_get(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.challenges.widgets.with_raw_response.get(
client.turnstile.widgets.with_raw_response.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
client.challenges.widgets.with_raw_response.get(
client.turnstile.widgets.with_raw_response.get(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@parametrize
def test_method_rotate_secret(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.rotate_secret(
widget = client.turnstile.widgets.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -321,7 +321,7 @@ class TestWidgets:
@parametrize
def test_method_rotate_secret_with_all_params(self, client: Cloudflare) -> None:
widget = client.challenges.widgets.rotate_secret(
widget = client.turnstile.widgets.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
invalidate_immediately=True,
@ -330,7 +330,7 @@ class TestWidgets:
@parametrize
def test_raw_response_rotate_secret(self, client: Cloudflare) -> None:
response = client.challenges.widgets.with_raw_response.rotate_secret(
response = client.turnstile.widgets.with_raw_response.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -342,7 +342,7 @@ class TestWidgets:
@parametrize
def test_streaming_response_rotate_secret(self, client: Cloudflare) -> None:
with client.challenges.widgets.with_streaming_response.rotate_secret(
with client.turnstile.widgets.with_streaming_response.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
@ -357,13 +357,13 @@ class TestWidgets:
@parametrize
def test_path_params_rotate_secret(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.challenges.widgets.with_raw_response.rotate_secret(
client.turnstile.widgets.with_raw_response.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
client.challenges.widgets.with_raw_response.rotate_secret(
client.turnstile.widgets.with_raw_response.rotate_secret(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -374,7 +374,7 @@ class TestAsyncWidgets:
@parametrize
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.create(
widget = await async_client.turnstile.widgets.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -384,7 +384,7 @@ class TestAsyncWidgets:
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.create(
widget = await async_client.turnstile.widgets.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -402,7 +402,7 @@ class TestAsyncWidgets:
@parametrize
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
response = await async_client.challenges.widgets.with_raw_response.create(
response = await async_client.turnstile.widgets.with_raw_response.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -416,7 +416,7 @@ class TestAsyncWidgets:
@parametrize
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
async with async_client.challenges.widgets.with_streaming_response.create(
async with async_client.turnstile.widgets.with_streaming_response.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -433,7 +433,7 @@ class TestAsyncWidgets:
@parametrize
async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.challenges.widgets.with_raw_response.create(
await async_client.turnstile.widgets.with_raw_response.create(
account_id="",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
mode="non-interactive",
@ -442,7 +442,7 @@ class TestAsyncWidgets:
@parametrize
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.update(
widget = await async_client.turnstile.widgets.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -453,7 +453,7 @@ class TestAsyncWidgets:
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.update(
widget = await async_client.turnstile.widgets.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -467,7 +467,7 @@ class TestAsyncWidgets:
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
response = await async_client.challenges.widgets.with_raw_response.update(
response = await async_client.turnstile.widgets.with_raw_response.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -482,7 +482,7 @@ class TestAsyncWidgets:
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
async with async_client.challenges.widgets.with_streaming_response.update(
async with async_client.turnstile.widgets.with_streaming_response.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -500,7 +500,7 @@ class TestAsyncWidgets:
@parametrize
async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.challenges.widgets.with_raw_response.update(
await async_client.turnstile.widgets.with_raw_response.update(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -509,7 +509,7 @@ class TestAsyncWidgets:
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
await async_client.challenges.widgets.with_raw_response.update(
await async_client.turnstile.widgets.with_raw_response.update(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
domains=["203.0.113.1", "cloudflare.com", "blog.example.com"],
@ -519,14 +519,14 @@ class TestAsyncWidgets:
@parametrize
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.list(
widget = await async_client.turnstile.widgets.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(AsyncV4PagePaginationArray[WidgetListResponse], widget, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.list(
widget = await async_client.turnstile.widgets.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
direction="asc",
order="id",
@ -537,7 +537,7 @@ class TestAsyncWidgets:
@parametrize
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
response = await async_client.challenges.widgets.with_raw_response.list(
response = await async_client.turnstile.widgets.with_raw_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -548,7 +548,7 @@ class TestAsyncWidgets:
@parametrize
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
async with async_client.challenges.widgets.with_streaming_response.list(
async with async_client.turnstile.widgets.with_streaming_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
assert not response.is_closed
@ -562,13 +562,13 @@ class TestAsyncWidgets:
@parametrize
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.challenges.widgets.with_raw_response.list(
await async_client.turnstile.widgets.with_raw_response.list(
account_id="",
)
@parametrize
async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.delete(
widget = await async_client.turnstile.widgets.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -576,7 +576,7 @@ class TestAsyncWidgets:
@parametrize
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
response = await async_client.challenges.widgets.with_raw_response.delete(
response = await async_client.turnstile.widgets.with_raw_response.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -588,7 +588,7 @@ class TestAsyncWidgets:
@parametrize
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
async with async_client.challenges.widgets.with_streaming_response.delete(
async with async_client.turnstile.widgets.with_streaming_response.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
@ -603,20 +603,20 @@ class TestAsyncWidgets:
@parametrize
async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.challenges.widgets.with_raw_response.delete(
await async_client.turnstile.widgets.with_raw_response.delete(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
await async_client.challenges.widgets.with_raw_response.delete(
await async_client.turnstile.widgets.with_raw_response.delete(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@parametrize
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.get(
widget = await async_client.turnstile.widgets.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -624,7 +624,7 @@ class TestAsyncWidgets:
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
response = await async_client.challenges.widgets.with_raw_response.get(
response = await async_client.turnstile.widgets.with_raw_response.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -636,7 +636,7 @@ class TestAsyncWidgets:
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
async with async_client.challenges.widgets.with_streaming_response.get(
async with async_client.turnstile.widgets.with_streaming_response.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
@ -651,20 +651,20 @@ class TestAsyncWidgets:
@parametrize
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.challenges.widgets.with_raw_response.get(
await async_client.turnstile.widgets.with_raw_response.get(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
await async_client.challenges.widgets.with_raw_response.get(
await async_client.turnstile.widgets.with_raw_response.get(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@parametrize
async def test_method_rotate_secret(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.rotate_secret(
widget = await async_client.turnstile.widgets.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -672,7 +672,7 @@ class TestAsyncWidgets:
@parametrize
async def test_method_rotate_secret_with_all_params(self, async_client: AsyncCloudflare) -> None:
widget = await async_client.challenges.widgets.rotate_secret(
widget = await async_client.turnstile.widgets.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
invalidate_immediately=True,
@ -681,7 +681,7 @@ class TestAsyncWidgets:
@parametrize
async def test_raw_response_rotate_secret(self, async_client: AsyncCloudflare) -> None:
response = await async_client.challenges.widgets.with_raw_response.rotate_secret(
response = await async_client.turnstile.widgets.with_raw_response.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
@ -693,7 +693,7 @@ class TestAsyncWidgets:
@parametrize
async def test_streaming_response_rotate_secret(self, async_client: AsyncCloudflare) -> None:
async with async_client.challenges.widgets.with_streaming_response.rotate_secret(
async with async_client.turnstile.widgets.with_streaming_response.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
@ -708,13 +708,13 @@ class TestAsyncWidgets:
@parametrize
async def test_path_params_rotate_secret(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.challenges.widgets.with_raw_response.rotate_secret(
await async_client.turnstile.widgets.with_raw_response.rotate_secret(
sitekey="0x4AAF00AAAABn0R22HWm-YUc",
account_id="",
)
with pytest.raises(ValueError, match=r"Expected a non-empty value for `sitekey` but received ''"):
await async_client.challenges.widgets.with_raw_response.rotate_secret(
await async_client.turnstile.widgets.with_raw_response.rotate_secret(
sitekey="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)