From c81e57e139a099f29dfadb50038c3fa4f9b2f66e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:20:25 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#326) --- api.md | 58 +++++++++--------- .../resources/workers/account_settings.py | 18 +++--- src/cloudflare/resources/workers/domains.py | 18 +++--- .../resources/workers/scripts/content.py | 10 ++-- .../resources/workers/scripts/deployments.py | 18 +++--- .../resources/workers/scripts/schedules.py | 18 +++--- .../resources/workers/scripts/scripts.py | 18 +++--- .../resources/workers/scripts/settings.py | 18 +++--- .../resources/workers/scripts/tail.py | 60 +++++++------------ .../resources/workers/scripts/versions.py | 26 ++++---- .../resources/workers/subdomains.py | 18 +++--- .../dispatch/namespaces/namespaces.py | 18 +++--- .../dispatch/namespaces/scripts/bindings.py | 10 ++-- .../dispatch/namespaces/scripts/content.py | 10 ++-- .../dispatch/namespaces/scripts/scripts.py | 26 ++++---- .../dispatch/namespaces/scripts/secrets.py | 10 ++-- .../dispatch/namespaces/scripts/settings.py | 18 +++--- .../dispatch/namespaces/scripts/tags.py | 10 ++-- .../workers/scripts/tail_delete_response.py | 15 ++++- .../workers/scripts/test_content.py | 18 +++--- .../workers/scripts/test_deployments.py | 30 +++++----- .../workers/scripts/test_schedules.py | 26 ++++---- .../workers/scripts/test_settings.py | 30 +++++----- .../workers/scripts/test_tail.py | 26 ++++---- .../workers/scripts/test_versions.py | 42 ++++++------- .../workers/test_account_settings.py | 26 ++++---- tests/api_resources/workers/test_domains.py | 26 ++++---- tests/api_resources/workers/test_scripts.py | 34 +++++------ .../api_resources/workers/test_subdomains.py | 26 ++++---- .../namespaces/scripts/test_bindings.py | 14 ++--- .../namespaces/scripts/test_content.py | 18 +++--- .../namespaces/scripts/test_secrets.py | 18 +++--- .../namespaces/scripts/test_settings.py | 30 +++++----- .../dispatch/namespaces/scripts/test_tags.py | 14 ++--- .../dispatch/namespaces/test_scripts.py | 46 +++++++------- .../dispatch/test_namespaces.py | 30 +++++----- 36 files changed, 422 insertions(+), 429 deletions(-) diff --git a/api.md b/api.md index 737197d88fd7..1669a8e4f200 100644 --- a/api.md +++ b/api.md @@ -2641,7 +2641,7 @@ from cloudflare.types.workers import Script, ScriptSetting Methods: -- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> Script +- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> Optional - client.workers.scripts.list(\*, account_id) -> SyncSinglePage[Script] - client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> None - client.workers.scripts.get(script_name, \*, account_id) -> BinaryAPIResponse @@ -2656,8 +2656,8 @@ from cloudflare.types.workers.scripts import Schedule, ScheduleUpdateResponse, S Methods: -- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> ScheduleUpdateResponse -- client.workers.scripts.schedules.get(script_name, \*, account_id) -> ScheduleGetResponse +- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.schedules.get(script_name, \*, account_id) -> Optional ### Tail @@ -2674,23 +2674,23 @@ from cloudflare.types.workers.scripts import ( Methods: -- client.workers.scripts.tail.create(script_name, \*, account_id, \*\*params) -> TailCreateResponse +- client.workers.scripts.tail.create(script_name, \*, account_id, \*\*params) -> Optional - client.workers.scripts.tail.delete(id, \*, account_id, script_name, \*\*params) -> TailDeleteResponse -- client.workers.scripts.tail.get(script_name, \*, account_id) -> TailGetResponse +- client.workers.scripts.tail.get(script_name, \*, account_id) -> Optional ### Content Methods: -- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Script +- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Optional - client.workers.scripts.content.get(script_name, \*, account_id) -> BinaryAPIResponse ### Settings Methods: -- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> ScriptSetting -- client.workers.scripts.settings.get(script_name, \*, account_id) -> ScriptSetting +- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.settings.get(script_name, \*, account_id) -> Optional ### Deployments @@ -2706,8 +2706,8 @@ from cloudflare.types.workers.scripts import ( Methods: -- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> DeploymentCreateResponse -- client.workers.scripts.deployments.get(script_name, \*, account_id) -> DeploymentGetResponse +- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.deployments.get(script_name, \*, account_id) -> Optional ### Versions @@ -2723,9 +2723,9 @@ from cloudflare.types.workers.scripts import ( Methods: -- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> VersionCreateResponse -- client.workers.scripts.versions.list(script_name, \*, account_id) -> VersionListResponse -- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> VersionGetResponse +- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> Optional +- client.workers.scripts.versions.list(script_name, \*, account_id) -> Optional +- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> Optional ## AccountSettings @@ -2737,8 +2737,8 @@ from cloudflare.types.workers import AccountSettingUpdateResponse, AccountSettin Methods: -- client.workers.account_settings.update(\*, account_id, \*\*params) -> AccountSettingUpdateResponse -- client.workers.account_settings.get(\*, account_id) -> AccountSettingGetResponse +- client.workers.account_settings.update(\*, account_id, \*\*params) -> Optional +- client.workers.account_settings.get(\*, account_id) -> Optional ## Domains @@ -2750,10 +2750,10 @@ from cloudflare.types.workers import Domain Methods: -- client.workers.domains.update(\*, account_id, \*\*params) -> Domain +- client.workers.domains.update(\*, account_id, \*\*params) -> Optional - client.workers.domains.list(\*, account_id, \*\*params) -> SyncSinglePage[Domain] - client.workers.domains.delete(domain_id, \*, account_id, \*\*params) -> None -- client.workers.domains.get(domain_id, \*, account_id) -> Domain +- client.workers.domains.get(domain_id, \*, account_id) -> Optional ## Subdomains @@ -2765,8 +2765,8 @@ from cloudflare.types.workers import SubdomainUpdateResponse, SubdomainGetRespon Methods: -- client.workers.subdomains.update(\*, account_id, \*\*params) -> SubdomainUpdateResponse -- client.workers.subdomains.get(\*, account_id) -> SubdomainGetResponse +- client.workers.subdomains.update(\*, account_id, \*\*params) -> Optional +- client.workers.subdomains.get(\*, account_id) -> Optional # KV @@ -4637,10 +4637,10 @@ from cloudflare.types.workers_for_platforms.dispatch import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> NamespaceCreateResponse +- client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.list(\*, account_id) -> SyncSinglePage[NamespaceListResponse] - client.workers_for_platforms.dispatch.namespaces.delete(dispatch_namespace, \*, account_id) -> object -- client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> NamespaceGetResponse +- client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> Optional #### Scripts @@ -4652,15 +4652,15 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces import Script Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Script +- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> None -- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Script +- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Optional ##### Content Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Script +- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.scripts.content.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse ##### Settings @@ -4676,8 +4676,8 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SettingEditResponse -- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> SettingGetResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional +- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> Optional ##### Bindings @@ -4689,7 +4689,7 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import B Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> BindingGetResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> Optional ##### Secrets @@ -4704,7 +4704,7 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SecretUpdateResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[SecretListResponse] ##### Tags @@ -4721,7 +4721,7 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> TagUpdateResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional - client.workers_for_platforms.dispatch.namespaces.scripts.tags.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[TagListResponse] - client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete(tag, \*, account_id, dispatch_namespace, script_name) -> object diff --git a/src/cloudflare/resources/workers/account_settings.py b/src/cloudflare/resources/workers/account_settings.py index 562a83c49c43..e672a2d60de6 100644 --- a/src/cloudflare/resources/workers/account_settings.py +++ b/src/cloudflare/resources/workers/account_settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -48,7 +48,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingUpdateResponse: + ) -> Optional[AccountSettingUpdateResponse]: """ Creates Worker account settings for an account. @@ -75,7 +75,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AccountSettingUpdateResponse], ResultWrapper[AccountSettingUpdateResponse]), + cast_to=cast(Type[Optional[AccountSettingUpdateResponse]], ResultWrapper[AccountSettingUpdateResponse]), ) def get( @@ -88,7 +88,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingGetResponse: + ) -> Optional[AccountSettingGetResponse]: """ Fetches Worker account settings for an account. @@ -114,7 +114,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AccountSettingGetResponse], ResultWrapper[AccountSettingGetResponse]), + cast_to=cast(Type[Optional[AccountSettingGetResponse]], ResultWrapper[AccountSettingGetResponse]), ) @@ -138,7 +138,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingUpdateResponse: + ) -> Optional[AccountSettingUpdateResponse]: """ Creates Worker account settings for an account. @@ -165,7 +165,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AccountSettingUpdateResponse], ResultWrapper[AccountSettingUpdateResponse]), + cast_to=cast(Type[Optional[AccountSettingUpdateResponse]], ResultWrapper[AccountSettingUpdateResponse]), ) async def get( @@ -178,7 +178,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountSettingGetResponse: + ) -> Optional[AccountSettingGetResponse]: """ Fetches Worker account settings for an account. @@ -204,7 +204,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[AccountSettingGetResponse], ResultWrapper[AccountSettingGetResponse]), + cast_to=cast(Type[Optional[AccountSettingGetResponse]], ResultWrapper[AccountSettingGetResponse]), ) diff --git a/src/cloudflare/resources/workers/domains.py b/src/cloudflare/resources/workers/domains.py index e0857f41572f..a93b5b19f01a 100644 --- a/src/cloudflare/resources/workers/domains.py +++ b/src/cloudflare/resources/workers/domains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -53,7 +53,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Domain: + ) -> Optional[Domain]: """ Attaches a Worker to a zone and hostname. @@ -94,7 +94,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Domain], ResultWrapper[Domain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) def list( @@ -211,7 +211,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Domain: + ) -> Optional[Domain]: """ Gets a Worker domain. @@ -239,7 +239,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Domain], ResultWrapper[Domain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) @@ -266,7 +266,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Domain: + ) -> Optional[Domain]: """ Attaches a Worker to a zone and hostname. @@ -307,7 +307,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Domain], ResultWrapper[Domain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) def list( @@ -424,7 +424,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Domain: + ) -> Optional[Domain]: """ Gets a Worker domain. @@ -452,7 +452,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Domain], ResultWrapper[Domain]), + cast_to=cast(Type[Optional[Domain]], ResultWrapper[Domain]), ) diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py index 98e0d2a57ab4..3d41cbb142ac 100644 --- a/src/cloudflare/resources/workers/scripts/content.py +++ b/src/cloudflare/resources/workers/scripts/content.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Mapping, cast +from typing import List, Type, Mapping, Optional, cast import httpx @@ -62,7 +62,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Put script content without touching config or metadata @@ -115,7 +115,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def get( @@ -182,7 +182,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Put script content without touching config or metadata @@ -235,7 +235,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) async def get( diff --git a/src/cloudflare/resources/workers/scripts/deployments.py b/src/cloudflare/resources/workers/scripts/deployments.py index a1fa83fad26b..bb64020919da 100644 --- a/src/cloudflare/resources/workers/scripts/deployments.py +++ b/src/cloudflare/resources/workers/scripts/deployments.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -55,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeploymentCreateResponse: + ) -> Optional[DeploymentCreateResponse]: """ Deployments configure how [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) @@ -95,7 +95,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DeploymentCreateResponse], ResultWrapper[DeploymentCreateResponse]), + cast_to=cast(Type[Optional[DeploymentCreateResponse]], ResultWrapper[DeploymentCreateResponse]), ) def get( @@ -109,7 +109,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeploymentGetResponse: + ) -> Optional[DeploymentGetResponse]: """List of Worker Deployments. The first deployment in the list is the latest @@ -141,7 +141,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DeploymentGetResponse], ResultWrapper[DeploymentGetResponse]), + cast_to=cast(Type[Optional[DeploymentGetResponse]], ResultWrapper[DeploymentGetResponse]), ) @@ -167,7 +167,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeploymentCreateResponse: + ) -> Optional[DeploymentCreateResponse]: """ Deployments configure how [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions) @@ -207,7 +207,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DeploymentCreateResponse], ResultWrapper[DeploymentCreateResponse]), + cast_to=cast(Type[Optional[DeploymentCreateResponse]], ResultWrapper[DeploymentCreateResponse]), ) async def get( @@ -221,7 +221,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeploymentGetResponse: + ) -> Optional[DeploymentGetResponse]: """List of Worker Deployments. The first deployment in the list is the latest @@ -253,7 +253,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DeploymentGetResponse], ResultWrapper[DeploymentGetResponse]), + cast_to=cast(Type[Optional[DeploymentGetResponse]], ResultWrapper[DeploymentGetResponse]), ) diff --git a/src/cloudflare/resources/workers/scripts/schedules.py b/src/cloudflare/resources/workers/scripts/schedules.py index 08b743870013..058df41ba330 100644 --- a/src/cloudflare/resources/workers/scripts/schedules.py +++ b/src/cloudflare/resources/workers/scripts/schedules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -49,7 +49,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleUpdateResponse: + ) -> Optional[ScheduleUpdateResponse]: """ Updates Cron Triggers for a Worker. @@ -80,7 +80,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScheduleUpdateResponse], ResultWrapper[ScheduleUpdateResponse]), + cast_to=cast(Type[Optional[ScheduleUpdateResponse]], ResultWrapper[ScheduleUpdateResponse]), ) def get( @@ -94,7 +94,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleGetResponse: + ) -> Optional[ScheduleGetResponse]: """ Fetches Cron Triggers for a Worker. @@ -124,7 +124,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScheduleGetResponse], ResultWrapper[ScheduleGetResponse]), + cast_to=cast(Type[Optional[ScheduleGetResponse]], ResultWrapper[ScheduleGetResponse]), ) @@ -149,7 +149,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleUpdateResponse: + ) -> Optional[ScheduleUpdateResponse]: """ Updates Cron Triggers for a Worker. @@ -180,7 +180,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScheduleUpdateResponse], ResultWrapper[ScheduleUpdateResponse]), + cast_to=cast(Type[Optional[ScheduleUpdateResponse]], ResultWrapper[ScheduleUpdateResponse]), ) async def get( @@ -194,7 +194,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScheduleGetResponse: + ) -> Optional[ScheduleGetResponse]: """ Fetches Cron Triggers for a Worker. @@ -224,7 +224,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScheduleGetResponse], ResultWrapper[ScheduleGetResponse]), + cast_to=cast(Type[Optional[ScheduleGetResponse]], ResultWrapper[ScheduleGetResponse]), ) diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index 8c8d0e6cb615..428a7b8c11ea 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast, overload +from typing import List, Type, Optional, cast, overload import httpx @@ -135,7 +135,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Upload a worker module. @@ -180,7 +180,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Upload a worker module. @@ -222,7 +222,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: @@ -245,7 +245,7 @@ def update( query=maybe_transform({"rollback_to": rollback_to}, script_update_params.ScriptUpdateParams), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def list( @@ -429,7 +429,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Upload a worker module. @@ -474,7 +474,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Upload a worker module. @@ -516,7 +516,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: @@ -541,7 +541,7 @@ async def update( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def list( diff --git a/src/cloudflare/resources/workers/scripts/settings.py b/src/cloudflare/resources/workers/scripts/settings.py index c8bdf7e6908e..41202351d28a 100644 --- a/src/cloudflare/resources/workers/scripts/settings.py +++ b/src/cloudflare/resources/workers/scripts/settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -51,7 +51,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptSetting: + ) -> Optional[ScriptSetting]: """ Patch script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). @@ -94,7 +94,7 @@ def edit( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) def get( @@ -108,7 +108,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptSetting: + ) -> Optional[ScriptSetting]: """ Get script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). @@ -140,7 +140,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) @@ -166,7 +166,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptSetting: + ) -> Optional[ScriptSetting]: """ Patch script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). @@ -209,7 +209,7 @@ async def edit( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) 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, - ) -> ScriptSetting: + ) -> Optional[ScriptSetting]: """ Get script-level settings when using [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions). @@ -255,7 +255,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ScriptSetting], ResultWrapper[ScriptSetting]), + cast_to=cast(Type[Optional[ScriptSetting]], ResultWrapper[ScriptSetting]), ) diff --git a/src/cloudflare/resources/workers/scripts/tail.py b/src/cloudflare/resources/workers/scripts/tail.py index 0ed295311179..21857b83ee69 100644 --- a/src/cloudflare/resources/workers/scripts/tail.py +++ b/src/cloudflare/resources/workers/scripts/tail.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Type, Optional, cast import httpx @@ -55,7 +55,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TailCreateResponse: + ) -> Optional[TailCreateResponse]: """ Starts a tail that receives logs and exception from a Worker. @@ -86,7 +86,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TailCreateResponse], ResultWrapper[TailCreateResponse]), + cast_to=cast(Type[Optional[TailCreateResponse]], ResultWrapper[TailCreateResponse]), ) def delete( @@ -127,22 +127,13 @@ def delete( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return cast( - TailDeleteResponse, - self._delete( - f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", - body=maybe_transform(body, tail_delete_params.TailDeleteParams), - 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( - Any, ResultWrapper[TailDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", + body=maybe_transform(body, tail_delete_params.TailDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=TailDeleteResponse, ) def get( @@ -156,7 +147,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TailGetResponse: + ) -> Optional[TailGetResponse]: """ Get list of tails currently deployed on a Worker. @@ -186,7 +177,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TailGetResponse], ResultWrapper[TailGetResponse]), + cast_to=cast(Type[Optional[TailGetResponse]], ResultWrapper[TailGetResponse]), ) @@ -211,7 +202,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TailCreateResponse: + ) -> Optional[TailCreateResponse]: """ Starts a tail that receives logs and exception from a Worker. @@ -242,7 +233,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TailCreateResponse], ResultWrapper[TailCreateResponse]), + cast_to=cast(Type[Optional[TailCreateResponse]], ResultWrapper[TailCreateResponse]), ) async def delete( @@ -283,22 +274,13 @@ async def delete( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return cast( - TailDeleteResponse, - await self._delete( - f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", - body=await async_maybe_transform(body, tail_delete_params.TailDeleteParams), - 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( - Any, ResultWrapper[TailDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/workers/scripts/{script_name}/tails/{id}", + body=await async_maybe_transform(body, tail_delete_params.TailDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=TailDeleteResponse, ) async def get( @@ -312,7 +294,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TailGetResponse: + ) -> Optional[TailGetResponse]: """ Get list of tails currently deployed on a Worker. @@ -342,7 +324,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TailGetResponse], ResultWrapper[TailGetResponse]), + cast_to=cast(Type[Optional[TailGetResponse]], ResultWrapper[TailGetResponse]), ) diff --git a/src/cloudflare/resources/workers/scripts/versions.py b/src/cloudflare/resources/workers/scripts/versions.py index a1097ea64797..7e281ef46214 100644 --- a/src/cloudflare/resources/workers/scripts/versions.py +++ b/src/cloudflare/resources/workers/scripts/versions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Mapping, cast +from typing import List, Type, Mapping, Optional, cast import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VersionCreateResponse: + ) -> Optional[VersionCreateResponse]: """ Upload a Worker Version without deploying to Cloudflare's network. @@ -107,7 +107,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VersionCreateResponse], ResultWrapper[VersionCreateResponse]), + cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]), ) def list( @@ -121,7 +121,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VersionListResponse: + ) -> Optional[VersionListResponse]: """List of Worker Versions. The first version in the list is the latest version. @@ -152,7 +152,7 @@ def list( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VersionListResponse], ResultWrapper[VersionListResponse]), + cast_to=cast(Type[Optional[VersionListResponse]], ResultWrapper[VersionListResponse]), ) def get( @@ -167,7 +167,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VersionGetResponse: + ) -> Optional[VersionGetResponse]: """ Get Version Detail @@ -199,7 +199,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]), + cast_to=cast(Type[Optional[VersionGetResponse]], ResultWrapper[VersionGetResponse]), ) @@ -225,7 +225,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VersionCreateResponse: + ) -> Optional[VersionCreateResponse]: """ Upload a Worker Version without deploying to Cloudflare's network. @@ -275,7 +275,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VersionCreateResponse], ResultWrapper[VersionCreateResponse]), + cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]), ) async def list( @@ -289,7 +289,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VersionListResponse: + ) -> Optional[VersionListResponse]: """List of Worker Versions. The first version in the list is the latest version. @@ -320,7 +320,7 @@ async def list( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VersionListResponse], ResultWrapper[VersionListResponse]), + cast_to=cast(Type[Optional[VersionListResponse]], ResultWrapper[VersionListResponse]), ) async def get( @@ -335,7 +335,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VersionGetResponse: + ) -> Optional[VersionGetResponse]: """ Get Version Detail @@ -367,7 +367,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]), + cast_to=cast(Type[Optional[VersionGetResponse]], ResultWrapper[VersionGetResponse]), ) diff --git a/src/cloudflare/resources/workers/subdomains.py b/src/cloudflare/resources/workers/subdomains.py index 53e6c2ff836a..10313d041b95 100644 --- a/src/cloudflare/resources/workers/subdomains.py +++ b/src/cloudflare/resources/workers/subdomains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -48,7 +48,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainUpdateResponse: + ) -> Optional[SubdomainUpdateResponse]: """ Creates a Workers subdomain for an account. @@ -75,7 +75,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SubdomainUpdateResponse], ResultWrapper[SubdomainUpdateResponse]), + cast_to=cast(Type[Optional[SubdomainUpdateResponse]], ResultWrapper[SubdomainUpdateResponse]), ) def get( @@ -88,7 +88,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainGetResponse: + ) -> Optional[SubdomainGetResponse]: """ Returns a Workers subdomain for an account. @@ -114,7 +114,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SubdomainGetResponse], ResultWrapper[SubdomainGetResponse]), + cast_to=cast(Type[Optional[SubdomainGetResponse]], ResultWrapper[SubdomainGetResponse]), ) @@ -138,7 +138,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainUpdateResponse: + ) -> Optional[SubdomainUpdateResponse]: """ Creates a Workers subdomain for an account. @@ -165,7 +165,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SubdomainUpdateResponse], ResultWrapper[SubdomainUpdateResponse]), + cast_to=cast(Type[Optional[SubdomainUpdateResponse]], ResultWrapper[SubdomainUpdateResponse]), ) async def get( @@ -178,7 +178,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SubdomainGetResponse: + ) -> Optional[SubdomainGetResponse]: """ Returns a Workers subdomain for an account. @@ -204,7 +204,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SubdomainGetResponse], ResultWrapper[SubdomainGetResponse]), + cast_to=cast(Type[Optional[SubdomainGetResponse]], ResultWrapper[SubdomainGetResponse]), ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py index 6609c8266150..a2a41bd7ebba 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -68,7 +68,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceCreateResponse: + ) -> Optional[NamespaceCreateResponse]: """ Create a new Workers for Platforms namespace. @@ -97,7 +97,7 @@ def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]), + cast_to=cast(Type[Optional[NamespaceCreateResponse]], ResultWrapper[NamespaceCreateResponse]), ) def list( @@ -191,7 +191,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceGetResponse: + ) -> Optional[NamespaceGetResponse]: """ Get a Workers for Platforms namespace. @@ -221,7 +221,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[NamespaceGetResponse], ResultWrapper[NamespaceGetResponse]), + cast_to=cast(Type[Optional[NamespaceGetResponse]], ResultWrapper[NamespaceGetResponse]), ) @@ -249,7 +249,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceCreateResponse: + ) -> Optional[NamespaceCreateResponse]: """ Create a new Workers for Platforms namespace. @@ -278,7 +278,7 @@ async def create( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]), + cast_to=cast(Type[Optional[NamespaceCreateResponse]], ResultWrapper[NamespaceCreateResponse]), ) def list( @@ -372,7 +372,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceGetResponse: + ) -> Optional[NamespaceGetResponse]: """ Get a Workers for Platforms namespace. @@ -402,7 +402,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[NamespaceGetResponse], ResultWrapper[NamespaceGetResponse]), + cast_to=cast(Type[Optional[NamespaceGetResponse]], ResultWrapper[NamespaceGetResponse]), ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py index 60f9cfd9db97..9cb2b4dd6db5 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -45,7 +45,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingGetResponse: + ) -> Optional[BindingGetResponse]: """ Fetch script bindings from a script uploaded to a Workers for Platforms namespace. @@ -80,7 +80,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]), + cast_to=cast(Type[Optional[BindingGetResponse]], ResultWrapper[BindingGetResponse]), ) @@ -105,7 +105,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingGetResponse: + ) -> Optional[BindingGetResponse]: """ Fetch script bindings from a script uploaded to a Workers for Platforms namespace. @@ -140,7 +140,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]), + cast_to=cast(Type[Optional[BindingGetResponse]], ResultWrapper[BindingGetResponse]), ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py index d7372f378930..27b9367c5701 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Mapping, cast +from typing import List, Type, Mapping, Optional, cast import httpx @@ -63,7 +63,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Put script content for a script uploaded to a Workers for Platforms namespace. @@ -120,7 +120,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def get( @@ -194,7 +194,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Put script content for a script uploaded to a Workers for Platforms namespace. @@ -251,7 +251,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) async def get( diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py index 4e7f2ed5fd7d..3f878144b9f0 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast, overload +from typing import List, Type, Optional, cast, overload import httpx @@ -114,7 +114,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """Upload a worker module to a Workers for Platforms namespace. You can find an @@ -160,7 +160,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """Upload a worker module to a Workers for Platforms namespace. You can find an @@ -203,7 +203,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not dispatch_namespace: @@ -227,7 +227,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) def delete( @@ -301,7 +301,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Fetch information about a script uploaded to a Workers for Platforms namespace. @@ -335,7 +335,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) @@ -383,7 +383,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """Upload a worker module to a Workers for Platforms namespace. You can find an @@ -429,7 +429,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """Upload a worker module to a Workers for Platforms namespace. You can find an @@ -472,7 +472,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not dispatch_namespace: @@ -496,7 +496,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) async def delete( @@ -570,7 +570,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Script: + ) -> Optional[Script]: """ Fetch information about a script uploaded to a Workers for Platforms namespace. @@ -604,7 +604,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Script], ResultWrapper[Script]), + cast_to=cast(Type[Optional[Script]], ResultWrapper[Script]), ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py index 9aac5862840e..97a48d2e0330 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.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 @@ -59,7 +59,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretUpdateResponse: + ) -> Optional[SecretUpdateResponse]: """ Put secrets to a script uploaded to a Workers for Platforms namespace. @@ -107,7 +107,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SecretUpdateResponse], ResultWrapper[SecretUpdateResponse]), + cast_to=cast(Type[Optional[SecretUpdateResponse]], ResultWrapper[SecretUpdateResponse]), ) def list( @@ -181,7 +181,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretUpdateResponse: + ) -> Optional[SecretUpdateResponse]: """ Put secrets to a script uploaded to a Workers for Platforms namespace. @@ -229,7 +229,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SecretUpdateResponse], ResultWrapper[SecretUpdateResponse]), + cast_to=cast(Type[Optional[SecretUpdateResponse]], ResultWrapper[SecretUpdateResponse]), ) def list( diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py index ca87932c18ad..be3ddc67aeba 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -54,7 +54,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingEditResponse: + ) -> Optional[SettingEditResponse]: """ Patch script metadata, such as bindings @@ -89,7 +89,7 @@ def edit( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), ) def get( @@ -104,7 +104,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingGetResponse: + ) -> Optional[SettingGetResponse]: """ Get script settings from a script uploaded to a Workers for Platforms namespace. @@ -138,7 +138,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), + cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), ) @@ -164,7 +164,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingEditResponse: + ) -> Optional[SettingEditResponse]: """ Patch script metadata, such as bindings @@ -199,7 +199,7 @@ async def edit( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), ) async def get( @@ -214,7 +214,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingGetResponse: + ) -> Optional[SettingGetResponse]: """ Get script settings from a script uploaded to a Workers for Platforms namespace. @@ -248,7 +248,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]), + cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), ) diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py index 188a42b443a7..ff29999966cc 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import List, Type, Optional, cast 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, - ) -> TagUpdateResponse: + ) -> Optional[TagUpdateResponse]: """ Put script tags for a script uploaded to a Workers for Platforms namespace. @@ -93,7 +93,7 @@ def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TagUpdateResponse], ResultWrapper[TagUpdateResponse]), + cast_to=cast(Type[Optional[TagUpdateResponse]], ResultWrapper[TagUpdateResponse]), ) def list( @@ -219,7 +219,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TagUpdateResponse: + ) -> Optional[TagUpdateResponse]: """ Put script tags for a script uploaded to a Workers for Platforms namespace. @@ -256,7 +256,7 @@ async def update( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[TagUpdateResponse], ResultWrapper[TagUpdateResponse]), + cast_to=cast(Type[Optional[TagUpdateResponse]], ResultWrapper[TagUpdateResponse]), ) def list( diff --git a/src/cloudflare/types/workers/scripts/tail_delete_response.py b/src/cloudflare/types/workers/scripts/tail_delete_response.py index 5c1bf53bdf69..63b7e710c393 100644 --- a/src/cloudflare/types/workers/scripts/tail_delete_response.py +++ b/src/cloudflare/types/workers/scripts/tail_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ...shared import ResponseInfo +from ...._models import BaseModel __all__ = ["TailDeleteResponse"] -TailDeleteResponse = Union[List[object], str, object] + +class TailDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py index 37650bb7dedf..c0e7fa824caa 100644 --- a/tests/api_resources/workers/scripts/test_content.py +++ b/tests/api_resources/workers/scripts/test_content.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import httpx import pytest @@ -32,7 +32,7 @@ def test_method_update(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,7 +46,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "main_module": "worker.js", }, ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -59,7 +59,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" content = response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -72,7 +72,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True @@ -172,7 +172,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +186,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "main_module": "worker.js", }, ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +199,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" content = await response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -212,7 +212,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = await response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_deployments.py b/tests/api_resources/workers/scripts/test_deployments.py index f650505f6461..0ec9ea4f1218 100644 --- a/tests/api_resources/workers/scripts/test_deployments.py +++ b/tests/api_resources/workers/scripts/test_deployments.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -27,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -38,7 +38,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: annotations={"workers_message": "Deploy bug fix."}, strategy="string", ) - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,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" deployment = response.parse() - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +90,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DeploymentGetResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +103,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" deployment = response.parse() - assert_matches_type(DeploymentGetResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(DeploymentGetResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -146,7 +146,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +157,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare annotations={"workers_message": "Deploy bug fix."}, strategy="string", ) - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +170,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" deployment = await response.parse() - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -183,7 +183,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(DeploymentCreateResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentCreateResponse], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +209,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DeploymentGetResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -222,7 +222,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" deployment = await response.parse() - assert_matches_type(DeploymentGetResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -235,7 +235,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(DeploymentGetResponse, deployment, path=["response"]) + assert_matches_type(Optional[DeploymentGetResponse], deployment, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_schedules.py b/tests/api_resources/workers/scripts/test_schedules.py index 7ecc4f2629d8..46d790e89cde 100644 --- a/tests/api_resources/workers/scripts/test_schedules.py +++ b/tests/api_resources/workers/scripts/test_schedules.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="[{'cron': '*/30 * * * *'}]", ) - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,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" schedule = response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -81,7 +81,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +94,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" schedule = response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -138,7 +138,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="[{'cron': '*/30 * * * *'}]", ) - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +152,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" schedule = await response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -166,7 +166,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = await response.parse() - assert_matches_type(ScheduleUpdateResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleUpdateResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -194,7 +194,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +207,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" schedule = await response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) @pytest.mark.skip() @parametrize @@ -220,7 +220,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" schedule = await response.parse() - assert_matches_type(ScheduleGetResponse, schedule, path=["response"]) + assert_matches_type(Optional[ScheduleGetResponse], schedule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_settings.py b/tests/api_resources/workers/scripts/test_settings.py index 18860873e22f..18af0318652e 100644 --- a/tests/api_resources/workers/scripts/test_settings.py +++ b/tests/api_resources/workers/scripts/test_settings.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_edit(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -77,7 +77,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -103,7 +103,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,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" setting = response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -159,7 +159,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +186,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) }, ], ) - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +199,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -212,7 +212,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +238,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,7 +251,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" setting = await response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -264,7 +264,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(ScriptSetting, setting, path=["response"]) + assert_matches_type(Optional[ScriptSetting], setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_tail.py b/tests/api_resources/workers/scripts/test_tail.py index 819ac972cf9d..b03902ca689a 100644 --- a/tests/api_resources/workers/scripts/test_tail.py +++ b/tests/api_resources/workers/scripts/test_tail.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +43,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" tail = response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -57,7 +57,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,7 +155,7 @@ def test_method_get(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -168,7 +168,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" tail = response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -181,7 +181,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True @@ -212,7 +212,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body={}, ) - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -226,7 +226,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" tail = await response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -240,7 +240,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = await response.parse() - assert_matches_type(TailCreateResponse, tail, path=["response"]) + assert_matches_type(Optional[TailCreateResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True @@ -338,7 +338,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -351,7 +351,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" tail = await response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) @pytest.mark.skip() @parametrize @@ -364,7 +364,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tail = await response.parse() - assert_matches_type(TailGetResponse, tail, path=["response"]) + assert_matches_type(Optional[TailGetResponse], tail, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py index 701befc6da14..a7df8e4feadf 100644 --- a/tests/api_resources/workers/scripts/test_versions.py +++ b/tests/api_resources/workers/scripts/test_versions.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "usage_model": "standard", }, ) - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -69,7 +69,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" version = response.parse() - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +82,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,7 +108,7 @@ def test_method_list(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VersionListResponse, version, path=["response"]) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +121,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(VersionListResponse, version, path=["response"]) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +134,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(VersionListResponse, version, path=["response"]) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", ) - assert_matches_type(VersionGetResponse, version, path=["response"]) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +175,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" version = response.parse() - assert_matches_type(VersionGetResponse, version, path=["response"]) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -189,7 +189,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(VersionGetResponse, version, path=["response"]) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -228,7 +228,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -256,7 +256,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "usage_model": "standard", }, ) - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +269,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" version = await response.parse() - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -282,7 +282,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(VersionCreateResponse, version, path=["response"]) + assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -308,7 +308,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VersionListResponse, version, path=["response"]) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -321,7 +321,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(VersionListResponse, version, path=["response"]) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -334,7 +334,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(VersionListResponse, version, path=["response"]) + assert_matches_type(Optional[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -361,7 +361,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", script_name="this-is_my_script-01", ) - assert_matches_type(VersionGetResponse, version, path=["response"]) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +375,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" version = await response.parse() - assert_matches_type(VersionGetResponse, version, path=["response"]) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -389,7 +389,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(VersionGetResponse, version, path=["response"]) + assert_matches_type(Optional[VersionGetResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_account_settings.py b/tests/api_resources/workers/test_account_settings.py index e3a0c6fece32..e4a4dfdba558 100644 --- a/tests/api_resources/workers/test_account_settings.py +++ b/tests/api_resources/workers/test_account_settings.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -27,7 +27,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'default_usage_model': 'unbound'}", ) - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +40,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" account_setting = response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_setting = client.workers.account_settings.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -84,7 +84,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" account_setting = response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,7 +96,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -119,7 +119,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'default_usage_model': 'unbound'}", ) - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -132,7 +132,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" account_setting = await response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +145,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = await response.parse() - assert_matches_type(AccountSettingUpdateResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingUpdateResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -164,7 +164,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_setting = await async_client.workers.account_settings.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +176,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" account_setting = await response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +188,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" account_setting = await response.parse() - assert_matches_type(AccountSettingGetResponse, account_setting, path=["response"]) + assert_matches_type(Optional[AccountSettingGetResponse], account_setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_domains.py b/tests/api_resources/workers/test_domains.py index ab46c5a79c75..ddd9b6b4616a 100644 --- a/tests/api_resources/workers/test_domains.py +++ b/tests/api_resources/workers/test_domains.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: service="foo", zone_id="593c9c94de529bbbfaac7c53ced0447d", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +44,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" domain = response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -195,7 +195,7 @@ def test_method_get(self, client: Cloudflare) -> None: "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +208,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" domain = response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +221,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -254,7 +254,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: service="foo", zone_id="593c9c94de529bbbfaac7c53ced0447d", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -270,7 +270,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" domain = await response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -286,7 +286,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -421,7 +421,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "dbe10b4bc17c295377eabd600e1787fd", account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -434,7 +434,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" domain = await response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -447,7 +447,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(Domain, domain, path=["response"]) + assert_matches_type(Optional[Domain], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_scripts.py b/tests/api_resources/workers/test_scripts.py index 061c2550d833..37653e7083c6 100644 --- a/tests/api_resources/workers/test_scripts.py +++ b/tests/api_resources/workers/test_scripts.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import httpx import pytest @@ -33,7 +33,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "version_tags": {}, }, ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -130,7 +130,7 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -143,7 +143,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -169,7 +169,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -180,7 +180,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", message="string", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,7 @@ def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +206,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -416,7 +416,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -500,7 +500,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "version_tags": {}, }, ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +513,7 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -526,7 +526,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -552,7 +552,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -563,7 +563,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", message="string", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -576,7 +576,7 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -589,7 +589,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_subdomains.py b/tests/api_resources/workers/test_subdomains.py index 24b36b21408f..03efd6388285 100644 --- a/tests/api_resources/workers/test_subdomains.py +++ b/tests/api_resources/workers/test_subdomains.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: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'subdomain': 'example-subdomain'}", ) - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,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" subdomain = response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_get(self, client: Cloudflare) -> None: subdomain = client.workers.subdomains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +81,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" subdomain = response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -116,7 +116,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body="{'subdomain': 'example-subdomain'}", ) - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,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" subdomain = await response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +142,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = await response.parse() - assert_matches_type(SubdomainUpdateResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainUpdateResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: subdomain = await async_client.workers.subdomains.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,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" subdomain = await response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +185,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" subdomain = await response.parse() - assert_matches_type(SubdomainGetResponse, subdomain, path=["response"]) + assert_matches_type(Optional[SubdomainGetResponse], subdomain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py index e11447ac29af..a5e2e126fece 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_bindings.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,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" binding = response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -53,7 +53,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -93,7 +93,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,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" binding = await response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +121,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(BindingGetResponse, binding, path=["response"]) + assert_matches_type(Optional[BindingGetResponse], binding, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py index 8f4137753e6c..6c1374dca41e 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import httpx import pytest @@ -33,7 +33,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -48,7 +48,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: "main_module": "worker.js", }, ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -62,7 +62,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" content = response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -76,7 +76,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True @@ -198,7 +198,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -213,7 +213,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare "main_module": "worker.js", }, ) - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -229,7 +229,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" content = await response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) @pytest.mark.skip() @parametrize @@ -243,7 +243,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" content = await response.parse() - assert_matches_type(Script, content, path=["response"]) + assert_matches_type(Optional[Script], content, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py index 77350d5c9054..80ca972e5f37 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -29,7 +29,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +42,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: text="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", type="secret_text", ) - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +56,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" secret = response.parse() - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -70,7 +70,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -174,7 +174,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +187,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare text="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", type="secret_text", ) - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -203,7 +203,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" secret = await response.parse() - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) @pytest.mark.skip() @parametrize @@ -217,7 +217,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretUpdateResponse, secret, path=["response"]) + assert_matches_type(Optional[SecretUpdateResponse], secret, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py index eb8a214f2417..64f27b5f64ba 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_edit(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +106,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "usage_model": "unbound", }, ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -120,7 +120,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +134,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,7 +170,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -184,7 +184,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" setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -198,7 +198,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +238,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -316,7 +316,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "usage_model": "unbound", }, ) - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -330,7 +330,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +344,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingEditResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -380,7 +380,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -394,7 +394,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" setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @pytest.mark.skip() @parametrize @@ -408,7 +408,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingGetResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py index 3e7dd4d20e42..a273f1b53b0d 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -30,7 +30,7 @@ def test_method_update(self, client: Cloudflare) -> None: dispatch_namespace="my-dispatch-namespace", body=["my-tag", "my-tag", "my-tag"], ) - assert_matches_type(TagUpdateResponse, tag, path=["response"]) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -45,7 +45,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" tag = response.parse() - assert_matches_type(TagUpdateResponse, tag, path=["response"]) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(TagUpdateResponse, tag, path=["response"]) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -246,7 +246,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: dispatch_namespace="my-dispatch-namespace", body=["my-tag", "my-tag", "my-tag"], ) - assert_matches_type(TagUpdateResponse, tag, path=["response"]) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +261,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" tag = await response.parse() - assert_matches_type(TagUpdateResponse, tag, path=["response"]) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +276,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(TagUpdateResponse, tag, path=["response"]) + assert_matches_type(Optional[TagUpdateResponse], tag, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py index 14252ec36306..cc10a096022d 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "version_tags": {}, }, ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -140,7 +140,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -176,7 +176,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +187,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N dispatch_namespace="my-dispatch-namespace", message="string", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +201,7 @@ def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +215,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -333,7 +333,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -347,7 +347,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" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -361,7 +361,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -401,7 +401,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -485,7 +485,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "version_tags": {}, }, ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -499,7 +499,7 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +513,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -549,7 +549,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -560,7 +560,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn dispatch_namespace="my-dispatch-namespace", message="string", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -574,7 +574,7 @@ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflar assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -588,7 +588,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -706,7 +706,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", ) - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -720,7 +720,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" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -734,7 +734,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Script, script, path=["response"]) + assert_matches_type(Optional[Script], script, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py b/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py index f4a211a58293..11cc9e441f76 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py +++ b/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: namespace = client.workers_for_platforms.dispatch.namespaces.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-dispatch-namespace", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,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" namespace = response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -174,7 +174,7 @@ def test_method_get(self, client: Cloudflare) -> None: "my-dispatch-namespace", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +187,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" namespace = response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -200,7 +200,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -229,7 +229,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.workers_for_platforms.dispatch.namespaces.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -238,7 +238,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="my-dispatch-namespace", ) - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -250,7 +250,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" namespace = await response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +262,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceCreateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceCreateResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -375,7 +375,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "my-dispatch-namespace", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -388,7 +388,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" namespace = await response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -401,7 +401,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceGetResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceGetResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True