diff --git a/.stats.yml b/.stats.yml index 4ad3cde641a..a9b67b23d4e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1354 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f22c959e7be17424e69c94feb574b7d547df7b07ad0633af9cc70695c31ea25e.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-22b8666752db395cb52859e06d34c134e7ac46a9098067be1c7c55686165624f.yml diff --git a/api.md b/api.md index 6b687dbe2ec..f7262cdc739 100644 --- a/api.md +++ b/api.md @@ -639,10 +639,10 @@ from cloudflare.types.cache import ( Methods: -- client.cache.cache_reserve.clear(\*, zone_id, \*\*params) -> CacheReserveClearResponse -- client.cache.cache_reserve.edit(\*, zone_id, \*\*params) -> CacheReserveEditResponse -- client.cache.cache_reserve.get(\*, zone_id) -> CacheReserveGetResponse -- client.cache.cache_reserve.status(\*, zone_id) -> CacheReserveStatusResponse +- client.cache.cache_reserve.clear(\*, zone_id, \*\*params) -> Optional +- client.cache.cache_reserve.edit(\*, zone_id, \*\*params) -> Optional +- client.cache.cache_reserve.get(\*, zone_id) -> Optional +- client.cache.cache_reserve.status(\*, zone_id) -> Optional ## SmartTieredCache @@ -658,9 +658,9 @@ from cloudflare.types.cache import ( Methods: -- client.cache.smart_tiered_cache.delete(\*, zone_id) -> SmartTieredCacheDeleteResponse -- client.cache.smart_tiered_cache.edit(\*, zone_id, \*\*params) -> SmartTieredCacheEditResponse -- client.cache.smart_tiered_cache.get(\*, zone_id) -> SmartTieredCacheGetResponse +- client.cache.smart_tiered_cache.delete(\*, zone_id) -> Optional +- client.cache.smart_tiered_cache.edit(\*, zone_id, \*\*params) -> Optional +- client.cache.smart_tiered_cache.get(\*, zone_id) -> Optional ## Variants @@ -677,9 +677,9 @@ from cloudflare.types.cache import ( Methods: -- client.cache.variants.delete(\*, zone_id) -> CacheVariant -- client.cache.variants.edit(\*, zone_id, \*\*params) -> VariantEditResponse -- client.cache.variants.get(\*, zone_id) -> VariantGetResponse +- client.cache.variants.delete(\*, zone_id) -> Optional +- client.cache.variants.edit(\*, zone_id, \*\*params) -> Optional +- client.cache.variants.get(\*, zone_id) -> Optional ## RegionalTieredCache @@ -695,8 +695,8 @@ from cloudflare.types.cache import ( Methods: -- client.cache.regional_tiered_cache.edit(\*, zone_id, \*\*params) -> RegionalTieredCacheEditResponse -- client.cache.regional_tiered_cache.get(\*, zone_id) -> RegionalTieredCacheGetResponse +- client.cache.regional_tiered_cache.edit(\*, zone_id, \*\*params) -> Optional +- client.cache.regional_tiered_cache.get(\*, zone_id) -> Optional # SSL @@ -840,8 +840,8 @@ from cloudflare.types.argo import TieredCachingEditResponse, TieredCachingGetRes Methods: -- client.argo.tiered_caching.edit(\*, zone_id, \*\*params) -> TieredCachingEditResponse -- client.argo.tiered_caching.get(\*, zone_id) -> TieredCachingGetResponse +- client.argo.tiered_caching.edit(\*, zone_id, \*\*params) -> Optional +- client.argo.tiered_caching.get(\*, zone_id) -> Optional # CertificateAuthorities @@ -2394,9 +2394,9 @@ from cloudflare.types.kv import Namespace, NamespaceUpdateResponse, NamespaceDel Methods: - client.kv.namespaces.create(\*, account_id, \*\*params) -> Optional -- client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> Optional +- client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> object - client.kv.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Namespace] -- client.kv.namespaces.delete(namespace_id, \*, account_id) -> Optional +- client.kv.namespaces.delete(namespace_id, \*, account_id) -> object - client.kv.namespaces.get(namespace_id, \*, account_id) -> Optional ### Bulk @@ -2409,8 +2409,8 @@ from cloudflare.types.kv.namespaces import BulkUpdateResponse, BulkDeleteRespons Methods: -- client.kv.namespaces.bulk.update(namespace_id, \*, account_id, \*\*params) -> Optional -- client.kv.namespaces.bulk.delete(namespace_id, \*, account_id) -> Optional +- client.kv.namespaces.bulk.update(namespace_id, \*, account_id, \*\*params) -> object +- client.kv.namespaces.bulk.delete(namespace_id, \*, account_id) -> object ### Keys @@ -2446,8 +2446,8 @@ from cloudflare.types.kv.namespaces import ValueUpdateResponse, ValueDeleteRespo Methods: -- client.kv.namespaces.values.update(key_name, \*, account_id, namespace_id, \*\*params) -> Optional -- client.kv.namespaces.values.delete(key_name, \*, account_id, namespace_id) -> Optional +- client.kv.namespaces.values.update(key_name, \*, account_id, namespace_id, \*\*params) -> object +- client.kv.namespaces.values.delete(key_name, \*, account_id, namespace_id) -> object - client.kv.namespaces.values.get(key_name, \*, account_id, namespace_id) -> BinaryAPIResponse # DurableObjects @@ -4708,7 +4708,7 @@ from cloudflare.types.zero_trust import Device, DeviceGetResponse Methods: - client.zero_trust.devices.list(\*, account_id) -> SyncSinglePage[Device] -- client.zero_trust.devices.get(device_id, \*, account_id) -> DeviceGetResponse +- client.zero_trust.devices.get(device_id, \*, account_id) -> Optional ### DEXTests @@ -4777,8 +4777,8 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: -- client.zero_trust.devices.policies.certificates.update(zone_tag, \*\*params) -> CertificateUpdateResponse -- client.zero_trust.devices.policies.certificates.get(zone_tag) -> CertificateGetResponse +- client.zero_trust.devices.policies.certificates.update(zone_tag, \*\*params) -> Optional +- client.zero_trust.devices.policies.certificates.get(zone_tag) -> Optional #### DefaultPolicy @@ -4895,7 +4895,7 @@ Methods: - client.zero_trust.devices.posture.integrations.create(\*, account_id, \*\*params) -> Optional - client.zero_trust.devices.posture.integrations.list(\*, account_id) -> SyncSinglePage[Integration] -- client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id) -> IntegrationDeleteResponse +- client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id) -> Optional - client.zero_trust.devices.posture.integrations.edit(integration_id, \*, account_id, \*\*params) -> Optional - client.zero_trust.devices.posture.integrations.get(integration_id, \*, account_id) -> Optional @@ -4909,7 +4909,7 @@ from cloudflare.types.zero_trust.devices import RevokeCreateResponse Methods: -- client.zero_trust.devices.revoke.create(\*, account_id, \*\*params) -> RevokeCreateResponse +- client.zero_trust.devices.revoke.create(\*, account_id, \*\*params) -> Optional ### Settings @@ -4935,7 +4935,7 @@ from cloudflare.types.zero_trust.devices import UnrevokeCreateResponse Methods: -- client.zero_trust.devices.unrevoke.create(\*, account_id, \*\*params) -> UnrevokeCreateResponse +- client.zero_trust.devices.unrevoke.create(\*, account_id, \*\*params) -> Optional ### OverrideCodes @@ -6176,7 +6176,7 @@ Methods: - client.hyperdrive.configs.create(\*, account_id, \*\*params) -> Optional - client.hyperdrive.configs.update(hyperdrive_id, \*, account_id, \*\*params) -> Optional - client.hyperdrive.configs.list(\*, account_id) -> SyncSinglePage[Hyperdrive] -- client.hyperdrive.configs.delete(hyperdrive_id, \*, account_id) -> ConfigDeleteResponse +- client.hyperdrive.configs.delete(hyperdrive_id, \*, account_id) -> Optional - client.hyperdrive.configs.edit(hyperdrive_id, \*, account_id, \*\*params) -> Optional - client.hyperdrive.configs.get(hyperdrive_id, \*, account_id) -> Optional @@ -6241,7 +6241,7 @@ Methods: - client.vectorize.indexes.create(\*, account_id, \*\*params) -> Optional - client.vectorize.indexes.list(\*, account_id) -> SyncSinglePage[CreateIndex] -- client.vectorize.indexes.delete(index_name, \*, account_id) -> IndexDeleteResponse +- client.vectorize.indexes.delete(index_name, \*, account_id) -> Optional - client.vectorize.indexes.delete_by_ids(index_name, \*, account_id, \*\*params) -> Optional - client.vectorize.indexes.get(index_name, \*, account_id) -> Optional - client.vectorize.indexes.get_by_ids(index_name, \*, account_id, \*\*params) -> object @@ -7524,8 +7524,8 @@ from cloudflare.types.origin_post_quantum_encryption import ( Methods: -- client.origin_post_quantum_encryption.update(\*, zone_id, \*\*params) -> OriginPostQuantumEncryptionUpdateResponse -- client.origin_post_quantum_encryption.get(\*, zone_id) -> OriginPostQuantumEncryptionGetResponse +- client.origin_post_quantum_encryption.update(\*, zone_id, \*\*params) -> object +- client.origin_post_quantum_encryption.get(\*, zone_id) -> object # Speed diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index 46fb96c1e31..2f51ebdb9e0 100644 --- a/src/cloudflare/resources/argo/tiered_caching.py +++ b/src/cloudflare/resources/argo/tiered_caching.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 @@ -60,7 +60,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingEditResponse: + ) -> Optional[TieredCachingEditResponse]: """ Updates enablement of Tiered Caching @@ -87,9 +87,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingEditResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingEditResponse], ResultWrapper[TieredCachingEditResponse]), + cast_to=cast(Type[Optional[TieredCachingEditResponse]], ResultWrapper[TieredCachingEditResponse]), ) def get( @@ -102,7 +102,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingGetResponse: + ) -> Optional[TieredCachingGetResponse]: """ Get Tiered Caching setting @@ -126,9 +126,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingGetResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingGetResponse], ResultWrapper[TieredCachingGetResponse]), + cast_to=cast(Type[Optional[TieredCachingGetResponse]], ResultWrapper[TieredCachingGetResponse]), ) @@ -163,7 +163,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingEditResponse: + ) -> Optional[TieredCachingEditResponse]: """ Updates enablement of Tiered Caching @@ -190,9 +190,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingEditResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingEditResponse], ResultWrapper[TieredCachingEditResponse]), + cast_to=cast(Type[Optional[TieredCachingEditResponse]], ResultWrapper[TieredCachingEditResponse]), ) async def get( @@ -205,7 +205,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TieredCachingGetResponse: + ) -> Optional[TieredCachingGetResponse]: """ Get Tiered Caching setting @@ -229,9 +229,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TieredCachingGetResponse]]._unwrapper, ), - cast_to=cast(Type[TieredCachingGetResponse], ResultWrapper[TieredCachingGetResponse]), + cast_to=cast(Type[Optional[TieredCachingGetResponse]], ResultWrapper[TieredCachingGetResponse]), ) diff --git a/src/cloudflare/resources/cache/cache_reserve.py b/src/cloudflare/resources/cache/cache_reserve.py index 9116ecc0307..df5c9f28ccf 100644 --- a/src/cloudflare/resources/cache/cache_reserve.py +++ b/src/cloudflare/resources/cache/cache_reserve.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 @@ -62,7 +62,7 @@ def clear( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveClearResponse: + ) -> Optional[CacheReserveClearResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -90,9 +90,9 @@ def clear( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveClearResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveClearResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveClearResponse], ResultWrapper[CacheReserveClearResponse]), + cast_to=cast(Type[Optional[CacheReserveClearResponse]], ResultWrapper[CacheReserveClearResponse]), ) def edit( @@ -106,7 +106,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveEditResponse: + ) -> Optional[CacheReserveEditResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -138,9 +138,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveEditResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveEditResponse], ResultWrapper[CacheReserveEditResponse]), + cast_to=cast(Type[Optional[CacheReserveEditResponse]], ResultWrapper[CacheReserveEditResponse]), ) def get( @@ -153,7 +153,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveGetResponse: + ) -> Optional[CacheReserveGetResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -182,9 +182,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveGetResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveGetResponse], ResultWrapper[CacheReserveGetResponse]), + cast_to=cast(Type[Optional[CacheReserveGetResponse]], ResultWrapper[CacheReserveGetResponse]), ) def status( @@ -197,7 +197,7 @@ def status( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveStatusResponse: + ) -> Optional[CacheReserveStatusResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -224,9 +224,9 @@ def status( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveStatusResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveStatusResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveStatusResponse], ResultWrapper[CacheReserveStatusResponse]), + cast_to=cast(Type[Optional[CacheReserveStatusResponse]], ResultWrapper[CacheReserveStatusResponse]), ) @@ -261,7 +261,7 @@ async def clear( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveClearResponse: + ) -> Optional[CacheReserveClearResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -289,9 +289,9 @@ async def clear( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveClearResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveClearResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveClearResponse], ResultWrapper[CacheReserveClearResponse]), + cast_to=cast(Type[Optional[CacheReserveClearResponse]], ResultWrapper[CacheReserveClearResponse]), ) async def edit( @@ -305,7 +305,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveEditResponse: + ) -> Optional[CacheReserveEditResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -337,9 +337,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveEditResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveEditResponse], ResultWrapper[CacheReserveEditResponse]), + cast_to=cast(Type[Optional[CacheReserveEditResponse]], ResultWrapper[CacheReserveEditResponse]), ) async def get( @@ -352,7 +352,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveGetResponse: + ) -> Optional[CacheReserveGetResponse]: """ Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve @@ -381,9 +381,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveGetResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveGetResponse], ResultWrapper[CacheReserveGetResponse]), + cast_to=cast(Type[Optional[CacheReserveGetResponse]], ResultWrapper[CacheReserveGetResponse]), ) async def status( @@ -396,7 +396,7 @@ async def status( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheReserveStatusResponse: + ) -> Optional[CacheReserveStatusResponse]: """ You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. @@ -423,9 +423,9 @@ async def status( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheReserveStatusResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CacheReserveStatusResponse]]._unwrapper, ), - cast_to=cast(Type[CacheReserveStatusResponse], ResultWrapper[CacheReserveStatusResponse]), + cast_to=cast(Type[Optional[CacheReserveStatusResponse]], ResultWrapper[CacheReserveStatusResponse]), ) diff --git a/src/cloudflare/resources/cache/regional_tiered_cache.py b/src/cloudflare/resources/cache/regional_tiered_cache.py index e2d101b0154..69889f46644 100644 --- a/src/cloudflare/resources/cache/regional_tiered_cache.py +++ b/src/cloudflare/resources/cache/regional_tiered_cache.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 @@ -60,7 +60,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheEditResponse: + ) -> Optional[RegionalTieredCacheEditResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -89,9 +89,11 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheEditResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[RegionalTieredCacheEditResponse]], ResultWrapper[RegionalTieredCacheEditResponse] ), - cast_to=cast(Type[RegionalTieredCacheEditResponse], ResultWrapper[RegionalTieredCacheEditResponse]), ) def get( @@ -104,7 +106,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheGetResponse: + ) -> Optional[RegionalTieredCacheGetResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -130,9 +132,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[RegionalTieredCacheGetResponse], ResultWrapper[RegionalTieredCacheGetResponse]), + cast_to=cast(Type[Optional[RegionalTieredCacheGetResponse]], ResultWrapper[RegionalTieredCacheGetResponse]), ) @@ -167,7 +169,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheEditResponse: + ) -> Optional[RegionalTieredCacheEditResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -198,9 +200,11 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheEditResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[RegionalTieredCacheEditResponse]], ResultWrapper[RegionalTieredCacheEditResponse] ), - cast_to=cast(Type[RegionalTieredCacheEditResponse], ResultWrapper[RegionalTieredCacheEditResponse]), ) async def get( @@ -213,7 +217,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalTieredCacheGetResponse: + ) -> Optional[RegionalTieredCacheGetResponse]: """ Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache @@ -239,9 +243,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RegionalTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RegionalTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[RegionalTieredCacheGetResponse], ResultWrapper[RegionalTieredCacheGetResponse]), + cast_to=cast(Type[Optional[RegionalTieredCacheGetResponse]], ResultWrapper[RegionalTieredCacheGetResponse]), ) diff --git a/src/cloudflare/resources/cache/smart_tiered_cache.py b/src/cloudflare/resources/cache/smart_tiered_cache.py index abd3127ed38..d86423d81f3 100644 --- a/src/cloudflare/resources/cache/smart_tiered_cache.py +++ b/src/cloudflare/resources/cache/smart_tiered_cache.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 @@ -60,7 +60,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheDeleteResponse: + ) -> Optional[SmartTieredCacheDeleteResponse]: """ Remvoves enablement of Smart Tiered Cache @@ -84,9 +84,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheDeleteResponse], ResultWrapper[SmartTieredCacheDeleteResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheDeleteResponse]], ResultWrapper[SmartTieredCacheDeleteResponse]), ) def edit( @@ -100,7 +100,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheEditResponse: + ) -> Optional[SmartTieredCacheEditResponse]: """ Updates enablement of Tiered Cache @@ -127,9 +127,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheEditResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheEditResponse], ResultWrapper[SmartTieredCacheEditResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheEditResponse]], ResultWrapper[SmartTieredCacheEditResponse]), ) def get( @@ -142,7 +142,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheGetResponse: + ) -> Optional[SmartTieredCacheGetResponse]: """ Get Smart Tiered Cache setting @@ -166,9 +166,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheGetResponse], ResultWrapper[SmartTieredCacheGetResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheGetResponse]], ResultWrapper[SmartTieredCacheGetResponse]), ) @@ -202,7 +202,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheDeleteResponse: + ) -> Optional[SmartTieredCacheDeleteResponse]: """ Remvoves enablement of Smart Tiered Cache @@ -226,9 +226,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheDeleteResponse], ResultWrapper[SmartTieredCacheDeleteResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheDeleteResponse]], ResultWrapper[SmartTieredCacheDeleteResponse]), ) async def edit( @@ -242,7 +242,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheEditResponse: + ) -> Optional[SmartTieredCacheEditResponse]: """ Updates enablement of Tiered Cache @@ -271,9 +271,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheEditResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheEditResponse], ResultWrapper[SmartTieredCacheEditResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheEditResponse]], ResultWrapper[SmartTieredCacheEditResponse]), ) async def get( @@ -286,7 +286,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SmartTieredCacheGetResponse: + ) -> Optional[SmartTieredCacheGetResponse]: """ Get Smart Tiered Cache setting @@ -310,9 +310,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SmartTieredCacheGetResponse]]._unwrapper, ), - cast_to=cast(Type[SmartTieredCacheGetResponse], ResultWrapper[SmartTieredCacheGetResponse]), + cast_to=cast(Type[Optional[SmartTieredCacheGetResponse]], ResultWrapper[SmartTieredCacheGetResponse]), ) diff --git a/src/cloudflare/resources/cache/variants.py b/src/cloudflare/resources/cache/variants.py index 254dbf3eb20..78f252b4c50 100644 --- a/src/cloudflare/resources/cache/variants.py +++ b/src/cloudflare/resources/cache/variants.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -59,7 +59,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheVariant: + ) -> Optional[CacheVariant]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -87,9 +87,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheVariant]._unwrapper, + post_parser=ResultWrapper[Optional[CacheVariant]]._unwrapper, ), - cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), + cast_to=cast(Type[Optional[CacheVariant]], ResultWrapper[CacheVariant]), ) def edit( @@ -103,7 +103,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantEditResponse: + ) -> Optional[VariantEditResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -134,9 +134,9 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantEditResponse]]._unwrapper, ), - cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), + cast_to=cast(Type[Optional[VariantEditResponse]], ResultWrapper[VariantEditResponse]), ) def get( @@ -149,7 +149,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantGetResponse: + ) -> Optional[VariantGetResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -177,9 +177,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantGetResponse]]._unwrapper, ), - cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), + cast_to=cast(Type[Optional[VariantGetResponse]], ResultWrapper[VariantGetResponse]), ) @@ -213,7 +213,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CacheVariant: + ) -> Optional[CacheVariant]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -241,9 +241,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CacheVariant]._unwrapper, + post_parser=ResultWrapper[Optional[CacheVariant]]._unwrapper, ), - cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), + cast_to=cast(Type[Optional[CacheVariant]], ResultWrapper[CacheVariant]), ) async def edit( @@ -257,7 +257,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantEditResponse: + ) -> Optional[VariantEditResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -288,9 +288,9 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantEditResponse]]._unwrapper, ), - cast_to=cast(Type[VariantEditResponse], ResultWrapper[VariantEditResponse]), + cast_to=cast(Type[Optional[VariantEditResponse]], ResultWrapper[VariantEditResponse]), ) async def get( @@ -303,7 +303,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VariantGetResponse: + ) -> Optional[VariantGetResponse]: """ Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the @@ -331,9 +331,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[VariantGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[VariantGetResponse]]._unwrapper, ), - cast_to=cast(Type[VariantGetResponse], ResultWrapper[VariantGetResponse]), + cast_to=cast(Type[Optional[VariantGetResponse]], ResultWrapper[VariantGetResponse]), ) diff --git a/src/cloudflare/resources/hyperdrive/configs.py b/src/cloudflare/resources/hyperdrive/configs.py index b64736b37a6..15355e802fd 100644 --- a/src/cloudflare/resources/hyperdrive/configs.py +++ b/src/cloudflare/resources/hyperdrive/configs.py @@ -202,7 +202,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigDeleteResponse: + ) -> Optional[ConfigDeleteResponse]: """ Deletes the specified Hyperdrive. @@ -224,7 +224,7 @@ def delete( if not hyperdrive_id: raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return cast( - ConfigDeleteResponse, + Optional[ConfigDeleteResponse], self._delete( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", options=make_request_options( @@ -232,7 +232,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ConfigDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[ConfigDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigDeleteResponse] @@ -514,7 +514,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigDeleteResponse: + ) -> Optional[ConfigDeleteResponse]: """ Deletes the specified Hyperdrive. @@ -536,7 +536,7 @@ async def delete( if not hyperdrive_id: raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}") return cast( - ConfigDeleteResponse, + Optional[ConfigDeleteResponse], await self._delete( f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}", options=make_request_options( @@ -544,7 +544,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[ConfigDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[ConfigDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[ConfigDeleteResponse] diff --git a/src/cloudflare/resources/kv/namespaces/bulk.py b/src/cloudflare/resources/kv/namespaces/bulk.py index 8fb4ed0f906..b19bcc4ff68 100644 --- a/src/cloudflare/resources/kv/namespaces/bulk.py +++ b/src/cloudflare/resources/kv/namespaces/bulk.py @@ -22,8 +22,6 @@ from ...._wrappers import ResultWrapper from ...._base_client import make_request_options from ....types.kv.namespaces import bulk_update_params -from ....types.kv.namespaces.bulk_delete_response import BulkDeleteResponse -from ....types.kv.namespaces.bulk_update_response import BulkUpdateResponse __all__ = ["BulkResource", "AsyncBulkResource"] @@ -60,7 +58,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BulkUpdateResponse]: + ) -> object: """Write multiple keys and values at once. Body should be an array of up to 10,000 @@ -95,9 +93,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[BulkUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[BulkUpdateResponse]], ResultWrapper[BulkUpdateResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) def delete( @@ -111,7 +109,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BulkDeleteResponse]: + ) -> object: """Remove multiple KV pairs from the namespace. Body should be an array of up to @@ -141,9 +139,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[BulkDeleteResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[BulkDeleteResponse]], ResultWrapper[BulkDeleteResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -179,7 +177,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BulkUpdateResponse]: + ) -> object: """Write multiple keys and values at once. Body should be an array of up to 10,000 @@ -214,9 +212,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[BulkUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[BulkUpdateResponse]], ResultWrapper[BulkUpdateResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def delete( @@ -230,7 +228,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BulkDeleteResponse]: + ) -> object: """Remove multiple KV pairs from the namespace. Body should be an array of up to @@ -260,9 +258,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[BulkDeleteResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[BulkDeleteResponse]], ResultWrapper[BulkDeleteResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) diff --git a/src/cloudflare/resources/kv/namespaces/namespaces.py b/src/cloudflare/resources/kv/namespaces/namespaces.py index 95fea898307..bf0b088bd9f 100644 --- a/src/cloudflare/resources/kv/namespaces/namespaces.py +++ b/src/cloudflare/resources/kv/namespaces/namespaces.py @@ -57,8 +57,6 @@ from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options from ....types.kv.namespace import Namespace -from ....types.kv.namespace_delete_response import NamespaceDeleteResponse -from ....types.kv.namespace_update_response import NamespaceUpdateResponse __all__ = ["NamespacesResource", "AsyncNamespacesResource"] @@ -157,7 +155,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NamespaceUpdateResponse]: + ) -> object: """ Modifies a namespace's title. @@ -188,9 +186,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[NamespaceUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[NamespaceUpdateResponse]], ResultWrapper[NamespaceUpdateResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) def list( @@ -264,7 +262,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NamespaceDeleteResponse]: + ) -> object: """ Deletes the namespace corresponding to the given ID. @@ -292,9 +290,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[NamespaceDeleteResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[NamespaceDeleteResponse]], ResultWrapper[NamespaceDeleteResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) def get( @@ -436,7 +434,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NamespaceUpdateResponse]: + ) -> object: """ Modifies a namespace's title. @@ -467,9 +465,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[NamespaceUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[NamespaceUpdateResponse]], ResultWrapper[NamespaceUpdateResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) def list( @@ -543,7 +541,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NamespaceDeleteResponse]: + ) -> object: """ Deletes the namespace corresponding to the given ID. @@ -571,9 +569,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[NamespaceDeleteResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[NamespaceDeleteResponse]], ResultWrapper[NamespaceDeleteResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def get( diff --git a/src/cloudflare/resources/kv/namespaces/values.py b/src/cloudflare/resources/kv/namespaces/values.py index 5f0c28b6f5b..84ed73dcb0c 100644 --- a/src/cloudflare/resources/kv/namespaces/values.py +++ b/src/cloudflare/resources/kv/namespaces/values.py @@ -30,8 +30,6 @@ from ...._wrappers import ResultWrapper from ...._base_client import make_request_options from ....types.kv.namespaces import value_update_params -from ....types.kv.namespaces.value_delete_response import ValueDeleteResponse -from ....types.kv.namespaces.value_update_response import ValueUpdateResponse __all__ = ["ValuesResource", "AsyncValuesResource"] @@ -70,7 +68,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ValueUpdateResponse]: + ) -> object: """Write a value identified by a key. Use URL-encoding to use special characters @@ -120,9 +118,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ValueUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[ValueUpdateResponse]], ResultWrapper[ValueUpdateResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) def delete( @@ -137,7 +135,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ValueDeleteResponse]: + ) -> object: """Remove a KV pair from the namespace. Use URL-encoding to use special characters @@ -172,9 +170,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ValueDeleteResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[ValueDeleteResponse]], ResultWrapper[ValueDeleteResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) def get( @@ -264,7 +262,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ValueUpdateResponse]: + ) -> object: """Write a value identified by a key. Use URL-encoding to use special characters @@ -314,9 +312,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ValueUpdateResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[ValueUpdateResponse]], ResultWrapper[ValueUpdateResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def delete( @@ -331,7 +329,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ValueDeleteResponse]: + ) -> object: """Remove a KV pair from the namespace. Use URL-encoding to use special characters @@ -366,9 +364,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ValueDeleteResponse]]._unwrapper, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), - cast_to=cast(Type[Optional[ValueDeleteResponse]], ResultWrapper[ValueDeleteResponse]), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def get( diff --git a/src/cloudflare/resources/origin_post_quantum_encryption.py b/src/cloudflare/resources/origin_post_quantum_encryption.py index bda025f507b..69096b7f376 100644 --- a/src/cloudflare/resources/origin_post_quantum_encryption.py +++ b/src/cloudflare/resources/origin_post_quantum_encryption.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -23,12 +23,6 @@ from .._wrappers import ResultWrapper from .._base_client import make_request_options from ..types.origin_post_quantum_encryption import origin_post_quantum_encryption_update_params -from ..types.origin_post_quantum_encryption.origin_post_quantum_encryption_get_response import ( - OriginPostQuantumEncryptionGetResponse, -) -from ..types.origin_post_quantum_encryption.origin_post_quantum_encryption_update_response import ( - OriginPostQuantumEncryptionUpdateResponse, -) __all__ = ["OriginPostQuantumEncryptionResource", "AsyncOriginPostQuantumEncryptionResource"] @@ -64,7 +58,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionUpdateResponse: + ) -> object: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -88,25 +82,19 @@ def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionUpdateResponse, - self._put( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - body=maybe_transform( - {"value": value}, - origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + body=maybe_transform( + {"value": value}, origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), ) def get( @@ -119,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionGetResponse: + ) -> object: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -141,21 +129,16 @@ def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionGetResponse, - self._get( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -190,7 +173,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionUpdateResponse: + ) -> object: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -214,25 +197,19 @@ async def update( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionUpdateResponse, - await self._put( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - body=await async_maybe_transform( - {"value": value}, - origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + body=await async_maybe_transform( + {"value": value}, origin_post_quantum_encryption_update_params.OriginPostQuantumEncryptionUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def get( @@ -245,7 +222,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionGetResponse: + ) -> object: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -267,21 +244,16 @@ async def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - OriginPostQuantumEncryptionGetResponse, - await self._get( - f"/zones/{zone_id}/cache/origin_post_quantum_encryption", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginPostQuantumEncryptionGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OriginPostQuantumEncryptionGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/zones/{zone_id}/cache/origin_post_quantum_encryption", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[object]]._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) diff --git a/src/cloudflare/resources/pages/projects/deployments/deployments.py b/src/cloudflare/resources/pages/projects/deployments/deployments.py index aed1fcd671e..d185b4765c7 100644 --- a/src/cloudflare/resources/pages/projects/deployments/deployments.py +++ b/src/cloudflare/resources/pages/projects/deployments/deployments.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast from typing_extensions import Literal import httpx @@ -214,7 +214,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -544,7 +544,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) diff --git a/src/cloudflare/resources/pages/projects/domains.py b/src/cloudflare/resources/pages/projects/domains.py index db10cae25ce..cb0ce2d3842 100644 --- a/src/cloudflare/resources/pages/projects/domains.py +++ b/src/cloudflare/resources/pages/projects/domains.py @@ -182,7 +182,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -439,7 +439,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) diff --git a/src/cloudflare/resources/pages/projects/projects.py b/src/cloudflare/resources/pages/projects/projects.py index 364a429ed6b..98a42fa5a98 100644 --- a/src/cloudflare/resources/pages/projects/projects.py +++ b/src/cloudflare/resources/pages/projects/projects.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -209,7 +209,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -364,7 +364,7 @@ def purge_build_cache( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -533,7 +533,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) @@ -688,7 +688,7 @@ async def purge_build_cache( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[object]]._unwrapper, + post_parser=ResultWrapper[object]._unwrapper, ), cast_to=cast(Type[object], ResultWrapper[object]), ) diff --git a/src/cloudflare/resources/vectorize/indexes/indexes.py b/src/cloudflare/resources/vectorize/indexes/indexes.py index c6529e277b6..f0f19510cce 100644 --- a/src/cloudflare/resources/vectorize/indexes/indexes.py +++ b/src/cloudflare/resources/vectorize/indexes/indexes.py @@ -175,7 +175,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexDeleteResponse: + ) -> Optional[IndexDeleteResponse]: """ Deletes the specified Vectorize Index. @@ -195,7 +195,7 @@ def delete( if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return cast( - IndexDeleteResponse, + Optional[IndexDeleteResponse], self._delete( f"/accounts/{account_id}/vectorize/v2/indexes/{index_name}", options=make_request_options( @@ -203,7 +203,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IndexDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IndexDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IndexDeleteResponse] @@ -687,7 +687,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexDeleteResponse: + ) -> Optional[IndexDeleteResponse]: """ Deletes the specified Vectorize Index. @@ -707,7 +707,7 @@ async def delete( if not index_name: raise ValueError(f"Expected a non-empty value for `index_name` but received {index_name!r}") return cast( - IndexDeleteResponse, + Optional[IndexDeleteResponse], await self._delete( f"/accounts/{account_id}/vectorize/v2/indexes/{index_name}", options=make_request_options( @@ -715,7 +715,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IndexDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IndexDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IndexDeleteResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/devices.py b/src/cloudflare/resources/zero_trust/devices/devices.py index 73e50bc540a..ca92217077f 100644 --- a/src/cloudflare/resources/zero_trust/devices/devices.py +++ b/src/cloudflare/resources/zero_trust/devices/devices.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -187,7 +187,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeviceGetResponse: + ) -> Optional[DeviceGetResponse]: """ Fetches details for a single device. @@ -207,7 +207,7 @@ def get( if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") return cast( - DeviceGetResponse, + Optional[DeviceGetResponse], self._get( f"/accounts/{account_id}/devices/{device_id}", options=make_request_options( @@ -215,7 +215,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[DeviceGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[DeviceGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DeviceGetResponse] @@ -321,7 +321,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeviceGetResponse: + ) -> Optional[DeviceGetResponse]: """ Fetches details for a single device. @@ -341,7 +341,7 @@ async def get( if not device_id: raise ValueError(f"Expected a non-empty value for `device_id` but received {device_id!r}") return cast( - DeviceGetResponse, + Optional[DeviceGetResponse], await self._get( f"/accounts/{account_id}/devices/{device_id}", options=make_request_options( @@ -349,7 +349,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[DeviceGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[DeviceGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[DeviceGetResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/policies/certificates.py b/src/cloudflare/resources/zero_trust/devices/policies/certificates.py index 6f361f32938..67b5180196d 100755 --- a/src/cloudflare/resources/zero_trust/devices/policies/certificates.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/certificates.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast 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, - ) -> CertificateUpdateResponse: + ) -> Optional[CertificateUpdateResponse]: """ Enable Zero Trust Clients to provision a certificate, containing a x509 subject, and referenced by Access device posture policies when the client visits MTLS @@ -80,7 +80,7 @@ def update( if not zone_tag: raise ValueError(f"Expected a non-empty value for `zone_tag` but received {zone_tag!r}") return cast( - CertificateUpdateResponse, + Optional[CertificateUpdateResponse], self._patch( f"/zones/{zone_tag}/devices/policy/certificates", body=maybe_transform({"enabled": enabled}, certificate_update_params.CertificateUpdateParams), @@ -89,7 +89,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateUpdateResponse] @@ -107,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateGetResponse: + ) -> Optional[CertificateGetResponse]: """ Fetches device certificate provisioning @@ -123,7 +123,7 @@ def get( if not zone_tag: raise ValueError(f"Expected a non-empty value for `zone_tag` but received {zone_tag!r}") return cast( - CertificateGetResponse, + Optional[CertificateGetResponse], self._get( f"/zones/{zone_tag}/devices/policy/certificates", options=make_request_options( @@ -131,7 +131,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateGetResponse] @@ -171,7 +171,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateUpdateResponse: + ) -> Optional[CertificateUpdateResponse]: """ Enable Zero Trust Clients to provision a certificate, containing a x509 subject, and referenced by Access device posture policies when the client visits MTLS @@ -192,7 +192,7 @@ async def update( if not zone_tag: raise ValueError(f"Expected a non-empty value for `zone_tag` but received {zone_tag!r}") return cast( - CertificateUpdateResponse, + Optional[CertificateUpdateResponse], await self._patch( f"/zones/{zone_tag}/devices/policy/certificates", body=await async_maybe_transform( @@ -203,7 +203,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateUpdateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateUpdateResponse] @@ -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, - ) -> CertificateGetResponse: + ) -> Optional[CertificateGetResponse]: """ Fetches device certificate provisioning @@ -237,7 +237,7 @@ async def get( if not zone_tag: raise ValueError(f"Expected a non-empty value for `zone_tag` but received {zone_tag!r}") return cast( - CertificateGetResponse, + Optional[CertificateGetResponse], await self._get( f"/zones/{zone_tag}/devices/policy/certificates", options=make_request_options( @@ -245,7 +245,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateGetResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateGetResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py index 0074d8055da..c02ac6559f6 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py @@ -156,7 +156,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntegrationDeleteResponse: + ) -> Optional[IntegrationDeleteResponse]: """ Delete a configured device posture integration. @@ -176,7 +176,7 @@ def delete( if not integration_id: raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") return cast( - IntegrationDeleteResponse, + Optional[IntegrationDeleteResponse], self._delete( f"/accounts/{account_id}/devices/posture/integration/{integration_id}", options=make_request_options( @@ -184,7 +184,7 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IntegrationDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IntegrationDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IntegrationDeleteResponse] @@ -428,7 +428,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntegrationDeleteResponse: + ) -> Optional[IntegrationDeleteResponse]: """ Delete a configured device posture integration. @@ -448,7 +448,7 @@ async def delete( if not integration_id: raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") return cast( - IntegrationDeleteResponse, + Optional[IntegrationDeleteResponse], await self._delete( f"/accounts/{account_id}/devices/posture/integration/{integration_id}", options=make_request_options( @@ -456,7 +456,7 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[IntegrationDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[IntegrationDeleteResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[IntegrationDeleteResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/revoke.py b/src/cloudflare/resources/zero_trust/devices/revoke.py index d14f3536764..3057bf6c62d 100644 --- a/src/cloudflare/resources/zero_trust/devices/revoke.py +++ b/src/cloudflare/resources/zero_trust/devices/revoke.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, cast +from typing import Any, List, 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, - ) -> RevokeCreateResponse: + ) -> Optional[RevokeCreateResponse]: """ Revokes a list of devices. @@ -75,7 +75,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - RevokeCreateResponse, + Optional[RevokeCreateResponse], self._post( f"/accounts/{account_id}/devices/revoke", body=maybe_transform(body, List[str]), @@ -84,7 +84,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RevokeCreateResponse] @@ -124,7 +124,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RevokeCreateResponse: + ) -> Optional[RevokeCreateResponse]: """ Revokes a list of devices. @@ -142,7 +142,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - RevokeCreateResponse, + Optional[RevokeCreateResponse], await self._post( f"/accounts/{account_id}/devices/revoke", body=await async_maybe_transform(body, List[str]), @@ -151,7 +151,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[RevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[RevokeCreateResponse] diff --git a/src/cloudflare/resources/zero_trust/devices/unrevoke.py b/src/cloudflare/resources/zero_trust/devices/unrevoke.py index 3c4489edec1..b99f36a0037 100644 --- a/src/cloudflare/resources/zero_trust/devices/unrevoke.py +++ b/src/cloudflare/resources/zero_trust/devices/unrevoke.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, cast +from typing import Any, List, 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, - ) -> UnrevokeCreateResponse: + ) -> Optional[UnrevokeCreateResponse]: """ Unrevokes a list of devices. @@ -75,7 +75,7 @@ def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - UnrevokeCreateResponse, + Optional[UnrevokeCreateResponse], self._post( f"/accounts/{account_id}/devices/unrevoke", body=maybe_transform(body, List[str]), @@ -84,7 +84,7 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UnrevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[UnrevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UnrevokeCreateResponse] @@ -124,7 +124,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UnrevokeCreateResponse: + ) -> Optional[UnrevokeCreateResponse]: """ Unrevokes a list of devices. @@ -142,7 +142,7 @@ async def create( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( - UnrevokeCreateResponse, + Optional[UnrevokeCreateResponse], await self._post( f"/accounts/{account_id}/devices/unrevoke", body=await async_maybe_transform(body, List[str]), @@ -151,7 +151,7 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UnrevokeCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[UnrevokeCreateResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[UnrevokeCreateResponse] diff --git a/src/cloudflare/types/accounts/subscription_create_response.py b/src/cloudflare/types/accounts/subscription_create_response.py index 5ba8b499d96..907605e38d7 100644 --- a/src/cloudflare/types/accounts/subscription_create_response.py +++ b/src/cloudflare/types/accounts/subscription_create_response.py @@ -5,4 +5,4 @@ __all__ = ["SubscriptionCreateResponse"] -SubscriptionCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +SubscriptionCreateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/accounts/subscription_update_response.py b/src/cloudflare/types/accounts/subscription_update_response.py index 71628cdb370..2938ede2a91 100644 --- a/src/cloudflare/types/accounts/subscription_update_response.py +++ b/src/cloudflare/types/accounts/subscription_update_response.py @@ -5,4 +5,4 @@ __all__ = ["SubscriptionUpdateResponse"] -SubscriptionUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +SubscriptionUpdateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/argo/smart_routing_edit_response.py b/src/cloudflare/types/argo/smart_routing_edit_response.py index 7fa39d8d0ca..eb10a30c757 100644 --- a/src/cloudflare/types/argo/smart_routing_edit_response.py +++ b/src/cloudflare/types/argo/smart_routing_edit_response.py @@ -5,4 +5,4 @@ __all__ = ["SmartRoutingEditResponse"] -SmartRoutingEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +SmartRoutingEditResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/argo/smart_routing_get_response.py b/src/cloudflare/types/argo/smart_routing_get_response.py index f65642d31d3..44743a8c601 100644 --- a/src/cloudflare/types/argo/smart_routing_get_response.py +++ b/src/cloudflare/types/argo/smart_routing_get_response.py @@ -5,4 +5,4 @@ __all__ = ["SmartRoutingGetResponse"] -SmartRoutingGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +SmartRoutingGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/access_rule_create_response.py b/src/cloudflare/types/firewall/access_rule_create_response.py index cf90fa66c02..a22df9118bb 100644 --- a/src/cloudflare/types/firewall/access_rule_create_response.py +++ b/src/cloudflare/types/firewall/access_rule_create_response.py @@ -5,4 +5,4 @@ __all__ = ["AccessRuleCreateResponse"] -AccessRuleCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +AccessRuleCreateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/access_rule_edit_response.py b/src/cloudflare/types/firewall/access_rule_edit_response.py index 9a812e80db2..94d60856d78 100644 --- a/src/cloudflare/types/firewall/access_rule_edit_response.py +++ b/src/cloudflare/types/firewall/access_rule_edit_response.py @@ -5,4 +5,4 @@ __all__ = ["AccessRuleEditResponse"] -AccessRuleEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +AccessRuleEditResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/access_rule_get_response.py b/src/cloudflare/types/firewall/access_rule_get_response.py index 0e6dc7f7983..60bb66386e9 100644 --- a/src/cloudflare/types/firewall/access_rule_get_response.py +++ b/src/cloudflare/types/firewall/access_rule_get_response.py @@ -5,4 +5,4 @@ __all__ = ["AccessRuleGetResponse"] -AccessRuleGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +AccessRuleGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/ua_rule_create_response.py b/src/cloudflare/types/firewall/ua_rule_create_response.py index bb2d6671967..fdeab8ca53c 100644 --- a/src/cloudflare/types/firewall/ua_rule_create_response.py +++ b/src/cloudflare/types/firewall/ua_rule_create_response.py @@ -5,4 +5,4 @@ __all__ = ["UARuleCreateResponse"] -UARuleCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +UARuleCreateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/ua_rule_get_response.py b/src/cloudflare/types/firewall/ua_rule_get_response.py index 10613bd3d5b..ce8cbcbc281 100644 --- a/src/cloudflare/types/firewall/ua_rule_get_response.py +++ b/src/cloudflare/types/firewall/ua_rule_get_response.py @@ -5,4 +5,4 @@ __all__ = ["UARuleGetResponse"] -UARuleGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +UARuleGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/ua_rule_update_response.py b/src/cloudflare/types/firewall/ua_rule_update_response.py index 4dc4d0ae168..812b6ecb182 100644 --- a/src/cloudflare/types/firewall/ua_rule_update_response.py +++ b/src/cloudflare/types/firewall/ua_rule_update_response.py @@ -5,4 +5,4 @@ __all__ = ["UARuleUpdateResponse"] -UARuleUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +UARuleUpdateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/waf/package_get_response.py b/src/cloudflare/types/firewall/waf/package_get_response.py index 6c5fda24087..218464c9db5 100644 --- a/src/cloudflare/types/firewall/waf/package_get_response.py +++ b/src/cloudflare/types/firewall/waf/package_get_response.py @@ -14,7 +14,7 @@ class FirewallAPIResponseSingle(BaseModel): messages: List[ResponseInfo] - result: Union[Optional[str], Optional[object]] + result: Union[Optional[str], object] success: Literal[True] """Whether the API call was successful""" diff --git a/src/cloudflare/types/firewall/waf/packages/group_edit_response.py b/src/cloudflare/types/firewall/waf/packages/group_edit_response.py index 1c60b3dc5cd..4848a5e17c0 100644 --- a/src/cloudflare/types/firewall/waf/packages/group_edit_response.py +++ b/src/cloudflare/types/firewall/waf/packages/group_edit_response.py @@ -5,4 +5,4 @@ __all__ = ["GroupEditResponse"] -GroupEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +GroupEditResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/waf/packages/group_get_response.py b/src/cloudflare/types/firewall/waf/packages/group_get_response.py index 3a957c0f004..ee2add0082e 100644 --- a/src/cloudflare/types/firewall/waf/packages/group_get_response.py +++ b/src/cloudflare/types/firewall/waf/packages/group_get_response.py @@ -5,4 +5,4 @@ __all__ = ["GroupGetResponse"] -GroupGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +GroupGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/firewall/waf/packages/rule_get_response.py b/src/cloudflare/types/firewall/waf/packages/rule_get_response.py index 13fee82f1b2..68d667fdb2a 100644 --- a/src/cloudflare/types/firewall/waf/packages/rule_get_response.py +++ b/src/cloudflare/types/firewall/waf/packages/rule_get_response.py @@ -5,4 +5,4 @@ __all__ = ["RuleGetResponse"] -RuleGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +RuleGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/hyperdrive/config_delete_response.py b/src/cloudflare/types/hyperdrive/config_delete_response.py index 271346e64df..48d3bade3ab 100644 --- a/src/cloudflare/types/hyperdrive/config_delete_response.py +++ b/src/cloudflare/types/hyperdrive/config_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["ConfigDeleteResponse"] -ConfigDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +ConfigDeleteResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/images/v1/variant_delete_response.py b/src/cloudflare/types/images/v1/variant_delete_response.py index 849e187534e..3b3a97038ec 100644 --- a/src/cloudflare/types/images/v1/variant_delete_response.py +++ b/src/cloudflare/types/images/v1/variant_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["VariantDeleteResponse"] -VariantDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +VariantDeleteResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/images/v1_delete_response.py b/src/cloudflare/types/images/v1_delete_response.py index b616950e39c..0122c846f86 100644 --- a/src/cloudflare/types/images/v1_delete_response.py +++ b/src/cloudflare/types/images/v1_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["V1DeleteResponse"] -V1DeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +V1DeleteResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/kv/__init__.py b/src/cloudflare/types/kv/__init__.py index e345eaf540a..09b3bc52b28 100644 --- a/src/cloudflare/types/kv/__init__.py +++ b/src/cloudflare/types/kv/__init__.py @@ -6,5 +6,3 @@ from .namespace_list_params import NamespaceListParams as NamespaceListParams from .namespace_create_params import NamespaceCreateParams as NamespaceCreateParams from .namespace_update_params import NamespaceUpdateParams as NamespaceUpdateParams -from .namespace_delete_response import NamespaceDeleteResponse as NamespaceDeleteResponse -from .namespace_update_response import NamespaceUpdateResponse as NamespaceUpdateResponse diff --git a/src/cloudflare/types/kv/namespace_delete_response.py b/src/cloudflare/types/kv/namespace_delete_response.py deleted file mode 100644 index eb6f28e4253..00000000000 --- a/src/cloudflare/types/kv/namespace_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ..._models import BaseModel - -__all__ = ["NamespaceDeleteResponse"] - - -class NamespaceDeleteResponse(BaseModel): - pass diff --git a/src/cloudflare/types/kv/namespace_update_response.py b/src/cloudflare/types/kv/namespace_update_response.py deleted file mode 100644 index b8f763fc2e9..00000000000 --- a/src/cloudflare/types/kv/namespace_update_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ..._models import BaseModel - -__all__ = ["NamespaceUpdateResponse"] - - -class NamespaceUpdateResponse(BaseModel): - pass diff --git a/src/cloudflare/types/kv/namespaces/__init__.py b/src/cloudflare/types/kv/namespaces/__init__.py index 69632f0965e..c76af0cc06c 100644 --- a/src/cloudflare/types/kv/namespaces/__init__.py +++ b/src/cloudflare/types/kv/namespaces/__init__.py @@ -6,8 +6,4 @@ from .key_list_params import KeyListParams as KeyListParams from .bulk_update_params import BulkUpdateParams as BulkUpdateParams from .value_update_params import ValueUpdateParams as ValueUpdateParams -from .bulk_delete_response import BulkDeleteResponse as BulkDeleteResponse -from .bulk_update_response import BulkUpdateResponse as BulkUpdateResponse from .metadata_get_response import MetadataGetResponse as MetadataGetResponse -from .value_delete_response import ValueDeleteResponse as ValueDeleteResponse -from .value_update_response import ValueUpdateResponse as ValueUpdateResponse diff --git a/src/cloudflare/types/kv/namespaces/bulk_delete_response.py b/src/cloudflare/types/kv/namespaces/bulk_delete_response.py deleted file mode 100644 index 4ae88607764..00000000000 --- a/src/cloudflare/types/kv/namespaces/bulk_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ...._models import BaseModel - -__all__ = ["BulkDeleteResponse"] - - -class BulkDeleteResponse(BaseModel): - pass diff --git a/src/cloudflare/types/kv/namespaces/bulk_update_response.py b/src/cloudflare/types/kv/namespaces/bulk_update_response.py deleted file mode 100644 index 55544c65e54..00000000000 --- a/src/cloudflare/types/kv/namespaces/bulk_update_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ...._models import BaseModel - -__all__ = ["BulkUpdateResponse"] - - -class BulkUpdateResponse(BaseModel): - pass diff --git a/src/cloudflare/types/kv/namespaces/value_delete_response.py b/src/cloudflare/types/kv/namespaces/value_delete_response.py deleted file mode 100644 index 224a80852b0..00000000000 --- a/src/cloudflare/types/kv/namespaces/value_delete_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ...._models import BaseModel - -__all__ = ["ValueDeleteResponse"] - - -class ValueDeleteResponse(BaseModel): - pass diff --git a/src/cloudflare/types/kv/namespaces/value_update_response.py b/src/cloudflare/types/kv/namespaces/value_update_response.py deleted file mode 100644 index 40ffa943af8..00000000000 --- a/src/cloudflare/types/kv/namespaces/value_update_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from ...._models import BaseModel - -__all__ = ["ValueUpdateResponse"] - - -class ValueUpdateResponse(BaseModel): - pass diff --git a/src/cloudflare/types/load_balancers/region_get_response.py b/src/cloudflare/types/load_balancers/region_get_response.py index c4bbad7f15f..fd3582537fa 100644 --- a/src/cloudflare/types/load_balancers/region_get_response.py +++ b/src/cloudflare/types/load_balancers/region_get_response.py @@ -5,4 +5,4 @@ __all__ = ["RegionGetResponse"] -RegionGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +RegionGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/load_balancers/region_list_response.py b/src/cloudflare/types/load_balancers/region_list_response.py index 668f256ec66..25d3aa695ef 100644 --- a/src/cloudflare/types/load_balancers/region_list_response.py +++ b/src/cloudflare/types/load_balancers/region_list_response.py @@ -5,4 +5,4 @@ __all__ = ["RegionListResponse"] -RegionListResponse: TypeAlias = Union[Optional[str], Optional[object]] +RegionListResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/origin_post_quantum_encryption/__init__.py b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py index 31525d2b891..0c34922d5b1 100644 --- a/src/cloudflare/types/origin_post_quantum_encryption/__init__.py +++ b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py @@ -2,12 +2,6 @@ from __future__ import annotations -from .origin_post_quantum_encryption_get_response import ( - OriginPostQuantumEncryptionGetResponse as OriginPostQuantumEncryptionGetResponse, -) from .origin_post_quantum_encryption_update_params import ( OriginPostQuantumEncryptionUpdateParams as OriginPostQuantumEncryptionUpdateParams, ) -from .origin_post_quantum_encryption_update_response import ( - OriginPostQuantumEncryptionUpdateResponse as OriginPostQuantumEncryptionUpdateResponse, -) diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py deleted file mode 100644 index 6f1aa4dca49..00000000000 --- a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_get_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import TypeAlias - -__all__ = ["OriginPostQuantumEncryptionGetResponse"] - -OriginPostQuantumEncryptionGetResponse: TypeAlias = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py deleted file mode 100644 index bfc6dab7036..00000000000 --- a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import TypeAlias - -__all__ = ["OriginPostQuantumEncryptionUpdateResponse"] - -OriginPostQuantumEncryptionUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/pagerules/pagerule_create_response.py b/src/cloudflare/types/pagerules/pagerule_create_response.py index c169da3be94..279a337023e 100644 --- a/src/cloudflare/types/pagerules/pagerule_create_response.py +++ b/src/cloudflare/types/pagerules/pagerule_create_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["PageruleCreateResponse"] -PageruleCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +PageruleCreateResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/pagerules/pagerule_edit_response.py b/src/cloudflare/types/pagerules/pagerule_edit_response.py index 7b882ba930a..ff50de1e7f8 100644 --- a/src/cloudflare/types/pagerules/pagerule_edit_response.py +++ b/src/cloudflare/types/pagerules/pagerule_edit_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["PageruleEditResponse"] -PageruleEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +PageruleEditResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/pagerules/pagerule_get_response.py b/src/cloudflare/types/pagerules/pagerule_get_response.py index 542af026355..961e4bdedaa 100644 --- a/src/cloudflare/types/pagerules/pagerule_get_response.py +++ b/src/cloudflare/types/pagerules/pagerule_get_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["PageruleGetResponse"] -PageruleGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +PageruleGetResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/pagerules/pagerule_update_response.py b/src/cloudflare/types/pagerules/pagerule_update_response.py index 110b4c3282b..fdb37486582 100644 --- a/src/cloudflare/types/pagerules/pagerule_update_response.py +++ b/src/cloudflare/types/pagerules/pagerule_update_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["PageruleUpdateResponse"] -PageruleUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +PageruleUpdateResponse: TypeAlias = Union[str, object] diff --git a/src/cloudflare/types/rate_limits/rate_limit_create_response.py b/src/cloudflare/types/rate_limits/rate_limit_create_response.py index 66dfea95151..46f90b4a90f 100644 --- a/src/cloudflare/types/rate_limits/rate_limit_create_response.py +++ b/src/cloudflare/types/rate_limits/rate_limit_create_response.py @@ -5,4 +5,4 @@ __all__ = ["RateLimitCreateResponse"] -RateLimitCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +RateLimitCreateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/rate_limits/rate_limit_edit_response.py b/src/cloudflare/types/rate_limits/rate_limit_edit_response.py index f7c7ef2529a..6bf33364b45 100644 --- a/src/cloudflare/types/rate_limits/rate_limit_edit_response.py +++ b/src/cloudflare/types/rate_limits/rate_limit_edit_response.py @@ -5,4 +5,4 @@ __all__ = ["RateLimitEditResponse"] -RateLimitEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +RateLimitEditResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/rate_limits/rate_limit_get_response.py b/src/cloudflare/types/rate_limits/rate_limit_get_response.py index a48c8258a4a..edefe69c807 100644 --- a/src/cloudflare/types/rate_limits/rate_limit_get_response.py +++ b/src/cloudflare/types/rate_limits/rate_limit_get_response.py @@ -5,4 +5,4 @@ __all__ = ["RateLimitGetResponse"] -RateLimitGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +RateLimitGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/user/subscription_update_response.py b/src/cloudflare/types/user/subscription_update_response.py index 71628cdb370..2938ede2a91 100644 --- a/src/cloudflare/types/user/subscription_update_response.py +++ b/src/cloudflare/types/user/subscription_update_response.py @@ -5,4 +5,4 @@ __all__ = ["SubscriptionUpdateResponse"] -SubscriptionUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +SubscriptionUpdateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/vectorize/index_delete_response.py b/src/cloudflare/types/vectorize/index_delete_response.py index 2680eb61604..04ceee6b545 100644 --- a/src/cloudflare/types/vectorize/index_delete_response.py +++ b/src/cloudflare/types/vectorize/index_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["IndexDeleteResponse"] -IndexDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +IndexDeleteResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/certificate_rule.py b/src/cloudflare/types/zero_trust/certificate_rule.py index f14637d2f4d..fb76060608c 100644 --- a/src/cloudflare/types/zero_trust/certificate_rule.py +++ b/src/cloudflare/types/zero_trust/certificate_rule.py @@ -4,12 +4,8 @@ from ..._models import BaseModel -__all__ = ["CertificateRule", "Certificate"] - - -class Certificate(BaseModel): - pass +__all__ = ["CertificateRule"] class CertificateRule(BaseModel): - certificate: Certificate + certificate: object diff --git a/src/cloudflare/types/zero_trust/certificate_rule_param.py b/src/cloudflare/types/zero_trust/certificate_rule_param.py index de01c8184d6..a93d12ae10b 100644 --- a/src/cloudflare/types/zero_trust/certificate_rule_param.py +++ b/src/cloudflare/types/zero_trust/certificate_rule_param.py @@ -4,12 +4,8 @@ from typing_extensions import Required, TypedDict -__all__ = ["CertificateRuleParam", "Certificate"] - - -class Certificate(TypedDict, total=False): - pass +__all__ = ["CertificateRuleParam"] class CertificateRuleParam(TypedDict, total=False): - certificate: Required[Certificate] + certificate: Required[object] diff --git a/src/cloudflare/types/zero_trust/device_get_response.py b/src/cloudflare/types/zero_trust/device_get_response.py index 0b11c5ec1cc..ba79380b7b3 100644 --- a/src/cloudflare/types/zero_trust/device_get_response.py +++ b/src/cloudflare/types/zero_trust/device_get_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["DeviceGetResponse"] -DeviceGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +DeviceGetResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/policies/certificate_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/certificate_get_response.py index 055be51f531..47253a71db8 100755 --- a/src/cloudflare/types/zero_trust/devices/policies/certificate_get_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/certificate_get_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["CertificateGetResponse"] -CertificateGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +CertificateGetResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/policies/certificate_update_response.py b/src/cloudflare/types/zero_trust/devices/policies/certificate_update_response.py index 015f7860390..19199b9c581 100755 --- a/src/cloudflare/types/zero_trust/devices/policies/certificate_update_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/certificate_update_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["CertificateUpdateResponse"] -CertificateUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +CertificateUpdateResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py b/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py index df93cf5607b..5ad6c5cee94 100644 --- a/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py +++ b/src/cloudflare/types/zero_trust/devices/posture/integration_delete_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["IntegrationDeleteResponse"] -IntegrationDeleteResponse: TypeAlias = Union[Optional[str], Optional[object]] +IntegrationDeleteResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/revoke_create_response.py b/src/cloudflare/types/zero_trust/devices/revoke_create_response.py index 09aceb4935f..42834980772 100644 --- a/src/cloudflare/types/zero_trust/devices/revoke_create_response.py +++ b/src/cloudflare/types/zero_trust/devices/revoke_create_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["RevokeCreateResponse"] -RevokeCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +RevokeCreateResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py b/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py index 4b3977f4e98..80dd27e6b84 100644 --- a/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py +++ b/src/cloudflare/types/zero_trust/devices/unrevoke_create_response.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Union from typing_extensions import TypeAlias __all__ = ["UnrevokeCreateResponse"] -UnrevokeCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +UnrevokeCreateResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zones/subscription_create_response.py b/src/cloudflare/types/zones/subscription_create_response.py index 5ba8b499d96..907605e38d7 100644 --- a/src/cloudflare/types/zones/subscription_create_response.py +++ b/src/cloudflare/types/zones/subscription_create_response.py @@ -5,4 +5,4 @@ __all__ = ["SubscriptionCreateResponse"] -SubscriptionCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +SubscriptionCreateResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/zones/subscription_get_response.py b/src/cloudflare/types/zones/subscription_get_response.py index 88f2f2b2875..87b2b42959e 100644 --- a/src/cloudflare/types/zones/subscription_get_response.py +++ b/src/cloudflare/types/zones/subscription_get_response.py @@ -5,4 +5,4 @@ __all__ = ["SubscriptionGetResponse"] -SubscriptionGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +SubscriptionGetResponse: TypeAlias = Union[Optional[str], object] diff --git a/src/cloudflare/types/zones/subscription_update_response.py b/src/cloudflare/types/zones/subscription_update_response.py index 71628cdb370..2938ede2a91 100644 --- a/src/cloudflare/types/zones/subscription_update_response.py +++ b/src/cloudflare/types/zones/subscription_update_response.py @@ -5,4 +5,4 @@ __all__ = ["SubscriptionUpdateResponse"] -SubscriptionUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +SubscriptionUpdateResponse: TypeAlias = Union[Optional[str], object] diff --git a/tests/api_resources/argo/test_tiered_caching.py b/tests/api_resources/argo/test_tiered_caching.py index 9afbafa5d1c..d91060caa7b 100644 --- a/tests/api_resources/argo/test_tiered_caching.py +++ b/tests/api_resources/argo/test_tiered_caching.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -35,7 +35,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" tiered_caching = response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True @@ -64,7 +64,7 @@ def test_method_get(self, client: Cloudflare) -> None: tiered_caching = client.argo.tiered_caching.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -75,7 +75,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" tiered_caching = response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -86,7 +86,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True @@ -107,7 +107,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -119,7 +119,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" tiered_caching = await response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -131,7 +131,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = await response.parse() - assert_matches_type(TieredCachingEditResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingEditResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +148,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: tiered_caching = await async_client.argo.tiered_caching.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -159,7 +159,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" tiered_caching = await response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -170,7 +170,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" tiered_caching = await response.parse() - assert_matches_type(TieredCachingGetResponse, tiered_caching, path=["response"]) + assert_matches_type(Optional[TieredCachingGetResponse], tiered_caching, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_cache_reserve.py b/tests/api_resources/cache/test_cache_reserve.py index fb8eab75309..b1e3ec59f38 100644 --- a/tests/api_resources/cache/test_cache_reserve.py +++ b/tests/api_resources/cache/test_cache_reserve.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_clear(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", body="{}", ) - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_clear(self, client: Cloudflare) -> None: @@ -40,7 +40,7 @@ def test_raw_response_clear(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_clear(self, client: Cloudflare) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_clear(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -82,7 +82,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" cache_reserve = response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -94,7 +94,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -111,7 +111,7 @@ def test_method_get(self, client: Cloudflare) -> None: cache_reserve = client.cache.cache_reserve.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -122,7 +122,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" cache_reserve = response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -133,7 +133,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +149,7 @@ def test_method_status(self, client: Cloudflare) -> None: cache_reserve = client.cache.cache_reserve.status( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize def test_raw_response_status(self, client: Cloudflare) -> None: @@ -160,7 +160,7 @@ def test_raw_response_status(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize def test_streaming_response_status(self, client: Cloudflare) -> None: @@ -171,7 +171,7 @@ def test_streaming_response_status(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -192,7 +192,7 @@ async def test_method_clear(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", body="{}", ) - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_clear(self, async_client: AsyncCloudflare) -> None: @@ -204,7 +204,7 @@ async def test_raw_response_clear(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_clear(self, async_client: AsyncCloudflare) -> None: @@ -216,7 +216,7 @@ async def test_streaming_response_clear(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveClearResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveClearResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -234,7 +234,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -246,7 +246,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" cache_reserve = await response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -258,7 +258,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveEditResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveEditResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -275,7 +275,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: cache_reserve = await async_client.cache.cache_reserve.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -286,7 +286,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" cache_reserve = await response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -297,7 +297,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveGetResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveGetResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True @@ -313,7 +313,7 @@ async def test_method_status(self, async_client: AsyncCloudflare) -> None: cache_reserve = await async_client.cache.cache_reserve.status( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize async def test_raw_response_status(self, async_client: AsyncCloudflare) -> None: @@ -324,7 +324,7 @@ async def test_raw_response_status(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) @parametrize async def test_streaming_response_status(self, async_client: AsyncCloudflare) -> None: @@ -335,7 +335,7 @@ async def test_streaming_response_status(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" cache_reserve = await response.parse() - assert_matches_type(CacheReserveStatusResponse, cache_reserve, path=["response"]) + assert_matches_type(Optional[CacheReserveStatusResponse], cache_reserve, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_regional_tiered_cache.py b/tests/api_resources/cache/test_regional_tiered_cache.py index ec3ddfeb861..98deff2adf5 100644 --- a/tests/api_resources/cache/test_regional_tiered_cache.py +++ b/tests/api_resources/cache/test_regional_tiered_cache.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -38,7 +38,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" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +67,7 @@ def test_method_get(self, client: Cloudflare) -> None: regional_tiered_cache = client.cache.regional_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -78,7 +78,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" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +110,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -122,7 +122,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" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -134,7 +134,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheEditResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheEditResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -151,7 +151,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: regional_tiered_cache = await async_client.cache.regional_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -162,7 +162,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" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -173,7 +173,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" regional_tiered_cache = await response.parse() - assert_matches_type(RegionalTieredCacheGetResponse, regional_tiered_cache, path=["response"]) + assert_matches_type(Optional[RegionalTieredCacheGetResponse], regional_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_smart_tiered_cache.py b/tests/api_resources/cache/test_smart_tiered_cache.py index b683f9fc4dc..4502fff107d 100644 --- a/tests/api_resources/cache/test_smart_tiered_cache.py +++ b/tests/api_resources/cache/test_smart_tiered_cache.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_delete(self, client: Cloudflare) -> None: smart_tiered_cache = client.cache.smart_tiered_cache.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -37,7 +37,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -48,7 +48,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,7 +65,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -77,7 +77,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" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -106,7 +106,7 @@ def test_method_get(self, client: Cloudflare) -> None: smart_tiered_cache = client.cache.smart_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -117,7 +117,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -128,7 +128,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -148,7 +148,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: smart_tiered_cache = await async_client.cache.smart_tiered_cache.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -159,7 +159,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -170,7 +170,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheDeleteResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheDeleteResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -187,7 +187,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="on", ) - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -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" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -211,7 +211,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheEditResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheEditResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True @@ -228,7 +228,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: smart_tiered_cache = await async_client.cache.smart_tiered_cache.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -239,7 +239,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -250,7 +250,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" smart_tiered_cache = await response.parse() - assert_matches_type(SmartTieredCacheGetResponse, smart_tiered_cache, path=["response"]) + assert_matches_type(Optional[SmartTieredCacheGetResponse], smart_tiered_cache, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/test_variants.py b/tests/api_resources/cache/test_variants.py index c46c601fbb8..d274611a7f1 100644 --- a/tests/api_resources/cache/test_variants.py +++ b/tests/api_resources/cache/test_variants.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_delete(self, client: Cloudflare) -> None: variant = client.cache.variants.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[CacheVariant], variant, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -33,7 +33,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[CacheVariant], variant, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -44,7 +44,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[CacheVariant], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -61,7 +61,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @@ -81,7 +81,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "webp": ["image/jpeg", "image/avif"], }, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -93,7 +93,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" variant = response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -105,7 +105,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,7 +122,7 @@ def test_method_get(self, client: Cloudflare) -> None: variant = client.cache.variants.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -133,7 +133,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" variant = response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -144,7 +144,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -164,7 +164,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.delete( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[CacheVariant], variant, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -175,7 +175,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[CacheVariant], variant, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -186,7 +186,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(CacheVariant, variant, path=["response"]) + assert_matches_type(Optional[CacheVariant], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -203,7 +203,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value={}, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -223,7 +223,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "webp": ["image/jpeg", "image/avif"], }, ) - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -235,7 +235,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" variant = await response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -247,7 +247,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(VariantEditResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantEditResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True @@ -264,7 +264,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: variant = await async_client.cache.variants.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -275,7 +275,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" variant = await response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -286,7 +286,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" variant = await response.parse() - assert_matches_type(VariantGetResponse, variant, path=["response"]) + assert_matches_type(Optional[VariantGetResponse], variant, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/hyperdrive/test_configs.py b/tests/api_resources/hyperdrive/test_configs.py index 7451d922a7e..48d09cf76f2 100644 --- a/tests/api_resources/hyperdrive/test_configs.py +++ b/tests/api_resources/hyperdrive/test_configs.py @@ -267,7 +267,7 @@ def test_method_delete(self, client: Cloudflare) -> None: hyperdrive_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ConfigDeleteResponse, config, path=["response"]) + assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -279,7 +279,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(ConfigDeleteResponse, config, path=["response"]) + assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -291,7 +291,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(ConfigDeleteResponse, config, path=["response"]) + assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -682,7 +682,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: hyperdrive_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ConfigDeleteResponse, config, path=["response"]) + assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -694,7 +694,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(ConfigDeleteResponse, config, path=["response"]) + assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -706,7 +706,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(ConfigDeleteResponse, config, path=["response"]) + assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/kv/namespaces/test_bulk.py b/tests/api_resources/kv/namespaces/test_bulk.py index 42649742375..be32c24ea39 100644 --- a/tests/api_resources/kv/namespaces/test_bulk.py +++ b/tests/api_resources/kv/namespaces/test_bulk.py @@ -3,13 +3,12 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.kv.namespaces import BulkDeleteResponse, BulkUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +23,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{}, {}, {}], ) - assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -37,7 +36,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" bulk = response.parse() - assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -50,7 +49,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = response.parse() - assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +75,7 @@ def test_method_delete(self, client: Cloudflare) -> None: namespace_id="0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -88,7 +87,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = response.parse() - assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -100,7 +99,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = response.parse() - assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) assert cast(Any, response.is_closed) is True @@ -129,7 +128,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{}, {}, {}], ) - assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -142,7 +141,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" bulk = await response.parse() - assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -155,7 +154,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = await response.parse() - assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +180,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: namespace_id="0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -193,7 +192,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = await response.parse() - assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -205,7 +204,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = await response.parse() - assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) + assert_matches_type(object, bulk, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/kv/namespaces/test_values.py b/tests/api_resources/kv/namespaces/test_values.py index 376ec1960ef..c9b8c299138 100644 --- a/tests/api_resources/kv/namespaces/test_values.py +++ b/tests/api_resources/kv/namespaces/test_values.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import httpx import pytest @@ -17,7 +17,6 @@ StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) -from cloudflare.types.kv.namespaces import ValueDeleteResponse, ValueUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -35,7 +34,7 @@ def test_method_update(self, client: Cloudflare) -> None: metadata='{"someMetadataKey": "someMetadataValue"}', value="Some Value", ) - assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -51,7 +50,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" value = response.parse() - assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -67,7 +66,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = response.parse() - assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,7 +107,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -121,7 +120,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = response.parse() - assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -134,7 +133,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = response.parse() - assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,7 +256,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: metadata='{"someMetadataKey": "someMetadataValue"}', value="Some Value", ) - assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -273,7 +272,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" value = await response.parse() - assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -289,7 +288,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = await response.parse() - assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -330,7 +329,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -343,7 +342,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = await response.parse() - assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -356,7 +355,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = await response.parse() - assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) + assert_matches_type(object, value, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/kv/test_namespaces.py b/tests/api_resources/kv/test_namespaces.py index aa2e9589dfe..ae45e68a4ee 100644 --- a/tests/api_resources/kv/test_namespaces.py +++ b/tests/api_resources/kv/test_namespaces.py @@ -9,11 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.kv import ( - Namespace, - NamespaceDeleteResponse, - NamespaceUpdateResponse, -) +from cloudflare.types.kv import Namespace from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -71,7 +67,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -84,7 +80,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" namespace = response.parse() - assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -97,7 +93,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -172,7 +168,7 @@ def test_method_delete(self, client: Cloudflare) -> None: namespace_id="0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -184,7 +180,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -196,7 +192,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -315,7 +311,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -328,7 +324,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" namespace = await response.parse() - assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -341,7 +337,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -416,7 +412,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: namespace_id="0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -428,7 +424,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -440,7 +436,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) + assert_matches_type(object, namespace, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_origin_post_quantum_encryption.py b/tests/api_resources/test_origin_post_quantum_encryption.py index 7b671649427..bfe684e3849 100644 --- a/tests/api_resources/test_origin_post_quantum_encryption.py +++ b/tests/api_resources/test_origin_post_quantum_encryption.py @@ -9,10 +9,6 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.origin_post_quantum_encryption import ( - OriginPostQuantumEncryptionGetResponse, - OriginPostQuantumEncryptionUpdateResponse, -) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,9 +23,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="preferred", ) - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -42,9 +36,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" origin_post_quantum_encryption = response.parse() - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -57,9 +49,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = response.parse() - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -78,7 +68,7 @@ def test_method_get(self, client: Cloudflare) -> None: origin_post_quantum_encryption = client.origin_post_quantum_encryption.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -90,7 +80,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" origin_post_quantum_encryption = response.parse() - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -102,9 +92,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = response.parse() - assert_matches_type( - OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -127,9 +115,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", value="preferred", ) - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -142,9 +128,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" origin_post_quantum_encryption = await response.parse() - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -157,9 +141,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = await response.parse() - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) assert cast(Any, response.is_closed) is True @@ -178,7 +160,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: origin_post_quantum_encryption = await async_client.origin_post_quantum_encryption.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -190,7 +172,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" origin_post_quantum_encryption = await response.parse() - assert_matches_type(OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"]) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -202,9 +184,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_post_quantum_encryption = await response.parse() - assert_matches_type( - OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"] - ) + assert_matches_type(object, origin_post_quantum_encryption, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/vectorize/test_indexes.py b/tests/api_resources/vectorize/test_indexes.py index 97fe5c1b9e8..272871b4418 100644 --- a/tests/api_resources/vectorize/test_indexes.py +++ b/tests/api_resources/vectorize/test_indexes.py @@ -141,7 +141,7 @@ def test_method_delete(self, client: Cloudflare) -> None: index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -153,7 +153,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -165,7 +165,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) assert cast(Any, response.is_closed) is True @@ -717,7 +717,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: index_name="example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -729,7 +729,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -741,7 +741,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(IndexDeleteResponse, index, path=["response"]) + assert_matches_type(Optional[IndexDeleteResponse], index, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_certificates.py b/tests/api_resources/zero_trust/devices/policies/test_certificates.py index 5bfe2d9b01a..f163b303b93 100755 --- a/tests/api_resources/zero_trust/devices/policies/test_certificates.py +++ b/tests/api_resources/zero_trust/devices/policies/test_certificates.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -26,7 +26,7 @@ def test_method_update(self, client: Cloudflare) -> None: zone_tag="699d98642c564d2e855e9661899b7252", enabled=True, ) - assert_matches_type(CertificateUpdateResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateUpdateResponse], certificate, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -38,7 +38,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" certificate = response.parse() - assert_matches_type(CertificateUpdateResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateUpdateResponse], certificate, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateUpdateResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateUpdateResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -67,7 +67,7 @@ def test_method_get(self, client: Cloudflare) -> None: certificate = client.zero_trust.devices.policies.certificates.get( "699d98642c564d2e855e9661899b7252", ) - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -78,7 +78,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" certificate = response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -89,7 +89,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +110,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: zone_tag="699d98642c564d2e855e9661899b7252", enabled=True, ) - assert_matches_type(CertificateUpdateResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateUpdateResponse], certificate, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -122,7 +122,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" certificate = await response.parse() - assert_matches_type(CertificateUpdateResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateUpdateResponse], certificate, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -134,7 +134,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateUpdateResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateUpdateResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -151,7 +151,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: certificate = await async_client.zero_trust.devices.policies.certificates.get( "699d98642c564d2e855e9661899b7252", ) - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -162,7 +162,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" certificate = await response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -173,7 +173,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(CertificateGetResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateGetResponse], certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/posture/test_integrations.py b/tests/api_resources/zero_trust/devices/posture/test_integrations.py index 6ad1c0fabd0..35efacf4282 100644 --- a/tests/api_resources/zero_trust/devices/posture/test_integrations.py +++ b/tests/api_resources/zero_trust/devices/posture/test_integrations.py @@ -155,7 +155,7 @@ def test_method_delete(self, client: Cloudflare) -> None: integration_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -167,7 +167,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -179,7 +179,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -448,7 +448,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: integration_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -460,7 +460,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -472,7 +472,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(IntegrationDeleteResponse, integration, path=["response"]) + assert_matches_type(Optional[IntegrationDeleteResponse], integration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_revoke.py b/tests/api_resources/zero_trust/devices/test_revoke.py index 27aa2002b99..1eb2113f4f4 100644 --- a/tests/api_resources/zero_trust/devices/test_revoke.py +++ b/tests/api_resources/zero_trust/devices/test_revoke.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: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -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" revoke = response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -59,7 +59,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" revoke = response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) assert cast(Any, response.is_closed) is True @@ -89,7 +89,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -105,7 +105,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" revoke = await response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -121,7 +121,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" revoke = await response.parse() - assert_matches_type(RevokeCreateResponse, revoke, path=["response"]) + assert_matches_type(Optional[RevokeCreateResponse], revoke, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_unrevoke.py b/tests/api_resources/zero_trust/devices/test_unrevoke.py index f3b7f43a733..67e5a521a3e 100644 --- a/tests/api_resources/zero_trust/devices/test_unrevoke.py +++ b/tests/api_resources/zero_trust/devices/test_unrevoke.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: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -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" unrevoke = response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -59,7 +59,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" unrevoke = response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) assert cast(Any, response.is_closed) is True @@ -89,7 +89,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ], ) - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -105,7 +105,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" unrevoke = await response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -121,7 +121,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" unrevoke = await response.parse() - assert_matches_type(UnrevokeCreateResponse, unrevoke, path=["response"]) + assert_matches_type(Optional[UnrevokeCreateResponse], unrevoke, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_devices.py b/tests/api_resources/zero_trust/test_devices.py index f814c7c80bc..e806fd8d30e 100644 --- a/tests/api_resources/zero_trust/test_devices.py +++ b/tests/api_resources/zero_trust/test_devices.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -62,7 +62,7 @@ def test_method_get(self, client: Cloudflare) -> None: device_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -74,7 +74,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" device = response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -86,7 +86,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,7 +152,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: device_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -164,7 +164,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" device = await response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -176,7 +176,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(DeviceGetResponse, device, path=["response"]) + assert_matches_type(Optional[DeviceGetResponse], device, path=["response"]) assert cast(Any, response.is_closed) is True