From 996eb17e26319f6edbbbccd3b7134eeab6db2425 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:09:10 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#388) --- .stats.yml | 2 +- api.md | 24 ++++---- .../resources/email_routing/addresses.py | 38 ++++++------ .../resources/email_routing/email_routing.py | 38 ++++++------ .../email_routing/rules/catch_alls.py | 26 ++++----- .../resources/email_routing/rules/rules.py | 50 ++++++++-------- .../email_routing/rules/test_catch_alls.py | 30 +++++----- .../email_routing/test_addresses.py | 38 ++++++------ .../api_resources/email_routing/test_rules.py | 58 +++++++++---------- tests/api_resources/test_email_routing.py | 38 ++++++------ 10 files changed, 171 insertions(+), 171 deletions(-) diff --git a/.stats.yml b/.stats.yml index b793266d078..c44a93364c5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1259 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-543a9898a4efc4501e7101d78908dcfaa303efd8f2abb7164299dd85be87749d.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-db82dd88520065dc6282d55691c415867cb115705691731e45ed70570bf0b2c4.yml diff --git a/api.md b/api.md index 72f9bde7c00..e484b059f53 100644 --- a/api.md +++ b/api.md @@ -1727,9 +1727,9 @@ from cloudflare.types.email_routing import Settings Methods: -- client.email_routing.disable(zone_identifier, \*\*params) -> Settings -- client.email_routing.enable(zone_identifier, \*\*params) -> Settings -- client.email_routing.get(zone_identifier) -> Settings +- client.email_routing.disable(zone_identifier, \*\*params) -> Optional +- client.email_routing.enable(zone_identifier, \*\*params) -> Optional +- client.email_routing.get(zone_identifier) -> Optional ## DNS @@ -1753,11 +1753,11 @@ from cloudflare.types.email_routing import Action, EmailRoutingRule, Matcher Methods: -- client.email_routing.rules.create(zone_identifier, \*\*params) -> EmailRoutingRule -- client.email_routing.rules.update(rule_identifier, \*, zone_identifier, \*\*params) -> EmailRoutingRule +- client.email_routing.rules.create(zone_identifier, \*\*params) -> Optional +- client.email_routing.rules.update(rule_identifier, \*, zone_identifier, \*\*params) -> Optional - client.email_routing.rules.list(zone_identifier, \*\*params) -> SyncV4PagePaginationArray[EmailRoutingRule] -- client.email_routing.rules.delete(rule_identifier, \*, zone_identifier) -> EmailRoutingRule -- client.email_routing.rules.get(rule_identifier, \*, zone_identifier) -> EmailRoutingRule +- client.email_routing.rules.delete(rule_identifier, \*, zone_identifier) -> Optional +- client.email_routing.rules.get(rule_identifier, \*, zone_identifier) -> Optional ### CatchAlls @@ -1774,8 +1774,8 @@ from cloudflare.types.email_routing.rules import ( Methods: -- client.email_routing.rules.catch_alls.update(zone_identifier, \*\*params) -> CatchAllUpdateResponse -- client.email_routing.rules.catch_alls.get(zone_identifier) -> CatchAllGetResponse +- client.email_routing.rules.catch_alls.update(zone_identifier, \*\*params) -> Optional +- client.email_routing.rules.catch_alls.get(zone_identifier) -> Optional ## Addresses @@ -1787,10 +1787,10 @@ from cloudflare.types.email_routing import Address Methods: -- client.email_routing.addresses.create(account_identifier, \*\*params) -> Address +- client.email_routing.addresses.create(account_identifier, \*\*params) -> Optional - client.email_routing.addresses.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[Address] -- client.email_routing.addresses.delete(destination_address_identifier, \*, account_identifier) -> Address -- client.email_routing.addresses.get(destination_address_identifier, \*, account_identifier) -> Address +- client.email_routing.addresses.delete(destination_address_identifier, \*, account_identifier) -> Optional +- client.email_routing.addresses.get(destination_address_identifier, \*, account_identifier) -> Optional # Filters diff --git a/src/cloudflare/resources/email_routing/addresses.py b/src/cloudflare/resources/email_routing/addresses.py index 8af8920e626..2ee58159aa2 100644 --- a/src/cloudflare/resources/email_routing/addresses.py +++ b/src/cloudflare/resources/email_routing/addresses.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -52,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Address: + ) -> Optional[Address]: """Create a destination address to forward your emails to. Destination addresses @@ -81,9 +81,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Address]._unwrapper, + post_parser=ResultWrapper[Optional[Address]]._unwrapper, ), - cast_to=cast(Type[Address], ResultWrapper[Address]), + cast_to=cast(Type[Optional[Address]], ResultWrapper[Address]), ) def list( @@ -157,7 +157,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Address: + ) -> Optional[Address]: """ Deletes a specific destination address. @@ -187,9 +187,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Address]._unwrapper, + post_parser=ResultWrapper[Optional[Address]]._unwrapper, ), - cast_to=cast(Type[Address], ResultWrapper[Address]), + cast_to=cast(Type[Optional[Address]], ResultWrapper[Address]), ) def get( @@ -203,7 +203,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Address: + ) -> Optional[Address]: """ Gets information for a specific destination email already created. @@ -233,9 +233,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Address]._unwrapper, + post_parser=ResultWrapper[Optional[Address]]._unwrapper, ), - cast_to=cast(Type[Address], ResultWrapper[Address]), + cast_to=cast(Type[Optional[Address]], ResultWrapper[Address]), ) @@ -259,7 +259,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Address: + ) -> Optional[Address]: """Create a destination address to forward your emails to. Destination addresses @@ -288,9 +288,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Address]._unwrapper, + post_parser=ResultWrapper[Optional[Address]]._unwrapper, ), - cast_to=cast(Type[Address], ResultWrapper[Address]), + cast_to=cast(Type[Optional[Address]], ResultWrapper[Address]), ) def list( @@ -364,7 +364,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Address: + ) -> Optional[Address]: """ Deletes a specific destination address. @@ -394,9 +394,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Address]._unwrapper, + post_parser=ResultWrapper[Optional[Address]]._unwrapper, ), - cast_to=cast(Type[Address], ResultWrapper[Address]), + cast_to=cast(Type[Optional[Address]], ResultWrapper[Address]), ) async def get( @@ -410,7 +410,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Address: + ) -> Optional[Address]: """ Gets information for a specific destination email already created. @@ -440,9 +440,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Address]._unwrapper, + post_parser=ResultWrapper[Optional[Address]]._unwrapper, ), - cast_to=cast(Type[Address], ResultWrapper[Address]), + cast_to=cast(Type[Optional[Address]], ResultWrapper[Address]), ) diff --git a/src/cloudflare/resources/email_routing/email_routing.py b/src/cloudflare/resources/email_routing/email_routing.py index 1a6ba8f71e0..52ff5a1758d 100644 --- a/src/cloudflare/resources/email_routing/email_routing.py +++ b/src/cloudflare/resources/email_routing/email_routing.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -86,7 +86,7 @@ def disable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Settings: + ) -> Optional[Settings]: """Disable your Email Routing zone. Also removes additional MX records previously @@ -113,9 +113,9 @@ def disable( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Settings]._unwrapper, + post_parser=ResultWrapper[Optional[Settings]]._unwrapper, ), - cast_to=cast(Type[Settings], ResultWrapper[Settings]), + cast_to=cast(Type[Optional[Settings]], ResultWrapper[Settings]), ) def enable( @@ -129,7 +129,7 @@ def enable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Settings: + ) -> Optional[Settings]: """Enable you Email Routing zone. Add and lock the necessary MX and SPF records. @@ -155,9 +155,9 @@ def enable( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Settings]._unwrapper, + post_parser=ResultWrapper[Optional[Settings]]._unwrapper, ), - cast_to=cast(Type[Settings], ResultWrapper[Settings]), + cast_to=cast(Type[Optional[Settings]], ResultWrapper[Settings]), ) def get( @@ -170,7 +170,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Settings: + ) -> Optional[Settings]: """ Get information about the settings for your Email Routing zone. @@ -194,9 +194,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Settings]._unwrapper, + post_parser=ResultWrapper[Optional[Settings]]._unwrapper, ), - cast_to=cast(Type[Settings], ResultWrapper[Settings]), + cast_to=cast(Type[Optional[Settings]], ResultWrapper[Settings]), ) @@ -232,7 +232,7 @@ async def disable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Settings: + ) -> Optional[Settings]: """Disable your Email Routing zone. Also removes additional MX records previously @@ -259,9 +259,9 @@ async def disable( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Settings]._unwrapper, + post_parser=ResultWrapper[Optional[Settings]]._unwrapper, ), - cast_to=cast(Type[Settings], ResultWrapper[Settings]), + cast_to=cast(Type[Optional[Settings]], ResultWrapper[Settings]), ) async def enable( @@ -275,7 +275,7 @@ async def enable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Settings: + ) -> Optional[Settings]: """Enable you Email Routing zone. Add and lock the necessary MX and SPF records. @@ -301,9 +301,9 @@ async def enable( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Settings]._unwrapper, + post_parser=ResultWrapper[Optional[Settings]]._unwrapper, ), - cast_to=cast(Type[Settings], ResultWrapper[Settings]), + cast_to=cast(Type[Optional[Settings]], ResultWrapper[Settings]), ) async def get( @@ -316,7 +316,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Settings: + ) -> Optional[Settings]: """ Get information about the settings for your Email Routing zone. @@ -340,9 +340,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Settings]._unwrapper, + post_parser=ResultWrapper[Optional[Settings]]._unwrapper, ), - cast_to=cast(Type[Settings], ResultWrapper[Settings]), + cast_to=cast(Type[Optional[Settings]], ResultWrapper[Settings]), ) diff --git a/src/cloudflare/resources/email_routing/rules/catch_alls.py b/src/cloudflare/resources/email_routing/rules/catch_alls.py index bc3761ff093..567104c8c91 100644 --- a/src/cloudflare/resources/email_routing/rules/catch_alls.py +++ b/src/cloudflare/resources/email_routing/rules/catch_alls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -56,7 +56,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CatchAllUpdateResponse: + ) -> Optional[CatchAllUpdateResponse]: """ Enable or disable catch-all routing rule, or change action to forward to specific destination address. @@ -98,9 +98,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CatchAllUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CatchAllUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[CatchAllUpdateResponse], ResultWrapper[CatchAllUpdateResponse]), + cast_to=cast(Type[Optional[CatchAllUpdateResponse]], ResultWrapper[CatchAllUpdateResponse]), ) def get( @@ -113,7 +113,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CatchAllGetResponse: + ) -> Optional[CatchAllGetResponse]: """ Get information on the default catch-all routing rule. @@ -137,9 +137,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CatchAllGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CatchAllGetResponse]]._unwrapper, ), - cast_to=cast(Type[CatchAllGetResponse], ResultWrapper[CatchAllGetResponse]), + cast_to=cast(Type[Optional[CatchAllGetResponse]], ResultWrapper[CatchAllGetResponse]), ) @@ -166,7 +166,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CatchAllUpdateResponse: + ) -> Optional[CatchAllUpdateResponse]: """ Enable or disable catch-all routing rule, or change action to forward to specific destination address. @@ -208,9 +208,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CatchAllUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CatchAllUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[CatchAllUpdateResponse], ResultWrapper[CatchAllUpdateResponse]), + cast_to=cast(Type[Optional[CatchAllUpdateResponse]], ResultWrapper[CatchAllUpdateResponse]), ) async def get( @@ -223,7 +223,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CatchAllGetResponse: + ) -> Optional[CatchAllGetResponse]: """ Get information on the default catch-all routing rule. @@ -247,9 +247,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CatchAllGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CatchAllGetResponse]]._unwrapper, ), - cast_to=cast(Type[CatchAllGetResponse], ResultWrapper[CatchAllGetResponse]), + cast_to=cast(Type[Optional[CatchAllGetResponse]], ResultWrapper[CatchAllGetResponse]), ) diff --git a/src/cloudflare/resources/email_routing/rules/rules.py b/src/cloudflare/resources/email_routing/rules/rules.py index 963df9fbe78..d38f48dfc4a 100644 --- a/src/cloudflare/resources/email_routing/rules/rules.py +++ b/src/cloudflare/resources/email_routing/rules/rules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -70,7 +70,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the @@ -116,9 +116,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) def update( @@ -137,7 +137,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Update actions and matches, or enable/disable specific routing rules. @@ -185,9 +185,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) def list( @@ -257,7 +257,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Delete a specific routing rule. @@ -285,9 +285,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) def get( @@ -301,7 +301,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Get information for a specific routing rule already created. @@ -329,9 +329,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) @@ -363,7 +363,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the @@ -409,9 +409,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) async def update( @@ -430,7 +430,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Update actions and matches, or enable/disable specific routing rules. @@ -478,9 +478,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) def list( @@ -550,7 +550,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Delete a specific routing rule. @@ -578,9 +578,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) async def get( @@ -594,7 +594,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmailRoutingRule: + ) -> Optional[EmailRoutingRule]: """ Get information for a specific routing rule already created. @@ -622,9 +622,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[EmailRoutingRule]._unwrapper, + post_parser=ResultWrapper[Optional[EmailRoutingRule]]._unwrapper, ), - cast_to=cast(Type[EmailRoutingRule], ResultWrapper[EmailRoutingRule]), + cast_to=cast(Type[Optional[EmailRoutingRule]], ResultWrapper[EmailRoutingRule]), ) diff --git a/tests/api_resources/email_routing/rules/test_catch_alls.py b/tests/api_resources/email_routing/rules/test_catch_alls.py index 1e50ffb3147..bae9a887033 100644 --- a/tests/api_resources/email_routing/rules/test_catch_alls.py +++ b/tests/api_resources/email_routing/rules/test_catch_alls.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_update(self, client: Cloudflare) -> None: actions=[{"type": "forward"}, {"type": "forward"}, {"type": "forward"}], matchers=[{"type": "all"}, {"type": "all"}, {"type": "all"}], ) - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -60,7 +60,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: enabled=True, name="Send to user@example.net rule.", ) - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -73,7 +73,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -86,7 +86,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) assert cast(Any, response.is_closed) is True @@ -104,7 +104,7 @@ def test_method_get(self, client: Cloudflare) -> None: catch_all = client.email_routing.rules.catch_alls.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllGetResponse], catch_all, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -115,7 +115,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllGetResponse], catch_all, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -126,7 +126,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = response.parse() - assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllGetResponse], catch_all, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +148,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: actions=[{"type": "forward"}, {"type": "forward"}, {"type": "forward"}], matchers=[{"type": "all"}, {"type": "all"}, {"type": "all"}], ) - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -184,7 +184,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare enabled=True, name="Send to user@example.net rule.", ) - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -197,7 +197,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -210,7 +210,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(CatchAllUpdateResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllUpdateResponse], catch_all, path=["response"]) assert cast(Any, response.is_closed) is True @@ -228,7 +228,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: catch_all = await async_client.email_routing.rules.catch_alls.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllGetResponse], catch_all, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -239,7 +239,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllGetResponse], catch_all, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -250,7 +250,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" catch_all = await response.parse() - assert_matches_type(CatchAllGetResponse, catch_all, path=["response"]) + assert_matches_type(Optional[CatchAllGetResponse], catch_all, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/test_addresses.py b/tests/api_resources/email_routing/test_addresses.py index 82e7f13e617..092f927fc8a 100644 --- a/tests/api_resources/email_routing/test_addresses.py +++ b/tests/api_resources/email_routing/test_addresses.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_create(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", email="user@example.com", ) - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -36,7 +36,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -48,7 +48,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -115,7 +115,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -127,7 +127,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -139,7 +139,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -165,7 +165,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -177,7 +177,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -189,7 +189,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -219,7 +219,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", email="user@example.com", ) - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -231,7 +231,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -243,7 +243,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -310,7 +310,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -322,7 +322,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -334,7 +334,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True @@ -360,7 +360,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ea95132c15732412d22c1476fa83f27a", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -372,7 +372,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -384,7 +384,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" address = await response.parse() - assert_matches_type(Address, address, path=["response"]) + assert_matches_type(Optional[Address], address, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/email_routing/test_rules.py b/tests/api_resources/email_routing/test_rules.py index 10e890b4d0e..0c130d6cce5 100644 --- a/tests/api_resources/email_routing/test_rules.py +++ b/tests/api_resources/email_routing/test_rules.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -66,7 +66,7 @@ def test_method_create(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -119,7 +119,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -173,7 +173,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -227,7 +227,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -330,7 +330,7 @@ def test_method_update(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -384,7 +384,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -439,7 +439,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -494,7 +494,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -652,7 +652,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -664,7 +664,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -676,7 +676,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -700,7 +700,7 @@ def test_method_get(self, client: Cloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -712,7 +712,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -724,7 +724,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -794,7 +794,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -847,7 +847,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -901,7 +901,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -955,7 +955,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1058,7 +1058,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -1112,7 +1112,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare name="Send to user@example.net rule.", priority=0, ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -1167,7 +1167,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -1222,7 +1222,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1380,7 +1380,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -1392,7 +1392,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -1404,7 +1404,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1428,7 +1428,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "a7e6fb77503c41d8a7f3113c6918f10c", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -1440,7 +1440,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -1452,7 +1452,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(EmailRoutingRule, rule, path=["response"]) + assert_matches_type(Optional[EmailRoutingRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_email_routing.py b/tests/api_resources/test_email_routing.py index 6969f592525..e31f84ff008 100644 --- a/tests/api_resources/test_email_routing.py +++ b/tests/api_resources/test_email_routing.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_disable(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize def test_raw_response_disable(self, client: Cloudflare) -> None: @@ -35,7 +35,7 @@ def test_raw_response_disable(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize def test_streaming_response_disable(self, client: Cloudflare) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_disable(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,7 +65,7 @@ def test_method_enable(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize def test_raw_response_enable(self, client: Cloudflare) -> None: @@ -77,7 +77,7 @@ def test_raw_response_enable(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize def test_streaming_response_enable(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_enable(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -106,7 +106,7 @@ def test_method_get(self, client: Cloudflare) -> None: email_routing = client.email_routing.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -117,7 +117,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -128,7 +128,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +149,7 @@ async def test_method_disable(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None: @@ -161,7 +161,7 @@ async def test_raw_response_disable(self, async_client: AsyncCloudflare) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize async def test_streaming_response_disable(self, async_client: AsyncCloudflare) -> None: @@ -173,7 +173,7 @@ async def test_streaming_response_disable(self, async_client: AsyncCloudflare) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -191,7 +191,7 @@ async def test_method_enable(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None: @@ -203,7 +203,7 @@ async def test_raw_response_enable(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize async def test_streaming_response_enable(self, async_client: AsyncCloudflare) -> None: @@ -215,7 +215,7 @@ async def test_streaming_response_enable(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) assert cast(Any, response.is_closed) is True @@ -232,7 +232,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: email_routing = await async_client.email_routing.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -243,7 +243,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -254,7 +254,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" email_routing = await response.parse() - assert_matches_type(Settings, email_routing, path=["response"]) + assert_matches_type(Optional[Settings], email_routing, path=["response"]) assert cast(Any, response.is_closed) is True