From 12d619f99a5512354cc632824bb5d82e9ec0350d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:47:40 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 4 +- api.md | 55 ++--- .../resources/argo/tiered_caching.py | 74 +++++-- .../resources/cache/cache_reserve.py | 50 ++--- .../resources/cache/regional_tiered_cache.py | 30 +-- .../resources/cache/smart_tiered_cache.py | 80 +++++--- src/cloudflare/resources/cache/variants.py | 40 ++-- .../origin_post_quantum_encryption.py | 191 +++--------------- .../resources/vectorize/indexes/indexes.py | 12 +- .../devices/policies/default/certificates.py | 26 +-- .../devices/posture/integrations.py | 12 +- .../resources/zero_trust/devices/revoke.py | 14 +- .../resources/zero_trust/devices/unrevoke.py | 14 +- .../argo/tiered_caching_edit_response.py | 13 +- .../types/argo/tiered_caching_get_response.py | 13 +- src/cloudflare/types/cache/__init__.py | 2 +- .../cache/cache_reserve_clear_response.py | 6 +- .../cache/cache_reserve_edit_response.py | 9 +- .../types/cache/cache_reserve_get_response.py | 9 +- .../cache/cache_reserve_status_response.py | 6 +- .../regional_tiered_cache_edit_response.py | 24 +-- .../regional_tiered_cache_get_response.py | 24 +-- .../smart_tiered_cache_delete_response.py | 12 +- .../cache/smart_tiered_cache_edit_response.py | 13 +- .../cache/smart_tiered_cache_get_response.py | 13 +- ..._variant.py => variant_delete_response.py} | 9 +- .../types/cache/variant_edit_response.py | 83 +------- .../types/cache/variant_get_response.py | 83 +------- .../images/v1/variant_delete_response.py | 4 +- .../types/images/v1_delete_response.py | 4 +- .../__init__.py | 6 - ...in_post_quantum_encryption_get_response.py | 21 +- ...n_post_quantum_encryption_update_params.py | 15 -- ...post_quantum_encryption_update_response.py | 8 - .../types/vectorize/index_delete_response.py | 4 +- .../default/certificate_edit_response.py | 4 +- .../default/certificate_get_response.py | 4 +- .../posture/integration_delete_response.py | 4 +- .../devices/revoke_create_response.py | 4 +- .../devices/unrevoke_create_response.py | 4 +- .../api_resources/argo/test_tiered_caching.py | 26 +-- .../api_resources/cache/test_cache_reserve.py | 50 ++--- .../cache/test_regional_tiered_cache.py | 26 +-- .../cache/test_smart_tiered_cache.py | 38 ++-- tests/api_resources/cache/test_variants.py | 44 ++-- .../test_origin_post_quantum_encryption.py | 131 ++---------- tests/api_resources/vectorize/test_indexes.py | 12 +- .../policies/default/test_certificates.py | 26 +-- .../devices/posture/test_integrations.py | 12 +- .../zero_trust/devices/test_revoke.py | 14 +- .../zero_trust/devices/test_unrevoke.py | 14 +- 51 files changed, 543 insertions(+), 853 deletions(-) rename src/cloudflare/types/cache/{cache_variant.py => variant_delete_response.py} (63%) delete mode 100644 src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_params.py delete mode 100644 src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_response.py diff --git a/.stats.yml b/.stats.yml index 3fdc78452d1..c1ea0316647 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1490 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-85569f0482730af4e8c6afc9b33c7ba894e47b2d8fa36a3e013daf5390adb647.yml +configured_endpoints: 1489 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-de7ae109130349e5b0b35b4d0944270435dfddb3ce7079da9b85f5dffaf86639.yml diff --git a/api.md b/api.md index b13dce5736d..404fed77140 100644 --- a/api.md +++ b/api.md @@ -664,10 +664,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[CacheReserveClearResponse] +- client.cache.cache_reserve.edit(\*, zone_id, \*\*params) -> Optional[CacheReserveEditResponse] +- client.cache.cache_reserve.get(\*, zone_id) -> Optional[CacheReserveGetResponse] +- client.cache.cache_reserve.status(\*, zone_id) -> Optional[CacheReserveStatusResponse] ## SmartTieredCache @@ -683,23 +683,28 @@ 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[SmartTieredCacheDeleteResponse] +- client.cache.smart_tiered_cache.edit(\*, zone_id, \*\*params) -> Optional[SmartTieredCacheEditResponse] +- client.cache.smart_tiered_cache.get(\*, zone_id) -> Optional[SmartTieredCacheGetResponse] ## Variants Types: ```python -from cloudflare.types.cache import CacheVariant, VariantEditResponse, VariantGetResponse +from cloudflare.types.cache import ( + CacheVariant, + VariantDeleteResponse, + VariantEditResponse, + VariantGetResponse, +) ``` 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[VariantDeleteResponse] +- client.cache.variants.edit(\*, zone_id, \*\*params) -> Optional[VariantEditResponse] +- client.cache.variants.get(\*, zone_id) -> Optional[VariantGetResponse] ## RegionalTieredCache @@ -715,8 +720,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[RegionalTieredCacheEditResponse] +- client.cache.regional_tiered_cache.get(\*, zone_id) -> Optional[RegionalTieredCacheGetResponse] # SSL @@ -850,8 +855,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[TieredCachingEditResponse] +- client.argo.tiered_caching.get(\*, zone_id) -> Optional[TieredCachingGetResponse] # CertificateAuthorities @@ -4949,8 +4954,8 @@ from cloudflare.types.zero_trust.devices.policies.default import ( Methods: -- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> CertificateEditResponse -- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> CertificateGetResponse +- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> Optional[CertificateEditResponse] +- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> Optional[CertificateGetResponse] #### Custom @@ -5064,7 +5069,7 @@ Methods: - client.zero_trust.devices.posture.integrations.create(\*, account_id, \*\*params) -> Optional[Integration] - 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[IntegrationDeleteResponse] - client.zero_trust.devices.posture.integrations.edit(integration_id, \*, account_id, \*\*params) -> Optional[Integration] - client.zero_trust.devices.posture.integrations.get(integration_id, \*, account_id) -> Optional[Integration] @@ -5078,7 +5083,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[RevokeCreateResponse] ### Settings @@ -5104,7 +5109,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[UnrevokeCreateResponse] ### OverrideCodes @@ -6549,7 +6554,7 @@ Methods: - client.vectorize.indexes.create(\*, account_id, \*\*params) -> Optional[CreateIndex] - 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[IndexDeleteResponse] - client.vectorize.indexes.delete_by_ids(index_name, \*, account_id, \*\*params) -> Optional[IndexDeleteByIDsResponse] - client.vectorize.indexes.get(index_name, \*, account_id) -> Optional[CreateIndex] - client.vectorize.indexes.get_by_ids(index_name, \*, account_id, \*\*params) -> object @@ -7786,16 +7791,12 @@ Methods: Types: ```python -from cloudflare.types.origin_post_quantum_encryption import ( - OriginPostQuantumEncryptionUpdateResponse, - OriginPostQuantumEncryptionGetResponse, -) +from cloudflare.types.origin_post_quantum_encryption import OriginPostQuantumEncryptionGetResponse ``` 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.get(\*, zone_id) -> Optional[OriginPostQuantumEncryptionGetResponse] # Speed diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index 46fb96c1e31..066b5a75b53 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,9 +60,19 @@ 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 + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -87,9 +97,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,9 +112,19 @@ 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 + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -126,9 +146,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,9 +183,19 @@ 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 + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -190,9 +220,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,9 +235,19 @@ 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 + Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + to see if it has the content. If the upper-tier does not have the content, only + the upper-tier can ask the origin for content. This practice improves bandwidth + efficiency by limiting the number of data centers that can ask the origin for + content, which reduces origin load and makes websites more cost-effective to + operate. Additionally, Tiered Cache concentrates connections to origin servers + so they come from a small number of data centers rather than the full set of + network locations. This results in fewer open connections using server + resources. Args: zone_id: Identifier @@ -229,9 +269,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..93a2f3510cf 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,9 +60,14 @@ 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 + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -84,9 +89,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,9 +105,14 @@ 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 + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -127,9 +137,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,9 +152,14 @@ 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 + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -166,9 +181,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,9 +217,14 @@ 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 + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -226,9 +246,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,9 +262,14 @@ 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 + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -271,9 +296,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,9 +311,14 @@ 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 + Smart Tiered Cache dynamically selects the single closest upper tier for each of + your website’s origins with no configuration required, using our in-house + performance and routing data. Cloudflare collects latency data for each request + to an origin, and uses the latency data to determine how well any upper-tier + data center is connected with an origin. As a result, Cloudflare can select the + data center with the lowest latency to be the upper-tier for an origin. Args: zone_id: Identifier @@ -310,9 +340,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..04b84159e3b 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 @@ -22,9 +22,9 @@ from ..._wrappers import ResultWrapper from ...types.cache import variant_edit_params from ..._base_client import make_request_options -from ...types.cache.cache_variant import CacheVariant from ...types.cache.variant_get_response import VariantGetResponse from ...types.cache.variant_edit_response import VariantEditResponse +from ...types.cache.variant_delete_response import VariantDeleteResponse __all__ = ["VariantsResource", "AsyncVariantsResource"] @@ -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[VariantDeleteResponse]: """ 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[VariantDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), + cast_to=cast(Type[Optional[VariantDeleteResponse]], ResultWrapper[VariantDeleteResponse]), ) 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[VariantDeleteResponse]: """ 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[VariantDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[CacheVariant], ResultWrapper[CacheVariant]), + cast_to=cast(Type[Optional[VariantDeleteResponse]], ResultWrapper[VariantDeleteResponse]), ) 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/origin_post_quantum_encryption.py b/src/cloudflare/resources/origin_post_quantum_encryption.py index bda025f507b..496eaf5495f 100644 --- a/src/cloudflare/resources/origin_post_quantum_encryption.py +++ b/src/cloudflare/resources/origin_post_quantum_encryption.py @@ -2,16 +2,11 @@ from __future__ import annotations -from typing import Any, cast -from typing_extensions import Literal +from typing import Type, Optional, cast import httpx from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -22,13 +17,9 @@ ) 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"] @@ -53,62 +44,6 @@ def with_streaming_response(self) -> OriginPostQuantumEncryptionResourceWithStre """ return OriginPostQuantumEncryptionResourceWithStreamingResponse(self) - def update( - self, - *, - zone_id: str, - value: Literal["preferred", "supported", "off"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionUpdateResponse: - """ - Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when - connecting to your origin. Preferred instructs Cloudflare to opportunistically - send a Post-Quantum keyshare in the first message to the origin (for fastest - connections when the origin supports and prefers PQ), supported means that PQ - algorithms are advertised but only used when requested by the origin, and off - means that PQ algorithms are not advertised - - Args: - zone_id: Identifier - - value: Value of the Origin Post Quantum Encryption Setting. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_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 - ), - ) - def get( self, *, @@ -119,7 +54,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionGetResponse: + ) -> Optional[OriginPostQuantumEncryptionGetResponse]: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -141,20 +76,18 @@ 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[OriginPostQuantumEncryptionGetResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[OriginPostQuantumEncryptionGetResponse]], + ResultWrapper[OriginPostQuantumEncryptionGetResponse], ), ) @@ -179,62 +112,6 @@ def with_streaming_response(self) -> AsyncOriginPostQuantumEncryptionResourceWit """ return AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse(self) - async def update( - self, - *, - zone_id: str, - value: Literal["preferred", "supported", "off"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionUpdateResponse: - """ - Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when - connecting to your origin. Preferred instructs Cloudflare to opportunistically - send a Post-Quantum keyshare in the first message to the origin (for fastest - connections when the origin supports and prefers PQ), supported means that PQ - algorithms are advertised but only used when requested by the origin, and off - means that PQ algorithms are not advertised - - Args: - zone_id: Identifier - - value: Value of the Origin Post Quantum Encryption Setting. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_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 - ), - ) - async def get( self, *, @@ -245,7 +122,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OriginPostQuantumEncryptionGetResponse: + ) -> Optional[OriginPostQuantumEncryptionGetResponse]: """ Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically @@ -267,20 +144,18 @@ 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[OriginPostQuantumEncryptionGetResponse]]._unwrapper, + ), + cast_to=cast( + Type[Optional[OriginPostQuantumEncryptionGetResponse]], + ResultWrapper[OriginPostQuantumEncryptionGetResponse], ), ) @@ -289,9 +164,6 @@ class OriginPostQuantumEncryptionResourceWithRawResponse: def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption - self.update = to_raw_response_wrapper( - origin_post_quantum_encryption.update, - ) self.get = to_raw_response_wrapper( origin_post_quantum_encryption.get, ) @@ -301,9 +173,6 @@ class AsyncOriginPostQuantumEncryptionResourceWithRawResponse: def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption - self.update = async_to_raw_response_wrapper( - origin_post_quantum_encryption.update, - ) self.get = async_to_raw_response_wrapper( origin_post_quantum_encryption.get, ) @@ -313,9 +182,6 @@ class OriginPostQuantumEncryptionResourceWithStreamingResponse: def __init__(self, origin_post_quantum_encryption: OriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption - self.update = to_streamed_response_wrapper( - origin_post_quantum_encryption.update, - ) self.get = to_streamed_response_wrapper( origin_post_quantum_encryption.get, ) @@ -325,9 +191,6 @@ class AsyncOriginPostQuantumEncryptionResourceWithStreamingResponse: def __init__(self, origin_post_quantum_encryption: AsyncOriginPostQuantumEncryptionResource) -> None: self._origin_post_quantum_encryption = origin_post_quantum_encryption - self.update = async_to_streamed_response_wrapper( - origin_post_quantum_encryption.update, - ) self.get = async_to_streamed_response_wrapper( origin_post_quantum_encryption.get, ) 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/policies/default/certificates.py b/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py index 1996ac06b92..d14e2eaa953 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/default/certificates.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/default/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 edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateEditResponse: + ) -> Optional[CertificateEditResponse]: """ 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 edit( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateEditResponse, + Optional[CertificateEditResponse], self._patch( f"/zones/{zone_id}/devices/policy/certificates", body=maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams), @@ -89,7 +89,7 @@ def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateEditResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateEditResponse] @@ -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_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateGetResponse, + Optional[CertificateGetResponse], self._get( f"/zones/{zone_id}/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 edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CertificateEditResponse: + ) -> Optional[CertificateEditResponse]: """ 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 edit( if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") return cast( - CertificateEditResponse, + Optional[CertificateEditResponse], await self._patch( f"/zones/{zone_id}/devices/policy/certificates", body=await async_maybe_transform({"enabled": enabled}, certificate_edit_params.CertificateEditParams), @@ -201,7 +201,7 @@ async def edit( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[CertificateEditResponse]._unwrapper, + post_parser=ResultWrapper[Optional[CertificateEditResponse]]._unwrapper, ), cast_to=cast( Any, ResultWrapper[CertificateEditResponse] @@ -219,7 +219,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 @@ -235,7 +235,7 @@ 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( - CertificateGetResponse, + Optional[CertificateGetResponse], await self._get( f"/zones/{zone_id}/devices/policy/certificates", options=make_request_options( @@ -243,7 +243,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/argo/tiered_caching_edit_response.py b/src/cloudflare/types/argo/tiered_caching_edit_response.py index 0e99559b8f5..dfabfbc67c2 100644 --- a/src/cloudflare/types/argo/tiered_caching_edit_response.py +++ b/src/cloudflare/types/argo/tiered_caching_edit_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class TieredCachingEditResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_caching"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/argo/tiered_caching_get_response.py b/src/cloudflare/types/argo/tiered_caching_get_response.py index 72f04aac880..8747f72e833 100644 --- a/src/cloudflare/types/argo/tiered_caching_get_response.py +++ b/src/cloudflare/types/argo/tiered_caching_get_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class TieredCachingGetResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_caching"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/__init__.py b/src/cloudflare/types/cache/__init__.py index dca49dade79..10937a5c1b3 100644 --- a/src/cloudflare/types/cache/__init__.py +++ b/src/cloudflare/types/cache/__init__.py @@ -4,7 +4,6 @@ from .state import State as State from .cache_reserve import CacheReserve as CacheReserve -from .cache_variant import CacheVariant as CacheVariant from .cache_purge_params import CachePurgeParams as CachePurgeParams from .cache_reserve_clear import CacheReserveClear as CacheReserveClear from .variant_edit_params import VariantEditParams as VariantEditParams @@ -12,6 +11,7 @@ from .variant_get_response import VariantGetResponse as VariantGetResponse from .regional_tiered_cache import RegionalTieredCache as RegionalTieredCache from .variant_edit_response import VariantEditResponse as VariantEditResponse +from .variant_delete_response import VariantDeleteResponse as VariantDeleteResponse from .cache_reserve_edit_params import CacheReserveEditParams as CacheReserveEditParams from .cache_reserve_clear_params import CacheReserveClearParams as CacheReserveClearParams from .cache_reserve_get_response import CacheReserveGetResponse as CacheReserveGetResponse diff --git a/src/cloudflare/types/cache/cache_reserve_clear_response.py b/src/cloudflare/types/cache/cache_reserve_clear_response.py index 6ef83d88029..48410c41b3c 100644 --- a/src/cloudflare/types/cache/cache_reserve_clear_response.py +++ b/src/cloudflare/types/cache/cache_reserve_clear_response.py @@ -14,9 +14,6 @@ class CacheReserveClearResponse(BaseModel): id: CacheReserveClear """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - start_ts: datetime """The time that the latest Cache Reserve Clear operation started.""" @@ -25,3 +22,6 @@ class CacheReserveClearResponse(BaseModel): end_ts: Optional[datetime] = None """The time that the latest Cache Reserve Clear operation completed.""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_reserve_edit_response.py b/src/cloudflare/types/cache/cache_reserve_edit_response.py index cf94dab2551..1ecbfb5cc66 100644 --- a/src/cloudflare/types/cache/cache_reserve_edit_response.py +++ b/src/cloudflare/types/cache/cache_reserve_edit_response.py @@ -14,8 +14,11 @@ class CacheReserveEditResponse(BaseModel): id: CacheReserve """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" value: Literal["on", "off"] - """Value of the Cache Reserve zone setting.""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_reserve_get_response.py b/src/cloudflare/types/cache/cache_reserve_get_response.py index 78ddefe3883..bfca4dcc125 100644 --- a/src/cloudflare/types/cache/cache_reserve_get_response.py +++ b/src/cloudflare/types/cache/cache_reserve_get_response.py @@ -14,8 +14,11 @@ class CacheReserveGetResponse(BaseModel): id: CacheReserve """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" value: Literal["on", "off"] - """Value of the Cache Reserve zone setting.""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_reserve_status_response.py b/src/cloudflare/types/cache/cache_reserve_status_response.py index abc1c4cba82..277b898dd11 100644 --- a/src/cloudflare/types/cache/cache_reserve_status_response.py +++ b/src/cloudflare/types/cache/cache_reserve_status_response.py @@ -14,9 +14,6 @@ class CacheReserveStatusResponse(BaseModel): id: CacheReserveClear """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - start_ts: datetime """The time that the latest Cache Reserve Clear operation started.""" @@ -25,3 +22,6 @@ class CacheReserveStatusResponse(BaseModel): end_ts: Optional[datetime] = None """The time that the latest Cache Reserve Clear operation completed.""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py b/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py index 8350d75dc86..089ee489e99 100644 --- a/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py +++ b/src/cloudflare/types/cache/regional_tiered_cache_edit_response.py @@ -2,31 +2,23 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .regional_tiered_cache import RegionalTieredCache -__all__ = ["RegionalTieredCacheEditResponse", "Value"] +__all__ = ["RegionalTieredCacheEditResponse"] -class Value(BaseModel): +class RegionalTieredCacheEditResponse(BaseModel): id: RegionalTieredCache """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - + editable: bool + """Whether the setting is editable""" -class RegionalTieredCacheEditResponse(BaseModel): - id: RegionalTieredCache - """ID of the zone setting.""" + value: Literal["on", "off"] + """The value of the feature""" modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - value: Value - """ - 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 - topologies. - """ + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/regional_tiered_cache_get_response.py b/src/cloudflare/types/cache/regional_tiered_cache_get_response.py index ac3f6c4e6e3..2730910de20 100644 --- a/src/cloudflare/types/cache/regional_tiered_cache_get_response.py +++ b/src/cloudflare/types/cache/regional_tiered_cache_get_response.py @@ -2,31 +2,23 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .regional_tiered_cache import RegionalTieredCache -__all__ = ["RegionalTieredCacheGetResponse", "Value"] +__all__ = ["RegionalTieredCacheGetResponse"] -class Value(BaseModel): +class RegionalTieredCacheGetResponse(BaseModel): id: RegionalTieredCache """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - + editable: bool + """Whether the setting is editable""" -class RegionalTieredCacheGetResponse(BaseModel): - id: RegionalTieredCache - """ID of the zone setting.""" + value: Literal["on", "off"] + """The value of the feature""" modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - value: Value - """ - 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 - topologies. - """ + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py b/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py index 3ccc2711f88..7bc174f36ae 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,11 @@ class SmartTieredCacheDeleteResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_cache_smart_topology_enable"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - - value: Literal["on", "off"] - """The status of the feature being on / off""" + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py b/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py index 8e871b0599c..75ab468d3bb 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class SmartTieredCacheEditResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_cache_smart_topology_enable"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_get_response.py b/src/cloudflare/types/cache/smart_tiered_cache_get_response.py index 787aa0d5d59..b8066e94776 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_get_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_get_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,14 +10,14 @@ class SmartTieredCacheGetResponse(BaseModel): - id: str - """The identifier of the caching setting""" + id: Literal["tiered_cache_smart_topology_enable"] + """ID of the zone setting.""" editable: bool """Whether the setting is editable""" - modified_on: datetime - """The time when the setting was last modified""" - value: Literal["on", "off"] - """The status of the feature being on / off""" + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/cache_variant.py b/src/cloudflare/types/cache/variant_delete_response.py similarity index 63% rename from src/cloudflare/types/cache/cache_variant.py rename to src/cloudflare/types/cache/variant_delete_response.py index e83ec666d1c..6d697bb1232 100644 --- a/src/cloudflare/types/cache/cache_variant.py +++ b/src/cloudflare/types/cache/variant_delete_response.py @@ -6,12 +6,15 @@ from ..._models import BaseModel -__all__ = ["CacheVariant"] +__all__ = ["VariantDeleteResponse"] -class CacheVariant(BaseModel): +class VariantDeleteResponse(BaseModel): id: Literal["variants"] """ID of the zone setting.""" + editable: bool + """Whether the setting is editable""" + modified_on: Optional[datetime] = None - """last time this setting was modified.""" + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/variant_edit_response.py b/src/cloudflare/types/cache/variant_edit_response.py index bdd337a206e..0cd828d795a 100644 --- a/src/cloudflare/types/cache/variant_edit_response.py +++ b/src/cloudflare/types/cache/variant_edit_response.py @@ -1,88 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["VariantEditResponse", "Value"] - - -class Value(BaseModel): - avif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for avif. - """ - - bmp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for bmp. - """ - - gif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for gif. - """ - - jp2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jp2. - """ - - jpeg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpeg. - """ - - jpg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg. - """ - - jpg2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg2. - """ - - png: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for png. - """ - - tif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tif. - """ - - tiff: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tiff. - """ - - webp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for webp. - """ +__all__ = ["VariantEditResponse"] class VariantEditResponse(BaseModel): id: Literal["variants"] """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" + + value: str + """The value of the feature""" - value: Value - """Value of the zone setting.""" + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/cache/variant_get_response.py b/src/cloudflare/types/cache/variant_get_response.py index 777c7d0da5c..1b440b5b812 100644 --- a/src/cloudflare/types/cache/variant_get_response.py +++ b/src/cloudflare/types/cache/variant_get_response.py @@ -1,88 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["VariantGetResponse", "Value"] - - -class Value(BaseModel): - avif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for avif. - """ - - bmp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for bmp. - """ - - gif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for gif. - """ - - jp2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jp2. - """ - - jpeg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpeg. - """ - - jpg: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg. - """ - - jpg2: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for jpg2. - """ - - png: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for png. - """ - - tif: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tif. - """ - - tiff: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for tiff. - """ - - webp: Optional[List[str]] = None - """ - List of strings with the MIME types of all the variants that should be served - for webp. - """ +__all__ = ["VariantGetResponse"] class VariantGetResponse(BaseModel): id: Literal["variants"] """ID of the zone setting.""" - modified_on: Optional[datetime] = None - """last time this setting was modified.""" + editable: bool + """Whether the setting is editable""" + + value: str + """The value of the feature""" - value: Value - """Value of the zone setting.""" + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" 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/origin_post_quantum_encryption/__init__.py b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py index 31525d2b891..273631df76f 100644 --- a/src/cloudflare/types/origin_post_quantum_encryption/__init__.py +++ b/src/cloudflare/types/origin_post_quantum_encryption/__init__.py @@ -5,9 +5,3 @@ 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 index 6f1aa4dca49..160be05baa8 100644 --- 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 @@ -1,8 +1,23 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["OriginPostQuantumEncryptionGetResponse"] -OriginPostQuantumEncryptionGetResponse: TypeAlias = Union[Optional[str], Optional[object]] + +class OriginPostQuantumEncryptionGetResponse(BaseModel): + id: Literal["origin_pqe"] + """Value of the zone setting.""" + + editable: bool + """Whether the setting is editable""" + + value: Literal["preferred", "supported", "off"] + """The value of the feature""" + + modified_on: Optional[datetime] = None + """Last time this setting was modified.""" diff --git a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_params.py b/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_params.py deleted file mode 100644 index b059d4aee6a..00000000000 --- a/src/cloudflare/types/origin_post_quantum_encryption/origin_post_quantum_encryption_update_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["OriginPostQuantumEncryptionUpdateParams"] - - -class OriginPostQuantumEncryptionUpdateParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["preferred", "supported", "off"]] - """Value of the Origin Post Quantum Encryption Setting.""" 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/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/devices/policies/default/certificate_edit_response.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py index 0cd113c6420..b74cd9b2576 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_edit_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_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__ = ["CertificateEditResponse"] -CertificateEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +CertificateEditResponse: TypeAlias = Union[str, object, None] diff --git a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py b/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py index 055be51f531..47253a71db8 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/default/certificate_get_response.py +++ b/src/cloudflare/types/zero_trust/devices/policies/default/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/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/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 1d1478215cf..1d125319b6f 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..e848dd3cd8c 100644 --- a/tests/api_resources/cache/test_variants.py +++ b/tests/api_resources/cache/test_variants.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.cache import CacheVariant, VariantGetResponse, VariantEditResponse +from cloudflare.types.cache import VariantGetResponse, VariantEditResponse, VariantDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -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[VariantDeleteResponse], 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[VariantDeleteResponse], 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[VariantDeleteResponse], 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[VariantDeleteResponse], 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[VariantDeleteResponse], 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[VariantDeleteResponse], 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/test_origin_post_quantum_encryption.py b/tests/api_resources/test_origin_post_quantum_encryption.py index 7b671649427..68dff01d3e0 100644 --- a/tests/api_resources/test_origin_post_quantum_encryption.py +++ b/tests/api_resources/test_origin_post_quantum_encryption.py @@ -3,16 +3,13 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.origin_post_quantum_encryption import ( - OriginPostQuantumEncryptionGetResponse, - OriginPostQuantumEncryptionUpdateResponse, -) +from cloudflare.types.origin_post_quantum_encryption import OriginPostQuantumEncryptionGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,65 +17,15 @@ class TestOriginPostQuantumEncryption: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - origin_post_quantum_encryption = client.origin_post_quantum_encryption.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="preferred", - ) - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.origin_post_quantum_encryption.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="preferred", - ) - - 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"] - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.origin_post_quantum_encryption.with_streaming_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="preferred", - ) as response: - assert not response.is_closed - 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 cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.origin_post_quantum_encryption.with_raw_response.update( - zone_id="", - value="preferred", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize 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( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -90,7 +37,9 @@ 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( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -103,7 +52,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: origin_post_quantum_encryption = response.parse() assert_matches_type( - OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] ) assert cast(Any, response.is_closed) is True @@ -120,65 +69,15 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncOriginPostQuantumEncryption: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - origin_post_quantum_encryption = await async_client.origin_post_quantum_encryption.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="preferred", - ) - assert_matches_type( - OriginPostQuantumEncryptionUpdateResponse, origin_post_quantum_encryption, path=["response"] - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.origin_post_quantum_encryption.with_raw_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="preferred", - ) - - 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"] - ) - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.origin_post_quantum_encryption.with_streaming_response.update( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="preferred", - ) as response: - assert not response.is_closed - 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 cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="TODO: investigate broken test") - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.origin_post_quantum_encryption.with_raw_response.update( - zone_id="", - value="preferred", - ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize 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( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -190,7 +89,9 @@ 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( + Optional[OriginPostQuantumEncryptionGetResponse], origin_post_quantum_encryption, path=["response"] + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -203,7 +104,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No origin_post_quantum_encryption = await response.parse() assert_matches_type( - OriginPostQuantumEncryptionGetResponse, origin_post_quantum_encryption, path=["response"] + Optional[OriginPostQuantumEncryptionGetResponse], 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/default/test_certificates.py b/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py index f616978a857..b94cf6d8191 100644 --- a/tests/api_resources/zero_trust/devices/policies/default/test_certificates.py +++ b/tests/api_resources/zero_trust/devices/policies/default/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_edit(self, client: Cloudflare) -> None: zone_id="699d98642c564d2e855e9661899b7252", enabled=True, ) - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, 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" certificate = response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, 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" certificate = response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], 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.default.certificates.get( zone_id="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_edit(self, async_client: AsyncCloudflare) -> None: zone_id="699d98642c564d2e855e9661899b7252", enabled=True, ) - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, 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" certificate = await response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], certificate, 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" certificate = await response.parse() - assert_matches_type(CertificateEditResponse, certificate, path=["response"]) + assert_matches_type(Optional[CertificateEditResponse], 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.default.certificates.get( zone_id="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 abfc42857d4..d093db0d2e7 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 @@ -23,7 +23,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["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: @@ -35,7 +35,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: @@ -47,7 +47,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 @@ -69,7 +69,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["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: @@ -81,7 +81,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: @@ -93,7 +93,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 1c0bc2acdf5..9196cb931f8 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 @@ -23,7 +23,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["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: @@ -35,7 +35,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: @@ -47,7 +47,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 @@ -69,7 +69,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="699d98642c564d2e855e9661899b7252", body=["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: @@ -81,7 +81,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: @@ -93,7 +93,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