mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-16 23:01:03 +00:00
feat: update via SDK Studio (#112)
This commit is contained in:
parent
4fe83fd139
commit
71a147c4a1
14 changed files with 399 additions and 688 deletions
35
api.md
35
api.md
|
|
@ -1765,25 +1765,20 @@ Methods:
|
|||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.email_routing import EmailSettings, RoutingGetResponse
|
||||
from cloudflare.types.email_routing import (
|
||||
EmailSettings,
|
||||
RoutingDisableResponse,
|
||||
RoutingEnableResponse,
|
||||
RoutingGetResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /zones/{zone_identifier}/email/routing/disable">client.email_routing.routing.<a href="./src/cloudflare/resources/email_routing/routing/routing.py">disable</a>(zone_identifier) -> <a href="./src/cloudflare/types/email_routing/routing_disable_response.py">RoutingDisableResponse</a></code>
|
||||
- <code title="post /zones/{zone_identifier}/email/routing/enable">client.email_routing.routing.<a href="./src/cloudflare/resources/email_routing/routing/routing.py">enable</a>(zone_identifier) -> <a href="./src/cloudflare/types/email_routing/routing_enable_response.py">RoutingEnableResponse</a></code>
|
||||
- <code title="get /zones/{zone_identifier}/email/routing">client.email_routing.routing.<a href="./src/cloudflare/resources/email_routing/routing/routing.py">get</a>(zone_identifier) -> <a href="./src/cloudflare/types/email_routing/routing_get_response.py">RoutingGetResponse</a></code>
|
||||
|
||||
### Disables
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.email_routing.routing import DisableCreateResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /zones/{zone_identifier}/email/routing/disable">client.email_routing.routing.disables.<a href="./src/cloudflare/resources/email_routing/routing/disables.py">create</a>(zone_identifier) -> <a href="./src/cloudflare/types/email_routing/routing/disable_create_response.py">DisableCreateResponse</a></code>
|
||||
|
||||
### DNS
|
||||
|
||||
Types:
|
||||
|
|
@ -1796,18 +1791,6 @@ Methods:
|
|||
|
||||
- <code title="get /zones/{zone_identifier}/email/routing/dns">client.email_routing.routing.dns.<a href="./src/cloudflare/resources/email_routing/routing/dns.py">get</a>(zone_identifier) -> <a href="./src/cloudflare/types/email_routing/routing/dns_get_response.py">Optional</a></code>
|
||||
|
||||
### Enables
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.email_routing.routing import EnableCreateResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /zones/{zone_identifier}/email/routing/enable">client.email_routing.routing.enables.<a href="./src/cloudflare/resources/email_routing/routing/enables.py">create</a>(zone_identifier) -> <a href="./src/cloudflare/types/email_routing/routing/enable_create_response.py">EnableCreateResponse</a></code>
|
||||
|
||||
### Rules
|
||||
|
||||
Types:
|
||||
|
|
@ -3060,7 +3043,7 @@ from cloudflare.types import PageShieldGetZoneSettings, PageShieldUpdateZoneSett
|
|||
Methods:
|
||||
|
||||
- <code title="put /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield_update_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield_update_zone_settings.py">PageShieldUpdateZoneSettings</a></code>
|
||||
- <code title="get /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">list</a>(\*, zone_id) -> <a href="./src/cloudflare/types/page_shield_get_zone_settings.py">PageShieldGetZoneSettings</a></code>
|
||||
- <code title="get /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/page_shield_get_zone_settings.py">PageShieldGetZoneSettings</a></code>
|
||||
|
||||
## Policies
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,6 @@ from .rules import (
|
|||
RulesWithStreamingResponse,
|
||||
AsyncRulesWithStreamingResponse,
|
||||
)
|
||||
from .enables import (
|
||||
Enables,
|
||||
AsyncEnables,
|
||||
EnablesWithRawResponse,
|
||||
AsyncEnablesWithRawResponse,
|
||||
EnablesWithStreamingResponse,
|
||||
AsyncEnablesWithStreamingResponse,
|
||||
)
|
||||
from .routing import (
|
||||
Routing,
|
||||
AsyncRouting,
|
||||
|
|
@ -32,14 +24,6 @@ from .routing import (
|
|||
RoutingWithStreamingResponse,
|
||||
AsyncRoutingWithStreamingResponse,
|
||||
)
|
||||
from .disables import (
|
||||
Disables,
|
||||
AsyncDisables,
|
||||
DisablesWithRawResponse,
|
||||
AsyncDisablesWithRawResponse,
|
||||
DisablesWithStreamingResponse,
|
||||
AsyncDisablesWithStreamingResponse,
|
||||
)
|
||||
from .addresses import (
|
||||
Addresses,
|
||||
AsyncAddresses,
|
||||
|
|
@ -50,24 +34,12 @@ from .addresses import (
|
|||
)
|
||||
|
||||
__all__ = [
|
||||
"Disables",
|
||||
"AsyncDisables",
|
||||
"DisablesWithRawResponse",
|
||||
"AsyncDisablesWithRawResponse",
|
||||
"DisablesWithStreamingResponse",
|
||||
"AsyncDisablesWithStreamingResponse",
|
||||
"DNS",
|
||||
"AsyncDNS",
|
||||
"DNSWithRawResponse",
|
||||
"AsyncDNSWithRawResponse",
|
||||
"DNSWithStreamingResponse",
|
||||
"AsyncDNSWithStreamingResponse",
|
||||
"Enables",
|
||||
"AsyncEnables",
|
||||
"EnablesWithRawResponse",
|
||||
"AsyncEnablesWithRawResponse",
|
||||
"EnablesWithStreamingResponse",
|
||||
"AsyncEnablesWithStreamingResponse",
|
||||
"Rules",
|
||||
"AsyncRules",
|
||||
"RulesWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -1,162 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._wrappers import ResultWrapper
|
||||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.email_routing.routing import DisableCreateResponse
|
||||
|
||||
__all__ = ["Disables", "AsyncDisables"]
|
||||
|
||||
|
||||
class Disables(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> DisablesWithRawResponse:
|
||||
return DisablesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> DisablesWithStreamingResponse:
|
||||
return DisablesWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> DisableCreateResponse:
|
||||
"""Disable your Email Routing zone.
|
||||
|
||||
Also removes additional MX records previously
|
||||
required for Email Routing to work.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/disable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DisableCreateResponse], ResultWrapper[DisableCreateResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncDisables(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncDisablesWithRawResponse:
|
||||
return AsyncDisablesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncDisablesWithStreamingResponse:
|
||||
return AsyncDisablesWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> DisableCreateResponse:
|
||||
"""Disable your Email Routing zone.
|
||||
|
||||
Also removes additional MX records previously
|
||||
required for Email Routing to work.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return await self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/disable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[DisableCreateResponse], ResultWrapper[DisableCreateResponse]),
|
||||
)
|
||||
|
||||
|
||||
class DisablesWithRawResponse:
|
||||
def __init__(self, disables: Disables) -> None:
|
||||
self._disables = disables
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
disables.create,
|
||||
)
|
||||
|
||||
|
||||
class AsyncDisablesWithRawResponse:
|
||||
def __init__(self, disables: AsyncDisables) -> None:
|
||||
self._disables = disables
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
disables.create,
|
||||
)
|
||||
|
||||
|
||||
class DisablesWithStreamingResponse:
|
||||
def __init__(self, disables: Disables) -> None:
|
||||
self._disables = disables
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
disables.create,
|
||||
)
|
||||
|
||||
|
||||
class AsyncDisablesWithStreamingResponse:
|
||||
def __init__(self, disables: AsyncDisables) -> None:
|
||||
self._disables = disables
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
disables.create,
|
||||
)
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._wrappers import ResultWrapper
|
||||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.email_routing.routing import EnableCreateResponse
|
||||
|
||||
__all__ = ["Enables", "AsyncEnables"]
|
||||
|
||||
|
||||
class Enables(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> EnablesWithRawResponse:
|
||||
return EnablesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> EnablesWithStreamingResponse:
|
||||
return EnablesWithStreamingResponse(self)
|
||||
|
||||
def create(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> EnableCreateResponse:
|
||||
"""Enable you Email Routing zone.
|
||||
|
||||
Add and lock the necessary MX and SPF records.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/enable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[EnableCreateResponse], ResultWrapper[EnableCreateResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncEnables(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncEnablesWithRawResponse:
|
||||
return AsyncEnablesWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncEnablesWithStreamingResponse:
|
||||
return AsyncEnablesWithStreamingResponse(self)
|
||||
|
||||
async def create(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> EnableCreateResponse:
|
||||
"""Enable you Email Routing zone.
|
||||
|
||||
Add and lock the necessary MX and SPF records.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return await self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/enable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[EnableCreateResponse], ResultWrapper[EnableCreateResponse]),
|
||||
)
|
||||
|
||||
|
||||
class EnablesWithRawResponse:
|
||||
def __init__(self, enables: Enables) -> None:
|
||||
self._enables = enables
|
||||
|
||||
self.create = to_raw_response_wrapper(
|
||||
enables.create,
|
||||
)
|
||||
|
||||
|
||||
class AsyncEnablesWithRawResponse:
|
||||
def __init__(self, enables: AsyncEnables) -> None:
|
||||
self._enables = enables
|
||||
|
||||
self.create = async_to_raw_response_wrapper(
|
||||
enables.create,
|
||||
)
|
||||
|
||||
|
||||
class EnablesWithStreamingResponse:
|
||||
def __init__(self, enables: Enables) -> None:
|
||||
self._enables = enables
|
||||
|
||||
self.create = to_streamed_response_wrapper(
|
||||
enables.create,
|
||||
)
|
||||
|
||||
|
||||
class AsyncEnablesWithStreamingResponse:
|
||||
def __init__(self, enables: AsyncEnables) -> None:
|
||||
self._enables = enables
|
||||
|
||||
self.create = async_to_streamed_response_wrapper(
|
||||
enables.create,
|
||||
)
|
||||
|
|
@ -22,22 +22,6 @@ from .rules import (
|
|||
RulesWithStreamingResponse,
|
||||
AsyncRulesWithStreamingResponse,
|
||||
)
|
||||
from .enables import (
|
||||
Enables,
|
||||
AsyncEnables,
|
||||
EnablesWithRawResponse,
|
||||
AsyncEnablesWithRawResponse,
|
||||
EnablesWithStreamingResponse,
|
||||
AsyncEnablesWithStreamingResponse,
|
||||
)
|
||||
from .disables import (
|
||||
Disables,
|
||||
AsyncDisables,
|
||||
DisablesWithRawResponse,
|
||||
AsyncDisablesWithRawResponse,
|
||||
DisablesWithStreamingResponse,
|
||||
AsyncDisablesWithStreamingResponse,
|
||||
)
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .addresses import (
|
||||
Addresses,
|
||||
|
|
@ -60,24 +44,16 @@ from ...._wrappers import ResultWrapper
|
|||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.email_routing import RoutingGetResponse
|
||||
from ....types.email_routing import RoutingGetResponse, RoutingEnableResponse, RoutingDisableResponse
|
||||
|
||||
__all__ = ["Routing", "AsyncRouting"]
|
||||
|
||||
|
||||
class Routing(SyncAPIResource):
|
||||
@cached_property
|
||||
def disables(self) -> Disables:
|
||||
return Disables(self._client)
|
||||
|
||||
@cached_property
|
||||
def dns(self) -> DNS:
|
||||
return DNS(self._client)
|
||||
|
||||
@cached_property
|
||||
def enables(self) -> Enables:
|
||||
return Enables(self._client)
|
||||
|
||||
@cached_property
|
||||
def rules(self) -> Rules:
|
||||
return Rules(self._client)
|
||||
|
|
@ -94,6 +70,87 @@ class Routing(SyncAPIResource):
|
|||
def with_streaming_response(self) -> RoutingWithStreamingResponse:
|
||||
return RoutingWithStreamingResponse(self)
|
||||
|
||||
def disable(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RoutingDisableResponse:
|
||||
"""Disable your Email Routing zone.
|
||||
|
||||
Also removes additional MX records previously
|
||||
required for Email Routing to work.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/disable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RoutingDisableResponse], ResultWrapper[RoutingDisableResponse]),
|
||||
)
|
||||
|
||||
def enable(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RoutingEnableResponse:
|
||||
"""Enable you Email Routing zone.
|
||||
|
||||
Add and lock the necessary MX and SPF records.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/enable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RoutingEnableResponse], ResultWrapper[RoutingEnableResponse]),
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
|
|
@ -135,18 +192,10 @@ class Routing(SyncAPIResource):
|
|||
|
||||
|
||||
class AsyncRouting(AsyncAPIResource):
|
||||
@cached_property
|
||||
def disables(self) -> AsyncDisables:
|
||||
return AsyncDisables(self._client)
|
||||
|
||||
@cached_property
|
||||
def dns(self) -> AsyncDNS:
|
||||
return AsyncDNS(self._client)
|
||||
|
||||
@cached_property
|
||||
def enables(self) -> AsyncEnables:
|
||||
return AsyncEnables(self._client)
|
||||
|
||||
@cached_property
|
||||
def rules(self) -> AsyncRules:
|
||||
return AsyncRules(self._client)
|
||||
|
|
@ -163,6 +212,87 @@ class AsyncRouting(AsyncAPIResource):
|
|||
def with_streaming_response(self) -> AsyncRoutingWithStreamingResponse:
|
||||
return AsyncRoutingWithStreamingResponse(self)
|
||||
|
||||
async def disable(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RoutingDisableResponse:
|
||||
"""Disable your Email Routing zone.
|
||||
|
||||
Also removes additional MX records previously
|
||||
required for Email Routing to work.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return await self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/disable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RoutingDisableResponse], ResultWrapper[RoutingDisableResponse]),
|
||||
)
|
||||
|
||||
async def enable(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> RoutingEnableResponse:
|
||||
"""Enable you Email Routing zone.
|
||||
|
||||
Add and lock the necessary MX and SPF records.
|
||||
|
||||
Args:
|
||||
zone_identifier: Identifier
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not zone_identifier:
|
||||
raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}")
|
||||
return await self._post(
|
||||
f"/zones/{zone_identifier}/email/routing/enable",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[RoutingEnableResponse], ResultWrapper[RoutingEnableResponse]),
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
zone_identifier: str,
|
||||
|
|
@ -207,22 +337,20 @@ class RoutingWithRawResponse:
|
|||
def __init__(self, routing: Routing) -> None:
|
||||
self._routing = routing
|
||||
|
||||
self.disable = to_raw_response_wrapper(
|
||||
routing.disable,
|
||||
)
|
||||
self.enable = to_raw_response_wrapper(
|
||||
routing.enable,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
routing.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def disables(self) -> DisablesWithRawResponse:
|
||||
return DisablesWithRawResponse(self._routing.disables)
|
||||
|
||||
@cached_property
|
||||
def dns(self) -> DNSWithRawResponse:
|
||||
return DNSWithRawResponse(self._routing.dns)
|
||||
|
||||
@cached_property
|
||||
def enables(self) -> EnablesWithRawResponse:
|
||||
return EnablesWithRawResponse(self._routing.enables)
|
||||
|
||||
@cached_property
|
||||
def rules(self) -> RulesWithRawResponse:
|
||||
return RulesWithRawResponse(self._routing.rules)
|
||||
|
|
@ -236,22 +364,20 @@ class AsyncRoutingWithRawResponse:
|
|||
def __init__(self, routing: AsyncRouting) -> None:
|
||||
self._routing = routing
|
||||
|
||||
self.disable = async_to_raw_response_wrapper(
|
||||
routing.disable,
|
||||
)
|
||||
self.enable = async_to_raw_response_wrapper(
|
||||
routing.enable,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
routing.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def disables(self) -> AsyncDisablesWithRawResponse:
|
||||
return AsyncDisablesWithRawResponse(self._routing.disables)
|
||||
|
||||
@cached_property
|
||||
def dns(self) -> AsyncDNSWithRawResponse:
|
||||
return AsyncDNSWithRawResponse(self._routing.dns)
|
||||
|
||||
@cached_property
|
||||
def enables(self) -> AsyncEnablesWithRawResponse:
|
||||
return AsyncEnablesWithRawResponse(self._routing.enables)
|
||||
|
||||
@cached_property
|
||||
def rules(self) -> AsyncRulesWithRawResponse:
|
||||
return AsyncRulesWithRawResponse(self._routing.rules)
|
||||
|
|
@ -265,22 +391,20 @@ class RoutingWithStreamingResponse:
|
|||
def __init__(self, routing: Routing) -> None:
|
||||
self._routing = routing
|
||||
|
||||
self.disable = to_streamed_response_wrapper(
|
||||
routing.disable,
|
||||
)
|
||||
self.enable = to_streamed_response_wrapper(
|
||||
routing.enable,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
routing.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def disables(self) -> DisablesWithStreamingResponse:
|
||||
return DisablesWithStreamingResponse(self._routing.disables)
|
||||
|
||||
@cached_property
|
||||
def dns(self) -> DNSWithStreamingResponse:
|
||||
return DNSWithStreamingResponse(self._routing.dns)
|
||||
|
||||
@cached_property
|
||||
def enables(self) -> EnablesWithStreamingResponse:
|
||||
return EnablesWithStreamingResponse(self._routing.enables)
|
||||
|
||||
@cached_property
|
||||
def rules(self) -> RulesWithStreamingResponse:
|
||||
return RulesWithStreamingResponse(self._routing.rules)
|
||||
|
|
@ -294,22 +418,20 @@ class AsyncRoutingWithStreamingResponse:
|
|||
def __init__(self, routing: AsyncRouting) -> None:
|
||||
self._routing = routing
|
||||
|
||||
self.disable = async_to_streamed_response_wrapper(
|
||||
routing.disable,
|
||||
)
|
||||
self.enable = async_to_streamed_response_wrapper(
|
||||
routing.enable,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
routing.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def disables(self) -> AsyncDisablesWithStreamingResponse:
|
||||
return AsyncDisablesWithStreamingResponse(self._routing.disables)
|
||||
|
||||
@cached_property
|
||||
def dns(self) -> AsyncDNSWithStreamingResponse:
|
||||
return AsyncDNSWithStreamingResponse(self._routing.dns)
|
||||
|
||||
@cached_property
|
||||
def enables(self) -> AsyncEnablesWithStreamingResponse:
|
||||
return AsyncEnablesWithStreamingResponse(self._routing.enables)
|
||||
|
||||
@cached_property
|
||||
def rules(self) -> AsyncRulesWithStreamingResponse:
|
||||
return AsyncRulesWithStreamingResponse(self._routing.rules)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class PageShield(SyncAPIResource):
|
|||
cast_to=cast(Type[PageShieldUpdateZoneSettings], ResultWrapper[PageShieldUpdateZoneSettings]),
|
||||
)
|
||||
|
||||
def list(
|
||||
def get(
|
||||
self,
|
||||
*,
|
||||
zone_id: str,
|
||||
|
|
@ -248,7 +248,7 @@ class AsyncPageShield(AsyncAPIResource):
|
|||
cast_to=cast(Type[PageShieldUpdateZoneSettings], ResultWrapper[PageShieldUpdateZoneSettings]),
|
||||
)
|
||||
|
||||
async def list(
|
||||
async def get(
|
||||
self,
|
||||
*,
|
||||
zone_id: str,
|
||||
|
|
@ -295,8 +295,8 @@ class PageShieldWithRawResponse:
|
|||
self.update = to_raw_response_wrapper(
|
||||
page_shield.update,
|
||||
)
|
||||
self.list = to_raw_response_wrapper(
|
||||
page_shield.list,
|
||||
self.get = to_raw_response_wrapper(
|
||||
page_shield.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
|
|
@ -319,8 +319,8 @@ class AsyncPageShieldWithRawResponse:
|
|||
self.update = async_to_raw_response_wrapper(
|
||||
page_shield.update,
|
||||
)
|
||||
self.list = async_to_raw_response_wrapper(
|
||||
page_shield.list,
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
page_shield.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
|
|
@ -343,8 +343,8 @@ class PageShieldWithStreamingResponse:
|
|||
self.update = to_streamed_response_wrapper(
|
||||
page_shield.update,
|
||||
)
|
||||
self.list = to_streamed_response_wrapper(
|
||||
page_shield.list,
|
||||
self.get = to_streamed_response_wrapper(
|
||||
page_shield.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
|
|
@ -367,8 +367,8 @@ class AsyncPageShieldWithStreamingResponse:
|
|||
self.update = async_to_streamed_response_wrapper(
|
||||
page_shield.update,
|
||||
)
|
||||
self.list = async_to_streamed_response_wrapper(
|
||||
page_shield.list,
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
page_shield.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
|
|
|
|||
|
|
@ -3,3 +3,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from .routing_get_response import RoutingGetResponse as RoutingGetResponse
|
||||
from .routing_enable_response import RoutingEnableResponse as RoutingEnableResponse
|
||||
from .routing_disable_response import RoutingDisableResponse as RoutingDisableResponse
|
||||
|
|
|
|||
|
|
@ -16,7 +16,5 @@ from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse
|
|||
from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse
|
||||
from .address_create_params import AddressCreateParams as AddressCreateParams
|
||||
from .address_list_response import AddressListResponse as AddressListResponse
|
||||
from .enable_create_response import EnableCreateResponse as EnableCreateResponse
|
||||
from .address_create_response import AddressCreateResponse as AddressCreateResponse
|
||||
from .address_delete_response import AddressDeleteResponse as AddressDeleteResponse
|
||||
from .disable_create_response import DisableCreateResponse as DisableCreateResponse
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ from typing import Optional
|
|||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["DisableCreateResponse"]
|
||||
__all__ = ["RoutingDisableResponse"]
|
||||
|
||||
|
||||
class DisableCreateResponse(BaseModel):
|
||||
class RoutingDisableResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Email Routing settings identifier."""
|
||||
|
||||
|
|
@ -4,12 +4,12 @@ from typing import Optional
|
|||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ...._models import BaseModel
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["EnableCreateResponse"]
|
||||
__all__ = ["RoutingEnableResponse"]
|
||||
|
||||
|
||||
class EnableCreateResponse(BaseModel):
|
||||
class RoutingEnableResponse(BaseModel):
|
||||
id: Optional[str] = None
|
||||
"""Email Routing settings identifier."""
|
||||
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.email_routing.routing import DisableCreateResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestDisables:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
disable = client.email_routing.routing.disables.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DisableCreateResponse, disable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.email_routing.routing.disables.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
disable = response.parse()
|
||||
assert_matches_type(DisableCreateResponse, disable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.email_routing.routing.disables.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
disable = response.parse()
|
||||
assert_matches_type(DisableCreateResponse, disable, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
client.email_routing.routing.disables.with_raw_response.create(
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncDisables:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
disable = await async_client.email_routing.routing.disables.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(DisableCreateResponse, disable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.email_routing.routing.disables.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
disable = await response.parse()
|
||||
assert_matches_type(DisableCreateResponse, disable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.email_routing.routing.disables.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
disable = await response.parse()
|
||||
assert_matches_type(DisableCreateResponse, disable, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
await async_client.email_routing.routing.disables.with_raw_response.create(
|
||||
"",
|
||||
)
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.email_routing.routing import EnableCreateResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestEnables:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_create(self, client: Cloudflare) -> None:
|
||||
enable = client.email_routing.routing.enables.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(EnableCreateResponse, enable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_create(self, client: Cloudflare) -> None:
|
||||
response = client.email_routing.routing.enables.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
enable = response.parse()
|
||||
assert_matches_type(EnableCreateResponse, enable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_create(self, client: Cloudflare) -> None:
|
||||
with client.email_routing.routing.enables.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
enable = response.parse()
|
||||
assert_matches_type(EnableCreateResponse, enable, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_create(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
client.email_routing.routing.enables.with_raw_response.create(
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncEnables:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_create(self, async_client: AsyncCloudflare) -> None:
|
||||
enable = await async_client.email_routing.routing.enables.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(EnableCreateResponse, enable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.email_routing.routing.enables.with_raw_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
enable = await response.parse()
|
||||
assert_matches_type(EnableCreateResponse, enable, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.email_routing.routing.enables.with_streaming_response.create(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
enable = await response.parse()
|
||||
assert_matches_type(EnableCreateResponse, enable, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
await async_client.email_routing.routing.enables.with_raw_response.create(
|
||||
"",
|
||||
)
|
||||
|
|
@ -9,7 +9,7 @@ import pytest
|
|||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
from cloudflare.types.email_routing import RoutingGetResponse
|
||||
from cloudflare.types.email_routing import RoutingGetResponse, RoutingEnableResponse, RoutingDisableResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -17,6 +17,90 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|||
class TestRouting:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_disable(self, client: Cloudflare) -> None:
|
||||
routing = client.email_routing.routing.disable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RoutingDisableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_disable(self, client: Cloudflare) -> None:
|
||||
response = client.email_routing.routing.with_raw_response.disable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
routing = response.parse()
|
||||
assert_matches_type(RoutingDisableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_disable(self, client: Cloudflare) -> None:
|
||||
with client.email_routing.routing.with_streaming_response.disable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
routing = response.parse()
|
||||
assert_matches_type(RoutingDisableResponse, routing, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_disable(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
client.email_routing.routing.with_raw_response.disable(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_enable(self, client: Cloudflare) -> None:
|
||||
routing = client.email_routing.routing.enable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RoutingEnableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_enable(self, client: Cloudflare) -> None:
|
||||
response = client.email_routing.routing.with_raw_response.enable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
routing = response.parse()
|
||||
assert_matches_type(RoutingEnableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_enable(self, client: Cloudflare) -> None:
|
||||
with client.email_routing.routing.with_streaming_response.enable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
routing = response.parse()
|
||||
assert_matches_type(RoutingEnableResponse, routing, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_enable(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
client.email_routing.routing.with_raw_response.enable(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
|
|
@ -63,6 +147,90 @@ class TestRouting:
|
|||
class TestAsyncRouting:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_disable(self, async_client: AsyncCloudflare) -> None:
|
||||
routing = await async_client.email_routing.routing.disable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RoutingDisableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.email_routing.routing.with_raw_response.disable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
routing = await response.parse()
|
||||
assert_matches_type(RoutingDisableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_disable(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.email_routing.routing.with_streaming_response.disable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
routing = await response.parse()
|
||||
assert_matches_type(RoutingDisableResponse, routing, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_disable(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
await async_client.email_routing.routing.with_raw_response.disable(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_enable(self, async_client: AsyncCloudflare) -> None:
|
||||
routing = await async_client.email_routing.routing.enable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(RoutingEnableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.email_routing.routing.with_raw_response.enable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
routing = await response.parse()
|
||||
assert_matches_type(RoutingEnableResponse, routing, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_enable(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.email_routing.routing.with_streaming_response.enable(
|
||||
"023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
routing = await response.parse()
|
||||
assert_matches_type(RoutingEnableResponse, routing, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_enable(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"):
|
||||
await async_client.email_routing.routing.with_raw_response.enable(
|
||||
"",
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
|
|
|
|||
|
|
@ -72,16 +72,16 @@ class TestPageShield:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_list(self, client: Cloudflare) -> None:
|
||||
page_shield = client.page_shield.list(
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
page_shield = client.page_shield.get(
|
||||
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(PageShieldGetZoneSettings, page_shield, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_list(self, client: Cloudflare) -> None:
|
||||
response = client.page_shield.with_raw_response.list(
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.page_shield.with_raw_response.get(
|
||||
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ class TestPageShield:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_list(self, client: Cloudflare) -> None:
|
||||
with client.page_shield.with_streaming_response.list(
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.page_shield.with_streaming_response.get(
|
||||
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
|
|
@ -106,9 +106,9 @@ class TestPageShield:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_path_params_list(self, client: Cloudflare) -> None:
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
|
||||
client.page_shield.with_raw_response.list(
|
||||
client.page_shield.with_raw_response.get(
|
||||
zone_id="",
|
||||
)
|
||||
|
||||
|
|
@ -171,16 +171,16 @@ class TestAsyncPageShield:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_list(self, async_client: AsyncCloudflare) -> None:
|
||||
page_shield = await async_client.page_shield.list(
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
page_shield = await async_client.page_shield.get(
|
||||
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
assert_matches_type(PageShieldGetZoneSettings, page_shield, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.page_shield.with_raw_response.list(
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.page_shield.with_raw_response.get(
|
||||
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
)
|
||||
|
||||
|
|
@ -191,8 +191,8 @@ class TestAsyncPageShield:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.page_shield.with_streaming_response.list(
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.page_shield.with_streaming_response.get(
|
||||
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
|
|
@ -205,8 +205,8 @@ class TestAsyncPageShield:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
|
||||
await async_client.page_shield.with_raw_response.list(
|
||||
await async_client.page_shield.with_raw_response.get(
|
||||
zone_id="",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue