diff --git a/.stats.yml b/.stats.yml index 72dd24c9531..ed30724f8aa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1353 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cd837fea75977564d3cf39f8e1799785f77785a6fcc538d9c2471156a6d309b1.yml +configured_endpoints: 1256 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-dbe283789a3023e23b1cae66d3cd8f4bdde2422ce3e8d3f88c42bf8a0791e622.yml diff --git a/api.md b/api.md index 3f970882269..4a571e0960a 100644 --- a/api.md +++ b/api.md @@ -315,11 +315,6 @@ Types: from cloudflare.types.zones.settings import ZeroRTT ``` -Methods: - -- client.zones.settings.zero_rtt.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.zero_rtt.get(\*, zone_id) -> Optional - ### AdvancedDDoS Types: @@ -328,10 +323,6 @@ Types: from cloudflare.types.zones.settings import AdvancedDDoS ``` -Methods: - -- client.zones.settings.advanced_ddos.get(\*, zone_id) -> Optional - ### AlwaysOnline Types: @@ -340,11 +331,6 @@ Types: from cloudflare.types.zones.settings import AlwaysOnline ``` -Methods: - -- client.zones.settings.always_online.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.always_online.get(\*, zone_id) -> Optional - ### AlwaysUseHTTPS Types: @@ -353,11 +339,6 @@ Types: from cloudflare.types.zones.settings import AlwaysUseHTTPS ``` -Methods: - -- client.zones.settings.always_use_https.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.always_use_https.get(\*, zone_id) -> Optional - ### AutomaticHTTPSRewrites Types: @@ -366,11 +347,6 @@ Types: from cloudflare.types.zones.settings import AutomaticHTTPSRewrites ``` -Methods: - -- client.zones.settings.automatic_https_rewrites.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.automatic_https_rewrites.get(\*, zone_id) -> Optional - ### AutomaticPlatformOptimization Types: @@ -379,11 +355,6 @@ Types: from cloudflare.types.zones.settings import AutomaticPlatformOptimization ``` -Methods: - -- client.zones.settings.automatic_platform_optimization.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.automatic_platform_optimization.get(\*, zone_id) -> Optional - ### Brotli Types: @@ -392,11 +363,6 @@ Types: from cloudflare.types.zones.settings import Brotli ``` -Methods: - -- client.zones.settings.brotli.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.brotli.get(\*, zone_id) -> Optional - ### BrowserCacheTTL Types: @@ -405,11 +371,6 @@ Types: from cloudflare.types.zones.settings import BrowserCacheTTL ``` -Methods: - -- client.zones.settings.browser_cache_ttl.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.browser_cache_ttl.get(\*, zone_id) -> Optional - ### BrowserCheck Types: @@ -418,11 +379,6 @@ Types: from cloudflare.types.zones.settings import BrowserCheck ``` -Methods: - -- client.zones.settings.browser_check.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.browser_check.get(\*, zone_id) -> Optional - ### CacheLevel Types: @@ -431,11 +387,6 @@ Types: from cloudflare.types.zones.settings import CacheLevel ``` -Methods: - -- client.zones.settings.cache_level.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.cache_level.get(\*, zone_id) -> Optional - ### ChallengeTTL Types: @@ -444,11 +395,6 @@ Types: from cloudflare.types.zones.settings import ChallengeTTL ``` -Methods: - -- client.zones.settings.challenge_ttl.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.challenge_ttl.get(\*, zone_id) -> Optional - ### Ciphers Types: @@ -457,11 +403,6 @@ Types: from cloudflare.types.zones.settings import Ciphers ``` -Methods: - -- client.zones.settings.ciphers.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ciphers.get(\*, zone_id) -> Optional - ### DevelopmentMode Types: @@ -470,11 +411,6 @@ Types: from cloudflare.types.zones.settings import DevelopmentMode ``` -Methods: - -- client.zones.settings.development_mode.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.development_mode.get(\*, zone_id) -> Optional - ### EarlyHints Types: @@ -483,11 +419,6 @@ Types: from cloudflare.types.zones.settings import EarlyHints ``` -Methods: - -- client.zones.settings.early_hints.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.early_hints.get(\*, zone_id) -> Optional - ### EmailObfuscation Types: @@ -496,11 +427,6 @@ Types: from cloudflare.types.zones.settings import EmailObfuscation ``` -Methods: - -- client.zones.settings.email_obfuscation.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.email_obfuscation.get(\*, zone_id) -> Optional - ### H2Prioritization Types: @@ -509,11 +435,6 @@ Types: from cloudflare.types.zones.settings import H2Prioritization ``` -Methods: - -- client.zones.settings.h2_prioritization.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.h2_prioritization.get(\*, zone_id) -> Optional - ### HotlinkProtection Types: @@ -522,11 +443,6 @@ Types: from cloudflare.types.zones.settings import HotlinkProtection ``` -Methods: - -- client.zones.settings.hotlink_protection.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.hotlink_protection.get(\*, zone_id) -> Optional - ### HTTP2 Types: @@ -535,11 +451,6 @@ Types: from cloudflare.types.zones.settings import HTTP2 ``` -Methods: - -- client.zones.settings.http2.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.http2.get(\*, zone_id) -> Optional - ### HTTP3 Types: @@ -548,11 +459,6 @@ Types: from cloudflare.types.zones.settings import HTTP3 ``` -Methods: - -- client.zones.settings.http3.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.http3.get(\*, zone_id) -> Optional - ### ImageResizing Types: @@ -561,11 +467,6 @@ Types: from cloudflare.types.zones.settings import ImageResizing ``` -Methods: - -- client.zones.settings.image_resizing.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.image_resizing.get(\*, zone_id) -> Optional - ### IPGeolocation Types: @@ -574,11 +475,6 @@ Types: from cloudflare.types.zones.settings import IPGeolocation ``` -Methods: - -- client.zones.settings.ip_geolocation.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ip_geolocation.get(\*, zone_id) -> Optional - ### IPV6 Types: @@ -587,11 +483,6 @@ Types: from cloudflare.types.zones.settings import IPV6 ``` -Methods: - -- client.zones.settings.ipv6.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ipv6.get(\*, zone_id) -> Optional - ### MinTLSVersion Types: @@ -600,11 +491,6 @@ Types: from cloudflare.types.zones.settings import MinTLSVersion ``` -Methods: - -- client.zones.settings.min_tls_version.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.min_tls_version.get(\*, zone_id) -> Optional - ### Minify Types: @@ -613,11 +499,6 @@ Types: from cloudflare.types.zones.settings import Minify ``` -Methods: - -- client.zones.settings.minify.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.minify.get(\*, zone_id) -> Optional - ### Mirage Types: @@ -626,11 +507,6 @@ Types: from cloudflare.types.zones.settings import Mirage ``` -Methods: - -- client.zones.settings.mirage.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.mirage.get(\*, zone_id) -> Optional - ### MobileRedirect Types: @@ -639,11 +515,6 @@ Types: from cloudflare.types.zones.settings import MobileRedirect ``` -Methods: - -- client.zones.settings.mobile_redirect.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.mobile_redirect.get(\*, zone_id) -> Optional - ### NEL Types: @@ -652,11 +523,6 @@ Types: from cloudflare.types.zones.settings import NEL ``` -Methods: - -- client.zones.settings.nel.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.nel.get(\*, zone_id) -> Optional - ### OpportunisticEncryption Types: @@ -665,11 +531,6 @@ Types: from cloudflare.types.zones.settings import OpportunisticEncryption ``` -Methods: - -- client.zones.settings.opportunistic_encryption.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.opportunistic_encryption.get(\*, zone_id) -> Optional - ### OpportunisticOnion Types: @@ -678,11 +539,6 @@ Types: from cloudflare.types.zones.settings import OpportunisticOnion ``` -Methods: - -- client.zones.settings.opportunistic_onion.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.opportunistic_onion.get(\*, zone_id) -> Optional - ### OrangeToOrange Types: @@ -691,11 +547,6 @@ Types: from cloudflare.types.zones.settings import OrangeToOrange ``` -Methods: - -- client.zones.settings.orange_to_orange.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.orange_to_orange.get(\*, zone_id) -> Optional - ### OriginErrorPagePassThru Types: @@ -704,11 +555,6 @@ Types: from cloudflare.types.zones.settings import OriginErrorPagePassThru ``` -Methods: - -- client.zones.settings.origin_error_page_pass_thru.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.origin_error_page_pass_thru.get(\*, zone_id) -> Optional - ### OriginMaxHTTPVersion Types: @@ -734,11 +580,6 @@ Types: from cloudflare.types.zones.settings import Polish ``` -Methods: - -- client.zones.settings.polish.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.polish.get(\*, zone_id) -> Optional - ### PrefetchPreload Types: @@ -747,11 +588,6 @@ Types: from cloudflare.types.zones.settings import PrefetchPreload ``` -Methods: - -- client.zones.settings.prefetch_preload.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.prefetch_preload.get(\*, zone_id) -> Optional - ### ProxyReadTimeout Types: @@ -760,11 +596,6 @@ Types: from cloudflare.types.zones.settings import ProxyReadTimeout ``` -Methods: - -- client.zones.settings.proxy_read_timeout.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.proxy_read_timeout.get(\*, zone_id) -> Optional - ### PseudoIPV4 Types: @@ -773,11 +604,6 @@ Types: from cloudflare.types.zones.settings import PseudoIPV4 ``` -Methods: - -- client.zones.settings.pseudo_ipv4.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.pseudo_ipv4.get(\*, zone_id) -> Optional - ### ResponseBuffering Types: @@ -786,11 +612,6 @@ Types: from cloudflare.types.zones.settings import ResponseBuffering ``` -Methods: - -- client.zones.settings.response_buffering.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.response_buffering.get(\*, zone_id) -> Optional - ### RocketLoader Types: @@ -799,11 +620,6 @@ Types: from cloudflare.types.zones.settings import RocketLoader ``` -Methods: - -- client.zones.settings.rocket_loader.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.rocket_loader.get(\*, zone_id) -> Optional - ### SecurityHeaders Types: @@ -812,11 +628,6 @@ Types: from cloudflare.types.zones.settings import SecurityHeaders ``` -Methods: - -- client.zones.settings.security_headers.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.security_headers.get(\*, zone_id) -> Optional - ### SecurityLevel Types: @@ -825,11 +636,6 @@ Types: from cloudflare.types.zones.settings import SecurityLevel ``` -Methods: - -- client.zones.settings.security_level.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.security_level.get(\*, zone_id) -> Optional - ### ServerSideExcludes Types: @@ -838,11 +644,6 @@ Types: from cloudflare.types.zones.settings import ServerSideExcludes ``` -Methods: - -- client.zones.settings.server_side_excludes.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.server_side_excludes.get(\*, zone_id) -> Optional - ### SortQueryStringForCache Types: @@ -851,11 +652,6 @@ Types: from cloudflare.types.zones.settings import SortQueryStringForCache ``` -Methods: - -- client.zones.settings.sort_query_string_for_cache.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.sort_query_string_for_cache.get(\*, zone_id) -> Optional - ### SSL Types: @@ -864,11 +660,6 @@ Types: from cloudflare.types.zones.settings import SSL ``` -Methods: - -- client.zones.settings.ssl.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ssl.get(\*, zone_id) -> Optional - ### SSLRecommender Types: @@ -877,11 +668,6 @@ Types: from cloudflare.types.zones.settings import SSLRecommender ``` -Methods: - -- client.zones.settings.ssl_recommender.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.ssl_recommender.get(\*, zone_id) -> Optional - ### TLS1_3 Types: @@ -890,11 +676,6 @@ Types: from cloudflare.types.zones.settings import TLS1_3 ``` -Methods: - -- client.zones.settings.tls_1_3.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.tls_1_3.get(\*, zone_id) -> Optional - ### TLSClientAuth Types: @@ -903,11 +684,6 @@ Types: from cloudflare.types.zones.settings import TLSClientAuth ``` -Methods: - -- client.zones.settings.tls_client_auth.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.tls_client_auth.get(\*, zone_id) -> Optional - ### TrueClientIPHeader Types: @@ -916,11 +692,6 @@ Types: from cloudflare.types.zones.settings import TrueClientIPHeader ``` -Methods: - -- client.zones.settings.true_client_ip_header.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.true_client_ip_header.get(\*, zone_id) -> Optional - ### WAF Types: @@ -929,11 +700,6 @@ Types: from cloudflare.types.zones.settings import WAF ``` -Methods: - -- client.zones.settings.waf.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.waf.get(\*, zone_id) -> Optional - ### WebP Types: @@ -942,11 +708,6 @@ Types: from cloudflare.types.zones.settings import WebP ``` -Methods: - -- client.zones.settings.webp.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.webp.get(\*, zone_id) -> Optional - ### Websocket Types: @@ -955,11 +716,6 @@ Types: from cloudflare.types.zones.settings import Websocket ``` -Methods: - -- client.zones.settings.websocket.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.websocket.get(\*, zone_id) -> Optional - ### FontSettings Types: diff --git a/src/cloudflare/resources/zones/settings/__init__.py b/src/cloudflare/resources/zones/settings/__init__.py index 1ac5af2ef0a..ae9eeaf9d4a 100644 --- a/src/cloudflare/resources/zones/settings/__init__.py +++ b/src/cloudflare/resources/zones/settings/__init__.py @@ -1,109 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .nel import ( - NELResource, - AsyncNELResource, - NELResourceWithRawResponse, - AsyncNELResourceWithRawResponse, - NELResourceWithStreamingResponse, - AsyncNELResourceWithStreamingResponse, -) -from .ssl import ( - SSLResource, - AsyncSSLResource, - SSLResourceWithRawResponse, - AsyncSSLResourceWithRawResponse, - SSLResourceWithStreamingResponse, - AsyncSSLResourceWithStreamingResponse, -) -from .waf import ( - WAFResource, - AsyncWAFResource, - WAFResourceWithRawResponse, - AsyncWAFResourceWithRawResponse, - WAFResourceWithStreamingResponse, - AsyncWAFResourceWithStreamingResponse, -) -from .ipv6 import ( - IPV6Resource, - AsyncIPV6Resource, - IPV6ResourceWithRawResponse, - AsyncIPV6ResourceWithRawResponse, - IPV6ResourceWithStreamingResponse, - AsyncIPV6ResourceWithStreamingResponse, -) -from .webp import ( - WebPResource, - AsyncWebPResource, - WebPResourceWithRawResponse, - AsyncWebPResourceWithRawResponse, - WebPResourceWithStreamingResponse, - AsyncWebPResourceWithStreamingResponse, -) -from .http2 import ( - HTTP2Resource, - AsyncHTTP2Resource, - HTTP2ResourceWithRawResponse, - AsyncHTTP2ResourceWithRawResponse, - HTTP2ResourceWithStreamingResponse, - AsyncHTTP2ResourceWithStreamingResponse, -) -from .http3 import ( - HTTP3Resource, - AsyncHTTP3Resource, - HTTP3ResourceWithRawResponse, - AsyncHTTP3ResourceWithRawResponse, - HTTP3ResourceWithStreamingResponse, - AsyncHTTP3ResourceWithStreamingResponse, -) -from .brotli import ( - BrotliResource, - AsyncBrotliResource, - BrotliResourceWithRawResponse, - AsyncBrotliResourceWithRawResponse, - BrotliResourceWithStreamingResponse, - AsyncBrotliResourceWithStreamingResponse, -) -from .minify import ( - MinifyResource, - AsyncMinifyResource, - MinifyResourceWithRawResponse, - AsyncMinifyResourceWithRawResponse, - MinifyResourceWithStreamingResponse, - AsyncMinifyResourceWithStreamingResponse, -) -from .mirage import ( - MirageResource, - AsyncMirageResource, - MirageResourceWithRawResponse, - AsyncMirageResourceWithRawResponse, - MirageResourceWithStreamingResponse, - AsyncMirageResourceWithStreamingResponse, -) -from .polish import ( - PolishResource, - AsyncPolishResource, - PolishResourceWithRawResponse, - AsyncPolishResourceWithRawResponse, - PolishResourceWithStreamingResponse, - AsyncPolishResourceWithStreamingResponse, -) -from .ciphers import ( - CiphersResource, - AsyncCiphersResource, - CiphersResourceWithRawResponse, - AsyncCiphersResourceWithRawResponse, - CiphersResourceWithStreamingResponse, - AsyncCiphersResourceWithStreamingResponse, -) -from .tls_1_3 import ( - TLS1_3Resource, - AsyncTLS1_3Resource, - TLS1_3ResourceWithRawResponse, - AsyncTLS1_3ResourceWithRawResponse, - TLS1_3ResourceWithStreamingResponse, - AsyncTLS1_3ResourceWithStreamingResponse, -) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -112,78 +8,6 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from .zero_rtt import ( - ZeroRTTResource, - AsyncZeroRTTResource, - ZeroRTTResourceWithRawResponse, - AsyncZeroRTTResourceWithRawResponse, - ZeroRTTResourceWithStreamingResponse, - AsyncZeroRTTResourceWithStreamingResponse, -) -from .websocket import ( - WebsocketResource, - AsyncWebsocketResource, - WebsocketResourceWithRawResponse, - AsyncWebsocketResourceWithRawResponse, - WebsocketResourceWithStreamingResponse, - AsyncWebsocketResourceWithStreamingResponse, -) -from .cache_level import ( - CacheLevelResource, - AsyncCacheLevelResource, - CacheLevelResourceWithRawResponse, - AsyncCacheLevelResourceWithRawResponse, - CacheLevelResourceWithStreamingResponse, - AsyncCacheLevelResourceWithStreamingResponse, -) -from .early_hints import ( - EarlyHintsResource, - AsyncEarlyHintsResource, - EarlyHintsResourceWithRawResponse, - AsyncEarlyHintsResourceWithRawResponse, - EarlyHintsResourceWithStreamingResponse, - AsyncEarlyHintsResourceWithStreamingResponse, -) -from .pseudo_ipv4 import ( - PseudoIPV4Resource, - AsyncPseudoIPV4Resource, - PseudoIPV4ResourceWithRawResponse, - AsyncPseudoIPV4ResourceWithRawResponse, - PseudoIPV4ResourceWithStreamingResponse, - AsyncPseudoIPV4ResourceWithStreamingResponse, -) -from .advanced_ddos import ( - AdvancedDDoSResource, - AsyncAdvancedDDoSResource, - AdvancedDDoSResourceWithRawResponse, - AsyncAdvancedDDoSResourceWithRawResponse, - AdvancedDDoSResourceWithStreamingResponse, - AsyncAdvancedDDoSResourceWithStreamingResponse, -) -from .always_online import ( - AlwaysOnlineResource, - AsyncAlwaysOnlineResource, - AlwaysOnlineResourceWithRawResponse, - AsyncAlwaysOnlineResourceWithRawResponse, - AlwaysOnlineResourceWithStreamingResponse, - AsyncAlwaysOnlineResourceWithStreamingResponse, -) -from .browser_check import ( - BrowserCheckResource, - AsyncBrowserCheckResource, - BrowserCheckResourceWithRawResponse, - AsyncBrowserCheckResourceWithRawResponse, - BrowserCheckResourceWithStreamingResponse, - AsyncBrowserCheckResourceWithStreamingResponse, -) -from .challenge_ttl import ( - ChallengeTTLResource, - AsyncChallengeTTLResource, - ChallengeTTLResourceWithRawResponse, - AsyncChallengeTTLResourceWithRawResponse, - ChallengeTTLResourceWithStreamingResponse, - AsyncChallengeTTLResourceWithStreamingResponse, -) from .font_settings import ( FontSettingsResource, AsyncFontSettingsResource, @@ -192,182 +16,6 @@ FontSettingsResourceWithStreamingResponse, AsyncFontSettingsResourceWithStreamingResponse, ) -from .rocket_loader import ( - RocketLoaderResource, - AsyncRocketLoaderResource, - RocketLoaderResourceWithRawResponse, - AsyncRocketLoaderResourceWithRawResponse, - RocketLoaderResourceWithStreamingResponse, - AsyncRocketLoaderResourceWithStreamingResponse, -) -from .image_resizing import ( - ImageResizingResource, - AsyncImageResizingResource, - ImageResizingResourceWithRawResponse, - AsyncImageResizingResourceWithRawResponse, - ImageResizingResourceWithStreamingResponse, - AsyncImageResizingResourceWithStreamingResponse, -) -from .ip_geolocation import ( - IPGeolocationResource, - AsyncIPGeolocationResource, - IPGeolocationResourceWithRawResponse, - AsyncIPGeolocationResourceWithRawResponse, - IPGeolocationResourceWithStreamingResponse, - AsyncIPGeolocationResourceWithStreamingResponse, -) -from .security_level import ( - SecurityLevelResource, - AsyncSecurityLevelResource, - SecurityLevelResourceWithRawResponse, - AsyncSecurityLevelResourceWithRawResponse, - SecurityLevelResourceWithStreamingResponse, - AsyncSecurityLevelResourceWithStreamingResponse, -) -from .min_tls_version import ( - MinTLSVersionResource, - AsyncMinTLSVersionResource, - MinTLSVersionResourceWithRawResponse, - AsyncMinTLSVersionResourceWithRawResponse, - MinTLSVersionResourceWithStreamingResponse, - AsyncMinTLSVersionResourceWithStreamingResponse, -) -from .mobile_redirect import ( - MobileRedirectResource, - AsyncMobileRedirectResource, - MobileRedirectResourceWithRawResponse, - AsyncMobileRedirectResourceWithRawResponse, - MobileRedirectResourceWithStreamingResponse, - AsyncMobileRedirectResourceWithStreamingResponse, -) -from .ssl_recommender import ( - SSLRecommenderResource, - AsyncSSLRecommenderResource, - SSLRecommenderResourceWithRawResponse, - AsyncSSLRecommenderResourceWithRawResponse, - SSLRecommenderResourceWithStreamingResponse, - AsyncSSLRecommenderResourceWithStreamingResponse, -) -from .tls_client_auth import ( - TLSClientAuthResource, - AsyncTLSClientAuthResource, - TLSClientAuthResourceWithRawResponse, - AsyncTLSClientAuthResourceWithRawResponse, - TLSClientAuthResourceWithStreamingResponse, - AsyncTLSClientAuthResourceWithStreamingResponse, -) -from .always_use_https import ( - AlwaysUseHTTPSResource, - AsyncAlwaysUseHTTPSResource, - AlwaysUseHTTPSResourceWithRawResponse, - AsyncAlwaysUseHTTPSResourceWithRawResponse, - AlwaysUseHTTPSResourceWithStreamingResponse, - AsyncAlwaysUseHTTPSResourceWithStreamingResponse, -) -from .development_mode import ( - DevelopmentModeResource, - AsyncDevelopmentModeResource, - DevelopmentModeResourceWithRawResponse, - AsyncDevelopmentModeResourceWithRawResponse, - DevelopmentModeResourceWithStreamingResponse, - AsyncDevelopmentModeResourceWithStreamingResponse, -) -from .orange_to_orange import ( - OrangeToOrangeResource, - AsyncOrangeToOrangeResource, - OrangeToOrangeResourceWithRawResponse, - AsyncOrangeToOrangeResourceWithRawResponse, - OrangeToOrangeResourceWithStreamingResponse, - AsyncOrangeToOrangeResourceWithStreamingResponse, -) -from .prefetch_preload import ( - PrefetchPreloadResource, - AsyncPrefetchPreloadResource, - PrefetchPreloadResourceWithRawResponse, - AsyncPrefetchPreloadResourceWithRawResponse, - PrefetchPreloadResourceWithStreamingResponse, - AsyncPrefetchPreloadResourceWithStreamingResponse, -) -from .security_headers import ( - SecurityHeadersResource, - AsyncSecurityHeadersResource, - SecurityHeadersResourceWithRawResponse, - AsyncSecurityHeadersResourceWithRawResponse, - SecurityHeadersResourceWithStreamingResponse, - AsyncSecurityHeadersResourceWithStreamingResponse, -) -from .browser_cache_ttl import ( - BrowserCacheTTLResource, - AsyncBrowserCacheTTLResource, - BrowserCacheTTLResourceWithRawResponse, - AsyncBrowserCacheTTLResourceWithRawResponse, - BrowserCacheTTLResourceWithStreamingResponse, - AsyncBrowserCacheTTLResourceWithStreamingResponse, -) -from .email_obfuscation import ( - EmailObfuscationResource, - AsyncEmailObfuscationResource, - EmailObfuscationResourceWithRawResponse, - AsyncEmailObfuscationResourceWithRawResponse, - EmailObfuscationResourceWithStreamingResponse, - AsyncEmailObfuscationResourceWithStreamingResponse, -) -from .h2_prioritization import ( - H2PrioritizationResource, - AsyncH2PrioritizationResource, - H2PrioritizationResourceWithRawResponse, - AsyncH2PrioritizationResourceWithRawResponse, - H2PrioritizationResourceWithStreamingResponse, - AsyncH2PrioritizationResourceWithStreamingResponse, -) -from .hotlink_protection import ( - HotlinkProtectionResource, - AsyncHotlinkProtectionResource, - HotlinkProtectionResourceWithRawResponse, - AsyncHotlinkProtectionResourceWithRawResponse, - HotlinkProtectionResourceWithStreamingResponse, - AsyncHotlinkProtectionResourceWithStreamingResponse, -) -from .proxy_read_timeout import ( - ProxyReadTimeoutResource, - AsyncProxyReadTimeoutResource, - ProxyReadTimeoutResourceWithRawResponse, - AsyncProxyReadTimeoutResourceWithRawResponse, - ProxyReadTimeoutResourceWithStreamingResponse, - AsyncProxyReadTimeoutResourceWithStreamingResponse, -) -from .response_buffering import ( - ResponseBufferingResource, - AsyncResponseBufferingResource, - ResponseBufferingResourceWithRawResponse, - AsyncResponseBufferingResourceWithRawResponse, - ResponseBufferingResourceWithStreamingResponse, - AsyncResponseBufferingResourceWithStreamingResponse, -) -from .opportunistic_onion import ( - OpportunisticOnionResource, - AsyncOpportunisticOnionResource, - OpportunisticOnionResourceWithRawResponse, - AsyncOpportunisticOnionResourceWithRawResponse, - OpportunisticOnionResourceWithStreamingResponse, - AsyncOpportunisticOnionResourceWithStreamingResponse, -) -from .server_side_excludes import ( - ServerSideExcludesResource, - AsyncServerSideExcludesResource, - ServerSideExcludesResourceWithRawResponse, - AsyncServerSideExcludesResourceWithRawResponse, - ServerSideExcludesResourceWithStreamingResponse, - AsyncServerSideExcludesResourceWithStreamingResponse, -) -from .true_client_ip_header import ( - TrueClientIPHeaderResource, - AsyncTrueClientIPHeaderResource, - TrueClientIPHeaderResourceWithRawResponse, - AsyncTrueClientIPHeaderResourceWithRawResponse, - TrueClientIPHeaderResourceWithStreamingResponse, - AsyncTrueClientIPHeaderResourceWithStreamingResponse, -) from .origin_max_http_version import ( OriginMaxHTTPVersionResource, AsyncOriginMaxHTTPVersionResource, @@ -376,348 +24,14 @@ OriginMaxHTTPVersionResourceWithStreamingResponse, AsyncOriginMaxHTTPVersionResourceWithStreamingResponse, ) -from .automatic_https_rewrites import ( - AutomaticHTTPSRewritesResource, - AsyncAutomaticHTTPSRewritesResource, - AutomaticHTTPSRewritesResourceWithRawResponse, - AsyncAutomaticHTTPSRewritesResourceWithRawResponse, - AutomaticHTTPSRewritesResourceWithStreamingResponse, - AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse, -) -from .opportunistic_encryption import ( - OpportunisticEncryptionResource, - AsyncOpportunisticEncryptionResource, - OpportunisticEncryptionResourceWithRawResponse, - AsyncOpportunisticEncryptionResourceWithRawResponse, - OpportunisticEncryptionResourceWithStreamingResponse, - AsyncOpportunisticEncryptionResourceWithStreamingResponse, -) -from .origin_error_page_pass_thru import ( - OriginErrorPagePassThruResource, - AsyncOriginErrorPagePassThruResource, - OriginErrorPagePassThruResourceWithRawResponse, - AsyncOriginErrorPagePassThruResourceWithRawResponse, - OriginErrorPagePassThruResourceWithStreamingResponse, - AsyncOriginErrorPagePassThruResourceWithStreamingResponse, -) -from .sort_query_string_for_cache import ( - SortQueryStringForCacheResource, - AsyncSortQueryStringForCacheResource, - SortQueryStringForCacheResourceWithRawResponse, - AsyncSortQueryStringForCacheResourceWithRawResponse, - SortQueryStringForCacheResourceWithStreamingResponse, - AsyncSortQueryStringForCacheResourceWithStreamingResponse, -) -from .automatic_platform_optimization import ( - AutomaticPlatformOptimizationResource, - AsyncAutomaticPlatformOptimizationResource, - AutomaticPlatformOptimizationResourceWithRawResponse, - AsyncAutomaticPlatformOptimizationResourceWithRawResponse, - AutomaticPlatformOptimizationResourceWithStreamingResponse, - AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse, -) __all__ = [ - "ZeroRTTResource", - "AsyncZeroRTTResource", - "ZeroRTTResourceWithRawResponse", - "AsyncZeroRTTResourceWithRawResponse", - "ZeroRTTResourceWithStreamingResponse", - "AsyncZeroRTTResourceWithStreamingResponse", - "AdvancedDDoSResource", - "AsyncAdvancedDDoSResource", - "AdvancedDDoSResourceWithRawResponse", - "AsyncAdvancedDDoSResourceWithRawResponse", - "AdvancedDDoSResourceWithStreamingResponse", - "AsyncAdvancedDDoSResourceWithStreamingResponse", - "AlwaysOnlineResource", - "AsyncAlwaysOnlineResource", - "AlwaysOnlineResourceWithRawResponse", - "AsyncAlwaysOnlineResourceWithRawResponse", - "AlwaysOnlineResourceWithStreamingResponse", - "AsyncAlwaysOnlineResourceWithStreamingResponse", - "AlwaysUseHTTPSResource", - "AsyncAlwaysUseHTTPSResource", - "AlwaysUseHTTPSResourceWithRawResponse", - "AsyncAlwaysUseHTTPSResourceWithRawResponse", - "AlwaysUseHTTPSResourceWithStreamingResponse", - "AsyncAlwaysUseHTTPSResourceWithStreamingResponse", - "AutomaticHTTPSRewritesResource", - "AsyncAutomaticHTTPSRewritesResource", - "AutomaticHTTPSRewritesResourceWithRawResponse", - "AsyncAutomaticHTTPSRewritesResourceWithRawResponse", - "AutomaticHTTPSRewritesResourceWithStreamingResponse", - "AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse", - "AutomaticPlatformOptimizationResource", - "AsyncAutomaticPlatformOptimizationResource", - "AutomaticPlatformOptimizationResourceWithRawResponse", - "AsyncAutomaticPlatformOptimizationResourceWithRawResponse", - "AutomaticPlatformOptimizationResourceWithStreamingResponse", - "AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse", - "BrotliResource", - "AsyncBrotliResource", - "BrotliResourceWithRawResponse", - "AsyncBrotliResourceWithRawResponse", - "BrotliResourceWithStreamingResponse", - "AsyncBrotliResourceWithStreamingResponse", - "BrowserCacheTTLResource", - "AsyncBrowserCacheTTLResource", - "BrowserCacheTTLResourceWithRawResponse", - "AsyncBrowserCacheTTLResourceWithRawResponse", - "BrowserCacheTTLResourceWithStreamingResponse", - "AsyncBrowserCacheTTLResourceWithStreamingResponse", - "BrowserCheckResource", - "AsyncBrowserCheckResource", - "BrowserCheckResourceWithRawResponse", - "AsyncBrowserCheckResourceWithRawResponse", - "BrowserCheckResourceWithStreamingResponse", - "AsyncBrowserCheckResourceWithStreamingResponse", - "CacheLevelResource", - "AsyncCacheLevelResource", - "CacheLevelResourceWithRawResponse", - "AsyncCacheLevelResourceWithRawResponse", - "CacheLevelResourceWithStreamingResponse", - "AsyncCacheLevelResourceWithStreamingResponse", - "ChallengeTTLResource", - "AsyncChallengeTTLResource", - "ChallengeTTLResourceWithRawResponse", - "AsyncChallengeTTLResourceWithRawResponse", - "ChallengeTTLResourceWithStreamingResponse", - "AsyncChallengeTTLResourceWithStreamingResponse", - "CiphersResource", - "AsyncCiphersResource", - "CiphersResourceWithRawResponse", - "AsyncCiphersResourceWithRawResponse", - "CiphersResourceWithStreamingResponse", - "AsyncCiphersResourceWithStreamingResponse", - "DevelopmentModeResource", - "AsyncDevelopmentModeResource", - "DevelopmentModeResourceWithRawResponse", - "AsyncDevelopmentModeResourceWithRawResponse", - "DevelopmentModeResourceWithStreamingResponse", - "AsyncDevelopmentModeResourceWithStreamingResponse", - "EarlyHintsResource", - "AsyncEarlyHintsResource", - "EarlyHintsResourceWithRawResponse", - "AsyncEarlyHintsResourceWithRawResponse", - "EarlyHintsResourceWithStreamingResponse", - "AsyncEarlyHintsResourceWithStreamingResponse", - "EmailObfuscationResource", - "AsyncEmailObfuscationResource", - "EmailObfuscationResourceWithRawResponse", - "AsyncEmailObfuscationResourceWithRawResponse", - "EmailObfuscationResourceWithStreamingResponse", - "AsyncEmailObfuscationResourceWithStreamingResponse", - "H2PrioritizationResource", - "AsyncH2PrioritizationResource", - "H2PrioritizationResourceWithRawResponse", - "AsyncH2PrioritizationResourceWithRawResponse", - "H2PrioritizationResourceWithStreamingResponse", - "AsyncH2PrioritizationResourceWithStreamingResponse", - "HotlinkProtectionResource", - "AsyncHotlinkProtectionResource", - "HotlinkProtectionResourceWithRawResponse", - "AsyncHotlinkProtectionResourceWithRawResponse", - "HotlinkProtectionResourceWithStreamingResponse", - "AsyncHotlinkProtectionResourceWithStreamingResponse", - "HTTP2Resource", - "AsyncHTTP2Resource", - "HTTP2ResourceWithRawResponse", - "AsyncHTTP2ResourceWithRawResponse", - "HTTP2ResourceWithStreamingResponse", - "AsyncHTTP2ResourceWithStreamingResponse", - "HTTP3Resource", - "AsyncHTTP3Resource", - "HTTP3ResourceWithRawResponse", - "AsyncHTTP3ResourceWithRawResponse", - "HTTP3ResourceWithStreamingResponse", - "AsyncHTTP3ResourceWithStreamingResponse", - "ImageResizingResource", - "AsyncImageResizingResource", - "ImageResizingResourceWithRawResponse", - "AsyncImageResizingResourceWithRawResponse", - "ImageResizingResourceWithStreamingResponse", - "AsyncImageResizingResourceWithStreamingResponse", - "IPGeolocationResource", - "AsyncIPGeolocationResource", - "IPGeolocationResourceWithRawResponse", - "AsyncIPGeolocationResourceWithRawResponse", - "IPGeolocationResourceWithStreamingResponse", - "AsyncIPGeolocationResourceWithStreamingResponse", - "IPV6Resource", - "AsyncIPV6Resource", - "IPV6ResourceWithRawResponse", - "AsyncIPV6ResourceWithRawResponse", - "IPV6ResourceWithStreamingResponse", - "AsyncIPV6ResourceWithStreamingResponse", - "MinTLSVersionResource", - "AsyncMinTLSVersionResource", - "MinTLSVersionResourceWithRawResponse", - "AsyncMinTLSVersionResourceWithRawResponse", - "MinTLSVersionResourceWithStreamingResponse", - "AsyncMinTLSVersionResourceWithStreamingResponse", - "MinifyResource", - "AsyncMinifyResource", - "MinifyResourceWithRawResponse", - "AsyncMinifyResourceWithRawResponse", - "MinifyResourceWithStreamingResponse", - "AsyncMinifyResourceWithStreamingResponse", - "MirageResource", - "AsyncMirageResource", - "MirageResourceWithRawResponse", - "AsyncMirageResourceWithRawResponse", - "MirageResourceWithStreamingResponse", - "AsyncMirageResourceWithStreamingResponse", - "MobileRedirectResource", - "AsyncMobileRedirectResource", - "MobileRedirectResourceWithRawResponse", - "AsyncMobileRedirectResourceWithRawResponse", - "MobileRedirectResourceWithStreamingResponse", - "AsyncMobileRedirectResourceWithStreamingResponse", - "NELResource", - "AsyncNELResource", - "NELResourceWithRawResponse", - "AsyncNELResourceWithRawResponse", - "NELResourceWithStreamingResponse", - "AsyncNELResourceWithStreamingResponse", - "OpportunisticEncryptionResource", - "AsyncOpportunisticEncryptionResource", - "OpportunisticEncryptionResourceWithRawResponse", - "AsyncOpportunisticEncryptionResourceWithRawResponse", - "OpportunisticEncryptionResourceWithStreamingResponse", - "AsyncOpportunisticEncryptionResourceWithStreamingResponse", - "OpportunisticOnionResource", - "AsyncOpportunisticOnionResource", - "OpportunisticOnionResourceWithRawResponse", - "AsyncOpportunisticOnionResourceWithRawResponse", - "OpportunisticOnionResourceWithStreamingResponse", - "AsyncOpportunisticOnionResourceWithStreamingResponse", - "OrangeToOrangeResource", - "AsyncOrangeToOrangeResource", - "OrangeToOrangeResourceWithRawResponse", - "AsyncOrangeToOrangeResourceWithRawResponse", - "OrangeToOrangeResourceWithStreamingResponse", - "AsyncOrangeToOrangeResourceWithStreamingResponse", - "OriginErrorPagePassThruResource", - "AsyncOriginErrorPagePassThruResource", - "OriginErrorPagePassThruResourceWithRawResponse", - "AsyncOriginErrorPagePassThruResourceWithRawResponse", - "OriginErrorPagePassThruResourceWithStreamingResponse", - "AsyncOriginErrorPagePassThruResourceWithStreamingResponse", "OriginMaxHTTPVersionResource", "AsyncOriginMaxHTTPVersionResource", "OriginMaxHTTPVersionResourceWithRawResponse", "AsyncOriginMaxHTTPVersionResourceWithRawResponse", "OriginMaxHTTPVersionResourceWithStreamingResponse", "AsyncOriginMaxHTTPVersionResourceWithStreamingResponse", - "PolishResource", - "AsyncPolishResource", - "PolishResourceWithRawResponse", - "AsyncPolishResourceWithRawResponse", - "PolishResourceWithStreamingResponse", - "AsyncPolishResourceWithStreamingResponse", - "PrefetchPreloadResource", - "AsyncPrefetchPreloadResource", - "PrefetchPreloadResourceWithRawResponse", - "AsyncPrefetchPreloadResourceWithRawResponse", - "PrefetchPreloadResourceWithStreamingResponse", - "AsyncPrefetchPreloadResourceWithStreamingResponse", - "ProxyReadTimeoutResource", - "AsyncProxyReadTimeoutResource", - "ProxyReadTimeoutResourceWithRawResponse", - "AsyncProxyReadTimeoutResourceWithRawResponse", - "ProxyReadTimeoutResourceWithStreamingResponse", - "AsyncProxyReadTimeoutResourceWithStreamingResponse", - "PseudoIPV4Resource", - "AsyncPseudoIPV4Resource", - "PseudoIPV4ResourceWithRawResponse", - "AsyncPseudoIPV4ResourceWithRawResponse", - "PseudoIPV4ResourceWithStreamingResponse", - "AsyncPseudoIPV4ResourceWithStreamingResponse", - "ResponseBufferingResource", - "AsyncResponseBufferingResource", - "ResponseBufferingResourceWithRawResponse", - "AsyncResponseBufferingResourceWithRawResponse", - "ResponseBufferingResourceWithStreamingResponse", - "AsyncResponseBufferingResourceWithStreamingResponse", - "RocketLoaderResource", - "AsyncRocketLoaderResource", - "RocketLoaderResourceWithRawResponse", - "AsyncRocketLoaderResourceWithRawResponse", - "RocketLoaderResourceWithStreamingResponse", - "AsyncRocketLoaderResourceWithStreamingResponse", - "SecurityHeadersResource", - "AsyncSecurityHeadersResource", - "SecurityHeadersResourceWithRawResponse", - "AsyncSecurityHeadersResourceWithRawResponse", - "SecurityHeadersResourceWithStreamingResponse", - "AsyncSecurityHeadersResourceWithStreamingResponse", - "SecurityLevelResource", - "AsyncSecurityLevelResource", - "SecurityLevelResourceWithRawResponse", - "AsyncSecurityLevelResourceWithRawResponse", - "SecurityLevelResourceWithStreamingResponse", - "AsyncSecurityLevelResourceWithStreamingResponse", - "ServerSideExcludesResource", - "AsyncServerSideExcludesResource", - "ServerSideExcludesResourceWithRawResponse", - "AsyncServerSideExcludesResourceWithRawResponse", - "ServerSideExcludesResourceWithStreamingResponse", - "AsyncServerSideExcludesResourceWithStreamingResponse", - "SortQueryStringForCacheResource", - "AsyncSortQueryStringForCacheResource", - "SortQueryStringForCacheResourceWithRawResponse", - "AsyncSortQueryStringForCacheResourceWithRawResponse", - "SortQueryStringForCacheResourceWithStreamingResponse", - "AsyncSortQueryStringForCacheResourceWithStreamingResponse", - "SSLResource", - "AsyncSSLResource", - "SSLResourceWithRawResponse", - "AsyncSSLResourceWithRawResponse", - "SSLResourceWithStreamingResponse", - "AsyncSSLResourceWithStreamingResponse", - "SSLRecommenderResource", - "AsyncSSLRecommenderResource", - "SSLRecommenderResourceWithRawResponse", - "AsyncSSLRecommenderResourceWithRawResponse", - "SSLRecommenderResourceWithStreamingResponse", - "AsyncSSLRecommenderResourceWithStreamingResponse", - "TLS1_3Resource", - "AsyncTLS1_3Resource", - "TLS1_3ResourceWithRawResponse", - "AsyncTLS1_3ResourceWithRawResponse", - "TLS1_3ResourceWithStreamingResponse", - "AsyncTLS1_3ResourceWithStreamingResponse", - "TLSClientAuthResource", - "AsyncTLSClientAuthResource", - "TLSClientAuthResourceWithRawResponse", - "AsyncTLSClientAuthResourceWithRawResponse", - "TLSClientAuthResourceWithStreamingResponse", - "AsyncTLSClientAuthResourceWithStreamingResponse", - "TrueClientIPHeaderResource", - "AsyncTrueClientIPHeaderResource", - "TrueClientIPHeaderResourceWithRawResponse", - "AsyncTrueClientIPHeaderResourceWithRawResponse", - "TrueClientIPHeaderResourceWithStreamingResponse", - "AsyncTrueClientIPHeaderResourceWithStreamingResponse", - "WAFResource", - "AsyncWAFResource", - "WAFResourceWithRawResponse", - "AsyncWAFResourceWithRawResponse", - "WAFResourceWithStreamingResponse", - "AsyncWAFResourceWithStreamingResponse", - "WebPResource", - "AsyncWebPResource", - "WebPResourceWithRawResponse", - "AsyncWebPResourceWithRawResponse", - "WebPResourceWithStreamingResponse", - "AsyncWebPResourceWithStreamingResponse", - "WebsocketResource", - "AsyncWebsocketResource", - "WebsocketResourceWithRawResponse", - "AsyncWebsocketResourceWithRawResponse", - "WebsocketResourceWithStreamingResponse", - "AsyncWebsocketResourceWithStreamingResponse", "FontSettingsResource", "AsyncFontSettingsResource", "FontSettingsResourceWithRawResponse", diff --git a/src/cloudflare/resources/zones/settings/advanced_ddos.py b/src/cloudflare/resources/zones/settings/advanced_ddos.py deleted file mode 100644 index 0b862955cf6..00000000000 --- a/src/cloudflare/resources/zones/settings/advanced_ddos.py +++ /dev/null @@ -1,162 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings.advanced_ddos import AdvancedDDoS - -__all__ = ["AdvancedDDoSResource", "AsyncAdvancedDDoSResource"] - - -class AdvancedDDoSResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AdvancedDDoSResourceWithRawResponse: - return AdvancedDDoSResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AdvancedDDoSResourceWithStreamingResponse: - return AdvancedDDoSResourceWithStreamingResponse(self) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AdvancedDDoS]: - """ - Advanced protection from Distributed Denial of Service (DDoS) attacks on your - website. This is an uneditable value that is 'on' in the case of Business and - Enterprise zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/advanced_ddos", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AdvancedDDoS]]._unwrapper, - ), - cast_to=cast(Type[Optional[AdvancedDDoS]], ResultWrapper[AdvancedDDoS]), - ) - - -class AsyncAdvancedDDoSResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAdvancedDDoSResourceWithRawResponse: - return AsyncAdvancedDDoSResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAdvancedDDoSResourceWithStreamingResponse: - return AsyncAdvancedDDoSResourceWithStreamingResponse(self) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AdvancedDDoS]: - """ - Advanced protection from Distributed Denial of Service (DDoS) attacks on your - website. This is an uneditable value that is 'on' in the case of Business and - Enterprise zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/advanced_ddos", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AdvancedDDoS]]._unwrapper, - ), - cast_to=cast(Type[Optional[AdvancedDDoS]], ResultWrapper[AdvancedDDoS]), - ) - - -class AdvancedDDoSResourceWithRawResponse: - def __init__(self, advanced_ddos: AdvancedDDoSResource) -> None: - self._advanced_ddos = advanced_ddos - - self.get = to_raw_response_wrapper( - advanced_ddos.get, - ) - - -class AsyncAdvancedDDoSResourceWithRawResponse: - def __init__(self, advanced_ddos: AsyncAdvancedDDoSResource) -> None: - self._advanced_ddos = advanced_ddos - - self.get = async_to_raw_response_wrapper( - advanced_ddos.get, - ) - - -class AdvancedDDoSResourceWithStreamingResponse: - def __init__(self, advanced_ddos: AdvancedDDoSResource) -> None: - self._advanced_ddos = advanced_ddos - - self.get = to_streamed_response_wrapper( - advanced_ddos.get, - ) - - -class AsyncAdvancedDDoSResourceWithStreamingResponse: - def __init__(self, advanced_ddos: AsyncAdvancedDDoSResource) -> None: - self._advanced_ddos = advanced_ddos - - self.get = async_to_streamed_response_wrapper( - advanced_ddos.get, - ) diff --git a/src/cloudflare/resources/zones/settings/always_online.py b/src/cloudflare/resources/zones/settings/always_online.py deleted file mode 100644 index df0c7324373..00000000000 --- a/src/cloudflare/resources/zones/settings/always_online.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import always_online_edit_params -from ....types.zones.settings.always_online import AlwaysOnline - -__all__ = ["AlwaysOnlineResource", "AsyncAlwaysOnlineResource"] - - -class AlwaysOnlineResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AlwaysOnlineResourceWithRawResponse: - return AlwaysOnlineResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AlwaysOnlineResourceWithStreamingResponse: - return AlwaysOnlineResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[AlwaysOnline]: - """ - When enabled, Cloudflare serves limited copies of web pages available from the - [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is - offline. Refer to - [Always Online](https://developers.cloudflare.com/cache/about/always-online) for - more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/always_online", - body=maybe_transform({"value": value}, always_online_edit_params.AlwaysOnlineEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AlwaysOnline]: - """ - When enabled, Cloudflare serves limited copies of web pages available from the - [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is - offline. Refer to - [Always Online](https://developers.cloudflare.com/cache/about/always-online) for - more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/always_online", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), - ) - - -class AsyncAlwaysOnlineResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAlwaysOnlineResourceWithRawResponse: - return AsyncAlwaysOnlineResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAlwaysOnlineResourceWithStreamingResponse: - return AsyncAlwaysOnlineResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[AlwaysOnline]: - """ - When enabled, Cloudflare serves limited copies of web pages available from the - [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is - offline. Refer to - [Always Online](https://developers.cloudflare.com/cache/about/always-online) for - more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/always_online", - body=await async_maybe_transform({"value": value}, always_online_edit_params.AlwaysOnlineEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AlwaysOnline]: - """ - When enabled, Cloudflare serves limited copies of web pages available from the - [Internet Archive's Wayback Machine](https://archive.org/web/) if your server is - offline. Refer to - [Always Online](https://developers.cloudflare.com/cache/about/always-online) for - more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/always_online", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysOnline]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysOnline]], ResultWrapper[AlwaysOnline]), - ) - - -class AlwaysOnlineResourceWithRawResponse: - def __init__(self, always_online: AlwaysOnlineResource) -> None: - self._always_online = always_online - - self.edit = to_raw_response_wrapper( - always_online.edit, - ) - self.get = to_raw_response_wrapper( - always_online.get, - ) - - -class AsyncAlwaysOnlineResourceWithRawResponse: - def __init__(self, always_online: AsyncAlwaysOnlineResource) -> None: - self._always_online = always_online - - self.edit = async_to_raw_response_wrapper( - always_online.edit, - ) - self.get = async_to_raw_response_wrapper( - always_online.get, - ) - - -class AlwaysOnlineResourceWithStreamingResponse: - def __init__(self, always_online: AlwaysOnlineResource) -> None: - self._always_online = always_online - - self.edit = to_streamed_response_wrapper( - always_online.edit, - ) - self.get = to_streamed_response_wrapper( - always_online.get, - ) - - -class AsyncAlwaysOnlineResourceWithStreamingResponse: - def __init__(self, always_online: AsyncAlwaysOnlineResource) -> None: - self._always_online = always_online - - self.edit = async_to_streamed_response_wrapper( - always_online.edit, - ) - self.get = async_to_streamed_response_wrapper( - always_online.get, - ) diff --git a/src/cloudflare/resources/zones/settings/always_use_https.py b/src/cloudflare/resources/zones/settings/always_use_https.py deleted file mode 100644 index 3e9a208f93d..00000000000 --- a/src/cloudflare/resources/zones/settings/always_use_https.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import always_use_https_edit_params -from ....types.zones.settings.always_use_https import AlwaysUseHTTPS - -__all__ = ["AlwaysUseHTTPSResource", "AsyncAlwaysUseHTTPSResource"] - - -class AlwaysUseHTTPSResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AlwaysUseHTTPSResourceWithRawResponse: - return AlwaysUseHTTPSResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AlwaysUseHTTPSResourceWithStreamingResponse: - return AlwaysUseHTTPSResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[AlwaysUseHTTPS]: - """ - Reply to all requests for URLs that use "http" with a 301 redirect to the - equivalent "https" URL. If you only want to redirect for a subset of requests, - consider creating an "Always use HTTPS" page rule. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/always_use_https", - body=maybe_transform({"value": value}, always_use_https_edit_params.AlwaysUseHTTPSEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AlwaysUseHTTPS]: - """ - Reply to all requests for URLs that use "http" with a 301 redirect to the - equivalent "https" URL. If you only want to redirect for a subset of requests, - consider creating an "Always use HTTPS" page rule. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/always_use_https", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), - ) - - -class AsyncAlwaysUseHTTPSResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAlwaysUseHTTPSResourceWithRawResponse: - return AsyncAlwaysUseHTTPSResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAlwaysUseHTTPSResourceWithStreamingResponse: - return AsyncAlwaysUseHTTPSResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[AlwaysUseHTTPS]: - """ - Reply to all requests for URLs that use "http" with a 301 redirect to the - equivalent "https" URL. If you only want to redirect for a subset of requests, - consider creating an "Always use HTTPS" page rule. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/always_use_https", - body=await async_maybe_transform({"value": value}, always_use_https_edit_params.AlwaysUseHTTPSEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AlwaysUseHTTPS]: - """ - Reply to all requests for URLs that use "http" with a 301 redirect to the - equivalent "https" URL. If you only want to redirect for a subset of requests, - consider creating an "Always use HTTPS" page rule. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/always_use_https", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AlwaysUseHTTPS]]._unwrapper, - ), - cast_to=cast(Type[Optional[AlwaysUseHTTPS]], ResultWrapper[AlwaysUseHTTPS]), - ) - - -class AlwaysUseHTTPSResourceWithRawResponse: - def __init__(self, always_use_https: AlwaysUseHTTPSResource) -> None: - self._always_use_https = always_use_https - - self.edit = to_raw_response_wrapper( - always_use_https.edit, - ) - self.get = to_raw_response_wrapper( - always_use_https.get, - ) - - -class AsyncAlwaysUseHTTPSResourceWithRawResponse: - def __init__(self, always_use_https: AsyncAlwaysUseHTTPSResource) -> None: - self._always_use_https = always_use_https - - self.edit = async_to_raw_response_wrapper( - always_use_https.edit, - ) - self.get = async_to_raw_response_wrapper( - always_use_https.get, - ) - - -class AlwaysUseHTTPSResourceWithStreamingResponse: - def __init__(self, always_use_https: AlwaysUseHTTPSResource) -> None: - self._always_use_https = always_use_https - - self.edit = to_streamed_response_wrapper( - always_use_https.edit, - ) - self.get = to_streamed_response_wrapper( - always_use_https.get, - ) - - -class AsyncAlwaysUseHTTPSResourceWithStreamingResponse: - def __init__(self, always_use_https: AsyncAlwaysUseHTTPSResource) -> None: - self._always_use_https = always_use_https - - self.edit = async_to_streamed_response_wrapper( - always_use_https.edit, - ) - self.get = async_to_streamed_response_wrapper( - always_use_https.get, - ) diff --git a/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py b/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py deleted file mode 100644 index 329edb96881..00000000000 --- a/src/cloudflare/resources/zones/settings/automatic_https_rewrites.py +++ /dev/null @@ -1,266 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import automatic_https_rewrite_edit_params -from ....types.zones.settings.automatic_https_rewrites import AutomaticHTTPSRewrites - -__all__ = ["AutomaticHTTPSRewritesResource", "AsyncAutomaticHTTPSRewritesResource"] - - -class AutomaticHTTPSRewritesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AutomaticHTTPSRewritesResourceWithRawResponse: - return AutomaticHTTPSRewritesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AutomaticHTTPSRewritesResourceWithStreamingResponse: - return AutomaticHTTPSRewritesResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[AutomaticHTTPSRewrites]: - """ - Enable the Automatic HTTPS Rewrites feature for this zone. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 self._patch( - f"/zones/{zone_id}/settings/automatic_https_rewrites", - body=maybe_transform({"value": value}, automatic_https_rewrite_edit_params.AutomaticHTTPSRewriteEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AutomaticHTTPSRewrites]: - """ - Enable the Automatic HTTPS Rewrites feature for this zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/automatic_https_rewrites", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), - ) - - -class AsyncAutomaticHTTPSRewritesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAutomaticHTTPSRewritesResourceWithRawResponse: - return AsyncAutomaticHTTPSRewritesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse: - return AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[AutomaticHTTPSRewrites]: - """ - Enable the Automatic HTTPS Rewrites feature for this zone. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 await self._patch( - f"/zones/{zone_id}/settings/automatic_https_rewrites", - body=await async_maybe_transform( - {"value": value}, automatic_https_rewrite_edit_params.AutomaticHTTPSRewriteEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AutomaticHTTPSRewrites]: - """ - Enable the Automatic HTTPS Rewrites feature for this zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/automatic_https_rewrites", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticHTTPSRewrites]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticHTTPSRewrites]], ResultWrapper[AutomaticHTTPSRewrites]), - ) - - -class AutomaticHTTPSRewritesResourceWithRawResponse: - def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewritesResource) -> None: - self._automatic_https_rewrites = automatic_https_rewrites - - self.edit = to_raw_response_wrapper( - automatic_https_rewrites.edit, - ) - self.get = to_raw_response_wrapper( - automatic_https_rewrites.get, - ) - - -class AsyncAutomaticHTTPSRewritesResourceWithRawResponse: - def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewritesResource) -> None: - self._automatic_https_rewrites = automatic_https_rewrites - - self.edit = async_to_raw_response_wrapper( - automatic_https_rewrites.edit, - ) - self.get = async_to_raw_response_wrapper( - automatic_https_rewrites.get, - ) - - -class AutomaticHTTPSRewritesResourceWithStreamingResponse: - def __init__(self, automatic_https_rewrites: AutomaticHTTPSRewritesResource) -> None: - self._automatic_https_rewrites = automatic_https_rewrites - - self.edit = to_streamed_response_wrapper( - automatic_https_rewrites.edit, - ) - self.get = to_streamed_response_wrapper( - automatic_https_rewrites.get, - ) - - -class AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse: - def __init__(self, automatic_https_rewrites: AsyncAutomaticHTTPSRewritesResource) -> None: - self._automatic_https_rewrites = automatic_https_rewrites - - self.edit = async_to_streamed_response_wrapper( - automatic_https_rewrites.edit, - ) - self.get = async_to_streamed_response_wrapper( - automatic_https_rewrites.get, - ) diff --git a/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py b/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py deleted file mode 100644 index 5bb239a25aa..00000000000 --- a/src/cloudflare/resources/zones/settings/automatic_platform_optimization.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import AutomaticPlatformOptimization, automatic_platform_optimization_edit_params -from ....types.zones.settings.automatic_platform_optimization import AutomaticPlatformOptimization -from ....types.zones.settings.automatic_platform_optimization_param import AutomaticPlatformOptimizationParam - -__all__ = ["AutomaticPlatformOptimizationResource", "AsyncAutomaticPlatformOptimizationResource"] - - -class AutomaticPlatformOptimizationResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AutomaticPlatformOptimizationResourceWithRawResponse: - return AutomaticPlatformOptimizationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AutomaticPlatformOptimizationResourceWithStreamingResponse: - return AutomaticPlatformOptimizationResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: AutomaticPlatformOptimizationParam, - # 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, - ) -> Optional[AutomaticPlatformOptimization]: - """ - [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) - serves your WordPress site from Cloudflare's edge network and caches third-party - fonts. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._patch( - f"/zones/{zone_id}/settings/automatic_platform_optimization", - body=maybe_transform( - {"value": value}, automatic_platform_optimization_edit_params.AutomaticPlatformOptimizationEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AutomaticPlatformOptimization]: - """ - [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) - serves your WordPress site from Cloudflare's edge network and caches third-party - fonts. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/automatic_platform_optimization", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), - ) - - -class AsyncAutomaticPlatformOptimizationResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAutomaticPlatformOptimizationResourceWithRawResponse: - return AsyncAutomaticPlatformOptimizationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse: - return AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: AutomaticPlatformOptimizationParam, - # 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, - ) -> Optional[AutomaticPlatformOptimization]: - """ - [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) - serves your WordPress site from Cloudflare's edge network and caches third-party - fonts. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._patch( - f"/zones/{zone_id}/settings/automatic_platform_optimization", - body=await async_maybe_transform( - {"value": value}, automatic_platform_optimization_edit_params.AutomaticPlatformOptimizationEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AutomaticPlatformOptimization]: - """ - [Automatic Platform Optimization for WordPress](https://developers.cloudflare.com/automatic-platform-optimization/) - serves your WordPress site from Cloudflare's edge network and caches third-party - fonts. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/automatic_platform_optimization", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AutomaticPlatformOptimization]]._unwrapper, - ), - cast_to=cast(Type[Optional[AutomaticPlatformOptimization]], ResultWrapper[AutomaticPlatformOptimization]), - ) - - -class AutomaticPlatformOptimizationResourceWithRawResponse: - def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimizationResource) -> None: - self._automatic_platform_optimization = automatic_platform_optimization - - self.edit = to_raw_response_wrapper( - automatic_platform_optimization.edit, - ) - self.get = to_raw_response_wrapper( - automatic_platform_optimization.get, - ) - - -class AsyncAutomaticPlatformOptimizationResourceWithRawResponse: - def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimizationResource) -> None: - self._automatic_platform_optimization = automatic_platform_optimization - - self.edit = async_to_raw_response_wrapper( - automatic_platform_optimization.edit, - ) - self.get = async_to_raw_response_wrapper( - automatic_platform_optimization.get, - ) - - -class AutomaticPlatformOptimizationResourceWithStreamingResponse: - def __init__(self, automatic_platform_optimization: AutomaticPlatformOptimizationResource) -> None: - self._automatic_platform_optimization = automatic_platform_optimization - - self.edit = to_streamed_response_wrapper( - automatic_platform_optimization.edit, - ) - self.get = to_streamed_response_wrapper( - automatic_platform_optimization.get, - ) - - -class AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse: - def __init__(self, automatic_platform_optimization: AsyncAutomaticPlatformOptimizationResource) -> None: - self._automatic_platform_optimization = automatic_platform_optimization - - self.edit = async_to_streamed_response_wrapper( - automatic_platform_optimization.edit, - ) - self.get = async_to_streamed_response_wrapper( - automatic_platform_optimization.get, - ) diff --git a/src/cloudflare/resources/zones/settings/brotli.py b/src/cloudflare/resources/zones/settings/brotli.py deleted file mode 100644 index 33912623ca6..00000000000 --- a/src/cloudflare/resources/zones/settings/brotli.py +++ /dev/null @@ -1,266 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import brotli_edit_params -from ....types.zones.settings.brotli import Brotli - -__all__ = ["BrotliResource", "AsyncBrotliResource"] - - -class BrotliResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BrotliResourceWithRawResponse: - return BrotliResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BrotliResourceWithStreamingResponse: - return BrotliResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[Brotli]: - """ - When the client requesting an asset supports the Brotli compression algorithm, - Cloudflare will serve a Brotli compressed version of the asset. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/brotli", - body=maybe_transform({"value": value}, brotli_edit_params.BrotliEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, - ), - cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Brotli]: - """ - When the client requesting an asset supports the Brotli compression algorithm, - Cloudflare will serve a Brotli compressed version of the asset. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/brotli", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, - ), - cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), - ) - - -class AsyncBrotliResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBrotliResourceWithRawResponse: - return AsyncBrotliResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBrotliResourceWithStreamingResponse: - return AsyncBrotliResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[Brotli]: - """ - When the client requesting an asset supports the Brotli compression algorithm, - Cloudflare will serve a Brotli compressed version of the asset. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/brotli", - body=await async_maybe_transform({"value": value}, brotli_edit_params.BrotliEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, - ), - cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Brotli]: - """ - When the client requesting an asset supports the Brotli compression algorithm, - Cloudflare will serve a Brotli compressed version of the asset. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/brotli", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Brotli]]._unwrapper, - ), - cast_to=cast(Type[Optional[Brotli]], ResultWrapper[Brotli]), - ) - - -class BrotliResourceWithRawResponse: - def __init__(self, brotli: BrotliResource) -> None: - self._brotli = brotli - - self.edit = to_raw_response_wrapper( - brotli.edit, - ) - self.get = to_raw_response_wrapper( - brotli.get, - ) - - -class AsyncBrotliResourceWithRawResponse: - def __init__(self, brotli: AsyncBrotliResource) -> None: - self._brotli = brotli - - self.edit = async_to_raw_response_wrapper( - brotli.edit, - ) - self.get = async_to_raw_response_wrapper( - brotli.get, - ) - - -class BrotliResourceWithStreamingResponse: - def __init__(self, brotli: BrotliResource) -> None: - self._brotli = brotli - - self.edit = to_streamed_response_wrapper( - brotli.edit, - ) - self.get = to_streamed_response_wrapper( - brotli.get, - ) - - -class AsyncBrotliResourceWithStreamingResponse: - def __init__(self, brotli: AsyncBrotliResource) -> None: - self._brotli = brotli - - self.edit = async_to_streamed_response_wrapper( - brotli.edit, - ) - self.get = async_to_streamed_response_wrapper( - brotli.get, - ) diff --git a/src/cloudflare/resources/zones/settings/browser_cache_ttl.py b/src/cloudflare/resources/zones/settings/browser_cache_ttl.py deleted file mode 100644 index 56eb8d8c62c..00000000000 --- a/src/cloudflare/resources/zones/settings/browser_cache_ttl.py +++ /dev/null @@ -1,334 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import browser_cache_ttl_edit_params -from ....types.zones.settings.browser_cache_ttl import BrowserCacheTTL - -__all__ = ["BrowserCacheTTLResource", "AsyncBrowserCacheTTLResource"] - - -class BrowserCacheTTLResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BrowserCacheTTLResourceWithRawResponse: - return BrowserCacheTTLResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BrowserCacheTTLResourceWithStreamingResponse: - return BrowserCacheTTLResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ], - # 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, - ) -> Optional[BrowserCacheTTL]: - """ - Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources - will remain on your visitors' computers. Cloudflare will honor any larger times - specified by your server. - (https://support.cloudflare.com/hc/en-us/articles/200168276). - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting - `Respect Existing Headers` - - 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 self._patch( - f"/zones/{zone_id}/settings/browser_cache_ttl", - body=maybe_transform({"value": value}, browser_cache_ttl_edit_params.BrowserCacheTTLEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BrowserCacheTTL]: - """ - Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources - will remain on your visitors' computers. Cloudflare will honor any larger times - specified by your server. - (https://support.cloudflare.com/hc/en-us/articles/200168276). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/browser_cache_ttl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), - ) - - -class AsyncBrowserCacheTTLResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBrowserCacheTTLResourceWithRawResponse: - return AsyncBrowserCacheTTLResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBrowserCacheTTLResourceWithStreamingResponse: - return AsyncBrowserCacheTTLResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ], - # 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, - ) -> Optional[BrowserCacheTTL]: - """ - Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources - will remain on your visitors' computers. Cloudflare will honor any larger times - specified by your server. - (https://support.cloudflare.com/hc/en-us/articles/200168276). - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting - `Respect Existing Headers` - - 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 await self._patch( - f"/zones/{zone_id}/settings/browser_cache_ttl", - body=await async_maybe_transform({"value": value}, browser_cache_ttl_edit_params.BrowserCacheTTLEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BrowserCacheTTL]: - """ - Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources - will remain on your visitors' computers. Cloudflare will honor any larger times - specified by your server. - (https://support.cloudflare.com/hc/en-us/articles/200168276). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/browser_cache_ttl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCacheTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCacheTTL]], ResultWrapper[BrowserCacheTTL]), - ) - - -class BrowserCacheTTLResourceWithRawResponse: - def __init__(self, browser_cache_ttl: BrowserCacheTTLResource) -> None: - self._browser_cache_ttl = browser_cache_ttl - - self.edit = to_raw_response_wrapper( - browser_cache_ttl.edit, - ) - self.get = to_raw_response_wrapper( - browser_cache_ttl.get, - ) - - -class AsyncBrowserCacheTTLResourceWithRawResponse: - def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTLResource) -> None: - self._browser_cache_ttl = browser_cache_ttl - - self.edit = async_to_raw_response_wrapper( - browser_cache_ttl.edit, - ) - self.get = async_to_raw_response_wrapper( - browser_cache_ttl.get, - ) - - -class BrowserCacheTTLResourceWithStreamingResponse: - def __init__(self, browser_cache_ttl: BrowserCacheTTLResource) -> None: - self._browser_cache_ttl = browser_cache_ttl - - self.edit = to_streamed_response_wrapper( - browser_cache_ttl.edit, - ) - self.get = to_streamed_response_wrapper( - browser_cache_ttl.get, - ) - - -class AsyncBrowserCacheTTLResourceWithStreamingResponse: - def __init__(self, browser_cache_ttl: AsyncBrowserCacheTTLResource) -> None: - self._browser_cache_ttl = browser_cache_ttl - - self.edit = async_to_streamed_response_wrapper( - browser_cache_ttl.edit, - ) - self.get = async_to_streamed_response_wrapper( - browser_cache_ttl.get, - ) diff --git a/src/cloudflare/resources/zones/settings/browser_check.py b/src/cloudflare/resources/zones/settings/browser_check.py deleted file mode 100644 index 20516575677..00000000000 --- a/src/cloudflare/resources/zones/settings/browser_check.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import browser_check_edit_params -from ....types.zones.settings.browser_check import BrowserCheck - -__all__ = ["BrowserCheckResource", "AsyncBrowserCheckResource"] - - -class BrowserCheckResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BrowserCheckResourceWithRawResponse: - return BrowserCheckResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BrowserCheckResourceWithStreamingResponse: - return BrowserCheckResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[BrowserCheck]: - """ - Browser Integrity Check is similar to Bad Behavior and looks for common HTTP - headers abused most commonly by spammers and denies access to your page. It will - also challenge visitors that do not have a user agent or a non standard user - agent (also commonly used by abuse bots, crawlers or visitors). - (https://support.cloudflare.com/hc/en-us/articles/200170086). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/browser_check", - body=maybe_transform({"value": value}, browser_check_edit_params.BrowserCheckEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BrowserCheck]: - """ - Browser Integrity Check is similar to Bad Behavior and looks for common HTTP - headers abused most commonly by spammers and denies access to your page. It will - also challenge visitors that do not have a user agent or a non standard user - agent (also commonly used by abuse bots, crawlers or visitors). - (https://support.cloudflare.com/hc/en-us/articles/200170086). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/browser_check", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), - ) - - -class AsyncBrowserCheckResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBrowserCheckResourceWithRawResponse: - return AsyncBrowserCheckResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBrowserCheckResourceWithStreamingResponse: - return AsyncBrowserCheckResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[BrowserCheck]: - """ - Browser Integrity Check is similar to Bad Behavior and looks for common HTTP - headers abused most commonly by spammers and denies access to your page. It will - also challenge visitors that do not have a user agent or a non standard user - agent (also commonly used by abuse bots, crawlers or visitors). - (https://support.cloudflare.com/hc/en-us/articles/200170086). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/browser_check", - body=await async_maybe_transform({"value": value}, browser_check_edit_params.BrowserCheckEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BrowserCheck]: - """ - Browser Integrity Check is similar to Bad Behavior and looks for common HTTP - headers abused most commonly by spammers and denies access to your page. It will - also challenge visitors that do not have a user agent or a non standard user - agent (also commonly used by abuse bots, crawlers or visitors). - (https://support.cloudflare.com/hc/en-us/articles/200170086). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/browser_check", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[BrowserCheck]]._unwrapper, - ), - cast_to=cast(Type[Optional[BrowserCheck]], ResultWrapper[BrowserCheck]), - ) - - -class BrowserCheckResourceWithRawResponse: - def __init__(self, browser_check: BrowserCheckResource) -> None: - self._browser_check = browser_check - - self.edit = to_raw_response_wrapper( - browser_check.edit, - ) - self.get = to_raw_response_wrapper( - browser_check.get, - ) - - -class AsyncBrowserCheckResourceWithRawResponse: - def __init__(self, browser_check: AsyncBrowserCheckResource) -> None: - self._browser_check = browser_check - - self.edit = async_to_raw_response_wrapper( - browser_check.edit, - ) - self.get = async_to_raw_response_wrapper( - browser_check.get, - ) - - -class BrowserCheckResourceWithStreamingResponse: - def __init__(self, browser_check: BrowserCheckResource) -> None: - self._browser_check = browser_check - - self.edit = to_streamed_response_wrapper( - browser_check.edit, - ) - self.get = to_streamed_response_wrapper( - browser_check.get, - ) - - -class AsyncBrowserCheckResourceWithStreamingResponse: - def __init__(self, browser_check: AsyncBrowserCheckResource) -> None: - self._browser_check = browser_check - - self.edit = async_to_streamed_response_wrapper( - browser_check.edit, - ) - self.get = async_to_streamed_response_wrapper( - browser_check.get, - ) diff --git a/src/cloudflare/resources/zones/settings/cache_level.py b/src/cloudflare/resources/zones/settings/cache_level.py deleted file mode 100644 index 444c3b71f2c..00000000000 --- a/src/cloudflare/resources/zones/settings/cache_level.py +++ /dev/null @@ -1,282 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import cache_level_edit_params -from ....types.zones.settings.cache_level import CacheLevel - -__all__ = ["CacheLevelResource", "AsyncCacheLevelResource"] - - -class CacheLevelResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CacheLevelResourceWithRawResponse: - return CacheLevelResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CacheLevelResourceWithStreamingResponse: - return CacheLevelResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["aggressive", "basic", "simplified"], - # 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, - ) -> Optional[CacheLevel]: - """Cache Level functions based off the setting level. - - The basic setting will cache - most static resources (i.e., css, images, and JavaScript). The simplified - setting will ignore the query string when delivering a cached resource. The - aggressive setting will cache all static resources, including ones with a query - string. (https://support.cloudflare.com/hc/en-us/articles/200168256). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/cache_level", - body=maybe_transform({"value": value}, cache_level_edit_params.CacheLevelEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CacheLevel]: - """Cache Level functions based off the setting level. - - The basic setting will cache - most static resources (i.e., css, images, and JavaScript). The simplified - setting will ignore the query string when delivering a cached resource. The - aggressive setting will cache all static resources, including ones with a query - string. (https://support.cloudflare.com/hc/en-us/articles/200168256). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/cache_level", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), - ) - - -class AsyncCacheLevelResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCacheLevelResourceWithRawResponse: - return AsyncCacheLevelResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCacheLevelResourceWithStreamingResponse: - return AsyncCacheLevelResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["aggressive", "basic", "simplified"], - # 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, - ) -> Optional[CacheLevel]: - """Cache Level functions based off the setting level. - - The basic setting will cache - most static resources (i.e., css, images, and JavaScript). The simplified - setting will ignore the query string when delivering a cached resource. The - aggressive setting will cache all static resources, including ones with a query - string. (https://support.cloudflare.com/hc/en-us/articles/200168256). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/cache_level", - body=await async_maybe_transform({"value": value}, cache_level_edit_params.CacheLevelEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CacheLevel]: - """Cache Level functions based off the setting level. - - The basic setting will cache - most static resources (i.e., css, images, and JavaScript). The simplified - setting will ignore the query string when delivering a cached resource. The - aggressive setting will cache all static resources, including ones with a query - string. (https://support.cloudflare.com/hc/en-us/articles/200168256). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/cache_level", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[CacheLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[CacheLevel]], ResultWrapper[CacheLevel]), - ) - - -class CacheLevelResourceWithRawResponse: - def __init__(self, cache_level: CacheLevelResource) -> None: - self._cache_level = cache_level - - self.edit = to_raw_response_wrapper( - cache_level.edit, - ) - self.get = to_raw_response_wrapper( - cache_level.get, - ) - - -class AsyncCacheLevelResourceWithRawResponse: - def __init__(self, cache_level: AsyncCacheLevelResource) -> None: - self._cache_level = cache_level - - self.edit = async_to_raw_response_wrapper( - cache_level.edit, - ) - self.get = async_to_raw_response_wrapper( - cache_level.get, - ) - - -class CacheLevelResourceWithStreamingResponse: - def __init__(self, cache_level: CacheLevelResource) -> None: - self._cache_level = cache_level - - self.edit = to_streamed_response_wrapper( - cache_level.edit, - ) - self.get = to_streamed_response_wrapper( - cache_level.get, - ) - - -class AsyncCacheLevelResourceWithStreamingResponse: - def __init__(self, cache_level: AsyncCacheLevelResource) -> None: - self._cache_level = cache_level - - self.edit = async_to_streamed_response_wrapper( - cache_level.edit, - ) - self.get = async_to_streamed_response_wrapper( - cache_level.get, - ) diff --git a/src/cloudflare/resources/zones/settings/challenge_ttl.py b/src/cloudflare/resources/zones/settings/challenge_ttl.py deleted file mode 100644 index 7730173627d..00000000000 --- a/src/cloudflare/resources/zones/settings/challenge_ttl.py +++ /dev/null @@ -1,278 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import challenge_ttl_edit_params -from ....types.zones.settings.challenge_ttl import ChallengeTTL - -__all__ = ["ChallengeTTLResource", "AsyncChallengeTTLResource"] - - -class ChallengeTTLResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ChallengeTTLResourceWithRawResponse: - return ChallengeTTLResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ChallengeTTLResourceWithStreamingResponse: - return ChallengeTTLResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal[300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000], - # 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, - ) -> Optional[ChallengeTTL]: - """ - Specify how long a visitor is allowed access to your site after successfully - completing a challenge (such as a CAPTCHA). After the TTL has expired the - visitor will have to complete a new challenge. We recommend a 15 - 45 minute - setting and will attempt to honor any setting above 45 minutes. - (https://support.cloudflare.com/hc/en-us/articles/200170136). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/challenge_ttl", - body=maybe_transform({"value": value}, challenge_ttl_edit_params.ChallengeTTLEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengeTTL]: - """ - Specify how long a visitor is allowed access to your site after successfully - completing a challenge (such as a CAPTCHA). After the TTL has expired the - visitor will have to complete a new challenge. We recommend a 15 - 45 minute - setting and will attempt to honor any setting above 45 minutes. - (https://support.cloudflare.com/hc/en-us/articles/200170136). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/challenge_ttl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), - ) - - -class AsyncChallengeTTLResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncChallengeTTLResourceWithRawResponse: - return AsyncChallengeTTLResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncChallengeTTLResourceWithStreamingResponse: - return AsyncChallengeTTLResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal[300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000], - # 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, - ) -> Optional[ChallengeTTL]: - """ - Specify how long a visitor is allowed access to your site after successfully - completing a challenge (such as a CAPTCHA). After the TTL has expired the - visitor will have to complete a new challenge. We recommend a 15 - 45 minute - setting and will attempt to honor any setting above 45 minutes. - (https://support.cloudflare.com/hc/en-us/articles/200170136). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/challenge_ttl", - body=await async_maybe_transform({"value": value}, challenge_ttl_edit_params.ChallengeTTLEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ChallengeTTL]: - """ - Specify how long a visitor is allowed access to your site after successfully - completing a challenge (such as a CAPTCHA). After the TTL has expired the - visitor will have to complete a new challenge. We recommend a 15 - 45 minute - setting and will attempt to honor any setting above 45 minutes. - (https://support.cloudflare.com/hc/en-us/articles/200170136). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/challenge_ttl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ChallengeTTL]]._unwrapper, - ), - cast_to=cast(Type[Optional[ChallengeTTL]], ResultWrapper[ChallengeTTL]), - ) - - -class ChallengeTTLResourceWithRawResponse: - def __init__(self, challenge_ttl: ChallengeTTLResource) -> None: - self._challenge_ttl = challenge_ttl - - self.edit = to_raw_response_wrapper( - challenge_ttl.edit, - ) - self.get = to_raw_response_wrapper( - challenge_ttl.get, - ) - - -class AsyncChallengeTTLResourceWithRawResponse: - def __init__(self, challenge_ttl: AsyncChallengeTTLResource) -> None: - self._challenge_ttl = challenge_ttl - - self.edit = async_to_raw_response_wrapper( - challenge_ttl.edit, - ) - self.get = async_to_raw_response_wrapper( - challenge_ttl.get, - ) - - -class ChallengeTTLResourceWithStreamingResponse: - def __init__(self, challenge_ttl: ChallengeTTLResource) -> None: - self._challenge_ttl = challenge_ttl - - self.edit = to_streamed_response_wrapper( - challenge_ttl.edit, - ) - self.get = to_streamed_response_wrapper( - challenge_ttl.get, - ) - - -class AsyncChallengeTTLResourceWithStreamingResponse: - def __init__(self, challenge_ttl: AsyncChallengeTTLResource) -> None: - self._challenge_ttl = challenge_ttl - - self.edit = async_to_streamed_response_wrapper( - challenge_ttl.edit, - ) - self.get = async_to_streamed_response_wrapper( - challenge_ttl.get, - ) diff --git a/src/cloudflare/resources/zones/settings/ciphers.py b/src/cloudflare/resources/zones/settings/ciphers.py deleted file mode 100644 index c17128d464a..00000000000 --- a/src/cloudflare/resources/zones/settings/ciphers.py +++ /dev/null @@ -1,261 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, 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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import cipher_edit_params -from ....types.zones.settings.ciphers import Ciphers - -__all__ = ["CiphersResource", "AsyncCiphersResource"] - - -class CiphersResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CiphersResourceWithRawResponse: - return CiphersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CiphersResourceWithStreamingResponse: - return CiphersResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: List[str], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Ciphers]: - """ - Changes ciphers setting. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/ciphers", - body=maybe_transform({"value": value}, cipher_edit_params.CipherEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, - ), - cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Ciphers]: - """ - Gets ciphers setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/ciphers", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, - ), - cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), - ) - - -class AsyncCiphersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCiphersResourceWithRawResponse: - return AsyncCiphersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCiphersResourceWithStreamingResponse: - return AsyncCiphersResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: List[str], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Ciphers]: - """ - Changes ciphers setting. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/ciphers", - body=await async_maybe_transform({"value": value}, cipher_edit_params.CipherEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, - ), - cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Ciphers]: - """ - Gets ciphers setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/ciphers", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Ciphers]]._unwrapper, - ), - cast_to=cast(Type[Optional[Ciphers]], ResultWrapper[Ciphers]), - ) - - -class CiphersResourceWithRawResponse: - def __init__(self, ciphers: CiphersResource) -> None: - self._ciphers = ciphers - - self.edit = to_raw_response_wrapper( - ciphers.edit, - ) - self.get = to_raw_response_wrapper( - ciphers.get, - ) - - -class AsyncCiphersResourceWithRawResponse: - def __init__(self, ciphers: AsyncCiphersResource) -> None: - self._ciphers = ciphers - - self.edit = async_to_raw_response_wrapper( - ciphers.edit, - ) - self.get = async_to_raw_response_wrapper( - ciphers.get, - ) - - -class CiphersResourceWithStreamingResponse: - def __init__(self, ciphers: CiphersResource) -> None: - self._ciphers = ciphers - - self.edit = to_streamed_response_wrapper( - ciphers.edit, - ) - self.get = to_streamed_response_wrapper( - ciphers.get, - ) - - -class AsyncCiphersResourceWithStreamingResponse: - def __init__(self, ciphers: AsyncCiphersResource) -> None: - self._ciphers = ciphers - - self.edit = async_to_streamed_response_wrapper( - ciphers.edit, - ) - self.get = async_to_streamed_response_wrapper( - ciphers.get, - ) diff --git a/src/cloudflare/resources/zones/settings/development_mode.py b/src/cloudflare/resources/zones/settings/development_mode.py deleted file mode 100644 index d5a609c139a..00000000000 --- a/src/cloudflare/resources/zones/settings/development_mode.py +++ /dev/null @@ -1,282 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import development_mode_edit_params -from ....types.zones.settings.development_mode import DevelopmentMode - -__all__ = ["DevelopmentModeResource", "AsyncDevelopmentModeResource"] - - -class DevelopmentModeResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DevelopmentModeResourceWithRawResponse: - return DevelopmentModeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DevelopmentModeResourceWithStreamingResponse: - return DevelopmentModeResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[DevelopmentMode]: - """ - Development Mode temporarily allows you to enter development mode for your - websites if you need to make changes to your site. This will bypass Cloudflare's - accelerated cache and slow down your site, but is useful if you are making - changes to cacheable content (like images, css, or JavaScript) and would like to - see those changes right away. Once entered, development mode will last for 3 - hours and then automatically toggle off. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/development_mode", - body=maybe_transform({"value": value}, development_mode_edit_params.DevelopmentModeEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, - ), - cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevelopmentMode]: - """ - Development Mode temporarily allows you to enter development mode for your - websites if you need to make changes to your site. This will bypass Cloudflare's - accelerated cache and slow down your site, but is useful if you are making - changes to cacheable content (like images, css, or JavaScript) and would like to - see those changes right away. Once entered, development mode will last for 3 - hours and then automatically toggle off. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/development_mode", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, - ), - cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), - ) - - -class AsyncDevelopmentModeResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDevelopmentModeResourceWithRawResponse: - return AsyncDevelopmentModeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDevelopmentModeResourceWithStreamingResponse: - return AsyncDevelopmentModeResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[DevelopmentMode]: - """ - Development Mode temporarily allows you to enter development mode for your - websites if you need to make changes to your site. This will bypass Cloudflare's - accelerated cache and slow down your site, but is useful if you are making - changes to cacheable content (like images, css, or JavaScript) and would like to - see those changes right away. Once entered, development mode will last for 3 - hours and then automatically toggle off. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/development_mode", - body=await async_maybe_transform({"value": value}, development_mode_edit_params.DevelopmentModeEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, - ), - cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DevelopmentMode]: - """ - Development Mode temporarily allows you to enter development mode for your - websites if you need to make changes to your site. This will bypass Cloudflare's - accelerated cache and slow down your site, but is useful if you are making - changes to cacheable content (like images, css, or JavaScript) and would like to - see those changes right away. Once entered, development mode will last for 3 - hours and then automatically toggle off. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/development_mode", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DevelopmentMode]]._unwrapper, - ), - cast_to=cast(Type[Optional[DevelopmentMode]], ResultWrapper[DevelopmentMode]), - ) - - -class DevelopmentModeResourceWithRawResponse: - def __init__(self, development_mode: DevelopmentModeResource) -> None: - self._development_mode = development_mode - - self.edit = to_raw_response_wrapper( - development_mode.edit, - ) - self.get = to_raw_response_wrapper( - development_mode.get, - ) - - -class AsyncDevelopmentModeResourceWithRawResponse: - def __init__(self, development_mode: AsyncDevelopmentModeResource) -> None: - self._development_mode = development_mode - - self.edit = async_to_raw_response_wrapper( - development_mode.edit, - ) - self.get = async_to_raw_response_wrapper( - development_mode.get, - ) - - -class DevelopmentModeResourceWithStreamingResponse: - def __init__(self, development_mode: DevelopmentModeResource) -> None: - self._development_mode = development_mode - - self.edit = to_streamed_response_wrapper( - development_mode.edit, - ) - self.get = to_streamed_response_wrapper( - development_mode.get, - ) - - -class AsyncDevelopmentModeResourceWithStreamingResponse: - def __init__(self, development_mode: AsyncDevelopmentModeResource) -> None: - self._development_mode = development_mode - - self.edit = async_to_streamed_response_wrapper( - development_mode.edit, - ) - self.get = async_to_streamed_response_wrapper( - development_mode.get, - ) diff --git a/src/cloudflare/resources/zones/settings/early_hints.py b/src/cloudflare/resources/zones/settings/early_hints.py deleted file mode 100644 index 4c751097ced..00000000000 --- a/src/cloudflare/resources/zones/settings/early_hints.py +++ /dev/null @@ -1,274 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import early_hint_edit_params -from ....types.zones.settings.early_hints import EarlyHints - -__all__ = ["EarlyHintsResource", "AsyncEarlyHintsResource"] - - -class EarlyHintsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EarlyHintsResourceWithRawResponse: - return EarlyHintsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EarlyHintsResourceWithStreamingResponse: - return EarlyHintsResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[EarlyHints]: - """ - When enabled, Cloudflare will attempt to speed up overall page loads by serving - `103` responses with `Link` headers from the final response. Refer to - [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for - more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/early_hints", - body=maybe_transform({"value": value}, early_hint_edit_params.EarlyHintEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, - ), - cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EarlyHints]: - """ - When enabled, Cloudflare will attempt to speed up overall page loads by serving - `103` responses with `Link` headers from the final response. Refer to - [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for - more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/early_hints", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, - ), - cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), - ) - - -class AsyncEarlyHintsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEarlyHintsResourceWithRawResponse: - return AsyncEarlyHintsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEarlyHintsResourceWithStreamingResponse: - return AsyncEarlyHintsResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[EarlyHints]: - """ - When enabled, Cloudflare will attempt to speed up overall page loads by serving - `103` responses with `Link` headers from the final response. Refer to - [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for - more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/early_hints", - body=await async_maybe_transform({"value": value}, early_hint_edit_params.EarlyHintEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, - ), - cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EarlyHints]: - """ - When enabled, Cloudflare will attempt to speed up overall page loads by serving - `103` responses with `Link` headers from the final response. Refer to - [Early Hints](https://developers.cloudflare.com/cache/about/early-hints) for - more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/early_hints", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EarlyHints]]._unwrapper, - ), - cast_to=cast(Type[Optional[EarlyHints]], ResultWrapper[EarlyHints]), - ) - - -class EarlyHintsResourceWithRawResponse: - def __init__(self, early_hints: EarlyHintsResource) -> None: - self._early_hints = early_hints - - self.edit = to_raw_response_wrapper( - early_hints.edit, - ) - self.get = to_raw_response_wrapper( - early_hints.get, - ) - - -class AsyncEarlyHintsResourceWithRawResponse: - def __init__(self, early_hints: AsyncEarlyHintsResource) -> None: - self._early_hints = early_hints - - self.edit = async_to_raw_response_wrapper( - early_hints.edit, - ) - self.get = async_to_raw_response_wrapper( - early_hints.get, - ) - - -class EarlyHintsResourceWithStreamingResponse: - def __init__(self, early_hints: EarlyHintsResource) -> None: - self._early_hints = early_hints - - self.edit = to_streamed_response_wrapper( - early_hints.edit, - ) - self.get = to_streamed_response_wrapper( - early_hints.get, - ) - - -class AsyncEarlyHintsResourceWithStreamingResponse: - def __init__(self, early_hints: AsyncEarlyHintsResource) -> None: - self._early_hints = early_hints - - self.edit = async_to_streamed_response_wrapper( - early_hints.edit, - ) - self.get = async_to_streamed_response_wrapper( - early_hints.get, - ) diff --git a/src/cloudflare/resources/zones/settings/email_obfuscation.py b/src/cloudflare/resources/zones/settings/email_obfuscation.py deleted file mode 100644 index da8a7e0e288..00000000000 --- a/src/cloudflare/resources/zones/settings/email_obfuscation.py +++ /dev/null @@ -1,268 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import email_obfuscation_edit_params -from ....types.zones.settings.email_obfuscation import EmailObfuscation - -__all__ = ["EmailObfuscationResource", "AsyncEmailObfuscationResource"] - - -class EmailObfuscationResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EmailObfuscationResourceWithRawResponse: - return EmailObfuscationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EmailObfuscationResourceWithStreamingResponse: - return EmailObfuscationResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[EmailObfuscation]: - """ - Encrypt email adresses on your web page from bots, while keeping them visible to - humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/email_obfuscation", - body=maybe_transform({"value": value}, email_obfuscation_edit_params.EmailObfuscationEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, - ), - cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EmailObfuscation]: - """ - Encrypt email adresses on your web page from bots, while keeping them visible to - humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/email_obfuscation", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, - ), - cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), - ) - - -class AsyncEmailObfuscationResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEmailObfuscationResourceWithRawResponse: - return AsyncEmailObfuscationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEmailObfuscationResourceWithStreamingResponse: - return AsyncEmailObfuscationResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[EmailObfuscation]: - """ - Encrypt email adresses on your web page from bots, while keeping them visible to - humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/email_obfuscation", - body=await async_maybe_transform( - {"value": value}, email_obfuscation_edit_params.EmailObfuscationEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, - ), - cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EmailObfuscation]: - """ - Encrypt email adresses on your web page from bots, while keeping them visible to - humans. (https://support.cloudflare.com/hc/en-us/articles/200170016). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/email_obfuscation", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EmailObfuscation]]._unwrapper, - ), - cast_to=cast(Type[Optional[EmailObfuscation]], ResultWrapper[EmailObfuscation]), - ) - - -class EmailObfuscationResourceWithRawResponse: - def __init__(self, email_obfuscation: EmailObfuscationResource) -> None: - self._email_obfuscation = email_obfuscation - - self.edit = to_raw_response_wrapper( - email_obfuscation.edit, - ) - self.get = to_raw_response_wrapper( - email_obfuscation.get, - ) - - -class AsyncEmailObfuscationResourceWithRawResponse: - def __init__(self, email_obfuscation: AsyncEmailObfuscationResource) -> None: - self._email_obfuscation = email_obfuscation - - self.edit = async_to_raw_response_wrapper( - email_obfuscation.edit, - ) - self.get = async_to_raw_response_wrapper( - email_obfuscation.get, - ) - - -class EmailObfuscationResourceWithStreamingResponse: - def __init__(self, email_obfuscation: EmailObfuscationResource) -> None: - self._email_obfuscation = email_obfuscation - - self.edit = to_streamed_response_wrapper( - email_obfuscation.edit, - ) - self.get = to_streamed_response_wrapper( - email_obfuscation.get, - ) - - -class AsyncEmailObfuscationResourceWithStreamingResponse: - def __init__(self, email_obfuscation: AsyncEmailObfuscationResource) -> None: - self._email_obfuscation = email_obfuscation - - self.edit = async_to_streamed_response_wrapper( - email_obfuscation.edit, - ) - self.get = async_to_streamed_response_wrapper( - email_obfuscation.get, - ) diff --git a/src/cloudflare/resources/zones/settings/h2_prioritization.py b/src/cloudflare/resources/zones/settings/h2_prioritization.py deleted file mode 100644 index 51c445962bc..00000000000 --- a/src/cloudflare/resources/zones/settings/h2_prioritization.py +++ /dev/null @@ -1,268 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import H2Prioritization, h2_prioritization_edit_params -from ....types.zones.settings.h2_prioritization import H2Prioritization -from ....types.zones.settings.h2_prioritization_param import H2PrioritizationParam - -__all__ = ["H2PrioritizationResource", "AsyncH2PrioritizationResource"] - - -class H2PrioritizationResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> H2PrioritizationResourceWithRawResponse: - return H2PrioritizationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> H2PrioritizationResourceWithStreamingResponse: - return H2PrioritizationResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: H2PrioritizationParam, - # 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, - ) -> Optional[H2Prioritization]: - """ - Gets HTTP/2 Edge Prioritization setting. - - Args: - zone_id: Identifier - - value: HTTP/2 Edge Prioritization optimises the delivery of resources served through - HTTP/2 to improve page load performance. It also supports fine control of - content delivery when used in conjunction with Workers. - - 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 self._patch( - f"/zones/{zone_id}/settings/h2_prioritization", - body=maybe_transform({"value": value}, h2_prioritization_edit_params.H2PrioritizationEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, - ), - cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[H2Prioritization]: - """ - Gets HTTP/2 Edge Prioritization setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/h2_prioritization", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, - ), - cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), - ) - - -class AsyncH2PrioritizationResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncH2PrioritizationResourceWithRawResponse: - return AsyncH2PrioritizationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncH2PrioritizationResourceWithStreamingResponse: - return AsyncH2PrioritizationResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: H2PrioritizationParam, - # 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, - ) -> Optional[H2Prioritization]: - """ - Gets HTTP/2 Edge Prioritization setting. - - Args: - zone_id: Identifier - - value: HTTP/2 Edge Prioritization optimises the delivery of resources served through - HTTP/2 to improve page load performance. It also supports fine control of - content delivery when used in conjunction with Workers. - - 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 await self._patch( - f"/zones/{zone_id}/settings/h2_prioritization", - body=await async_maybe_transform( - {"value": value}, h2_prioritization_edit_params.H2PrioritizationEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, - ), - cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[H2Prioritization]: - """ - Gets HTTP/2 Edge Prioritization setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/h2_prioritization", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[H2Prioritization]]._unwrapper, - ), - cast_to=cast(Type[Optional[H2Prioritization]], ResultWrapper[H2Prioritization]), - ) - - -class H2PrioritizationResourceWithRawResponse: - def __init__(self, h2_prioritization: H2PrioritizationResource) -> None: - self._h2_prioritization = h2_prioritization - - self.edit = to_raw_response_wrapper( - h2_prioritization.edit, - ) - self.get = to_raw_response_wrapper( - h2_prioritization.get, - ) - - -class AsyncH2PrioritizationResourceWithRawResponse: - def __init__(self, h2_prioritization: AsyncH2PrioritizationResource) -> None: - self._h2_prioritization = h2_prioritization - - self.edit = async_to_raw_response_wrapper( - h2_prioritization.edit, - ) - self.get = async_to_raw_response_wrapper( - h2_prioritization.get, - ) - - -class H2PrioritizationResourceWithStreamingResponse: - def __init__(self, h2_prioritization: H2PrioritizationResource) -> None: - self._h2_prioritization = h2_prioritization - - self.edit = to_streamed_response_wrapper( - h2_prioritization.edit, - ) - self.get = to_streamed_response_wrapper( - h2_prioritization.get, - ) - - -class AsyncH2PrioritizationResourceWithStreamingResponse: - def __init__(self, h2_prioritization: AsyncH2PrioritizationResource) -> None: - self._h2_prioritization = h2_prioritization - - self.edit = async_to_streamed_response_wrapper( - h2_prioritization.edit, - ) - self.get = async_to_streamed_response_wrapper( - h2_prioritization.get, - ) diff --git a/src/cloudflare/resources/zones/settings/hotlink_protection.py b/src/cloudflare/resources/zones/settings/hotlink_protection.py deleted file mode 100644 index 0b42ae6747d..00000000000 --- a/src/cloudflare/resources/zones/settings/hotlink_protection.py +++ /dev/null @@ -1,288 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import hotlink_protection_edit_params -from ....types.zones.settings.hotlink_protection import HotlinkProtection - -__all__ = ["HotlinkProtectionResource", "AsyncHotlinkProtectionResource"] - - -class HotlinkProtectionResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> HotlinkProtectionResourceWithRawResponse: - return HotlinkProtectionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> HotlinkProtectionResourceWithStreamingResponse: - return HotlinkProtectionResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[HotlinkProtection]: - """ - When enabled, the Hotlink Protection option ensures that other sites cannot suck - up your bandwidth by building pages that use images hosted on your site. Anytime - a request for an image on your site hits Cloudflare, we check to ensure that - it's not another site requesting them. People will still be able to download and - view images from your page, but other sites won't be able to steal them for use - on their own pages. - (https://support.cloudflare.com/hc/en-us/articles/200170026). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/hotlink_protection", - body=maybe_transform({"value": value}, hotlink_protection_edit_params.HotlinkProtectionEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, - ), - cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HotlinkProtection]: - """ - When enabled, the Hotlink Protection option ensures that other sites cannot suck - up your bandwidth by building pages that use images hosted on your site. Anytime - a request for an image on your site hits Cloudflare, we check to ensure that - it's not another site requesting them. People will still be able to download and - view images from your page, but other sites won't be able to steal them for use - on their own pages. - (https://support.cloudflare.com/hc/en-us/articles/200170026). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/hotlink_protection", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, - ), - cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), - ) - - -class AsyncHotlinkProtectionResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncHotlinkProtectionResourceWithRawResponse: - return AsyncHotlinkProtectionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncHotlinkProtectionResourceWithStreamingResponse: - return AsyncHotlinkProtectionResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[HotlinkProtection]: - """ - When enabled, the Hotlink Protection option ensures that other sites cannot suck - up your bandwidth by building pages that use images hosted on your site. Anytime - a request for an image on your site hits Cloudflare, we check to ensure that - it's not another site requesting them. People will still be able to download and - view images from your page, but other sites won't be able to steal them for use - on their own pages. - (https://support.cloudflare.com/hc/en-us/articles/200170026). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/hotlink_protection", - body=await async_maybe_transform( - {"value": value}, hotlink_protection_edit_params.HotlinkProtectionEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, - ), - cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HotlinkProtection]: - """ - When enabled, the Hotlink Protection option ensures that other sites cannot suck - up your bandwidth by building pages that use images hosted on your site. Anytime - a request for an image on your site hits Cloudflare, we check to ensure that - it's not another site requesting them. People will still be able to download and - view images from your page, but other sites won't be able to steal them for use - on their own pages. - (https://support.cloudflare.com/hc/en-us/articles/200170026). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/hotlink_protection", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HotlinkProtection]]._unwrapper, - ), - cast_to=cast(Type[Optional[HotlinkProtection]], ResultWrapper[HotlinkProtection]), - ) - - -class HotlinkProtectionResourceWithRawResponse: - def __init__(self, hotlink_protection: HotlinkProtectionResource) -> None: - self._hotlink_protection = hotlink_protection - - self.edit = to_raw_response_wrapper( - hotlink_protection.edit, - ) - self.get = to_raw_response_wrapper( - hotlink_protection.get, - ) - - -class AsyncHotlinkProtectionResourceWithRawResponse: - def __init__(self, hotlink_protection: AsyncHotlinkProtectionResource) -> None: - self._hotlink_protection = hotlink_protection - - self.edit = async_to_raw_response_wrapper( - hotlink_protection.edit, - ) - self.get = async_to_raw_response_wrapper( - hotlink_protection.get, - ) - - -class HotlinkProtectionResourceWithStreamingResponse: - def __init__(self, hotlink_protection: HotlinkProtectionResource) -> None: - self._hotlink_protection = hotlink_protection - - self.edit = to_streamed_response_wrapper( - hotlink_protection.edit, - ) - self.get = to_streamed_response_wrapper( - hotlink_protection.get, - ) - - -class AsyncHotlinkProtectionResourceWithStreamingResponse: - def __init__(self, hotlink_protection: AsyncHotlinkProtectionResource) -> None: - self._hotlink_protection = hotlink_protection - - self.edit = async_to_streamed_response_wrapper( - hotlink_protection.edit, - ) - self.get = async_to_streamed_response_wrapper( - hotlink_protection.get, - ) diff --git a/src/cloudflare/resources/zones/settings/http2.py b/src/cloudflare/resources/zones/settings/http2.py deleted file mode 100644 index 8b545d2e20d..00000000000 --- a/src/cloudflare/resources/zones/settings/http2.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import http2_edit_params -from ....types.zones.settings.http2 import HTTP2 - -__all__ = ["HTTP2Resource", "AsyncHTTP2Resource"] - - -class HTTP2Resource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> HTTP2ResourceWithRawResponse: - return HTTP2ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> HTTP2ResourceWithStreamingResponse: - return HTTP2ResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[HTTP2]: - """ - Value of the HTTP2 setting. - - Args: - zone_id: Identifier - - value: Value of the HTTP2 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 self._patch( - f"/zones/{zone_id}/settings/http2", - body=maybe_transform({"value": value}, http2_edit_params.HTTP2EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HTTP2]: - """ - Value of the HTTP2 setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/http2", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), - ) - - -class AsyncHTTP2Resource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncHTTP2ResourceWithRawResponse: - return AsyncHTTP2ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncHTTP2ResourceWithStreamingResponse: - return AsyncHTTP2ResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[HTTP2]: - """ - Value of the HTTP2 setting. - - Args: - zone_id: Identifier - - value: Value of the HTTP2 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 await self._patch( - f"/zones/{zone_id}/settings/http2", - body=await async_maybe_transform({"value": value}, http2_edit_params.HTTP2EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HTTP2]: - """ - Value of the HTTP2 setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/http2", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP2]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP2]], ResultWrapper[HTTP2]), - ) - - -class HTTP2ResourceWithRawResponse: - def __init__(self, http2: HTTP2Resource) -> None: - self._http2 = http2 - - self.edit = to_raw_response_wrapper( - http2.edit, - ) - self.get = to_raw_response_wrapper( - http2.get, - ) - - -class AsyncHTTP2ResourceWithRawResponse: - def __init__(self, http2: AsyncHTTP2Resource) -> None: - self._http2 = http2 - - self.edit = async_to_raw_response_wrapper( - http2.edit, - ) - self.get = async_to_raw_response_wrapper( - http2.get, - ) - - -class HTTP2ResourceWithStreamingResponse: - def __init__(self, http2: HTTP2Resource) -> None: - self._http2 = http2 - - self.edit = to_streamed_response_wrapper( - http2.edit, - ) - self.get = to_streamed_response_wrapper( - http2.get, - ) - - -class AsyncHTTP2ResourceWithStreamingResponse: - def __init__(self, http2: AsyncHTTP2Resource) -> None: - self._http2 = http2 - - self.edit = async_to_streamed_response_wrapper( - http2.edit, - ) - self.get = async_to_streamed_response_wrapper( - http2.get, - ) diff --git a/src/cloudflare/resources/zones/settings/http3.py b/src/cloudflare/resources/zones/settings/http3.py deleted file mode 100644 index cd32293b83a..00000000000 --- a/src/cloudflare/resources/zones/settings/http3.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import http3_edit_params -from ....types.zones.settings.http3 import HTTP3 - -__all__ = ["HTTP3Resource", "AsyncHTTP3Resource"] - - -class HTTP3Resource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> HTTP3ResourceWithRawResponse: - return HTTP3ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> HTTP3ResourceWithStreamingResponse: - return HTTP3ResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[HTTP3]: - """ - Value of the HTTP3 setting. - - Args: - zone_id: Identifier - - value: Value of the HTTP3 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 self._patch( - f"/zones/{zone_id}/settings/http3", - body=maybe_transform({"value": value}, http3_edit_params.HTTP3EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HTTP3]: - """ - Value of the HTTP3 setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/http3", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), - ) - - -class AsyncHTTP3Resource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncHTTP3ResourceWithRawResponse: - return AsyncHTTP3ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncHTTP3ResourceWithStreamingResponse: - return AsyncHTTP3ResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[HTTP3]: - """ - Value of the HTTP3 setting. - - Args: - zone_id: Identifier - - value: Value of the HTTP3 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 await self._patch( - f"/zones/{zone_id}/settings/http3", - body=await async_maybe_transform({"value": value}, http3_edit_params.HTTP3EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HTTP3]: - """ - Value of the HTTP3 setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/http3", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[HTTP3]]._unwrapper, - ), - cast_to=cast(Type[Optional[HTTP3]], ResultWrapper[HTTP3]), - ) - - -class HTTP3ResourceWithRawResponse: - def __init__(self, http3: HTTP3Resource) -> None: - self._http3 = http3 - - self.edit = to_raw_response_wrapper( - http3.edit, - ) - self.get = to_raw_response_wrapper( - http3.get, - ) - - -class AsyncHTTP3ResourceWithRawResponse: - def __init__(self, http3: AsyncHTTP3Resource) -> None: - self._http3 = http3 - - self.edit = async_to_raw_response_wrapper( - http3.edit, - ) - self.get = async_to_raw_response_wrapper( - http3.get, - ) - - -class HTTP3ResourceWithStreamingResponse: - def __init__(self, http3: HTTP3Resource) -> None: - self._http3 = http3 - - self.edit = to_streamed_response_wrapper( - http3.edit, - ) - self.get = to_streamed_response_wrapper( - http3.get, - ) - - -class AsyncHTTP3ResourceWithStreamingResponse: - def __init__(self, http3: AsyncHTTP3Resource) -> None: - self._http3 = http3 - - self.edit = async_to_streamed_response_wrapper( - http3.edit, - ) - self.get = async_to_streamed_response_wrapper( - http3.get, - ) diff --git a/src/cloudflare/resources/zones/settings/image_resizing.py b/src/cloudflare/resources/zones/settings/image_resizing.py deleted file mode 100644 index 417638b4d67..00000000000 --- a/src/cloudflare/resources/zones/settings/image_resizing.py +++ /dev/null @@ -1,280 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import ImageResizing, image_resizing_edit_params -from ....types.zones.settings.image_resizing import ImageResizing -from ....types.zones.settings.image_resizing_param import ImageResizingParam - -__all__ = ["ImageResizingResource", "AsyncImageResizingResource"] - - -class ImageResizingResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ImageResizingResourceWithRawResponse: - return ImageResizingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ImageResizingResourceWithStreamingResponse: - return ImageResizingResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: ImageResizingParam, - # 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, - ) -> Optional[ImageResizing]: - """ - Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - - Args: - zone_id: Identifier - - value: Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - - 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 self._patch( - f"/zones/{zone_id}/settings/image_resizing", - body=maybe_transform({"value": value}, image_resizing_edit_params.ImageResizingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, - ), - cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ImageResizing]: - """ - Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/image_resizing", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, - ), - cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), - ) - - -class AsyncImageResizingResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncImageResizingResourceWithRawResponse: - return AsyncImageResizingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncImageResizingResourceWithStreamingResponse: - return AsyncImageResizingResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: ImageResizingParam, - # 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, - ) -> Optional[ImageResizing]: - """ - Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - - Args: - zone_id: Identifier - - value: Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - - 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 await self._patch( - f"/zones/{zone_id}/settings/image_resizing", - body=await async_maybe_transform({"value": value}, image_resizing_edit_params.ImageResizingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, - ), - cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ImageResizing]: - """ - Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/image_resizing", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ImageResizing]]._unwrapper, - ), - cast_to=cast(Type[Optional[ImageResizing]], ResultWrapper[ImageResizing]), - ) - - -class ImageResizingResourceWithRawResponse: - def __init__(self, image_resizing: ImageResizingResource) -> None: - self._image_resizing = image_resizing - - self.edit = to_raw_response_wrapper( - image_resizing.edit, - ) - self.get = to_raw_response_wrapper( - image_resizing.get, - ) - - -class AsyncImageResizingResourceWithRawResponse: - def __init__(self, image_resizing: AsyncImageResizingResource) -> None: - self._image_resizing = image_resizing - - self.edit = async_to_raw_response_wrapper( - image_resizing.edit, - ) - self.get = async_to_raw_response_wrapper( - image_resizing.get, - ) - - -class ImageResizingResourceWithStreamingResponse: - def __init__(self, image_resizing: ImageResizingResource) -> None: - self._image_resizing = image_resizing - - self.edit = to_streamed_response_wrapper( - image_resizing.edit, - ) - self.get = to_streamed_response_wrapper( - image_resizing.get, - ) - - -class AsyncImageResizingResourceWithStreamingResponse: - def __init__(self, image_resizing: AsyncImageResizingResource) -> None: - self._image_resizing = image_resizing - - self.edit = async_to_streamed_response_wrapper( - image_resizing.edit, - ) - self.get = async_to_streamed_response_wrapper( - image_resizing.get, - ) diff --git a/src/cloudflare/resources/zones/settings/ip_geolocation.py b/src/cloudflare/resources/zones/settings/ip_geolocation.py deleted file mode 100644 index e46ca0373be..00000000000 --- a/src/cloudflare/resources/zones/settings/ip_geolocation.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import ip_geolocation_edit_params -from ....types.zones.settings.ip_geolocation import IPGeolocation - -__all__ = ["IPGeolocationResource", "AsyncIPGeolocationResource"] - - -class IPGeolocationResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> IPGeolocationResourceWithRawResponse: - return IPGeolocationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> IPGeolocationResourceWithStreamingResponse: - return IPGeolocationResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[IPGeolocation]: - """ - Enable IP Geolocation to have Cloudflare geolocate visitors to your website and - pass the country code to you. - (https://support.cloudflare.com/hc/en-us/articles/200168236). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/ip_geolocation", - body=maybe_transform({"value": value}, ip_geolocation_edit_params.IPGeolocationEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IPGeolocation]: - """ - Enable IP Geolocation to have Cloudflare geolocate visitors to your website and - pass the country code to you. - (https://support.cloudflare.com/hc/en-us/articles/200168236). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/ip_geolocation", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), - ) - - -class AsyncIPGeolocationResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncIPGeolocationResourceWithRawResponse: - return AsyncIPGeolocationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncIPGeolocationResourceWithStreamingResponse: - return AsyncIPGeolocationResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[IPGeolocation]: - """ - Enable IP Geolocation to have Cloudflare geolocate visitors to your website and - pass the country code to you. - (https://support.cloudflare.com/hc/en-us/articles/200168236). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/ip_geolocation", - body=await async_maybe_transform({"value": value}, ip_geolocation_edit_params.IPGeolocationEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IPGeolocation]: - """ - Enable IP Geolocation to have Cloudflare geolocate visitors to your website and - pass the country code to you. - (https://support.cloudflare.com/hc/en-us/articles/200168236). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/ip_geolocation", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPGeolocation]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPGeolocation]], ResultWrapper[IPGeolocation]), - ) - - -class IPGeolocationResourceWithRawResponse: - def __init__(self, ip_geolocation: IPGeolocationResource) -> None: - self._ip_geolocation = ip_geolocation - - self.edit = to_raw_response_wrapper( - ip_geolocation.edit, - ) - self.get = to_raw_response_wrapper( - ip_geolocation.get, - ) - - -class AsyncIPGeolocationResourceWithRawResponse: - def __init__(self, ip_geolocation: AsyncIPGeolocationResource) -> None: - self._ip_geolocation = ip_geolocation - - self.edit = async_to_raw_response_wrapper( - ip_geolocation.edit, - ) - self.get = async_to_raw_response_wrapper( - ip_geolocation.get, - ) - - -class IPGeolocationResourceWithStreamingResponse: - def __init__(self, ip_geolocation: IPGeolocationResource) -> None: - self._ip_geolocation = ip_geolocation - - self.edit = to_streamed_response_wrapper( - ip_geolocation.edit, - ) - self.get = to_streamed_response_wrapper( - ip_geolocation.get, - ) - - -class AsyncIPGeolocationResourceWithStreamingResponse: - def __init__(self, ip_geolocation: AsyncIPGeolocationResource) -> None: - self._ip_geolocation = ip_geolocation - - self.edit = async_to_streamed_response_wrapper( - ip_geolocation.edit, - ) - self.get = async_to_streamed_response_wrapper( - ip_geolocation.get, - ) diff --git a/src/cloudflare/resources/zones/settings/ipv6.py b/src/cloudflare/resources/zones/settings/ipv6.py deleted file mode 100644 index 5427997cfb8..00000000000 --- a/src/cloudflare/resources/zones/settings/ipv6.py +++ /dev/null @@ -1,266 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import ipv6_edit_params -from ....types.zones.settings.ipv6 import IPV6 - -__all__ = ["IPV6Resource", "AsyncIPV6Resource"] - - -class IPV6Resource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> IPV6ResourceWithRawResponse: - return IPV6ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> IPV6ResourceWithStreamingResponse: - return IPV6ResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[IPV6]: - """ - Enable IPv6 on all subdomains that are Cloudflare enabled. - (https://support.cloudflare.com/hc/en-us/articles/200168586). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/ipv6", - body=maybe_transform({"value": value}, ipv6_edit_params.IPV6EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IPV6]: - """ - Enable IPv6 on all subdomains that are Cloudflare enabled. - (https://support.cloudflare.com/hc/en-us/articles/200168586). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/ipv6", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), - ) - - -class AsyncIPV6Resource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncIPV6ResourceWithRawResponse: - return AsyncIPV6ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncIPV6ResourceWithStreamingResponse: - return AsyncIPV6ResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[IPV6]: - """ - Enable IPv6 on all subdomains that are Cloudflare enabled. - (https://support.cloudflare.com/hc/en-us/articles/200168586). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/ipv6", - body=await async_maybe_transform({"value": value}, ipv6_edit_params.IPV6EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IPV6]: - """ - Enable IPv6 on all subdomains that are Cloudflare enabled. - (https://support.cloudflare.com/hc/en-us/articles/200168586). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/ipv6", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[IPV6]]._unwrapper, - ), - cast_to=cast(Type[Optional[IPV6]], ResultWrapper[IPV6]), - ) - - -class IPV6ResourceWithRawResponse: - def __init__(self, ipv6: IPV6Resource) -> None: - self._ipv6 = ipv6 - - self.edit = to_raw_response_wrapper( - ipv6.edit, - ) - self.get = to_raw_response_wrapper( - ipv6.get, - ) - - -class AsyncIPV6ResourceWithRawResponse: - def __init__(self, ipv6: AsyncIPV6Resource) -> None: - self._ipv6 = ipv6 - - self.edit = async_to_raw_response_wrapper( - ipv6.edit, - ) - self.get = async_to_raw_response_wrapper( - ipv6.get, - ) - - -class IPV6ResourceWithStreamingResponse: - def __init__(self, ipv6: IPV6Resource) -> None: - self._ipv6 = ipv6 - - self.edit = to_streamed_response_wrapper( - ipv6.edit, - ) - self.get = to_streamed_response_wrapper( - ipv6.get, - ) - - -class AsyncIPV6ResourceWithStreamingResponse: - def __init__(self, ipv6: AsyncIPV6Resource) -> None: - self._ipv6 = ipv6 - - self.edit = async_to_streamed_response_wrapper( - ipv6.edit, - ) - self.get = async_to_streamed_response_wrapper( - ipv6.get, - ) diff --git a/src/cloudflare/resources/zones/settings/min_tls_version.py b/src/cloudflare/resources/zones/settings/min_tls_version.py deleted file mode 100644 index e497eb57709..00000000000 --- a/src/cloudflare/resources/zones/settings/min_tls_version.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import min_tls_version_edit_params -from ....types.zones.settings.min_tls_version import MinTLSVersion - -__all__ = ["MinTLSVersionResource", "AsyncMinTLSVersionResource"] - - -class MinTLSVersionResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MinTLSVersionResourceWithRawResponse: - return MinTLSVersionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MinTLSVersionResourceWithStreamingResponse: - return MinTLSVersionResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["1.0", "1.1", "1.2", "1.3"], - # 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, - ) -> Optional[MinTLSVersion]: - """ - Changes Minimum TLS Version setting. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/min_tls_version", - body=maybe_transform({"value": value}, min_tls_version_edit_params.MinTLSVersionEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, - ), - cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MinTLSVersion]: - """ - Gets Minimum TLS Version setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/min_tls_version", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, - ), - cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), - ) - - -class AsyncMinTLSVersionResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMinTLSVersionResourceWithRawResponse: - return AsyncMinTLSVersionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMinTLSVersionResourceWithStreamingResponse: - return AsyncMinTLSVersionResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["1.0", "1.1", "1.2", "1.3"], - # 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, - ) -> Optional[MinTLSVersion]: - """ - Changes Minimum TLS Version setting. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/min_tls_version", - body=await async_maybe_transform({"value": value}, min_tls_version_edit_params.MinTLSVersionEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, - ), - cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MinTLSVersion]: - """ - Gets Minimum TLS Version setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/min_tls_version", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MinTLSVersion]]._unwrapper, - ), - cast_to=cast(Type[Optional[MinTLSVersion]], ResultWrapper[MinTLSVersion]), - ) - - -class MinTLSVersionResourceWithRawResponse: - def __init__(self, min_tls_version: MinTLSVersionResource) -> None: - self._min_tls_version = min_tls_version - - self.edit = to_raw_response_wrapper( - min_tls_version.edit, - ) - self.get = to_raw_response_wrapper( - min_tls_version.get, - ) - - -class AsyncMinTLSVersionResourceWithRawResponse: - def __init__(self, min_tls_version: AsyncMinTLSVersionResource) -> None: - self._min_tls_version = min_tls_version - - self.edit = async_to_raw_response_wrapper( - min_tls_version.edit, - ) - self.get = async_to_raw_response_wrapper( - min_tls_version.get, - ) - - -class MinTLSVersionResourceWithStreamingResponse: - def __init__(self, min_tls_version: MinTLSVersionResource) -> None: - self._min_tls_version = min_tls_version - - self.edit = to_streamed_response_wrapper( - min_tls_version.edit, - ) - self.get = to_streamed_response_wrapper( - min_tls_version.get, - ) - - -class AsyncMinTLSVersionResourceWithStreamingResponse: - def __init__(self, min_tls_version: AsyncMinTLSVersionResource) -> None: - self._min_tls_version = min_tls_version - - self.edit = async_to_streamed_response_wrapper( - min_tls_version.edit, - ) - self.get = async_to_streamed_response_wrapper( - min_tls_version.get, - ) diff --git a/src/cloudflare/resources/zones/settings/minify.py b/src/cloudflare/resources/zones/settings/minify.py deleted file mode 100644 index 695214c16ce..00000000000 --- a/src/cloudflare/resources/zones/settings/minify.py +++ /dev/null @@ -1,273 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import minify_edit_params -from ....types.zones.settings.minify import Minify - -__all__ = ["MinifyResource", "AsyncMinifyResource"] - - -class MinifyResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MinifyResourceWithRawResponse: - return MinifyResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MinifyResourceWithStreamingResponse: - return MinifyResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: minify_edit_params.Value, - # 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, - ) -> Optional[Minify]: - """Automatically minify certain assets for your website. - - Refer to - [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) - for more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/minify", - body=maybe_transform({"value": value}, minify_edit_params.MinifyEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Minify]]._unwrapper, - ), - cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Minify]: - """Automatically minify certain assets for your website. - - Refer to - [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/minify", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Minify]]._unwrapper, - ), - cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), - ) - - -class AsyncMinifyResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMinifyResourceWithRawResponse: - return AsyncMinifyResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMinifyResourceWithStreamingResponse: - return AsyncMinifyResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: minify_edit_params.Value, - # 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, - ) -> Optional[Minify]: - """Automatically minify certain assets for your website. - - Refer to - [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) - for more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/minify", - body=await async_maybe_transform({"value": value}, minify_edit_params.MinifyEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Minify]]._unwrapper, - ), - cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Minify]: - """Automatically minify certain assets for your website. - - Refer to - [Using Cloudflare Auto Minify](https://support.cloudflare.com/hc/en-us/articles/200168196) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/minify", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Minify]]._unwrapper, - ), - cast_to=cast(Type[Optional[Minify]], ResultWrapper[Minify]), - ) - - -class MinifyResourceWithRawResponse: - def __init__(self, minify: MinifyResource) -> None: - self._minify = minify - - self.edit = to_raw_response_wrapper( - minify.edit, - ) - self.get = to_raw_response_wrapper( - minify.get, - ) - - -class AsyncMinifyResourceWithRawResponse: - def __init__(self, minify: AsyncMinifyResource) -> None: - self._minify = minify - - self.edit = async_to_raw_response_wrapper( - minify.edit, - ) - self.get = async_to_raw_response_wrapper( - minify.get, - ) - - -class MinifyResourceWithStreamingResponse: - def __init__(self, minify: MinifyResource) -> None: - self._minify = minify - - self.edit = to_streamed_response_wrapper( - minify.edit, - ) - self.get = to_streamed_response_wrapper( - minify.get, - ) - - -class AsyncMinifyResourceWithStreamingResponse: - def __init__(self, minify: AsyncMinifyResource) -> None: - self._minify = minify - - self.edit = async_to_streamed_response_wrapper( - minify.edit, - ) - self.get = async_to_streamed_response_wrapper( - minify.get, - ) diff --git a/src/cloudflare/resources/zones/settings/mirage.py b/src/cloudflare/resources/zones/settings/mirage.py deleted file mode 100644 index 3116f40060c..00000000000 --- a/src/cloudflare/resources/zones/settings/mirage.py +++ /dev/null @@ -1,274 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import mirage_edit_params -from ....types.zones.settings.mirage import Mirage - -__all__ = ["MirageResource", "AsyncMirageResource"] - - -class MirageResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MirageResourceWithRawResponse: - return MirageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MirageResourceWithStreamingResponse: - return MirageResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[Mirage]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our - [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more - information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/mirage", - body=maybe_transform({"value": value}, mirage_edit_params.MirageEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, - ), - cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Mirage]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our - [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more - information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/mirage", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, - ), - cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), - ) - - -class AsyncMirageResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMirageResourceWithRawResponse: - return AsyncMirageResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMirageResourceWithStreamingResponse: - return AsyncMirageResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[Mirage]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our - [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more - information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/mirage", - body=await async_maybe_transform({"value": value}, mirage_edit_params.MirageEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, - ), - cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Mirage]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our - [blog post](http://blog.cloudflare.com/mirage2-solving-mobile-speed) for more - information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/mirage", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Mirage]]._unwrapper, - ), - cast_to=cast(Type[Optional[Mirage]], ResultWrapper[Mirage]), - ) - - -class MirageResourceWithRawResponse: - def __init__(self, mirage: MirageResource) -> None: - self._mirage = mirage - - self.edit = to_raw_response_wrapper( - mirage.edit, - ) - self.get = to_raw_response_wrapper( - mirage.get, - ) - - -class AsyncMirageResourceWithRawResponse: - def __init__(self, mirage: AsyncMirageResource) -> None: - self._mirage = mirage - - self.edit = async_to_raw_response_wrapper( - mirage.edit, - ) - self.get = async_to_raw_response_wrapper( - mirage.get, - ) - - -class MirageResourceWithStreamingResponse: - def __init__(self, mirage: MirageResource) -> None: - self._mirage = mirage - - self.edit = to_streamed_response_wrapper( - mirage.edit, - ) - self.get = to_streamed_response_wrapper( - mirage.get, - ) - - -class AsyncMirageResourceWithStreamingResponse: - def __init__(self, mirage: AsyncMirageResource) -> None: - self._mirage = mirage - - self.edit = async_to_streamed_response_wrapper( - mirage.edit, - ) - self.get = async_to_streamed_response_wrapper( - mirage.get, - ) diff --git a/src/cloudflare/resources/zones/settings/mobile_redirect.py b/src/cloudflare/resources/zones/settings/mobile_redirect.py deleted file mode 100644 index 8774da3fb24..00000000000 --- a/src/cloudflare/resources/zones/settings/mobile_redirect.py +++ /dev/null @@ -1,273 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import mobile_redirect_edit_params -from ....types.zones.settings.mobile_redirect import MobileRedirect - -__all__ = ["MobileRedirectResource", "AsyncMobileRedirectResource"] - - -class MobileRedirectResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MobileRedirectResourceWithRawResponse: - return MobileRedirectResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MobileRedirectResourceWithStreamingResponse: - return MobileRedirectResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: mobile_redirect_edit_params.Value, - # 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, - ) -> Optional[MobileRedirect]: - """ - Automatically redirect visitors on mobile devices to a mobile-optimized - subdomain. Refer to - [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) - for more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/mobile_redirect", - body=maybe_transform({"value": value}, mobile_redirect_edit_params.MobileRedirectEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, - ), - cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MobileRedirect]: - """ - Automatically redirect visitors on mobile devices to a mobile-optimized - subdomain. Refer to - [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/mobile_redirect", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, - ), - cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), - ) - - -class AsyncMobileRedirectResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMobileRedirectResourceWithRawResponse: - return AsyncMobileRedirectResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMobileRedirectResourceWithStreamingResponse: - return AsyncMobileRedirectResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: mobile_redirect_edit_params.Value, - # 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, - ) -> Optional[MobileRedirect]: - """ - Automatically redirect visitors on mobile devices to a mobile-optimized - subdomain. Refer to - [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) - for more information. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/mobile_redirect", - body=await async_maybe_transform({"value": value}, mobile_redirect_edit_params.MobileRedirectEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, - ), - cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MobileRedirect]: - """ - Automatically redirect visitors on mobile devices to a mobile-optimized - subdomain. Refer to - [Understanding Cloudflare Mobile Redirect](https://support.cloudflare.com/hc/articles/200168336) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/mobile_redirect", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[MobileRedirect]]._unwrapper, - ), - cast_to=cast(Type[Optional[MobileRedirect]], ResultWrapper[MobileRedirect]), - ) - - -class MobileRedirectResourceWithRawResponse: - def __init__(self, mobile_redirect: MobileRedirectResource) -> None: - self._mobile_redirect = mobile_redirect - - self.edit = to_raw_response_wrapper( - mobile_redirect.edit, - ) - self.get = to_raw_response_wrapper( - mobile_redirect.get, - ) - - -class AsyncMobileRedirectResourceWithRawResponse: - def __init__(self, mobile_redirect: AsyncMobileRedirectResource) -> None: - self._mobile_redirect = mobile_redirect - - self.edit = async_to_raw_response_wrapper( - mobile_redirect.edit, - ) - self.get = async_to_raw_response_wrapper( - mobile_redirect.get, - ) - - -class MobileRedirectResourceWithStreamingResponse: - def __init__(self, mobile_redirect: MobileRedirectResource) -> None: - self._mobile_redirect = mobile_redirect - - self.edit = to_streamed_response_wrapper( - mobile_redirect.edit, - ) - self.get = to_streamed_response_wrapper( - mobile_redirect.get, - ) - - -class AsyncMobileRedirectResourceWithStreamingResponse: - def __init__(self, mobile_redirect: AsyncMobileRedirectResource) -> None: - self._mobile_redirect = mobile_redirect - - self.edit = async_to_streamed_response_wrapper( - mobile_redirect.edit, - ) - self.get = async_to_streamed_response_wrapper( - mobile_redirect.get, - ) diff --git a/src/cloudflare/resources/zones/settings/nel.py b/src/cloudflare/resources/zones/settings/nel.py deleted file mode 100644 index 325792ab4f1..00000000000 --- a/src/cloudflare/resources/zones/settings/nel.py +++ /dev/null @@ -1,268 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import NEL, nel_edit_params -from ....types.zones.settings.nel import NEL -from ....types.zones.settings.nel_param import NELParam - -__all__ = ["NELResource", "AsyncNELResource"] - - -class NELResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> NELResourceWithRawResponse: - return NELResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> NELResourceWithStreamingResponse: - return NELResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: NELParam, - # 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, - ) -> Optional[NEL]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our [blog post](http://blog.cloudflare.com/nel-solving-mobile-speed) - for more information. - - Args: - zone_id: Identifier - - value: Enable Network Error Logging reporting on your zone. (Beta) - - 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 self._patch( - f"/zones/{zone_id}/settings/nel", - body=maybe_transform({"value": value}, nel_edit_params.NELEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[NEL]]._unwrapper, - ), - cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NEL]: - """Enable Network Error Logging reporting on your zone. - - (Beta) - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/nel", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[NEL]]._unwrapper, - ), - cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), - ) - - -class AsyncNELResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncNELResourceWithRawResponse: - return AsyncNELResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncNELResourceWithStreamingResponse: - return AsyncNELResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: NELParam, - # 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, - ) -> Optional[NEL]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our [blog post](http://blog.cloudflare.com/nel-solving-mobile-speed) - for more information. - - Args: - zone_id: Identifier - - value: Enable Network Error Logging reporting on your zone. (Beta) - - 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 await self._patch( - f"/zones/{zone_id}/settings/nel", - body=await async_maybe_transform({"value": value}, nel_edit_params.NELEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[NEL]]._unwrapper, - ), - cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NEL]: - """Enable Network Error Logging reporting on your zone. - - (Beta) - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/nel", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[NEL]]._unwrapper, - ), - cast_to=cast(Type[Optional[NEL]], ResultWrapper[NEL]), - ) - - -class NELResourceWithRawResponse: - def __init__(self, nel: NELResource) -> None: - self._nel = nel - - self.edit = to_raw_response_wrapper( - nel.edit, - ) - self.get = to_raw_response_wrapper( - nel.get, - ) - - -class AsyncNELResourceWithRawResponse: - def __init__(self, nel: AsyncNELResource) -> None: - self._nel = nel - - self.edit = async_to_raw_response_wrapper( - nel.edit, - ) - self.get = async_to_raw_response_wrapper( - nel.get, - ) - - -class NELResourceWithStreamingResponse: - def __init__(self, nel: NELResource) -> None: - self._nel = nel - - self.edit = to_streamed_response_wrapper( - nel.edit, - ) - self.get = to_streamed_response_wrapper( - nel.get, - ) - - -class AsyncNELResourceWithStreamingResponse: - def __init__(self, nel: AsyncNELResource) -> None: - self._nel = nel - - self.edit = async_to_streamed_response_wrapper( - nel.edit, - ) - self.get = async_to_streamed_response_wrapper( - nel.get, - ) diff --git a/src/cloudflare/resources/zones/settings/opportunistic_encryption.py b/src/cloudflare/resources/zones/settings/opportunistic_encryption.py deleted file mode 100644 index dc2d9cb1ff1..00000000000 --- a/src/cloudflare/resources/zones/settings/opportunistic_encryption.py +++ /dev/null @@ -1,268 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import opportunistic_encryption_edit_params -from ....types.zones.settings.opportunistic_encryption import OpportunisticEncryption - -__all__ = ["OpportunisticEncryptionResource", "AsyncOpportunisticEncryptionResource"] - - -class OpportunisticEncryptionResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> OpportunisticEncryptionResourceWithRawResponse: - return OpportunisticEncryptionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> OpportunisticEncryptionResourceWithStreamingResponse: - return OpportunisticEncryptionResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[OpportunisticEncryption]: - """ - Changes Opportunistic Encryption setting. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 self._patch( - f"/zones/{zone_id}/settings/opportunistic_encryption", - body=maybe_transform( - {"value": value}, opportunistic_encryption_edit_params.OpportunisticEncryptionEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OpportunisticEncryption]: - """ - Gets Opportunistic Encryption setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/opportunistic_encryption", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), - ) - - -class AsyncOpportunisticEncryptionResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncOpportunisticEncryptionResourceWithRawResponse: - return AsyncOpportunisticEncryptionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncOpportunisticEncryptionResourceWithStreamingResponse: - return AsyncOpportunisticEncryptionResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[OpportunisticEncryption]: - """ - Changes Opportunistic Encryption setting. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 await self._patch( - f"/zones/{zone_id}/settings/opportunistic_encryption", - body=await async_maybe_transform( - {"value": value}, opportunistic_encryption_edit_params.OpportunisticEncryptionEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OpportunisticEncryption]: - """ - Gets Opportunistic Encryption setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/opportunistic_encryption", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticEncryption]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticEncryption]], ResultWrapper[OpportunisticEncryption]), - ) - - -class OpportunisticEncryptionResourceWithRawResponse: - def __init__(self, opportunistic_encryption: OpportunisticEncryptionResource) -> None: - self._opportunistic_encryption = opportunistic_encryption - - self.edit = to_raw_response_wrapper( - opportunistic_encryption.edit, - ) - self.get = to_raw_response_wrapper( - opportunistic_encryption.get, - ) - - -class AsyncOpportunisticEncryptionResourceWithRawResponse: - def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryptionResource) -> None: - self._opportunistic_encryption = opportunistic_encryption - - self.edit = async_to_raw_response_wrapper( - opportunistic_encryption.edit, - ) - self.get = async_to_raw_response_wrapper( - opportunistic_encryption.get, - ) - - -class OpportunisticEncryptionResourceWithStreamingResponse: - def __init__(self, opportunistic_encryption: OpportunisticEncryptionResource) -> None: - self._opportunistic_encryption = opportunistic_encryption - - self.edit = to_streamed_response_wrapper( - opportunistic_encryption.edit, - ) - self.get = to_streamed_response_wrapper( - opportunistic_encryption.get, - ) - - -class AsyncOpportunisticEncryptionResourceWithStreamingResponse: - def __init__(self, opportunistic_encryption: AsyncOpportunisticEncryptionResource) -> None: - self._opportunistic_encryption = opportunistic_encryption - - self.edit = async_to_streamed_response_wrapper( - opportunistic_encryption.edit, - ) - self.get = async_to_streamed_response_wrapper( - opportunistic_encryption.get, - ) diff --git a/src/cloudflare/resources/zones/settings/opportunistic_onion.py b/src/cloudflare/resources/zones/settings/opportunistic_onion.py deleted file mode 100644 index 50f3e225e33..00000000000 --- a/src/cloudflare/resources/zones/settings/opportunistic_onion.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import opportunistic_onion_edit_params -from ....types.zones.settings.opportunistic_onion import OpportunisticOnion - -__all__ = ["OpportunisticOnionResource", "AsyncOpportunisticOnionResource"] - - -class OpportunisticOnionResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> OpportunisticOnionResourceWithRawResponse: - return OpportunisticOnionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> OpportunisticOnionResourceWithStreamingResponse: - return OpportunisticOnionResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[OpportunisticOnion]: - """ - Add an Alt-Svc header to all legitimate requests from Tor, allowing the - connection to use our onion services instead of exit nodes. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 self._patch( - f"/zones/{zone_id}/settings/opportunistic_onion", - body=maybe_transform({"value": value}, opportunistic_onion_edit_params.OpportunisticOnionEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OpportunisticOnion]: - """ - Add an Alt-Svc header to all legitimate requests from Tor, allowing the - connection to use our onion services instead of exit nodes. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/opportunistic_onion", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), - ) - - -class AsyncOpportunisticOnionResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncOpportunisticOnionResourceWithRawResponse: - return AsyncOpportunisticOnionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncOpportunisticOnionResourceWithStreamingResponse: - return AsyncOpportunisticOnionResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[OpportunisticOnion]: - """ - Add an Alt-Svc header to all legitimate requests from Tor, allowing the - connection to use our onion services instead of exit nodes. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 await self._patch( - f"/zones/{zone_id}/settings/opportunistic_onion", - body=await async_maybe_transform( - {"value": value}, opportunistic_onion_edit_params.OpportunisticOnionEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OpportunisticOnion]: - """ - Add an Alt-Svc header to all legitimate requests from Tor, allowing the - connection to use our onion services instead of exit nodes. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/opportunistic_onion", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OpportunisticOnion]]._unwrapper, - ), - cast_to=cast(Type[Optional[OpportunisticOnion]], ResultWrapper[OpportunisticOnion]), - ) - - -class OpportunisticOnionResourceWithRawResponse: - def __init__(self, opportunistic_onion: OpportunisticOnionResource) -> None: - self._opportunistic_onion = opportunistic_onion - - self.edit = to_raw_response_wrapper( - opportunistic_onion.edit, - ) - self.get = to_raw_response_wrapper( - opportunistic_onion.get, - ) - - -class AsyncOpportunisticOnionResourceWithRawResponse: - def __init__(self, opportunistic_onion: AsyncOpportunisticOnionResource) -> None: - self._opportunistic_onion = opportunistic_onion - - self.edit = async_to_raw_response_wrapper( - opportunistic_onion.edit, - ) - self.get = async_to_raw_response_wrapper( - opportunistic_onion.get, - ) - - -class OpportunisticOnionResourceWithStreamingResponse: - def __init__(self, opportunistic_onion: OpportunisticOnionResource) -> None: - self._opportunistic_onion = opportunistic_onion - - self.edit = to_streamed_response_wrapper( - opportunistic_onion.edit, - ) - self.get = to_streamed_response_wrapper( - opportunistic_onion.get, - ) - - -class AsyncOpportunisticOnionResourceWithStreamingResponse: - def __init__(self, opportunistic_onion: AsyncOpportunisticOnionResource) -> None: - self._opportunistic_onion = opportunistic_onion - - self.edit = async_to_streamed_response_wrapper( - opportunistic_onion.edit, - ) - self.get = async_to_streamed_response_wrapper( - opportunistic_onion.get, - ) diff --git a/src/cloudflare/resources/zones/settings/orange_to_orange.py b/src/cloudflare/resources/zones/settings/orange_to_orange.py deleted file mode 100644 index c302303ee37..00000000000 --- a/src/cloudflare/resources/zones/settings/orange_to_orange.py +++ /dev/null @@ -1,268 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import OrangeToOrange, orange_to_orange_edit_params -from ....types.zones.settings.orange_to_orange import OrangeToOrange -from ....types.zones.settings.orange_to_orange_param import OrangeToOrangeParam - -__all__ = ["OrangeToOrangeResource", "AsyncOrangeToOrangeResource"] - - -class OrangeToOrangeResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> OrangeToOrangeResourceWithRawResponse: - return OrangeToOrangeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> OrangeToOrangeResourceWithStreamingResponse: - return OrangeToOrangeResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: OrangeToOrangeParam, - # 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, - ) -> Optional[OrangeToOrange]: - """ - Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - - Args: - zone_id: Identifier - - value: Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - - 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 self._patch( - f"/zones/{zone_id}/settings/orange_to_orange", - body=maybe_transform({"value": value}, orange_to_orange_edit_params.OrangeToOrangeEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, - ), - cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OrangeToOrange]: - """ - Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/orange_to_orange", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, - ), - cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), - ) - - -class AsyncOrangeToOrangeResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncOrangeToOrangeResourceWithRawResponse: - return AsyncOrangeToOrangeResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncOrangeToOrangeResourceWithStreamingResponse: - return AsyncOrangeToOrangeResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: OrangeToOrangeParam, - # 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, - ) -> Optional[OrangeToOrange]: - """ - Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - - Args: - zone_id: Identifier - - value: Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - - 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 await self._patch( - f"/zones/{zone_id}/settings/orange_to_orange", - body=await async_maybe_transform({"value": value}, orange_to_orange_edit_params.OrangeToOrangeEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, - ), - cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OrangeToOrange]: - """ - Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/orange_to_orange", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OrangeToOrange]]._unwrapper, - ), - cast_to=cast(Type[Optional[OrangeToOrange]], ResultWrapper[OrangeToOrange]), - ) - - -class OrangeToOrangeResourceWithRawResponse: - def __init__(self, orange_to_orange: OrangeToOrangeResource) -> None: - self._orange_to_orange = orange_to_orange - - self.edit = to_raw_response_wrapper( - orange_to_orange.edit, - ) - self.get = to_raw_response_wrapper( - orange_to_orange.get, - ) - - -class AsyncOrangeToOrangeResourceWithRawResponse: - def __init__(self, orange_to_orange: AsyncOrangeToOrangeResource) -> None: - self._orange_to_orange = orange_to_orange - - self.edit = async_to_raw_response_wrapper( - orange_to_orange.edit, - ) - self.get = async_to_raw_response_wrapper( - orange_to_orange.get, - ) - - -class OrangeToOrangeResourceWithStreamingResponse: - def __init__(self, orange_to_orange: OrangeToOrangeResource) -> None: - self._orange_to_orange = orange_to_orange - - self.edit = to_streamed_response_wrapper( - orange_to_orange.edit, - ) - self.get = to_streamed_response_wrapper( - orange_to_orange.get, - ) - - -class AsyncOrangeToOrangeResourceWithStreamingResponse: - def __init__(self, orange_to_orange: AsyncOrangeToOrangeResource) -> None: - self._orange_to_orange = orange_to_orange - - self.edit = async_to_streamed_response_wrapper( - orange_to_orange.edit, - ) - self.get = async_to_streamed_response_wrapper( - orange_to_orange.get, - ) diff --git a/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py b/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py deleted file mode 100644 index 37a1bae6963..00000000000 --- a/src/cloudflare/resources/zones/settings/origin_error_page_pass_thru.py +++ /dev/null @@ -1,274 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import origin_error_page_pass_thru_edit_params -from ....types.zones.settings.origin_error_page_pass_thru import OriginErrorPagePassThru - -__all__ = ["OriginErrorPagePassThruResource", "AsyncOriginErrorPagePassThruResource"] - - -class OriginErrorPagePassThruResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> OriginErrorPagePassThruResourceWithRawResponse: - return OriginErrorPagePassThruResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> OriginErrorPagePassThruResourceWithStreamingResponse: - return OriginErrorPagePassThruResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[OriginErrorPagePassThru]: - """ - Cloudflare will proxy customer error pages on any 502,504 errors on origin - server instead of showing a default Cloudflare error page. This does not apply - to 522 errors and is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/origin_error_page_pass_thru", - body=maybe_transform( - {"value": value}, origin_error_page_pass_thru_edit_params.OriginErrorPagePassThruEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, - ), - cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OriginErrorPagePassThru]: - """ - Cloudflare will proxy customer error pages on any 502,504 errors on origin - server instead of showing a default Cloudflare error page. This does not apply - to 522 errors and is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/origin_error_page_pass_thru", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, - ), - cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), - ) - - -class AsyncOriginErrorPagePassThruResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncOriginErrorPagePassThruResourceWithRawResponse: - return AsyncOriginErrorPagePassThruResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncOriginErrorPagePassThruResourceWithStreamingResponse: - return AsyncOriginErrorPagePassThruResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[OriginErrorPagePassThru]: - """ - Cloudflare will proxy customer error pages on any 502,504 errors on origin - server instead of showing a default Cloudflare error page. This does not apply - to 522 errors and is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/origin_error_page_pass_thru", - body=await async_maybe_transform( - {"value": value}, origin_error_page_pass_thru_edit_params.OriginErrorPagePassThruEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, - ), - cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OriginErrorPagePassThru]: - """ - Cloudflare will proxy customer error pages on any 502,504 errors on origin - server instead of showing a default Cloudflare error page. This does not apply - to 522 errors and is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/origin_error_page_pass_thru", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[OriginErrorPagePassThru]]._unwrapper, - ), - cast_to=cast(Type[Optional[OriginErrorPagePassThru]], ResultWrapper[OriginErrorPagePassThru]), - ) - - -class OriginErrorPagePassThruResourceWithRawResponse: - def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThruResource) -> None: - self._origin_error_page_pass_thru = origin_error_page_pass_thru - - self.edit = to_raw_response_wrapper( - origin_error_page_pass_thru.edit, - ) - self.get = to_raw_response_wrapper( - origin_error_page_pass_thru.get, - ) - - -class AsyncOriginErrorPagePassThruResourceWithRawResponse: - def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThruResource) -> None: - self._origin_error_page_pass_thru = origin_error_page_pass_thru - - self.edit = async_to_raw_response_wrapper( - origin_error_page_pass_thru.edit, - ) - self.get = async_to_raw_response_wrapper( - origin_error_page_pass_thru.get, - ) - - -class OriginErrorPagePassThruResourceWithStreamingResponse: - def __init__(self, origin_error_page_pass_thru: OriginErrorPagePassThruResource) -> None: - self._origin_error_page_pass_thru = origin_error_page_pass_thru - - self.edit = to_streamed_response_wrapper( - origin_error_page_pass_thru.edit, - ) - self.get = to_streamed_response_wrapper( - origin_error_page_pass_thru.get, - ) - - -class AsyncOriginErrorPagePassThruResourceWithStreamingResponse: - def __init__(self, origin_error_page_pass_thru: AsyncOriginErrorPagePassThruResource) -> None: - self._origin_error_page_pass_thru = origin_error_page_pass_thru - - self.edit = async_to_streamed_response_wrapper( - origin_error_page_pass_thru.edit, - ) - self.get = async_to_streamed_response_wrapper( - origin_error_page_pass_thru.get, - ) diff --git a/src/cloudflare/resources/zones/settings/polish.py b/src/cloudflare/resources/zones/settings/polish.py deleted file mode 100644 index 9479d26bade..00000000000 --- a/src/cloudflare/resources/zones/settings/polish.py +++ /dev/null @@ -1,280 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import Polish, polish_edit_params -from ....types.zones.settings.polish import Polish -from ....types.zones.settings.polish_param import PolishParam - -__all__ = ["PolishResource", "AsyncPolishResource"] - - -class PolishResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PolishResourceWithRawResponse: - return PolishResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PolishResourceWithStreamingResponse: - return PolishResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: PolishParam, - # 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, - ) -> Optional[Polish]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) - for more information. - - Args: - zone_id: Identifier - - value: Removes metadata and compresses your images for faster page load times. Basic - (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual - quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster - image loading. Larger JPEGs are converted to progressive images, loading a - lower-resolution image first and ending in a higher-resolution version. Not - recommended for hi-res photography sites. - - 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 self._patch( - f"/zones/{zone_id}/settings/polish", - body=maybe_transform({"value": value}, polish_edit_params.PolishEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Polish]]._unwrapper, - ), - cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Polish]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/polish", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Polish]]._unwrapper, - ), - cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), - ) - - -class AsyncPolishResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPolishResourceWithRawResponse: - return AsyncPolishResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPolishResourceWithStreamingResponse: - return AsyncPolishResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: PolishParam, - # 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, - ) -> Optional[Polish]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) - for more information. - - Args: - zone_id: Identifier - - value: Removes metadata and compresses your images for faster page load times. Basic - (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual - quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster - image loading. Larger JPEGs are converted to progressive images, loading a - lower-resolution image first and ending in a higher-resolution version. Not - recommended for hi-res photography sites. - - 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 await self._patch( - f"/zones/{zone_id}/settings/polish", - body=await async_maybe_transform({"value": value}, polish_edit_params.PolishEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Polish]]._unwrapper, - ), - cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Polish]: - """ - Automatically optimize image loading for website visitors on mobile devices. - Refer to our [blog post](http://blog.cloudflare.com/polish-solving-mobile-speed) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/polish", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Polish]]._unwrapper, - ), - cast_to=cast(Type[Optional[Polish]], ResultWrapper[Polish]), - ) - - -class PolishResourceWithRawResponse: - def __init__(self, polish: PolishResource) -> None: - self._polish = polish - - self.edit = to_raw_response_wrapper( - polish.edit, - ) - self.get = to_raw_response_wrapper( - polish.get, - ) - - -class AsyncPolishResourceWithRawResponse: - def __init__(self, polish: AsyncPolishResource) -> None: - self._polish = polish - - self.edit = async_to_raw_response_wrapper( - polish.edit, - ) - self.get = async_to_raw_response_wrapper( - polish.get, - ) - - -class PolishResourceWithStreamingResponse: - def __init__(self, polish: PolishResource) -> None: - self._polish = polish - - self.edit = to_streamed_response_wrapper( - polish.edit, - ) - self.get = to_streamed_response_wrapper( - polish.get, - ) - - -class AsyncPolishResourceWithStreamingResponse: - def __init__(self, polish: AsyncPolishResource) -> None: - self._polish = polish - - self.edit = async_to_streamed_response_wrapper( - polish.edit, - ) - self.get = async_to_streamed_response_wrapper( - polish.get, - ) diff --git a/src/cloudflare/resources/zones/settings/prefetch_preload.py b/src/cloudflare/resources/zones/settings/prefetch_preload.py deleted file mode 100644 index 39e208ff405..00000000000 --- a/src/cloudflare/resources/zones/settings/prefetch_preload.py +++ /dev/null @@ -1,266 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import prefetch_preload_edit_params -from ....types.zones.settings.prefetch_preload import PrefetchPreload - -__all__ = ["PrefetchPreloadResource", "AsyncPrefetchPreloadResource"] - - -class PrefetchPreloadResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PrefetchPreloadResourceWithRawResponse: - return PrefetchPreloadResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PrefetchPreloadResourceWithStreamingResponse: - return PrefetchPreloadResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[PrefetchPreload]: - """ - Cloudflare will prefetch any URLs that are included in the response headers. - This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/prefetch_preload", - body=maybe_transform({"value": value}, prefetch_preload_edit_params.PrefetchPreloadEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, - ), - cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PrefetchPreload]: - """ - Cloudflare will prefetch any URLs that are included in the response headers. - This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/prefetch_preload", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, - ), - cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), - ) - - -class AsyncPrefetchPreloadResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPrefetchPreloadResourceWithRawResponse: - return AsyncPrefetchPreloadResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPrefetchPreloadResourceWithStreamingResponse: - return AsyncPrefetchPreloadResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[PrefetchPreload]: - """ - Cloudflare will prefetch any URLs that are included in the response headers. - This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/prefetch_preload", - body=await async_maybe_transform({"value": value}, prefetch_preload_edit_params.PrefetchPreloadEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, - ), - cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PrefetchPreload]: - """ - Cloudflare will prefetch any URLs that are included in the response headers. - This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/prefetch_preload", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PrefetchPreload]]._unwrapper, - ), - cast_to=cast(Type[Optional[PrefetchPreload]], ResultWrapper[PrefetchPreload]), - ) - - -class PrefetchPreloadResourceWithRawResponse: - def __init__(self, prefetch_preload: PrefetchPreloadResource) -> None: - self._prefetch_preload = prefetch_preload - - self.edit = to_raw_response_wrapper( - prefetch_preload.edit, - ) - self.get = to_raw_response_wrapper( - prefetch_preload.get, - ) - - -class AsyncPrefetchPreloadResourceWithRawResponse: - def __init__(self, prefetch_preload: AsyncPrefetchPreloadResource) -> None: - self._prefetch_preload = prefetch_preload - - self.edit = async_to_raw_response_wrapper( - prefetch_preload.edit, - ) - self.get = async_to_raw_response_wrapper( - prefetch_preload.get, - ) - - -class PrefetchPreloadResourceWithStreamingResponse: - def __init__(self, prefetch_preload: PrefetchPreloadResource) -> None: - self._prefetch_preload = prefetch_preload - - self.edit = to_streamed_response_wrapper( - prefetch_preload.edit, - ) - self.get = to_streamed_response_wrapper( - prefetch_preload.get, - ) - - -class AsyncPrefetchPreloadResourceWithStreamingResponse: - def __init__(self, prefetch_preload: AsyncPrefetchPreloadResource) -> None: - self._prefetch_preload = prefetch_preload - - self.edit = async_to_streamed_response_wrapper( - prefetch_preload.edit, - ) - self.get = async_to_streamed_response_wrapper( - prefetch_preload.get, - ) diff --git a/src/cloudflare/resources/zones/settings/proxy_read_timeout.py b/src/cloudflare/resources/zones/settings/proxy_read_timeout.py deleted file mode 100644 index 1fd18b0cf77..00000000000 --- a/src/cloudflare/resources/zones/settings/proxy_read_timeout.py +++ /dev/null @@ -1,264 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import ProxyReadTimeout, proxy_read_timeout_edit_params -from ....types.zones.settings.proxy_read_timeout import ProxyReadTimeout -from ....types.zones.settings.proxy_read_timeout_param import ProxyReadTimeoutParam - -__all__ = ["ProxyReadTimeoutResource", "AsyncProxyReadTimeoutResource"] - - -class ProxyReadTimeoutResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProxyReadTimeoutResourceWithRawResponse: - return ProxyReadTimeoutResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProxyReadTimeoutResourceWithStreamingResponse: - return ProxyReadTimeoutResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: ProxyReadTimeoutParam, - # 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, - ) -> Optional[ProxyReadTimeout]: - """ - Maximum time between two read operations from origin. - - Args: - zone_id: Identifier - - value: Maximum time between two read operations from origin. - - 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 self._patch( - f"/zones/{zone_id}/settings/proxy_read_timeout", - body=maybe_transform({"value": value}, proxy_read_timeout_edit_params.ProxyReadTimeoutEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, - ), - cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyReadTimeout]: - """ - Maximum time between two read operations from origin. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/proxy_read_timeout", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, - ), - cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), - ) - - -class AsyncProxyReadTimeoutResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProxyReadTimeoutResourceWithRawResponse: - return AsyncProxyReadTimeoutResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProxyReadTimeoutResourceWithStreamingResponse: - return AsyncProxyReadTimeoutResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: ProxyReadTimeoutParam, - # 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, - ) -> Optional[ProxyReadTimeout]: - """ - Maximum time between two read operations from origin. - - Args: - zone_id: Identifier - - value: Maximum time between two read operations from origin. - - 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 await self._patch( - f"/zones/{zone_id}/settings/proxy_read_timeout", - body=await async_maybe_transform( - {"value": value}, proxy_read_timeout_edit_params.ProxyReadTimeoutEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, - ), - cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyReadTimeout]: - """ - Maximum time between two read operations from origin. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/proxy_read_timeout", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyReadTimeout]]._unwrapper, - ), - cast_to=cast(Type[Optional[ProxyReadTimeout]], ResultWrapper[ProxyReadTimeout]), - ) - - -class ProxyReadTimeoutResourceWithRawResponse: - def __init__(self, proxy_read_timeout: ProxyReadTimeoutResource) -> None: - self._proxy_read_timeout = proxy_read_timeout - - self.edit = to_raw_response_wrapper( - proxy_read_timeout.edit, - ) - self.get = to_raw_response_wrapper( - proxy_read_timeout.get, - ) - - -class AsyncProxyReadTimeoutResourceWithRawResponse: - def __init__(self, proxy_read_timeout: AsyncProxyReadTimeoutResource) -> None: - self._proxy_read_timeout = proxy_read_timeout - - self.edit = async_to_raw_response_wrapper( - proxy_read_timeout.edit, - ) - self.get = async_to_raw_response_wrapper( - proxy_read_timeout.get, - ) - - -class ProxyReadTimeoutResourceWithStreamingResponse: - def __init__(self, proxy_read_timeout: ProxyReadTimeoutResource) -> None: - self._proxy_read_timeout = proxy_read_timeout - - self.edit = to_streamed_response_wrapper( - proxy_read_timeout.edit, - ) - self.get = to_streamed_response_wrapper( - proxy_read_timeout.get, - ) - - -class AsyncProxyReadTimeoutResourceWithStreamingResponse: - def __init__(self, proxy_read_timeout: AsyncProxyReadTimeoutResource) -> None: - self._proxy_read_timeout = proxy_read_timeout - - self.edit = async_to_streamed_response_wrapper( - proxy_read_timeout.edit, - ) - self.get = async_to_streamed_response_wrapper( - proxy_read_timeout.get, - ) diff --git a/src/cloudflare/resources/zones/settings/pseudo_ipv4.py b/src/cloudflare/resources/zones/settings/pseudo_ipv4.py deleted file mode 100644 index c30371d3e58..00000000000 --- a/src/cloudflare/resources/zones/settings/pseudo_ipv4.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import pseudo_ipv4_edit_params -from ....types.zones.settings.pseudo_ipv4 import PseudoIPV4 - -__all__ = ["PseudoIPV4Resource", "AsyncPseudoIPV4Resource"] - - -class PseudoIPV4Resource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PseudoIPV4ResourceWithRawResponse: - return PseudoIPV4ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PseudoIPV4ResourceWithStreamingResponse: - return PseudoIPV4ResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "add_header", "overwrite_header"], - # 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, - ) -> Optional[PseudoIPV4]: - """ - Value of the Pseudo IPv4 setting. - - Args: - zone_id: Identifier - - value: Value of the Pseudo IPv4 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 self._patch( - f"/zones/{zone_id}/settings/pseudo_ipv4", - body=maybe_transform({"value": value}, pseudo_ipv4_edit_params.PseudoIPV4EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, - ), - cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PseudoIPV4]: - """ - Value of the Pseudo IPv4 setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/pseudo_ipv4", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, - ), - cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), - ) - - -class AsyncPseudoIPV4Resource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPseudoIPV4ResourceWithRawResponse: - return AsyncPseudoIPV4ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPseudoIPV4ResourceWithStreamingResponse: - return AsyncPseudoIPV4ResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "add_header", "overwrite_header"], - # 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, - ) -> Optional[PseudoIPV4]: - """ - Value of the Pseudo IPv4 setting. - - Args: - zone_id: Identifier - - value: Value of the Pseudo IPv4 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 await self._patch( - f"/zones/{zone_id}/settings/pseudo_ipv4", - body=await async_maybe_transform({"value": value}, pseudo_ipv4_edit_params.PseudoIPV4EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, - ), - cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PseudoIPV4]: - """ - Value of the Pseudo IPv4 setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/pseudo_ipv4", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PseudoIPV4]]._unwrapper, - ), - cast_to=cast(Type[Optional[PseudoIPV4]], ResultWrapper[PseudoIPV4]), - ) - - -class PseudoIPV4ResourceWithRawResponse: - def __init__(self, pseudo_ipv4: PseudoIPV4Resource) -> None: - self._pseudo_ipv4 = pseudo_ipv4 - - self.edit = to_raw_response_wrapper( - pseudo_ipv4.edit, - ) - self.get = to_raw_response_wrapper( - pseudo_ipv4.get, - ) - - -class AsyncPseudoIPV4ResourceWithRawResponse: - def __init__(self, pseudo_ipv4: AsyncPseudoIPV4Resource) -> None: - self._pseudo_ipv4 = pseudo_ipv4 - - self.edit = async_to_raw_response_wrapper( - pseudo_ipv4.edit, - ) - self.get = async_to_raw_response_wrapper( - pseudo_ipv4.get, - ) - - -class PseudoIPV4ResourceWithStreamingResponse: - def __init__(self, pseudo_ipv4: PseudoIPV4Resource) -> None: - self._pseudo_ipv4 = pseudo_ipv4 - - self.edit = to_streamed_response_wrapper( - pseudo_ipv4.edit, - ) - self.get = to_streamed_response_wrapper( - pseudo_ipv4.get, - ) - - -class AsyncPseudoIPV4ResourceWithStreamingResponse: - def __init__(self, pseudo_ipv4: AsyncPseudoIPV4Resource) -> None: - self._pseudo_ipv4 = pseudo_ipv4 - - self.edit = async_to_streamed_response_wrapper( - pseudo_ipv4.edit, - ) - self.get = async_to_streamed_response_wrapper( - pseudo_ipv4.get, - ) diff --git a/src/cloudflare/resources/zones/settings/response_buffering.py b/src/cloudflare/resources/zones/settings/response_buffering.py deleted file mode 100644 index d00093ba87a..00000000000 --- a/src/cloudflare/resources/zones/settings/response_buffering.py +++ /dev/null @@ -1,280 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import response_buffering_edit_params -from ....types.zones.settings.response_buffering import ResponseBuffering - -__all__ = ["ResponseBufferingResource", "AsyncResponseBufferingResource"] - - -class ResponseBufferingResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ResponseBufferingResourceWithRawResponse: - return ResponseBufferingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ResponseBufferingResourceWithStreamingResponse: - return ResponseBufferingResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[ResponseBuffering]: - """Enables or disables buffering of responses from the proxied server. - - Cloudflare - may buffer the whole payload to deliver it at once to the client versus allowing - it to be delivered in chunks. By default, the proxied server streams directly - and is not buffered by Cloudflare. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/response_buffering", - body=maybe_transform({"value": value}, response_buffering_edit_params.ResponseBufferingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, - ), - cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ResponseBuffering]: - """Enables or disables buffering of responses from the proxied server. - - Cloudflare - may buffer the whole payload to deliver it at once to the client versus allowing - it to be delivered in chunks. By default, the proxied server streams directly - and is not buffered by Cloudflare. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/response_buffering", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, - ), - cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), - ) - - -class AsyncResponseBufferingResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncResponseBufferingResourceWithRawResponse: - return AsyncResponseBufferingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncResponseBufferingResourceWithStreamingResponse: - return AsyncResponseBufferingResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[ResponseBuffering]: - """Enables or disables buffering of responses from the proxied server. - - Cloudflare - may buffer the whole payload to deliver it at once to the client versus allowing - it to be delivered in chunks. By default, the proxied server streams directly - and is not buffered by Cloudflare. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/response_buffering", - body=await async_maybe_transform( - {"value": value}, response_buffering_edit_params.ResponseBufferingEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, - ), - cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ResponseBuffering]: - """Enables or disables buffering of responses from the proxied server. - - Cloudflare - may buffer the whole payload to deliver it at once to the client versus allowing - it to be delivered in chunks. By default, the proxied server streams directly - and is not buffered by Cloudflare. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/response_buffering", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ResponseBuffering]]._unwrapper, - ), - cast_to=cast(Type[Optional[ResponseBuffering]], ResultWrapper[ResponseBuffering]), - ) - - -class ResponseBufferingResourceWithRawResponse: - def __init__(self, response_buffering: ResponseBufferingResource) -> None: - self._response_buffering = response_buffering - - self.edit = to_raw_response_wrapper( - response_buffering.edit, - ) - self.get = to_raw_response_wrapper( - response_buffering.get, - ) - - -class AsyncResponseBufferingResourceWithRawResponse: - def __init__(self, response_buffering: AsyncResponseBufferingResource) -> None: - self._response_buffering = response_buffering - - self.edit = async_to_raw_response_wrapper( - response_buffering.edit, - ) - self.get = async_to_raw_response_wrapper( - response_buffering.get, - ) - - -class ResponseBufferingResourceWithStreamingResponse: - def __init__(self, response_buffering: ResponseBufferingResource) -> None: - self._response_buffering = response_buffering - - self.edit = to_streamed_response_wrapper( - response_buffering.edit, - ) - self.get = to_streamed_response_wrapper( - response_buffering.get, - ) - - -class AsyncResponseBufferingResourceWithStreamingResponse: - def __init__(self, response_buffering: AsyncResponseBufferingResource) -> None: - self._response_buffering = response_buffering - - self.edit = async_to_streamed_response_wrapper( - response_buffering.edit, - ) - self.get = async_to_streamed_response_wrapper( - response_buffering.get, - ) diff --git a/src/cloudflare/resources/zones/settings/rocket_loader.py b/src/cloudflare/resources/zones/settings/rocket_loader.py deleted file mode 100644 index 0fbe364370d..00000000000 --- a/src/cloudflare/resources/zones/settings/rocket_loader.py +++ /dev/null @@ -1,316 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import RocketLoader, rocket_loader_edit_params -from ....types.zones.settings.rocket_loader import RocketLoader -from ....types.zones.settings.rocket_loader_param import RocketLoaderParam - -__all__ = ["RocketLoaderResource", "AsyncRocketLoaderResource"] - - -class RocketLoaderResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RocketLoaderResourceWithRawResponse: - return RocketLoaderResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RocketLoaderResourceWithStreamingResponse: - return RocketLoaderResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: RocketLoaderParam, - # 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, - ) -> Optional[RocketLoader]: - """ - Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - - Args: - zone_id: Identifier - - value: Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - - 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 self._patch( - f"/zones/{zone_id}/settings/rocket_loader", - body=maybe_transform({"value": value}, rocket_loader_edit_params.RocketLoaderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, - ), - cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RocketLoader]: - """ - Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/rocket_loader", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, - ), - cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), - ) - - -class AsyncRocketLoaderResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRocketLoaderResourceWithRawResponse: - return AsyncRocketLoaderResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRocketLoaderResourceWithStreamingResponse: - return AsyncRocketLoaderResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: RocketLoaderParam, - # 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, - ) -> Optional[RocketLoader]: - """ - Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - - Args: - zone_id: Identifier - - value: Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - - 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 await self._patch( - f"/zones/{zone_id}/settings/rocket_loader", - body=await async_maybe_transform({"value": value}, rocket_loader_edit_params.RocketLoaderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, - ), - cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RocketLoader]: - """ - Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/rocket_loader", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[RocketLoader]]._unwrapper, - ), - cast_to=cast(Type[Optional[RocketLoader]], ResultWrapper[RocketLoader]), - ) - - -class RocketLoaderResourceWithRawResponse: - def __init__(self, rocket_loader: RocketLoaderResource) -> None: - self._rocket_loader = rocket_loader - - self.edit = to_raw_response_wrapper( - rocket_loader.edit, - ) - self.get = to_raw_response_wrapper( - rocket_loader.get, - ) - - -class AsyncRocketLoaderResourceWithRawResponse: - def __init__(self, rocket_loader: AsyncRocketLoaderResource) -> None: - self._rocket_loader = rocket_loader - - self.edit = async_to_raw_response_wrapper( - rocket_loader.edit, - ) - self.get = async_to_raw_response_wrapper( - rocket_loader.get, - ) - - -class RocketLoaderResourceWithStreamingResponse: - def __init__(self, rocket_loader: RocketLoaderResource) -> None: - self._rocket_loader = rocket_loader - - self.edit = to_streamed_response_wrapper( - rocket_loader.edit, - ) - self.get = to_streamed_response_wrapper( - rocket_loader.get, - ) - - -class AsyncRocketLoaderResourceWithStreamingResponse: - def __init__(self, rocket_loader: AsyncRocketLoaderResource) -> None: - self._rocket_loader = rocket_loader - - self.edit = async_to_streamed_response_wrapper( - rocket_loader.edit, - ) - self.get = async_to_streamed_response_wrapper( - rocket_loader.get, - ) diff --git a/src/cloudflare/resources/zones/settings/security_headers.py b/src/cloudflare/resources/zones/settings/security_headers.py deleted file mode 100644 index 5c97da0cea2..00000000000 --- a/src/cloudflare/resources/zones/settings/security_headers.py +++ /dev/null @@ -1,257 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import security_header_edit_params -from ....types.zones.settings.security_headers import SecurityHeaders - -__all__ = ["SecurityHeadersResource", "AsyncSecurityHeadersResource"] - - -class SecurityHeadersResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SecurityHeadersResourceWithRawResponse: - return SecurityHeadersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SecurityHeadersResourceWithStreamingResponse: - return SecurityHeadersResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: security_header_edit_params.Value, - # 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, - ) -> Optional[SecurityHeaders]: - """ - Cloudflare security header for a zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._patch( - f"/zones/{zone_id}/settings/security_header", - body=maybe_transform({"value": value}, security_header_edit_params.SecurityHeaderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SecurityHeaders]: - """ - Cloudflare security header for a zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/security_header", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), - ) - - -class AsyncSecurityHeadersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSecurityHeadersResourceWithRawResponse: - return AsyncSecurityHeadersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSecurityHeadersResourceWithStreamingResponse: - return AsyncSecurityHeadersResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: security_header_edit_params.Value, - # 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, - ) -> Optional[SecurityHeaders]: - """ - Cloudflare security header for a zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._patch( - f"/zones/{zone_id}/settings/security_header", - body=await async_maybe_transform({"value": value}, security_header_edit_params.SecurityHeaderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SecurityHeaders]: - """ - Cloudflare security header for a zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/security_header", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityHeaders]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityHeaders]], ResultWrapper[SecurityHeaders]), - ) - - -class SecurityHeadersResourceWithRawResponse: - def __init__(self, security_headers: SecurityHeadersResource) -> None: - self._security_headers = security_headers - - self.edit = to_raw_response_wrapper( - security_headers.edit, - ) - self.get = to_raw_response_wrapper( - security_headers.get, - ) - - -class AsyncSecurityHeadersResourceWithRawResponse: - def __init__(self, security_headers: AsyncSecurityHeadersResource) -> None: - self._security_headers = security_headers - - self.edit = async_to_raw_response_wrapper( - security_headers.edit, - ) - self.get = async_to_raw_response_wrapper( - security_headers.get, - ) - - -class SecurityHeadersResourceWithStreamingResponse: - def __init__(self, security_headers: SecurityHeadersResource) -> None: - self._security_headers = security_headers - - self.edit = to_streamed_response_wrapper( - security_headers.edit, - ) - self.get = to_streamed_response_wrapper( - security_headers.get, - ) - - -class AsyncSecurityHeadersResourceWithStreamingResponse: - def __init__(self, security_headers: AsyncSecurityHeadersResource) -> None: - self._security_headers = security_headers - - self.edit = async_to_streamed_response_wrapper( - security_headers.edit, - ) - self.get = async_to_streamed_response_wrapper( - security_headers.get, - ) diff --git a/src/cloudflare/resources/zones/settings/security_level.py b/src/cloudflare/resources/zones/settings/security_level.py deleted file mode 100644 index af9040125a5..00000000000 --- a/src/cloudflare/resources/zones/settings/security_level.py +++ /dev/null @@ -1,274 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import security_level_edit_params -from ....types.zones.settings.security_level import SecurityLevel - -__all__ = ["SecurityLevelResource", "AsyncSecurityLevelResource"] - - -class SecurityLevelResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SecurityLevelResourceWithRawResponse: - return SecurityLevelResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SecurityLevelResourceWithStreamingResponse: - return SecurityLevelResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"], - # 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, - ) -> Optional[SecurityLevel]: - """ - Choose the appropriate security profile for your website, which will - automatically adjust each of the security settings. If you choose to customize - an individual security setting, the profile will become Custom. - (https://support.cloudflare.com/hc/en-us/articles/200170056). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/security_level", - body=maybe_transform({"value": value}, security_level_edit_params.SecurityLevelEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SecurityLevel]: - """ - Choose the appropriate security profile for your website, which will - automatically adjust each of the security settings. If you choose to customize - an individual security setting, the profile will become Custom. - (https://support.cloudflare.com/hc/en-us/articles/200170056). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/security_level", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), - ) - - -class AsyncSecurityLevelResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSecurityLevelResourceWithRawResponse: - return AsyncSecurityLevelResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSecurityLevelResourceWithStreamingResponse: - return AsyncSecurityLevelResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"], - # 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, - ) -> Optional[SecurityLevel]: - """ - Choose the appropriate security profile for your website, which will - automatically adjust each of the security settings. If you choose to customize - an individual security setting, the profile will become Custom. - (https://support.cloudflare.com/hc/en-us/articles/200170056). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/security_level", - body=await async_maybe_transform({"value": value}, security_level_edit_params.SecurityLevelEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SecurityLevel]: - """ - Choose the appropriate security profile for your website, which will - automatically adjust each of the security settings. If you choose to customize - an individual security setting, the profile will become Custom. - (https://support.cloudflare.com/hc/en-us/articles/200170056). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/security_level", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SecurityLevel]]._unwrapper, - ), - cast_to=cast(Type[Optional[SecurityLevel]], ResultWrapper[SecurityLevel]), - ) - - -class SecurityLevelResourceWithRawResponse: - def __init__(self, security_level: SecurityLevelResource) -> None: - self._security_level = security_level - - self.edit = to_raw_response_wrapper( - security_level.edit, - ) - self.get = to_raw_response_wrapper( - security_level.get, - ) - - -class AsyncSecurityLevelResourceWithRawResponse: - def __init__(self, security_level: AsyncSecurityLevelResource) -> None: - self._security_level = security_level - - self.edit = async_to_raw_response_wrapper( - security_level.edit, - ) - self.get = async_to_raw_response_wrapper( - security_level.get, - ) - - -class SecurityLevelResourceWithStreamingResponse: - def __init__(self, security_level: SecurityLevelResource) -> None: - self._security_level = security_level - - self.edit = to_streamed_response_wrapper( - security_level.edit, - ) - self.get = to_streamed_response_wrapper( - security_level.get, - ) - - -class AsyncSecurityLevelResourceWithStreamingResponse: - def __init__(self, security_level: AsyncSecurityLevelResource) -> None: - self._security_level = security_level - - self.edit = async_to_streamed_response_wrapper( - security_level.edit, - ) - self.get = async_to_streamed_response_wrapper( - security_level.get, - ) diff --git a/src/cloudflare/resources/zones/settings/server_side_excludes.py b/src/cloudflare/resources/zones/settings/server_side_excludes.py deleted file mode 100644 index b84f8e70b19..00000000000 --- a/src/cloudflare/resources/zones/settings/server_side_excludes.py +++ /dev/null @@ -1,304 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import server_side_exclude_edit_params -from ....types.zones.settings.server_side_excludes import ServerSideExcludes - -__all__ = ["ServerSideExcludesResource", "AsyncServerSideExcludesResource"] - - -class ServerSideExcludesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ServerSideExcludesResourceWithRawResponse: - return ServerSideExcludesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ServerSideExcludesResourceWithStreamingResponse: - return ServerSideExcludesResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[ServerSideExcludes]: - """ - If there is sensitive content on your website that you want visible to real - visitors, but that you want to hide from suspicious visitors, all you have to do - is wrap the content with Cloudflare SSE tags. Wrap any content that you want to - be excluded from suspicious visitors in the following SSE tags: - . For example: Bad visitors won't see my phone - number, 555-555-5555 . Note: SSE only will work with HTML. If you - have HTML minification enabled, you won't see the SSE tags in your HTML source - when it's served through Cloudflare. SSE will still function in this case, as - Cloudflare's HTML minification and SSE functionality occur on-the-fly as the - resource moves through our network to the visitor's computer. - (https://support.cloudflare.com/hc/en-us/articles/200170036). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/server_side_exclude", - body=maybe_transform({"value": value}, server_side_exclude_edit_params.ServerSideExcludeEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServerSideExcludes]: - """ - If there is sensitive content on your website that you want visible to real - visitors, but that you want to hide from suspicious visitors, all you have to do - is wrap the content with Cloudflare SSE tags. Wrap any content that you want to - be excluded from suspicious visitors in the following SSE tags: - . For example: Bad visitors won't see my phone - number, 555-555-5555 . Note: SSE only will work with HTML. If you - have HTML minification enabled, you won't see the SSE tags in your HTML source - when it's served through Cloudflare. SSE will still function in this case, as - Cloudflare's HTML minification and SSE functionality occur on-the-fly as the - resource moves through our network to the visitor's computer. - (https://support.cloudflare.com/hc/en-us/articles/200170036). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/server_side_exclude", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), - ) - - -class AsyncServerSideExcludesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncServerSideExcludesResourceWithRawResponse: - return AsyncServerSideExcludesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncServerSideExcludesResourceWithStreamingResponse: - return AsyncServerSideExcludesResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[ServerSideExcludes]: - """ - If there is sensitive content on your website that you want visible to real - visitors, but that you want to hide from suspicious visitors, all you have to do - is wrap the content with Cloudflare SSE tags. Wrap any content that you want to - be excluded from suspicious visitors in the following SSE tags: - . For example: Bad visitors won't see my phone - number, 555-555-5555 . Note: SSE only will work with HTML. If you - have HTML minification enabled, you won't see the SSE tags in your HTML source - when it's served through Cloudflare. SSE will still function in this case, as - Cloudflare's HTML minification and SSE functionality occur on-the-fly as the - resource moves through our network to the visitor's computer. - (https://support.cloudflare.com/hc/en-us/articles/200170036). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/server_side_exclude", - body=await async_maybe_transform( - {"value": value}, server_side_exclude_edit_params.ServerSideExcludeEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServerSideExcludes]: - """ - If there is sensitive content on your website that you want visible to real - visitors, but that you want to hide from suspicious visitors, all you have to do - is wrap the content with Cloudflare SSE tags. Wrap any content that you want to - be excluded from suspicious visitors in the following SSE tags: - . For example: Bad visitors won't see my phone - number, 555-555-5555 . Note: SSE only will work with HTML. If you - have HTML minification enabled, you won't see the SSE tags in your HTML source - when it's served through Cloudflare. SSE will still function in this case, as - Cloudflare's HTML minification and SSE functionality occur on-the-fly as the - resource moves through our network to the visitor's computer. - (https://support.cloudflare.com/hc/en-us/articles/200170036). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/server_side_exclude", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ServerSideExcludes]]._unwrapper, - ), - cast_to=cast(Type[Optional[ServerSideExcludes]], ResultWrapper[ServerSideExcludes]), - ) - - -class ServerSideExcludesResourceWithRawResponse: - def __init__(self, server_side_excludes: ServerSideExcludesResource) -> None: - self._server_side_excludes = server_side_excludes - - self.edit = to_raw_response_wrapper( - server_side_excludes.edit, - ) - self.get = to_raw_response_wrapper( - server_side_excludes.get, - ) - - -class AsyncServerSideExcludesResourceWithRawResponse: - def __init__(self, server_side_excludes: AsyncServerSideExcludesResource) -> None: - self._server_side_excludes = server_side_excludes - - self.edit = async_to_raw_response_wrapper( - server_side_excludes.edit, - ) - self.get = async_to_raw_response_wrapper( - server_side_excludes.get, - ) - - -class ServerSideExcludesResourceWithStreamingResponse: - def __init__(self, server_side_excludes: ServerSideExcludesResource) -> None: - self._server_side_excludes = server_side_excludes - - self.edit = to_streamed_response_wrapper( - server_side_excludes.edit, - ) - self.get = to_streamed_response_wrapper( - server_side_excludes.get, - ) - - -class AsyncServerSideExcludesResourceWithStreamingResponse: - def __init__(self, server_side_excludes: AsyncServerSideExcludesResource) -> None: - self._server_side_excludes = server_side_excludes - - self.edit = async_to_streamed_response_wrapper( - server_side_excludes.edit, - ) - self.get = async_to_streamed_response_wrapper( - server_side_excludes.get, - ) diff --git a/src/cloudflare/resources/zones/settings/settings.py b/src/cloudflare/resources/zones/settings/settings.py index 5202b805f12..48b3522b37e 100644 --- a/src/cloudflare/resources/zones/settings/settings.py +++ b/src/cloudflare/resources/zones/settings/settings.py @@ -2,184 +2,8 @@ from __future__ import annotations -from .nel import ( - NELResource, - AsyncNELResource, - NELResourceWithRawResponse, - AsyncNELResourceWithRawResponse, - NELResourceWithStreamingResponse, - AsyncNELResourceWithStreamingResponse, -) -from .ssl import ( - SSLResource, - AsyncSSLResource, - SSLResourceWithRawResponse, - AsyncSSLResourceWithRawResponse, - SSLResourceWithStreamingResponse, - AsyncSSLResourceWithStreamingResponse, -) -from .waf import ( - WAFResource, - AsyncWAFResource, - WAFResourceWithRawResponse, - AsyncWAFResourceWithRawResponse, - WAFResourceWithStreamingResponse, - AsyncWAFResourceWithStreamingResponse, -) -from .ipv6 import ( - IPV6Resource, - AsyncIPV6Resource, - IPV6ResourceWithRawResponse, - AsyncIPV6ResourceWithRawResponse, - IPV6ResourceWithStreamingResponse, - AsyncIPV6ResourceWithStreamingResponse, -) -from .webp import ( - WebPResource, - AsyncWebPResource, - WebPResourceWithRawResponse, - AsyncWebPResourceWithRawResponse, - WebPResourceWithStreamingResponse, - AsyncWebPResourceWithStreamingResponse, -) -from .http2 import ( - HTTP2Resource, - AsyncHTTP2Resource, - HTTP2ResourceWithRawResponse, - AsyncHTTP2ResourceWithRawResponse, - HTTP2ResourceWithStreamingResponse, - AsyncHTTP2ResourceWithStreamingResponse, -) -from .http3 import ( - HTTP3Resource, - AsyncHTTP3Resource, - HTTP3ResourceWithRawResponse, - AsyncHTTP3ResourceWithRawResponse, - HTTP3ResourceWithStreamingResponse, - AsyncHTTP3ResourceWithStreamingResponse, -) -from .brotli import ( - BrotliResource, - AsyncBrotliResource, - BrotliResourceWithRawResponse, - AsyncBrotliResourceWithRawResponse, - BrotliResourceWithStreamingResponse, - AsyncBrotliResourceWithStreamingResponse, -) -from .minify import ( - MinifyResource, - AsyncMinifyResource, - MinifyResourceWithRawResponse, - AsyncMinifyResourceWithRawResponse, - MinifyResourceWithStreamingResponse, - AsyncMinifyResourceWithStreamingResponse, -) -from .mirage import ( - MirageResource, - AsyncMirageResource, - MirageResourceWithRawResponse, - AsyncMirageResourceWithRawResponse, - MirageResourceWithStreamingResponse, - AsyncMirageResourceWithStreamingResponse, -) -from .polish import ( - PolishResource, - AsyncPolishResource, - PolishResourceWithRawResponse, - AsyncPolishResourceWithRawResponse, - PolishResourceWithStreamingResponse, - AsyncPolishResourceWithStreamingResponse, -) -from .ciphers import ( - CiphersResource, - AsyncCiphersResource, - CiphersResourceWithRawResponse, - AsyncCiphersResourceWithRawResponse, - CiphersResourceWithStreamingResponse, - AsyncCiphersResourceWithStreamingResponse, -) -from .tls_1_3 import ( - TLS1_3Resource, - AsyncTLS1_3Resource, - TLS1_3ResourceWithRawResponse, - AsyncTLS1_3ResourceWithRawResponse, - TLS1_3ResourceWithStreamingResponse, - AsyncTLS1_3ResourceWithStreamingResponse, -) -from .zero_rtt import ( - ZeroRTTResource, - AsyncZeroRTTResource, - ZeroRTTResourceWithRawResponse, - AsyncZeroRTTResourceWithRawResponse, - ZeroRTTResourceWithStreamingResponse, - AsyncZeroRTTResourceWithStreamingResponse, -) -from .websocket import ( - WebsocketResource, - AsyncWebsocketResource, - WebsocketResourceWithRawResponse, - AsyncWebsocketResourceWithRawResponse, - WebsocketResourceWithStreamingResponse, - AsyncWebsocketResourceWithStreamingResponse, -) from ...._compat import cached_property -from .cache_level import ( - CacheLevelResource, - AsyncCacheLevelResource, - CacheLevelResourceWithRawResponse, - AsyncCacheLevelResourceWithRawResponse, - CacheLevelResourceWithStreamingResponse, - AsyncCacheLevelResourceWithStreamingResponse, -) -from .early_hints import ( - EarlyHintsResource, - AsyncEarlyHintsResource, - EarlyHintsResourceWithRawResponse, - AsyncEarlyHintsResourceWithRawResponse, - EarlyHintsResourceWithStreamingResponse, - AsyncEarlyHintsResourceWithStreamingResponse, -) -from .pseudo_ipv4 import ( - PseudoIPV4Resource, - AsyncPseudoIPV4Resource, - PseudoIPV4ResourceWithRawResponse, - AsyncPseudoIPV4ResourceWithRawResponse, - PseudoIPV4ResourceWithStreamingResponse, - AsyncPseudoIPV4ResourceWithStreamingResponse, -) from ...._resource import SyncAPIResource, AsyncAPIResource -from .advanced_ddos import ( - AdvancedDDoSResource, - AsyncAdvancedDDoSResource, - AdvancedDDoSResourceWithRawResponse, - AsyncAdvancedDDoSResourceWithRawResponse, - AdvancedDDoSResourceWithStreamingResponse, - AsyncAdvancedDDoSResourceWithStreamingResponse, -) -from .always_online import ( - AlwaysOnlineResource, - AsyncAlwaysOnlineResource, - AlwaysOnlineResourceWithRawResponse, - AsyncAlwaysOnlineResourceWithRawResponse, - AlwaysOnlineResourceWithStreamingResponse, - AsyncAlwaysOnlineResourceWithStreamingResponse, -) -from .browser_check import ( - BrowserCheckResource, - AsyncBrowserCheckResource, - BrowserCheckResourceWithRawResponse, - AsyncBrowserCheckResourceWithRawResponse, - BrowserCheckResourceWithStreamingResponse, - AsyncBrowserCheckResourceWithStreamingResponse, -) -from .challenge_ttl import ( - ChallengeTTLResource, - AsyncChallengeTTLResource, - ChallengeTTLResourceWithRawResponse, - AsyncChallengeTTLResourceWithRawResponse, - ChallengeTTLResourceWithStreamingResponse, - AsyncChallengeTTLResourceWithStreamingResponse, -) from .font_settings import ( FontSettingsResource, AsyncFontSettingsResource, @@ -188,182 +12,6 @@ FontSettingsResourceWithStreamingResponse, AsyncFontSettingsResourceWithStreamingResponse, ) -from .rocket_loader import ( - RocketLoaderResource, - AsyncRocketLoaderResource, - RocketLoaderResourceWithRawResponse, - AsyncRocketLoaderResourceWithRawResponse, - RocketLoaderResourceWithStreamingResponse, - AsyncRocketLoaderResourceWithStreamingResponse, -) -from .image_resizing import ( - ImageResizingResource, - AsyncImageResizingResource, - ImageResizingResourceWithRawResponse, - AsyncImageResizingResourceWithRawResponse, - ImageResizingResourceWithStreamingResponse, - AsyncImageResizingResourceWithStreamingResponse, -) -from .ip_geolocation import ( - IPGeolocationResource, - AsyncIPGeolocationResource, - IPGeolocationResourceWithRawResponse, - AsyncIPGeolocationResourceWithRawResponse, - IPGeolocationResourceWithStreamingResponse, - AsyncIPGeolocationResourceWithStreamingResponse, -) -from .security_level import ( - SecurityLevelResource, - AsyncSecurityLevelResource, - SecurityLevelResourceWithRawResponse, - AsyncSecurityLevelResourceWithRawResponse, - SecurityLevelResourceWithStreamingResponse, - AsyncSecurityLevelResourceWithStreamingResponse, -) -from .min_tls_version import ( - MinTLSVersionResource, - AsyncMinTLSVersionResource, - MinTLSVersionResourceWithRawResponse, - AsyncMinTLSVersionResourceWithRawResponse, - MinTLSVersionResourceWithStreamingResponse, - AsyncMinTLSVersionResourceWithStreamingResponse, -) -from .mobile_redirect import ( - MobileRedirectResource, - AsyncMobileRedirectResource, - MobileRedirectResourceWithRawResponse, - AsyncMobileRedirectResourceWithRawResponse, - MobileRedirectResourceWithStreamingResponse, - AsyncMobileRedirectResourceWithStreamingResponse, -) -from .ssl_recommender import ( - SSLRecommenderResource, - AsyncSSLRecommenderResource, - SSLRecommenderResourceWithRawResponse, - AsyncSSLRecommenderResourceWithRawResponse, - SSLRecommenderResourceWithStreamingResponse, - AsyncSSLRecommenderResourceWithStreamingResponse, -) -from .tls_client_auth import ( - TLSClientAuthResource, - AsyncTLSClientAuthResource, - TLSClientAuthResourceWithRawResponse, - AsyncTLSClientAuthResourceWithRawResponse, - TLSClientAuthResourceWithStreamingResponse, - AsyncTLSClientAuthResourceWithStreamingResponse, -) -from .always_use_https import ( - AlwaysUseHTTPSResource, - AsyncAlwaysUseHTTPSResource, - AlwaysUseHTTPSResourceWithRawResponse, - AsyncAlwaysUseHTTPSResourceWithRawResponse, - AlwaysUseHTTPSResourceWithStreamingResponse, - AsyncAlwaysUseHTTPSResourceWithStreamingResponse, -) -from .development_mode import ( - DevelopmentModeResource, - AsyncDevelopmentModeResource, - DevelopmentModeResourceWithRawResponse, - AsyncDevelopmentModeResourceWithRawResponse, - DevelopmentModeResourceWithStreamingResponse, - AsyncDevelopmentModeResourceWithStreamingResponse, -) -from .orange_to_orange import ( - OrangeToOrangeResource, - AsyncOrangeToOrangeResource, - OrangeToOrangeResourceWithRawResponse, - AsyncOrangeToOrangeResourceWithRawResponse, - OrangeToOrangeResourceWithStreamingResponse, - AsyncOrangeToOrangeResourceWithStreamingResponse, -) -from .prefetch_preload import ( - PrefetchPreloadResource, - AsyncPrefetchPreloadResource, - PrefetchPreloadResourceWithRawResponse, - AsyncPrefetchPreloadResourceWithRawResponse, - PrefetchPreloadResourceWithStreamingResponse, - AsyncPrefetchPreloadResourceWithStreamingResponse, -) -from .security_headers import ( - SecurityHeadersResource, - AsyncSecurityHeadersResource, - SecurityHeadersResourceWithRawResponse, - AsyncSecurityHeadersResourceWithRawResponse, - SecurityHeadersResourceWithStreamingResponse, - AsyncSecurityHeadersResourceWithStreamingResponse, -) -from .browser_cache_ttl import ( - BrowserCacheTTLResource, - AsyncBrowserCacheTTLResource, - BrowserCacheTTLResourceWithRawResponse, - AsyncBrowserCacheTTLResourceWithRawResponse, - BrowserCacheTTLResourceWithStreamingResponse, - AsyncBrowserCacheTTLResourceWithStreamingResponse, -) -from .email_obfuscation import ( - EmailObfuscationResource, - AsyncEmailObfuscationResource, - EmailObfuscationResourceWithRawResponse, - AsyncEmailObfuscationResourceWithRawResponse, - EmailObfuscationResourceWithStreamingResponse, - AsyncEmailObfuscationResourceWithStreamingResponse, -) -from .h2_prioritization import ( - H2PrioritizationResource, - AsyncH2PrioritizationResource, - H2PrioritizationResourceWithRawResponse, - AsyncH2PrioritizationResourceWithRawResponse, - H2PrioritizationResourceWithStreamingResponse, - AsyncH2PrioritizationResourceWithStreamingResponse, -) -from .hotlink_protection import ( - HotlinkProtectionResource, - AsyncHotlinkProtectionResource, - HotlinkProtectionResourceWithRawResponse, - AsyncHotlinkProtectionResourceWithRawResponse, - HotlinkProtectionResourceWithStreamingResponse, - AsyncHotlinkProtectionResourceWithStreamingResponse, -) -from .proxy_read_timeout import ( - ProxyReadTimeoutResource, - AsyncProxyReadTimeoutResource, - ProxyReadTimeoutResourceWithRawResponse, - AsyncProxyReadTimeoutResourceWithRawResponse, - ProxyReadTimeoutResourceWithStreamingResponse, - AsyncProxyReadTimeoutResourceWithStreamingResponse, -) -from .response_buffering import ( - ResponseBufferingResource, - AsyncResponseBufferingResource, - ResponseBufferingResourceWithRawResponse, - AsyncResponseBufferingResourceWithRawResponse, - ResponseBufferingResourceWithStreamingResponse, - AsyncResponseBufferingResourceWithStreamingResponse, -) -from .opportunistic_onion import ( - OpportunisticOnionResource, - AsyncOpportunisticOnionResource, - OpportunisticOnionResourceWithRawResponse, - AsyncOpportunisticOnionResourceWithRawResponse, - OpportunisticOnionResourceWithStreamingResponse, - AsyncOpportunisticOnionResourceWithStreamingResponse, -) -from .server_side_excludes import ( - ServerSideExcludesResource, - AsyncServerSideExcludesResource, - ServerSideExcludesResourceWithRawResponse, - AsyncServerSideExcludesResourceWithRawResponse, - ServerSideExcludesResourceWithStreamingResponse, - AsyncServerSideExcludesResourceWithStreamingResponse, -) -from .true_client_ip_header import ( - TrueClientIPHeaderResource, - AsyncTrueClientIPHeaderResource, - TrueClientIPHeaderResourceWithRawResponse, - AsyncTrueClientIPHeaderResourceWithRawResponse, - TrueClientIPHeaderResourceWithStreamingResponse, - AsyncTrueClientIPHeaderResourceWithStreamingResponse, -) from .origin_max_http_version import ( OriginMaxHTTPVersionResource, AsyncOriginMaxHTTPVersionResource, @@ -372,251 +20,15 @@ OriginMaxHTTPVersionResourceWithStreamingResponse, AsyncOriginMaxHTTPVersionResourceWithStreamingResponse, ) -from .automatic_https_rewrites import ( - AutomaticHTTPSRewritesResource, - AsyncAutomaticHTTPSRewritesResource, - AutomaticHTTPSRewritesResourceWithRawResponse, - AsyncAutomaticHTTPSRewritesResourceWithRawResponse, - AutomaticHTTPSRewritesResourceWithStreamingResponse, - AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse, -) -from .opportunistic_encryption import ( - OpportunisticEncryptionResource, - AsyncOpportunisticEncryptionResource, - OpportunisticEncryptionResourceWithRawResponse, - AsyncOpportunisticEncryptionResourceWithRawResponse, - OpportunisticEncryptionResourceWithStreamingResponse, - AsyncOpportunisticEncryptionResourceWithStreamingResponse, -) -from .origin_error_page_pass_thru import ( - OriginErrorPagePassThruResource, - AsyncOriginErrorPagePassThruResource, - OriginErrorPagePassThruResourceWithRawResponse, - AsyncOriginErrorPagePassThruResourceWithRawResponse, - OriginErrorPagePassThruResourceWithStreamingResponse, - AsyncOriginErrorPagePassThruResourceWithStreamingResponse, -) -from .sort_query_string_for_cache import ( - SortQueryStringForCacheResource, - AsyncSortQueryStringForCacheResource, - SortQueryStringForCacheResourceWithRawResponse, - AsyncSortQueryStringForCacheResourceWithRawResponse, - SortQueryStringForCacheResourceWithStreamingResponse, - AsyncSortQueryStringForCacheResourceWithStreamingResponse, -) -from .automatic_platform_optimization import ( - AutomaticPlatformOptimizationResource, - AsyncAutomaticPlatformOptimizationResource, - AutomaticPlatformOptimizationResourceWithRawResponse, - AsyncAutomaticPlatformOptimizationResourceWithRawResponse, - AutomaticPlatformOptimizationResourceWithStreamingResponse, - AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse, -) __all__ = ["SettingsResource", "AsyncSettingsResource"] class SettingsResource(SyncAPIResource): - @cached_property - def zero_rtt(self) -> ZeroRTTResource: - return ZeroRTTResource(self._client) - - @cached_property - def advanced_ddos(self) -> AdvancedDDoSResource: - return AdvancedDDoSResource(self._client) - - @cached_property - def always_online(self) -> AlwaysOnlineResource: - return AlwaysOnlineResource(self._client) - - @cached_property - def always_use_https(self) -> AlwaysUseHTTPSResource: - return AlwaysUseHTTPSResource(self._client) - - @cached_property - def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesResource: - return AutomaticHTTPSRewritesResource(self._client) - - @cached_property - def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationResource: - return AutomaticPlatformOptimizationResource(self._client) - - @cached_property - def brotli(self) -> BrotliResource: - return BrotliResource(self._client) - - @cached_property - def browser_cache_ttl(self) -> BrowserCacheTTLResource: - return BrowserCacheTTLResource(self._client) - - @cached_property - def browser_check(self) -> BrowserCheckResource: - return BrowserCheckResource(self._client) - - @cached_property - def cache_level(self) -> CacheLevelResource: - return CacheLevelResource(self._client) - - @cached_property - def challenge_ttl(self) -> ChallengeTTLResource: - return ChallengeTTLResource(self._client) - - @cached_property - def ciphers(self) -> CiphersResource: - return CiphersResource(self._client) - - @cached_property - def development_mode(self) -> DevelopmentModeResource: - return DevelopmentModeResource(self._client) - - @cached_property - def early_hints(self) -> EarlyHintsResource: - return EarlyHintsResource(self._client) - - @cached_property - def email_obfuscation(self) -> EmailObfuscationResource: - return EmailObfuscationResource(self._client) - - @cached_property - def h2_prioritization(self) -> H2PrioritizationResource: - return H2PrioritizationResource(self._client) - - @cached_property - def hotlink_protection(self) -> HotlinkProtectionResource: - return HotlinkProtectionResource(self._client) - - @cached_property - def http2(self) -> HTTP2Resource: - return HTTP2Resource(self._client) - - @cached_property - def http3(self) -> HTTP3Resource: - return HTTP3Resource(self._client) - - @cached_property - def image_resizing(self) -> ImageResizingResource: - return ImageResizingResource(self._client) - - @cached_property - def ip_geolocation(self) -> IPGeolocationResource: - return IPGeolocationResource(self._client) - - @cached_property - def ipv6(self) -> IPV6Resource: - return IPV6Resource(self._client) - - @cached_property - def min_tls_version(self) -> MinTLSVersionResource: - return MinTLSVersionResource(self._client) - - @cached_property - def minify(self) -> MinifyResource: - return MinifyResource(self._client) - - @cached_property - def mirage(self) -> MirageResource: - return MirageResource(self._client) - - @cached_property - def mobile_redirect(self) -> MobileRedirectResource: - return MobileRedirectResource(self._client) - - @cached_property - def nel(self) -> NELResource: - return NELResource(self._client) - - @cached_property - def opportunistic_encryption(self) -> OpportunisticEncryptionResource: - return OpportunisticEncryptionResource(self._client) - - @cached_property - def opportunistic_onion(self) -> OpportunisticOnionResource: - return OpportunisticOnionResource(self._client) - - @cached_property - def orange_to_orange(self) -> OrangeToOrangeResource: - return OrangeToOrangeResource(self._client) - - @cached_property - def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruResource: - return OriginErrorPagePassThruResource(self._client) - @cached_property def origin_max_http_version(self) -> OriginMaxHTTPVersionResource: return OriginMaxHTTPVersionResource(self._client) - @cached_property - def polish(self) -> PolishResource: - return PolishResource(self._client) - - @cached_property - def prefetch_preload(self) -> PrefetchPreloadResource: - return PrefetchPreloadResource(self._client) - - @cached_property - def proxy_read_timeout(self) -> ProxyReadTimeoutResource: - return ProxyReadTimeoutResource(self._client) - - @cached_property - def pseudo_ipv4(self) -> PseudoIPV4Resource: - return PseudoIPV4Resource(self._client) - - @cached_property - def response_buffering(self) -> ResponseBufferingResource: - return ResponseBufferingResource(self._client) - - @cached_property - def rocket_loader(self) -> RocketLoaderResource: - return RocketLoaderResource(self._client) - - @cached_property - def security_headers(self) -> SecurityHeadersResource: - return SecurityHeadersResource(self._client) - - @cached_property - def security_level(self) -> SecurityLevelResource: - return SecurityLevelResource(self._client) - - @cached_property - def server_side_excludes(self) -> ServerSideExcludesResource: - return ServerSideExcludesResource(self._client) - - @cached_property - def sort_query_string_for_cache(self) -> SortQueryStringForCacheResource: - return SortQueryStringForCacheResource(self._client) - - @cached_property - def ssl(self) -> SSLResource: - return SSLResource(self._client) - - @cached_property - def ssl_recommender(self) -> SSLRecommenderResource: - return SSLRecommenderResource(self._client) - - @cached_property - def tls_1_3(self) -> TLS1_3Resource: - return TLS1_3Resource(self._client) - - @cached_property - def tls_client_auth(self) -> TLSClientAuthResource: - return TLSClientAuthResource(self._client) - - @cached_property - def true_client_ip_header(self) -> TrueClientIPHeaderResource: - return TrueClientIPHeaderResource(self._client) - - @cached_property - def waf(self) -> WAFResource: - return WAFResource(self._client) - - @cached_property - def webp(self) -> WebPResource: - return WebPResource(self._client) - - @cached_property - def websocket(self) -> WebsocketResource: - return WebsocketResource(self._client) - @cached_property def font_settings(self) -> FontSettingsResource: return FontSettingsResource(self._client) @@ -631,1054 +43,70 @@ def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: class AsyncSettingsResource(AsyncAPIResource): - @cached_property - def zero_rtt(self) -> AsyncZeroRTTResource: - return AsyncZeroRTTResource(self._client) - - @cached_property - def advanced_ddos(self) -> AsyncAdvancedDDoSResource: - return AsyncAdvancedDDoSResource(self._client) - - @cached_property - def always_online(self) -> AsyncAlwaysOnlineResource: - return AsyncAlwaysOnlineResource(self._client) - - @cached_property - def always_use_https(self) -> AsyncAlwaysUseHTTPSResource: - return AsyncAlwaysUseHTTPSResource(self._client) - - @cached_property - def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesResource: - return AsyncAutomaticHTTPSRewritesResource(self._client) - - @cached_property - def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationResource: - return AsyncAutomaticPlatformOptimizationResource(self._client) - - @cached_property - def brotli(self) -> AsyncBrotliResource: - return AsyncBrotliResource(self._client) - - @cached_property - def browser_cache_ttl(self) -> AsyncBrowserCacheTTLResource: - return AsyncBrowserCacheTTLResource(self._client) - - @cached_property - def browser_check(self) -> AsyncBrowserCheckResource: - return AsyncBrowserCheckResource(self._client) - - @cached_property - def cache_level(self) -> AsyncCacheLevelResource: - return AsyncCacheLevelResource(self._client) - - @cached_property - def challenge_ttl(self) -> AsyncChallengeTTLResource: - return AsyncChallengeTTLResource(self._client) - - @cached_property - def ciphers(self) -> AsyncCiphersResource: - return AsyncCiphersResource(self._client) - - @cached_property - def development_mode(self) -> AsyncDevelopmentModeResource: - return AsyncDevelopmentModeResource(self._client) - - @cached_property - def early_hints(self) -> AsyncEarlyHintsResource: - return AsyncEarlyHintsResource(self._client) - - @cached_property - def email_obfuscation(self) -> AsyncEmailObfuscationResource: - return AsyncEmailObfuscationResource(self._client) - - @cached_property - def h2_prioritization(self) -> AsyncH2PrioritizationResource: - return AsyncH2PrioritizationResource(self._client) - - @cached_property - def hotlink_protection(self) -> AsyncHotlinkProtectionResource: - return AsyncHotlinkProtectionResource(self._client) - - @cached_property - def http2(self) -> AsyncHTTP2Resource: - return AsyncHTTP2Resource(self._client) - - @cached_property - def http3(self) -> AsyncHTTP3Resource: - return AsyncHTTP3Resource(self._client) - - @cached_property - def image_resizing(self) -> AsyncImageResizingResource: - return AsyncImageResizingResource(self._client) - - @cached_property - def ip_geolocation(self) -> AsyncIPGeolocationResource: - return AsyncIPGeolocationResource(self._client) - - @cached_property - def ipv6(self) -> AsyncIPV6Resource: - return AsyncIPV6Resource(self._client) - - @cached_property - def min_tls_version(self) -> AsyncMinTLSVersionResource: - return AsyncMinTLSVersionResource(self._client) - - @cached_property - def minify(self) -> AsyncMinifyResource: - return AsyncMinifyResource(self._client) - - @cached_property - def mirage(self) -> AsyncMirageResource: - return AsyncMirageResource(self._client) - - @cached_property - def mobile_redirect(self) -> AsyncMobileRedirectResource: - return AsyncMobileRedirectResource(self._client) - - @cached_property - def nel(self) -> AsyncNELResource: - return AsyncNELResource(self._client) - - @cached_property - def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionResource: - return AsyncOpportunisticEncryptionResource(self._client) - - @cached_property - def opportunistic_onion(self) -> AsyncOpportunisticOnionResource: - return AsyncOpportunisticOnionResource(self._client) - - @cached_property - def orange_to_orange(self) -> AsyncOrangeToOrangeResource: - return AsyncOrangeToOrangeResource(self._client) - - @cached_property - def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruResource: - return AsyncOriginErrorPagePassThruResource(self._client) - @cached_property def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResource: return AsyncOriginMaxHTTPVersionResource(self._client) @cached_property - def polish(self) -> AsyncPolishResource: - return AsyncPolishResource(self._client) - - @cached_property - def prefetch_preload(self) -> AsyncPrefetchPreloadResource: - return AsyncPrefetchPreloadResource(self._client) - - @cached_property - def proxy_read_timeout(self) -> AsyncProxyReadTimeoutResource: - return AsyncProxyReadTimeoutResource(self._client) + def font_settings(self) -> AsyncFontSettingsResource: + return AsyncFontSettingsResource(self._client) @cached_property - def pseudo_ipv4(self) -> AsyncPseudoIPV4Resource: - return AsyncPseudoIPV4Resource(self._client) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def response_buffering(self) -> AsyncResponseBufferingResource: - return AsyncResponseBufferingResource(self._client) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) - @cached_property - def rocket_loader(self) -> AsyncRocketLoaderResource: - return AsyncRocketLoaderResource(self._client) - @cached_property - def security_headers(self) -> AsyncSecurityHeadersResource: - return AsyncSecurityHeadersResource(self._client) +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings @cached_property - def security_level(self) -> AsyncSecurityLevelResource: - return AsyncSecurityLevelResource(self._client) + def origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithRawResponse: + return OriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) @cached_property - def server_side_excludes(self) -> AsyncServerSideExcludesResource: - return AsyncServerSideExcludesResource(self._client) + def font_settings(self) -> FontSettingsResourceWithRawResponse: + return FontSettingsResourceWithRawResponse(self._settings.font_settings) - @cached_property - def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheResource: - return AsyncSortQueryStringForCacheResource(self._client) - @cached_property - def ssl(self) -> AsyncSSLResource: - return AsyncSSLResource(self._client) +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings @cached_property - def ssl_recommender(self) -> AsyncSSLRecommenderResource: - return AsyncSSLRecommenderResource(self._client) + def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithRawResponse: + return AsyncOriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) @cached_property - def tls_1_3(self) -> AsyncTLS1_3Resource: - return AsyncTLS1_3Resource(self._client) + def font_settings(self) -> AsyncFontSettingsResourceWithRawResponse: + return AsyncFontSettingsResourceWithRawResponse(self._settings.font_settings) - @cached_property - def tls_client_auth(self) -> AsyncTLSClientAuthResource: - return AsyncTLSClientAuthResource(self._client) - @cached_property - def true_client_ip_header(self) -> AsyncTrueClientIPHeaderResource: - return AsyncTrueClientIPHeaderResource(self._client) +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings @cached_property - def waf(self) -> AsyncWAFResource: - return AsyncWAFResource(self._client) + def origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithStreamingResponse: + return OriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) @cached_property - def webp(self) -> AsyncWebPResource: - return AsyncWebPResource(self._client) + def font_settings(self) -> FontSettingsResourceWithStreamingResponse: + return FontSettingsResourceWithStreamingResponse(self._settings.font_settings) - @cached_property - def websocket(self) -> AsyncWebsocketResource: - return AsyncWebsocketResource(self._client) - @cached_property - def font_settings(self) -> AsyncFontSettingsResource: - return AsyncFontSettingsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: - return AsyncSettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: - return AsyncSettingsResourceWithStreamingResponse(self) - - -class SettingsResourceWithRawResponse: - def __init__(self, settings: SettingsResource) -> None: - self._settings = settings - - @cached_property - def zero_rtt(self) -> ZeroRTTResourceWithRawResponse: - return ZeroRTTResourceWithRawResponse(self._settings.zero_rtt) - - @cached_property - def advanced_ddos(self) -> AdvancedDDoSResourceWithRawResponse: - return AdvancedDDoSResourceWithRawResponse(self._settings.advanced_ddos) - - @cached_property - def always_online(self) -> AlwaysOnlineResourceWithRawResponse: - return AlwaysOnlineResourceWithRawResponse(self._settings.always_online) - - @cached_property - def always_use_https(self) -> AlwaysUseHTTPSResourceWithRawResponse: - return AlwaysUseHTTPSResourceWithRawResponse(self._settings.always_use_https) - - @cached_property - def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesResourceWithRawResponse: - return AutomaticHTTPSRewritesResourceWithRawResponse(self._settings.automatic_https_rewrites) - - @cached_property - def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationResourceWithRawResponse: - return AutomaticPlatformOptimizationResourceWithRawResponse(self._settings.automatic_platform_optimization) - - @cached_property - def brotli(self) -> BrotliResourceWithRawResponse: - return BrotliResourceWithRawResponse(self._settings.brotli) - - @cached_property - def browser_cache_ttl(self) -> BrowserCacheTTLResourceWithRawResponse: - return BrowserCacheTTLResourceWithRawResponse(self._settings.browser_cache_ttl) - - @cached_property - def browser_check(self) -> BrowserCheckResourceWithRawResponse: - return BrowserCheckResourceWithRawResponse(self._settings.browser_check) - - @cached_property - def cache_level(self) -> CacheLevelResourceWithRawResponse: - return CacheLevelResourceWithRawResponse(self._settings.cache_level) - - @cached_property - def challenge_ttl(self) -> ChallengeTTLResourceWithRawResponse: - return ChallengeTTLResourceWithRawResponse(self._settings.challenge_ttl) - - @cached_property - def ciphers(self) -> CiphersResourceWithRawResponse: - return CiphersResourceWithRawResponse(self._settings.ciphers) - - @cached_property - def development_mode(self) -> DevelopmentModeResourceWithRawResponse: - return DevelopmentModeResourceWithRawResponse(self._settings.development_mode) - - @cached_property - def early_hints(self) -> EarlyHintsResourceWithRawResponse: - return EarlyHintsResourceWithRawResponse(self._settings.early_hints) - - @cached_property - def email_obfuscation(self) -> EmailObfuscationResourceWithRawResponse: - return EmailObfuscationResourceWithRawResponse(self._settings.email_obfuscation) - - @cached_property - def h2_prioritization(self) -> H2PrioritizationResourceWithRawResponse: - return H2PrioritizationResourceWithRawResponse(self._settings.h2_prioritization) - - @cached_property - def hotlink_protection(self) -> HotlinkProtectionResourceWithRawResponse: - return HotlinkProtectionResourceWithRawResponse(self._settings.hotlink_protection) - - @cached_property - def http2(self) -> HTTP2ResourceWithRawResponse: - return HTTP2ResourceWithRawResponse(self._settings.http2) - - @cached_property - def http3(self) -> HTTP3ResourceWithRawResponse: - return HTTP3ResourceWithRawResponse(self._settings.http3) - - @cached_property - def image_resizing(self) -> ImageResizingResourceWithRawResponse: - return ImageResizingResourceWithRawResponse(self._settings.image_resizing) - - @cached_property - def ip_geolocation(self) -> IPGeolocationResourceWithRawResponse: - return IPGeolocationResourceWithRawResponse(self._settings.ip_geolocation) - - @cached_property - def ipv6(self) -> IPV6ResourceWithRawResponse: - return IPV6ResourceWithRawResponse(self._settings.ipv6) - - @cached_property - def min_tls_version(self) -> MinTLSVersionResourceWithRawResponse: - return MinTLSVersionResourceWithRawResponse(self._settings.min_tls_version) - - @cached_property - def minify(self) -> MinifyResourceWithRawResponse: - return MinifyResourceWithRawResponse(self._settings.minify) - - @cached_property - def mirage(self) -> MirageResourceWithRawResponse: - return MirageResourceWithRawResponse(self._settings.mirage) - - @cached_property - def mobile_redirect(self) -> MobileRedirectResourceWithRawResponse: - return MobileRedirectResourceWithRawResponse(self._settings.mobile_redirect) - - @cached_property - def nel(self) -> NELResourceWithRawResponse: - return NELResourceWithRawResponse(self._settings.nel) - - @cached_property - def opportunistic_encryption(self) -> OpportunisticEncryptionResourceWithRawResponse: - return OpportunisticEncryptionResourceWithRawResponse(self._settings.opportunistic_encryption) - - @cached_property - def opportunistic_onion(self) -> OpportunisticOnionResourceWithRawResponse: - return OpportunisticOnionResourceWithRawResponse(self._settings.opportunistic_onion) - - @cached_property - def orange_to_orange(self) -> OrangeToOrangeResourceWithRawResponse: - return OrangeToOrangeResourceWithRawResponse(self._settings.orange_to_orange) - - @cached_property - def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruResourceWithRawResponse: - return OriginErrorPagePassThruResourceWithRawResponse(self._settings.origin_error_page_pass_thru) - - @cached_property - def origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithRawResponse: - return OriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) - - @cached_property - def polish(self) -> PolishResourceWithRawResponse: - return PolishResourceWithRawResponse(self._settings.polish) - - @cached_property - def prefetch_preload(self) -> PrefetchPreloadResourceWithRawResponse: - return PrefetchPreloadResourceWithRawResponse(self._settings.prefetch_preload) - - @cached_property - def proxy_read_timeout(self) -> ProxyReadTimeoutResourceWithRawResponse: - return ProxyReadTimeoutResourceWithRawResponse(self._settings.proxy_read_timeout) - - @cached_property - def pseudo_ipv4(self) -> PseudoIPV4ResourceWithRawResponse: - return PseudoIPV4ResourceWithRawResponse(self._settings.pseudo_ipv4) - - @cached_property - def response_buffering(self) -> ResponseBufferingResourceWithRawResponse: - return ResponseBufferingResourceWithRawResponse(self._settings.response_buffering) - - @cached_property - def rocket_loader(self) -> RocketLoaderResourceWithRawResponse: - return RocketLoaderResourceWithRawResponse(self._settings.rocket_loader) - - @cached_property - def security_headers(self) -> SecurityHeadersResourceWithRawResponse: - return SecurityHeadersResourceWithRawResponse(self._settings.security_headers) - - @cached_property - def security_level(self) -> SecurityLevelResourceWithRawResponse: - return SecurityLevelResourceWithRawResponse(self._settings.security_level) - - @cached_property - def server_side_excludes(self) -> ServerSideExcludesResourceWithRawResponse: - return ServerSideExcludesResourceWithRawResponse(self._settings.server_side_excludes) - - @cached_property - def sort_query_string_for_cache(self) -> SortQueryStringForCacheResourceWithRawResponse: - return SortQueryStringForCacheResourceWithRawResponse(self._settings.sort_query_string_for_cache) - - @cached_property - def ssl(self) -> SSLResourceWithRawResponse: - return SSLResourceWithRawResponse(self._settings.ssl) - - @cached_property - def ssl_recommender(self) -> SSLRecommenderResourceWithRawResponse: - return SSLRecommenderResourceWithRawResponse(self._settings.ssl_recommender) - - @cached_property - def tls_1_3(self) -> TLS1_3ResourceWithRawResponse: - return TLS1_3ResourceWithRawResponse(self._settings.tls_1_3) - - @cached_property - def tls_client_auth(self) -> TLSClientAuthResourceWithRawResponse: - return TLSClientAuthResourceWithRawResponse(self._settings.tls_client_auth) - - @cached_property - def true_client_ip_header(self) -> TrueClientIPHeaderResourceWithRawResponse: - return TrueClientIPHeaderResourceWithRawResponse(self._settings.true_client_ip_header) - - @cached_property - def waf(self) -> WAFResourceWithRawResponse: - return WAFResourceWithRawResponse(self._settings.waf) - - @cached_property - def webp(self) -> WebPResourceWithRawResponse: - return WebPResourceWithRawResponse(self._settings.webp) - - @cached_property - def websocket(self) -> WebsocketResourceWithRawResponse: - return WebsocketResourceWithRawResponse(self._settings.websocket) - - @cached_property - def font_settings(self) -> FontSettingsResourceWithRawResponse: - return FontSettingsResourceWithRawResponse(self._settings.font_settings) - - -class AsyncSettingsResourceWithRawResponse: - def __init__(self, settings: AsyncSettingsResource) -> None: - self._settings = settings - - @cached_property - def zero_rtt(self) -> AsyncZeroRTTResourceWithRawResponse: - return AsyncZeroRTTResourceWithRawResponse(self._settings.zero_rtt) - - @cached_property - def advanced_ddos(self) -> AsyncAdvancedDDoSResourceWithRawResponse: - return AsyncAdvancedDDoSResourceWithRawResponse(self._settings.advanced_ddos) - - @cached_property - def always_online(self) -> AsyncAlwaysOnlineResourceWithRawResponse: - return AsyncAlwaysOnlineResourceWithRawResponse(self._settings.always_online) - - @cached_property - def always_use_https(self) -> AsyncAlwaysUseHTTPSResourceWithRawResponse: - return AsyncAlwaysUseHTTPSResourceWithRawResponse(self._settings.always_use_https) - - @cached_property - def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesResourceWithRawResponse: - return AsyncAutomaticHTTPSRewritesResourceWithRawResponse(self._settings.automatic_https_rewrites) - - @cached_property - def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationResourceWithRawResponse: - return AsyncAutomaticPlatformOptimizationResourceWithRawResponse(self._settings.automatic_platform_optimization) - - @cached_property - def brotli(self) -> AsyncBrotliResourceWithRawResponse: - return AsyncBrotliResourceWithRawResponse(self._settings.brotli) - - @cached_property - def browser_cache_ttl(self) -> AsyncBrowserCacheTTLResourceWithRawResponse: - return AsyncBrowserCacheTTLResourceWithRawResponse(self._settings.browser_cache_ttl) - - @cached_property - def browser_check(self) -> AsyncBrowserCheckResourceWithRawResponse: - return AsyncBrowserCheckResourceWithRawResponse(self._settings.browser_check) - - @cached_property - def cache_level(self) -> AsyncCacheLevelResourceWithRawResponse: - return AsyncCacheLevelResourceWithRawResponse(self._settings.cache_level) - - @cached_property - def challenge_ttl(self) -> AsyncChallengeTTLResourceWithRawResponse: - return AsyncChallengeTTLResourceWithRawResponse(self._settings.challenge_ttl) - - @cached_property - def ciphers(self) -> AsyncCiphersResourceWithRawResponse: - return AsyncCiphersResourceWithRawResponse(self._settings.ciphers) - - @cached_property - def development_mode(self) -> AsyncDevelopmentModeResourceWithRawResponse: - return AsyncDevelopmentModeResourceWithRawResponse(self._settings.development_mode) - - @cached_property - def early_hints(self) -> AsyncEarlyHintsResourceWithRawResponse: - return AsyncEarlyHintsResourceWithRawResponse(self._settings.early_hints) - - @cached_property - def email_obfuscation(self) -> AsyncEmailObfuscationResourceWithRawResponse: - return AsyncEmailObfuscationResourceWithRawResponse(self._settings.email_obfuscation) - - @cached_property - def h2_prioritization(self) -> AsyncH2PrioritizationResourceWithRawResponse: - return AsyncH2PrioritizationResourceWithRawResponse(self._settings.h2_prioritization) - - @cached_property - def hotlink_protection(self) -> AsyncHotlinkProtectionResourceWithRawResponse: - return AsyncHotlinkProtectionResourceWithRawResponse(self._settings.hotlink_protection) - - @cached_property - def http2(self) -> AsyncHTTP2ResourceWithRawResponse: - return AsyncHTTP2ResourceWithRawResponse(self._settings.http2) - - @cached_property - def http3(self) -> AsyncHTTP3ResourceWithRawResponse: - return AsyncHTTP3ResourceWithRawResponse(self._settings.http3) - - @cached_property - def image_resizing(self) -> AsyncImageResizingResourceWithRawResponse: - return AsyncImageResizingResourceWithRawResponse(self._settings.image_resizing) - - @cached_property - def ip_geolocation(self) -> AsyncIPGeolocationResourceWithRawResponse: - return AsyncIPGeolocationResourceWithRawResponse(self._settings.ip_geolocation) - - @cached_property - def ipv6(self) -> AsyncIPV6ResourceWithRawResponse: - return AsyncIPV6ResourceWithRawResponse(self._settings.ipv6) - - @cached_property - def min_tls_version(self) -> AsyncMinTLSVersionResourceWithRawResponse: - return AsyncMinTLSVersionResourceWithRawResponse(self._settings.min_tls_version) - - @cached_property - def minify(self) -> AsyncMinifyResourceWithRawResponse: - return AsyncMinifyResourceWithRawResponse(self._settings.minify) - - @cached_property - def mirage(self) -> AsyncMirageResourceWithRawResponse: - return AsyncMirageResourceWithRawResponse(self._settings.mirage) - - @cached_property - def mobile_redirect(self) -> AsyncMobileRedirectResourceWithRawResponse: - return AsyncMobileRedirectResourceWithRawResponse(self._settings.mobile_redirect) - - @cached_property - def nel(self) -> AsyncNELResourceWithRawResponse: - return AsyncNELResourceWithRawResponse(self._settings.nel) - - @cached_property - def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionResourceWithRawResponse: - return AsyncOpportunisticEncryptionResourceWithRawResponse(self._settings.opportunistic_encryption) - - @cached_property - def opportunistic_onion(self) -> AsyncOpportunisticOnionResourceWithRawResponse: - return AsyncOpportunisticOnionResourceWithRawResponse(self._settings.opportunistic_onion) - - @cached_property - def orange_to_orange(self) -> AsyncOrangeToOrangeResourceWithRawResponse: - return AsyncOrangeToOrangeResourceWithRawResponse(self._settings.orange_to_orange) - - @cached_property - def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruResourceWithRawResponse: - return AsyncOriginErrorPagePassThruResourceWithRawResponse(self._settings.origin_error_page_pass_thru) - - @cached_property - def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithRawResponse: - return AsyncOriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) - - @cached_property - def polish(self) -> AsyncPolishResourceWithRawResponse: - return AsyncPolishResourceWithRawResponse(self._settings.polish) - - @cached_property - def prefetch_preload(self) -> AsyncPrefetchPreloadResourceWithRawResponse: - return AsyncPrefetchPreloadResourceWithRawResponse(self._settings.prefetch_preload) - - @cached_property - def proxy_read_timeout(self) -> AsyncProxyReadTimeoutResourceWithRawResponse: - return AsyncProxyReadTimeoutResourceWithRawResponse(self._settings.proxy_read_timeout) - - @cached_property - def pseudo_ipv4(self) -> AsyncPseudoIPV4ResourceWithRawResponse: - return AsyncPseudoIPV4ResourceWithRawResponse(self._settings.pseudo_ipv4) - - @cached_property - def response_buffering(self) -> AsyncResponseBufferingResourceWithRawResponse: - return AsyncResponseBufferingResourceWithRawResponse(self._settings.response_buffering) - - @cached_property - def rocket_loader(self) -> AsyncRocketLoaderResourceWithRawResponse: - return AsyncRocketLoaderResourceWithRawResponse(self._settings.rocket_loader) - - @cached_property - def security_headers(self) -> AsyncSecurityHeadersResourceWithRawResponse: - return AsyncSecurityHeadersResourceWithRawResponse(self._settings.security_headers) - - @cached_property - def security_level(self) -> AsyncSecurityLevelResourceWithRawResponse: - return AsyncSecurityLevelResourceWithRawResponse(self._settings.security_level) - - @cached_property - def server_side_excludes(self) -> AsyncServerSideExcludesResourceWithRawResponse: - return AsyncServerSideExcludesResourceWithRawResponse(self._settings.server_side_excludes) - - @cached_property - def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheResourceWithRawResponse: - return AsyncSortQueryStringForCacheResourceWithRawResponse(self._settings.sort_query_string_for_cache) - - @cached_property - def ssl(self) -> AsyncSSLResourceWithRawResponse: - return AsyncSSLResourceWithRawResponse(self._settings.ssl) - - @cached_property - def ssl_recommender(self) -> AsyncSSLRecommenderResourceWithRawResponse: - return AsyncSSLRecommenderResourceWithRawResponse(self._settings.ssl_recommender) - - @cached_property - def tls_1_3(self) -> AsyncTLS1_3ResourceWithRawResponse: - return AsyncTLS1_3ResourceWithRawResponse(self._settings.tls_1_3) - - @cached_property - def tls_client_auth(self) -> AsyncTLSClientAuthResourceWithRawResponse: - return AsyncTLSClientAuthResourceWithRawResponse(self._settings.tls_client_auth) - - @cached_property - def true_client_ip_header(self) -> AsyncTrueClientIPHeaderResourceWithRawResponse: - return AsyncTrueClientIPHeaderResourceWithRawResponse(self._settings.true_client_ip_header) - - @cached_property - def waf(self) -> AsyncWAFResourceWithRawResponse: - return AsyncWAFResourceWithRawResponse(self._settings.waf) - - @cached_property - def webp(self) -> AsyncWebPResourceWithRawResponse: - return AsyncWebPResourceWithRawResponse(self._settings.webp) - - @cached_property - def websocket(self) -> AsyncWebsocketResourceWithRawResponse: - return AsyncWebsocketResourceWithRawResponse(self._settings.websocket) - - @cached_property - def font_settings(self) -> AsyncFontSettingsResourceWithRawResponse: - return AsyncFontSettingsResourceWithRawResponse(self._settings.font_settings) - - -class SettingsResourceWithStreamingResponse: - def __init__(self, settings: SettingsResource) -> None: - self._settings = settings - - @cached_property - def zero_rtt(self) -> ZeroRTTResourceWithStreamingResponse: - return ZeroRTTResourceWithStreamingResponse(self._settings.zero_rtt) - - @cached_property - def advanced_ddos(self) -> AdvancedDDoSResourceWithStreamingResponse: - return AdvancedDDoSResourceWithStreamingResponse(self._settings.advanced_ddos) - - @cached_property - def always_online(self) -> AlwaysOnlineResourceWithStreamingResponse: - return AlwaysOnlineResourceWithStreamingResponse(self._settings.always_online) - - @cached_property - def always_use_https(self) -> AlwaysUseHTTPSResourceWithStreamingResponse: - return AlwaysUseHTTPSResourceWithStreamingResponse(self._settings.always_use_https) - - @cached_property - def automatic_https_rewrites(self) -> AutomaticHTTPSRewritesResourceWithStreamingResponse: - return AutomaticHTTPSRewritesResourceWithStreamingResponse(self._settings.automatic_https_rewrites) - - @cached_property - def automatic_platform_optimization(self) -> AutomaticPlatformOptimizationResourceWithStreamingResponse: - return AutomaticPlatformOptimizationResourceWithStreamingResponse( - self._settings.automatic_platform_optimization - ) - - @cached_property - def brotli(self) -> BrotliResourceWithStreamingResponse: - return BrotliResourceWithStreamingResponse(self._settings.brotli) - - @cached_property - def browser_cache_ttl(self) -> BrowserCacheTTLResourceWithStreamingResponse: - return BrowserCacheTTLResourceWithStreamingResponse(self._settings.browser_cache_ttl) - - @cached_property - def browser_check(self) -> BrowserCheckResourceWithStreamingResponse: - return BrowserCheckResourceWithStreamingResponse(self._settings.browser_check) - - @cached_property - def cache_level(self) -> CacheLevelResourceWithStreamingResponse: - return CacheLevelResourceWithStreamingResponse(self._settings.cache_level) - - @cached_property - def challenge_ttl(self) -> ChallengeTTLResourceWithStreamingResponse: - return ChallengeTTLResourceWithStreamingResponse(self._settings.challenge_ttl) - - @cached_property - def ciphers(self) -> CiphersResourceWithStreamingResponse: - return CiphersResourceWithStreamingResponse(self._settings.ciphers) - - @cached_property - def development_mode(self) -> DevelopmentModeResourceWithStreamingResponse: - return DevelopmentModeResourceWithStreamingResponse(self._settings.development_mode) - - @cached_property - def early_hints(self) -> EarlyHintsResourceWithStreamingResponse: - return EarlyHintsResourceWithStreamingResponse(self._settings.early_hints) - - @cached_property - def email_obfuscation(self) -> EmailObfuscationResourceWithStreamingResponse: - return EmailObfuscationResourceWithStreamingResponse(self._settings.email_obfuscation) - - @cached_property - def h2_prioritization(self) -> H2PrioritizationResourceWithStreamingResponse: - return H2PrioritizationResourceWithStreamingResponse(self._settings.h2_prioritization) - - @cached_property - def hotlink_protection(self) -> HotlinkProtectionResourceWithStreamingResponse: - return HotlinkProtectionResourceWithStreamingResponse(self._settings.hotlink_protection) - - @cached_property - def http2(self) -> HTTP2ResourceWithStreamingResponse: - return HTTP2ResourceWithStreamingResponse(self._settings.http2) - - @cached_property - def http3(self) -> HTTP3ResourceWithStreamingResponse: - return HTTP3ResourceWithStreamingResponse(self._settings.http3) - - @cached_property - def image_resizing(self) -> ImageResizingResourceWithStreamingResponse: - return ImageResizingResourceWithStreamingResponse(self._settings.image_resizing) - - @cached_property - def ip_geolocation(self) -> IPGeolocationResourceWithStreamingResponse: - return IPGeolocationResourceWithStreamingResponse(self._settings.ip_geolocation) - - @cached_property - def ipv6(self) -> IPV6ResourceWithStreamingResponse: - return IPV6ResourceWithStreamingResponse(self._settings.ipv6) - - @cached_property - def min_tls_version(self) -> MinTLSVersionResourceWithStreamingResponse: - return MinTLSVersionResourceWithStreamingResponse(self._settings.min_tls_version) - - @cached_property - def minify(self) -> MinifyResourceWithStreamingResponse: - return MinifyResourceWithStreamingResponse(self._settings.minify) - - @cached_property - def mirage(self) -> MirageResourceWithStreamingResponse: - return MirageResourceWithStreamingResponse(self._settings.mirage) - - @cached_property - def mobile_redirect(self) -> MobileRedirectResourceWithStreamingResponse: - return MobileRedirectResourceWithStreamingResponse(self._settings.mobile_redirect) - - @cached_property - def nel(self) -> NELResourceWithStreamingResponse: - return NELResourceWithStreamingResponse(self._settings.nel) - - @cached_property - def opportunistic_encryption(self) -> OpportunisticEncryptionResourceWithStreamingResponse: - return OpportunisticEncryptionResourceWithStreamingResponse(self._settings.opportunistic_encryption) - - @cached_property - def opportunistic_onion(self) -> OpportunisticOnionResourceWithStreamingResponse: - return OpportunisticOnionResourceWithStreamingResponse(self._settings.opportunistic_onion) - - @cached_property - def orange_to_orange(self) -> OrangeToOrangeResourceWithStreamingResponse: - return OrangeToOrangeResourceWithStreamingResponse(self._settings.orange_to_orange) - - @cached_property - def origin_error_page_pass_thru(self) -> OriginErrorPagePassThruResourceWithStreamingResponse: - return OriginErrorPagePassThruResourceWithStreamingResponse(self._settings.origin_error_page_pass_thru) - - @cached_property - def origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithStreamingResponse: - return OriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) - - @cached_property - def polish(self) -> PolishResourceWithStreamingResponse: - return PolishResourceWithStreamingResponse(self._settings.polish) - - @cached_property - def prefetch_preload(self) -> PrefetchPreloadResourceWithStreamingResponse: - return PrefetchPreloadResourceWithStreamingResponse(self._settings.prefetch_preload) - - @cached_property - def proxy_read_timeout(self) -> ProxyReadTimeoutResourceWithStreamingResponse: - return ProxyReadTimeoutResourceWithStreamingResponse(self._settings.proxy_read_timeout) - - @cached_property - def pseudo_ipv4(self) -> PseudoIPV4ResourceWithStreamingResponse: - return PseudoIPV4ResourceWithStreamingResponse(self._settings.pseudo_ipv4) - - @cached_property - def response_buffering(self) -> ResponseBufferingResourceWithStreamingResponse: - return ResponseBufferingResourceWithStreamingResponse(self._settings.response_buffering) - - @cached_property - def rocket_loader(self) -> RocketLoaderResourceWithStreamingResponse: - return RocketLoaderResourceWithStreamingResponse(self._settings.rocket_loader) - - @cached_property - def security_headers(self) -> SecurityHeadersResourceWithStreamingResponse: - return SecurityHeadersResourceWithStreamingResponse(self._settings.security_headers) - - @cached_property - def security_level(self) -> SecurityLevelResourceWithStreamingResponse: - return SecurityLevelResourceWithStreamingResponse(self._settings.security_level) - - @cached_property - def server_side_excludes(self) -> ServerSideExcludesResourceWithStreamingResponse: - return ServerSideExcludesResourceWithStreamingResponse(self._settings.server_side_excludes) - - @cached_property - def sort_query_string_for_cache(self) -> SortQueryStringForCacheResourceWithStreamingResponse: - return SortQueryStringForCacheResourceWithStreamingResponse(self._settings.sort_query_string_for_cache) - - @cached_property - def ssl(self) -> SSLResourceWithStreamingResponse: - return SSLResourceWithStreamingResponse(self._settings.ssl) - - @cached_property - def ssl_recommender(self) -> SSLRecommenderResourceWithStreamingResponse: - return SSLRecommenderResourceWithStreamingResponse(self._settings.ssl_recommender) - - @cached_property - def tls_1_3(self) -> TLS1_3ResourceWithStreamingResponse: - return TLS1_3ResourceWithStreamingResponse(self._settings.tls_1_3) - - @cached_property - def tls_client_auth(self) -> TLSClientAuthResourceWithStreamingResponse: - return TLSClientAuthResourceWithStreamingResponse(self._settings.tls_client_auth) - - @cached_property - def true_client_ip_header(self) -> TrueClientIPHeaderResourceWithStreamingResponse: - return TrueClientIPHeaderResourceWithStreamingResponse(self._settings.true_client_ip_header) - - @cached_property - def waf(self) -> WAFResourceWithStreamingResponse: - return WAFResourceWithStreamingResponse(self._settings.waf) - - @cached_property - def webp(self) -> WebPResourceWithStreamingResponse: - return WebPResourceWithStreamingResponse(self._settings.webp) - - @cached_property - def websocket(self) -> WebsocketResourceWithStreamingResponse: - return WebsocketResourceWithStreamingResponse(self._settings.websocket) - - @cached_property - def font_settings(self) -> FontSettingsResourceWithStreamingResponse: - return FontSettingsResourceWithStreamingResponse(self._settings.font_settings) - - -class AsyncSettingsResourceWithStreamingResponse: - def __init__(self, settings: AsyncSettingsResource) -> None: - self._settings = settings - - @cached_property - def zero_rtt(self) -> AsyncZeroRTTResourceWithStreamingResponse: - return AsyncZeroRTTResourceWithStreamingResponse(self._settings.zero_rtt) - - @cached_property - def advanced_ddos(self) -> AsyncAdvancedDDoSResourceWithStreamingResponse: - return AsyncAdvancedDDoSResourceWithStreamingResponse(self._settings.advanced_ddos) - - @cached_property - def always_online(self) -> AsyncAlwaysOnlineResourceWithStreamingResponse: - return AsyncAlwaysOnlineResourceWithStreamingResponse(self._settings.always_online) - - @cached_property - def always_use_https(self) -> AsyncAlwaysUseHTTPSResourceWithStreamingResponse: - return AsyncAlwaysUseHTTPSResourceWithStreamingResponse(self._settings.always_use_https) - - @cached_property - def automatic_https_rewrites(self) -> AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse: - return AsyncAutomaticHTTPSRewritesResourceWithStreamingResponse(self._settings.automatic_https_rewrites) - - @cached_property - def automatic_platform_optimization(self) -> AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse: - return AsyncAutomaticPlatformOptimizationResourceWithStreamingResponse( - self._settings.automatic_platform_optimization - ) - - @cached_property - def brotli(self) -> AsyncBrotliResourceWithStreamingResponse: - return AsyncBrotliResourceWithStreamingResponse(self._settings.brotli) - - @cached_property - def browser_cache_ttl(self) -> AsyncBrowserCacheTTLResourceWithStreamingResponse: - return AsyncBrowserCacheTTLResourceWithStreamingResponse(self._settings.browser_cache_ttl) - - @cached_property - def browser_check(self) -> AsyncBrowserCheckResourceWithStreamingResponse: - return AsyncBrowserCheckResourceWithStreamingResponse(self._settings.browser_check) - - @cached_property - def cache_level(self) -> AsyncCacheLevelResourceWithStreamingResponse: - return AsyncCacheLevelResourceWithStreamingResponse(self._settings.cache_level) - - @cached_property - def challenge_ttl(self) -> AsyncChallengeTTLResourceWithStreamingResponse: - return AsyncChallengeTTLResourceWithStreamingResponse(self._settings.challenge_ttl) - - @cached_property - def ciphers(self) -> AsyncCiphersResourceWithStreamingResponse: - return AsyncCiphersResourceWithStreamingResponse(self._settings.ciphers) - - @cached_property - def development_mode(self) -> AsyncDevelopmentModeResourceWithStreamingResponse: - return AsyncDevelopmentModeResourceWithStreamingResponse(self._settings.development_mode) - - @cached_property - def early_hints(self) -> AsyncEarlyHintsResourceWithStreamingResponse: - return AsyncEarlyHintsResourceWithStreamingResponse(self._settings.early_hints) - - @cached_property - def email_obfuscation(self) -> AsyncEmailObfuscationResourceWithStreamingResponse: - return AsyncEmailObfuscationResourceWithStreamingResponse(self._settings.email_obfuscation) - - @cached_property - def h2_prioritization(self) -> AsyncH2PrioritizationResourceWithStreamingResponse: - return AsyncH2PrioritizationResourceWithStreamingResponse(self._settings.h2_prioritization) - - @cached_property - def hotlink_protection(self) -> AsyncHotlinkProtectionResourceWithStreamingResponse: - return AsyncHotlinkProtectionResourceWithStreamingResponse(self._settings.hotlink_protection) - - @cached_property - def http2(self) -> AsyncHTTP2ResourceWithStreamingResponse: - return AsyncHTTP2ResourceWithStreamingResponse(self._settings.http2) - - @cached_property - def http3(self) -> AsyncHTTP3ResourceWithStreamingResponse: - return AsyncHTTP3ResourceWithStreamingResponse(self._settings.http3) - - @cached_property - def image_resizing(self) -> AsyncImageResizingResourceWithStreamingResponse: - return AsyncImageResizingResourceWithStreamingResponse(self._settings.image_resizing) - - @cached_property - def ip_geolocation(self) -> AsyncIPGeolocationResourceWithStreamingResponse: - return AsyncIPGeolocationResourceWithStreamingResponse(self._settings.ip_geolocation) - - @cached_property - def ipv6(self) -> AsyncIPV6ResourceWithStreamingResponse: - return AsyncIPV6ResourceWithStreamingResponse(self._settings.ipv6) - - @cached_property - def min_tls_version(self) -> AsyncMinTLSVersionResourceWithStreamingResponse: - return AsyncMinTLSVersionResourceWithStreamingResponse(self._settings.min_tls_version) - - @cached_property - def minify(self) -> AsyncMinifyResourceWithStreamingResponse: - return AsyncMinifyResourceWithStreamingResponse(self._settings.minify) - - @cached_property - def mirage(self) -> AsyncMirageResourceWithStreamingResponse: - return AsyncMirageResourceWithStreamingResponse(self._settings.mirage) - - @cached_property - def mobile_redirect(self) -> AsyncMobileRedirectResourceWithStreamingResponse: - return AsyncMobileRedirectResourceWithStreamingResponse(self._settings.mobile_redirect) - - @cached_property - def nel(self) -> AsyncNELResourceWithStreamingResponse: - return AsyncNELResourceWithStreamingResponse(self._settings.nel) - - @cached_property - def opportunistic_encryption(self) -> AsyncOpportunisticEncryptionResourceWithStreamingResponse: - return AsyncOpportunisticEncryptionResourceWithStreamingResponse(self._settings.opportunistic_encryption) - - @cached_property - def opportunistic_onion(self) -> AsyncOpportunisticOnionResourceWithStreamingResponse: - return AsyncOpportunisticOnionResourceWithStreamingResponse(self._settings.opportunistic_onion) - - @cached_property - def orange_to_orange(self) -> AsyncOrangeToOrangeResourceWithStreamingResponse: - return AsyncOrangeToOrangeResourceWithStreamingResponse(self._settings.orange_to_orange) - - @cached_property - def origin_error_page_pass_thru(self) -> AsyncOriginErrorPagePassThruResourceWithStreamingResponse: - return AsyncOriginErrorPagePassThruResourceWithStreamingResponse(self._settings.origin_error_page_pass_thru) +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings @cached_property def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: return AsyncOriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) - @cached_property - def polish(self) -> AsyncPolishResourceWithStreamingResponse: - return AsyncPolishResourceWithStreamingResponse(self._settings.polish) - - @cached_property - def prefetch_preload(self) -> AsyncPrefetchPreloadResourceWithStreamingResponse: - return AsyncPrefetchPreloadResourceWithStreamingResponse(self._settings.prefetch_preload) - - @cached_property - def proxy_read_timeout(self) -> AsyncProxyReadTimeoutResourceWithStreamingResponse: - return AsyncProxyReadTimeoutResourceWithStreamingResponse(self._settings.proxy_read_timeout) - - @cached_property - def pseudo_ipv4(self) -> AsyncPseudoIPV4ResourceWithStreamingResponse: - return AsyncPseudoIPV4ResourceWithStreamingResponse(self._settings.pseudo_ipv4) - - @cached_property - def response_buffering(self) -> AsyncResponseBufferingResourceWithStreamingResponse: - return AsyncResponseBufferingResourceWithStreamingResponse(self._settings.response_buffering) - - @cached_property - def rocket_loader(self) -> AsyncRocketLoaderResourceWithStreamingResponse: - return AsyncRocketLoaderResourceWithStreamingResponse(self._settings.rocket_loader) - - @cached_property - def security_headers(self) -> AsyncSecurityHeadersResourceWithStreamingResponse: - return AsyncSecurityHeadersResourceWithStreamingResponse(self._settings.security_headers) - - @cached_property - def security_level(self) -> AsyncSecurityLevelResourceWithStreamingResponse: - return AsyncSecurityLevelResourceWithStreamingResponse(self._settings.security_level) - - @cached_property - def server_side_excludes(self) -> AsyncServerSideExcludesResourceWithStreamingResponse: - return AsyncServerSideExcludesResourceWithStreamingResponse(self._settings.server_side_excludes) - - @cached_property - def sort_query_string_for_cache(self) -> AsyncSortQueryStringForCacheResourceWithStreamingResponse: - return AsyncSortQueryStringForCacheResourceWithStreamingResponse(self._settings.sort_query_string_for_cache) - - @cached_property - def ssl(self) -> AsyncSSLResourceWithStreamingResponse: - return AsyncSSLResourceWithStreamingResponse(self._settings.ssl) - - @cached_property - def ssl_recommender(self) -> AsyncSSLRecommenderResourceWithStreamingResponse: - return AsyncSSLRecommenderResourceWithStreamingResponse(self._settings.ssl_recommender) - - @cached_property - def tls_1_3(self) -> AsyncTLS1_3ResourceWithStreamingResponse: - return AsyncTLS1_3ResourceWithStreamingResponse(self._settings.tls_1_3) - - @cached_property - def tls_client_auth(self) -> AsyncTLSClientAuthResourceWithStreamingResponse: - return AsyncTLSClientAuthResourceWithStreamingResponse(self._settings.tls_client_auth) - - @cached_property - def true_client_ip_header(self) -> AsyncTrueClientIPHeaderResourceWithStreamingResponse: - return AsyncTrueClientIPHeaderResourceWithStreamingResponse(self._settings.true_client_ip_header) - - @cached_property - def waf(self) -> AsyncWAFResourceWithStreamingResponse: - return AsyncWAFResourceWithStreamingResponse(self._settings.waf) - - @cached_property - def webp(self) -> AsyncWebPResourceWithStreamingResponse: - return AsyncWebPResourceWithStreamingResponse(self._settings.webp) - - @cached_property - def websocket(self) -> AsyncWebsocketResourceWithStreamingResponse: - return AsyncWebsocketResourceWithStreamingResponse(self._settings.websocket) - @cached_property def font_settings(self) -> AsyncFontSettingsResourceWithStreamingResponse: return AsyncFontSettingsResourceWithStreamingResponse(self._settings.font_settings) diff --git a/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py b/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py deleted file mode 100644 index 8ac6a3306fa..00000000000 --- a/src/cloudflare/resources/zones/settings/sort_query_string_for_cache.py +++ /dev/null @@ -1,274 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import sort_query_string_for_cache_edit_params -from ....types.zones.settings.sort_query_string_for_cache import SortQueryStringForCache - -__all__ = ["SortQueryStringForCacheResource", "AsyncSortQueryStringForCacheResource"] - - -class SortQueryStringForCacheResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SortQueryStringForCacheResourceWithRawResponse: - return SortQueryStringForCacheResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SortQueryStringForCacheResourceWithStreamingResponse: - return SortQueryStringForCacheResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[SortQueryStringForCache]: - """ - Cloudflare will treat files with the same query strings as the same file in - cache, regardless of the order of the query strings. This is limited to - Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/sort_query_string_for_cache", - body=maybe_transform( - {"value": value}, sort_query_string_for_cache_edit_params.SortQueryStringForCacheEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, - ), - cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SortQueryStringForCache]: - """ - Cloudflare will treat files with the same query strings as the same file in - cache, regardless of the order of the query strings. This is limited to - Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/sort_query_string_for_cache", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, - ), - cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), - ) - - -class AsyncSortQueryStringForCacheResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSortQueryStringForCacheResourceWithRawResponse: - return AsyncSortQueryStringForCacheResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSortQueryStringForCacheResourceWithStreamingResponse: - return AsyncSortQueryStringForCacheResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[SortQueryStringForCache]: - """ - Cloudflare will treat files with the same query strings as the same file in - cache, regardless of the order of the query strings. This is limited to - Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/sort_query_string_for_cache", - body=await async_maybe_transform( - {"value": value}, sort_query_string_for_cache_edit_params.SortQueryStringForCacheEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, - ), - cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SortQueryStringForCache]: - """ - Cloudflare will treat files with the same query strings as the same file in - cache, regardless of the order of the query strings. This is limited to - Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/sort_query_string_for_cache", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SortQueryStringForCache]]._unwrapper, - ), - cast_to=cast(Type[Optional[SortQueryStringForCache]], ResultWrapper[SortQueryStringForCache]), - ) - - -class SortQueryStringForCacheResourceWithRawResponse: - def __init__(self, sort_query_string_for_cache: SortQueryStringForCacheResource) -> None: - self._sort_query_string_for_cache = sort_query_string_for_cache - - self.edit = to_raw_response_wrapper( - sort_query_string_for_cache.edit, - ) - self.get = to_raw_response_wrapper( - sort_query_string_for_cache.get, - ) - - -class AsyncSortQueryStringForCacheResourceWithRawResponse: - def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCacheResource) -> None: - self._sort_query_string_for_cache = sort_query_string_for_cache - - self.edit = async_to_raw_response_wrapper( - sort_query_string_for_cache.edit, - ) - self.get = async_to_raw_response_wrapper( - sort_query_string_for_cache.get, - ) - - -class SortQueryStringForCacheResourceWithStreamingResponse: - def __init__(self, sort_query_string_for_cache: SortQueryStringForCacheResource) -> None: - self._sort_query_string_for_cache = sort_query_string_for_cache - - self.edit = to_streamed_response_wrapper( - sort_query_string_for_cache.edit, - ) - self.get = to_streamed_response_wrapper( - sort_query_string_for_cache.get, - ) - - -class AsyncSortQueryStringForCacheResourceWithStreamingResponse: - def __init__(self, sort_query_string_for_cache: AsyncSortQueryStringForCacheResource) -> None: - self._sort_query_string_for_cache = sort_query_string_for_cache - - self.edit = async_to_streamed_response_wrapper( - sort_query_string_for_cache.edit, - ) - self.get = async_to_streamed_response_wrapper( - sort_query_string_for_cache.get, - ) diff --git a/src/cloudflare/resources/zones/settings/ssl.py b/src/cloudflare/resources/zones/settings/ssl.py deleted file mode 100644 index c04dd0ce79a..00000000000 --- a/src/cloudflare/resources/zones/settings/ssl.py +++ /dev/null @@ -1,322 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import ssl_edit_params -from ....types.zones.settings.ssl import SSL - -__all__ = ["SSLResource", "AsyncSSLResource"] - - -class SSLResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SSLResourceWithRawResponse: - return SSLResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SSLResourceWithStreamingResponse: - return SSLResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "flexible", "full", "strict"], - # 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, - ) -> Optional[SSL]: - """ - SSL encrypts your visitor's connection and safeguards credit card numbers and - other personal data to and from your website. SSL can take up to 5 minutes to - fully activate. Requires Cloudflare active on your root domain or www domain. - Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare - and your web server (all HTTP traffic). Flexible: SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and - your web server. You don't need to have an SSL cert on your web server, but your - vistors will still see the site as being HTTPS enabled. Full: SSL between the - visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between - Cloudflare and your web server. You'll need to have your own SSL cert or - self-signed cert at the very least. Full (Strict): SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and - your web server. You'll need to have a valid SSL certificate installed on your - web server. This certificate must be signed by a certificate authority, have an - expiration date in the future, and respond for the request domain name - (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Depends on the zone's plan level - - 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 self._patch( - f"/zones/{zone_id}/settings/ssl", - body=maybe_transform({"value": value}, ssl_edit_params.SSLEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSL]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SSL]: - """ - SSL encrypts your visitor's connection and safeguards credit card numbers and - other personal data to and from your website. SSL can take up to 5 minutes to - fully activate. Requires Cloudflare active on your root domain or www domain. - Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare - and your web server (all HTTP traffic). Flexible: SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and - your web server. You don't need to have an SSL cert on your web server, but your - vistors will still see the site as being HTTPS enabled. Full: SSL between the - visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between - Cloudflare and your web server. You'll need to have your own SSL cert or - self-signed cert at the very least. Full (Strict): SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and - your web server. You'll need to have a valid SSL certificate installed on your - web server. This certificate must be signed by a certificate authority, have an - expiration date in the future, and respond for the request domain name - (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/ssl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSL]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), - ) - - -class AsyncSSLResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSSLResourceWithRawResponse: - return AsyncSSLResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSSLResourceWithStreamingResponse: - return AsyncSSLResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "flexible", "full", "strict"], - # 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, - ) -> Optional[SSL]: - """ - SSL encrypts your visitor's connection and safeguards credit card numbers and - other personal data to and from your website. SSL can take up to 5 minutes to - fully activate. Requires Cloudflare active on your root domain or www domain. - Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare - and your web server (all HTTP traffic). Flexible: SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and - your web server. You don't need to have an SSL cert on your web server, but your - vistors will still see the site as being HTTPS enabled. Full: SSL between the - visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between - Cloudflare and your web server. You'll need to have your own SSL cert or - self-signed cert at the very least. Full (Strict): SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and - your web server. You'll need to have a valid SSL certificate installed on your - web server. This certificate must be signed by a certificate authority, have an - expiration date in the future, and respond for the request domain name - (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Depends on the zone's plan level - - 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 await self._patch( - f"/zones/{zone_id}/settings/ssl", - body=await async_maybe_transform({"value": value}, ssl_edit_params.SSLEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSL]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SSL]: - """ - SSL encrypts your visitor's connection and safeguards credit card numbers and - other personal data to and from your website. SSL can take up to 5 minutes to - fully activate. Requires Cloudflare active on your root domain or www domain. - Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare - and your web server (all HTTP traffic). Flexible: SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and - your web server. You don't need to have an SSL cert on your web server, but your - vistors will still see the site as being HTTPS enabled. Full: SSL between the - visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between - Cloudflare and your web server. You'll need to have your own SSL cert or - self-signed cert at the very least. Full (Strict): SSL between the visitor and - Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and - your web server. You'll need to have a valid SSL certificate installed on your - web server. This certificate must be signed by a certificate authority, have an - expiration date in the future, and respond for the request domain name - (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/ssl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSL]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSL]], ResultWrapper[SSL]), - ) - - -class SSLResourceWithRawResponse: - def __init__(self, ssl: SSLResource) -> None: - self._ssl = ssl - - self.edit = to_raw_response_wrapper( - ssl.edit, - ) - self.get = to_raw_response_wrapper( - ssl.get, - ) - - -class AsyncSSLResourceWithRawResponse: - def __init__(self, ssl: AsyncSSLResource) -> None: - self._ssl = ssl - - self.edit = async_to_raw_response_wrapper( - ssl.edit, - ) - self.get = async_to_raw_response_wrapper( - ssl.get, - ) - - -class SSLResourceWithStreamingResponse: - def __init__(self, ssl: SSLResource) -> None: - self._ssl = ssl - - self.edit = to_streamed_response_wrapper( - ssl.edit, - ) - self.get = to_streamed_response_wrapper( - ssl.get, - ) - - -class AsyncSSLResourceWithStreamingResponse: - def __init__(self, ssl: AsyncSSLResource) -> None: - self._ssl = ssl - - self.edit = async_to_streamed_response_wrapper( - ssl.edit, - ) - self.get = async_to_streamed_response_wrapper( - ssl.get, - ) diff --git a/src/cloudflare/resources/zones/settings/ssl_recommender.py b/src/cloudflare/resources/zones/settings/ssl_recommender.py deleted file mode 100644 index 816dd22ade6..00000000000 --- a/src/cloudflare/resources/zones/settings/ssl_recommender.py +++ /dev/null @@ -1,274 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import SSLRecommender, ssl_recommender_edit_params -from ....types.zones.settings.ssl_recommender import SSLRecommender -from ....types.zones.settings.ssl_recommender_param import SSLRecommenderParam - -__all__ = ["SSLRecommenderResource", "AsyncSSLRecommenderResource"] - - -class SSLRecommenderResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SSLRecommenderResourceWithRawResponse: - return SSLRecommenderResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SSLRecommenderResourceWithStreamingResponse: - return SSLRecommenderResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: SSLRecommenderParam, - # 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, - ) -> Optional[SSLRecommender]: - """ - Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - - Args: - zone_id: Identifier - - value: Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - - 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 self._patch( - f"/zones/{zone_id}/settings/ssl_recommender", - body=maybe_transform({"value": value}, ssl_recommender_edit_params.SSLRecommenderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SSLRecommender]: - """ - Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/ssl_recommender", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), - ) - - -class AsyncSSLRecommenderResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSSLRecommenderResourceWithRawResponse: - return AsyncSSLRecommenderResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSSLRecommenderResourceWithStreamingResponse: - return AsyncSSLRecommenderResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: SSLRecommenderParam, - # 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, - ) -> Optional[SSLRecommender]: - """ - Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - - Args: - zone_id: Identifier - - value: Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - - 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 await self._patch( - f"/zones/{zone_id}/settings/ssl_recommender", - body=await async_maybe_transform({"value": value}, ssl_recommender_edit_params.SSLRecommenderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SSLRecommender]: - """ - Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/ssl_recommender", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SSLRecommender]]._unwrapper, - ), - cast_to=cast(Type[Optional[SSLRecommender]], ResultWrapper[SSLRecommender]), - ) - - -class SSLRecommenderResourceWithRawResponse: - def __init__(self, ssl_recommender: SSLRecommenderResource) -> None: - self._ssl_recommender = ssl_recommender - - self.edit = to_raw_response_wrapper( - ssl_recommender.edit, - ) - self.get = to_raw_response_wrapper( - ssl_recommender.get, - ) - - -class AsyncSSLRecommenderResourceWithRawResponse: - def __init__(self, ssl_recommender: AsyncSSLRecommenderResource) -> None: - self._ssl_recommender = ssl_recommender - - self.edit = async_to_raw_response_wrapper( - ssl_recommender.edit, - ) - self.get = async_to_raw_response_wrapper( - ssl_recommender.get, - ) - - -class SSLRecommenderResourceWithStreamingResponse: - def __init__(self, ssl_recommender: SSLRecommenderResource) -> None: - self._ssl_recommender = ssl_recommender - - self.edit = to_streamed_response_wrapper( - ssl_recommender.edit, - ) - self.get = to_streamed_response_wrapper( - ssl_recommender.get, - ) - - -class AsyncSSLRecommenderResourceWithStreamingResponse: - def __init__(self, ssl_recommender: AsyncSSLRecommenderResource) -> None: - self._ssl_recommender = ssl_recommender - - self.edit = async_to_streamed_response_wrapper( - ssl_recommender.edit, - ) - self.get = async_to_streamed_response_wrapper( - ssl_recommender.get, - ) diff --git a/src/cloudflare/resources/zones/settings/tls_1_3.py b/src/cloudflare/resources/zones/settings/tls_1_3.py deleted file mode 100644 index 77eb21c1c48..00000000000 --- a/src/cloudflare/resources/zones/settings/tls_1_3.py +++ /dev/null @@ -1,264 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import tls_1_3_edit_params -from ....types.zones.settings.tls_1_3 import TLS1_3 - -__all__ = ["TLS1_3Resource", "AsyncTLS1_3Resource"] - - -class TLS1_3Resource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TLS1_3ResourceWithRawResponse: - return TLS1_3ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TLS1_3ResourceWithStreamingResponse: - return TLS1_3ResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "off", "zrt"], - # 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, - ) -> Optional[TLS1_3]: - """ - Changes TLS 1.3 setting. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 self._patch( - f"/zones/{zone_id}/settings/tls_1_3", - body=maybe_transform({"value": value}, tls_1_3_edit_params.TLS1_3EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TLS1_3]: - """ - Gets TLS 1.3 setting enabled for a zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/tls_1_3", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), - ) - - -class AsyncTLS1_3Resource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTLS1_3ResourceWithRawResponse: - return AsyncTLS1_3ResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTLS1_3ResourceWithStreamingResponse: - return AsyncTLS1_3ResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "off", "zrt"], - # 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, - ) -> Optional[TLS1_3]: - """ - Changes TLS 1.3 setting. - - Args: - zone_id: Identifier - - value: Value of the zone setting. Notes: Default value depends on the zone's plan - level. - - 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 await self._patch( - f"/zones/{zone_id}/settings/tls_1_3", - body=await async_maybe_transform({"value": value}, tls_1_3_edit_params.TLS1_3EditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TLS1_3]: - """ - Gets TLS 1.3 setting enabled for a zone. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/tls_1_3", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLS1_3]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLS1_3]], ResultWrapper[TLS1_3]), - ) - - -class TLS1_3ResourceWithRawResponse: - def __init__(self, tls_1_3: TLS1_3Resource) -> None: - self._tls_1_3 = tls_1_3 - - self.edit = to_raw_response_wrapper( - tls_1_3.edit, - ) - self.get = to_raw_response_wrapper( - tls_1_3.get, - ) - - -class AsyncTLS1_3ResourceWithRawResponse: - def __init__(self, tls_1_3: AsyncTLS1_3Resource) -> None: - self._tls_1_3 = tls_1_3 - - self.edit = async_to_raw_response_wrapper( - tls_1_3.edit, - ) - self.get = async_to_raw_response_wrapper( - tls_1_3.get, - ) - - -class TLS1_3ResourceWithStreamingResponse: - def __init__(self, tls_1_3: TLS1_3Resource) -> None: - self._tls_1_3 = tls_1_3 - - self.edit = to_streamed_response_wrapper( - tls_1_3.edit, - ) - self.get = to_streamed_response_wrapper( - tls_1_3.get, - ) - - -class AsyncTLS1_3ResourceWithStreamingResponse: - def __init__(self, tls_1_3: AsyncTLS1_3Resource) -> None: - self._tls_1_3 = tls_1_3 - - self.edit = async_to_streamed_response_wrapper( - tls_1_3.edit, - ) - self.get = async_to_streamed_response_wrapper( - tls_1_3.get, - ) diff --git a/src/cloudflare/resources/zones/settings/tls_client_auth.py b/src/cloudflare/resources/zones/settings/tls_client_auth.py deleted file mode 100644 index f1f2646104e..00000000000 --- a/src/cloudflare/resources/zones/settings/tls_client_auth.py +++ /dev/null @@ -1,266 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import tls_client_auth_edit_params -from ....types.zones.settings.tls_client_auth import TLSClientAuth - -__all__ = ["TLSClientAuthResource", "AsyncTLSClientAuthResource"] - - -class TLSClientAuthResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TLSClientAuthResourceWithRawResponse: - return TLSClientAuthResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TLSClientAuthResourceWithStreamingResponse: - return TLSClientAuthResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[TLSClientAuth]: - """ - TLS Client Auth requires Cloudflare to connect to your origin server using a - client certificate (Enterprise Only). - - Args: - zone_id: Identifier - - value: value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/tls_client_auth", - body=maybe_transform({"value": value}, tls_client_auth_edit_params.TLSClientAuthEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TLSClientAuth]: - """ - TLS Client Auth requires Cloudflare to connect to your origin server using a - client certificate (Enterprise Only). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/tls_client_auth", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), - ) - - -class AsyncTLSClientAuthResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTLSClientAuthResourceWithRawResponse: - return AsyncTLSClientAuthResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTLSClientAuthResourceWithStreamingResponse: - return AsyncTLSClientAuthResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[TLSClientAuth]: - """ - TLS Client Auth requires Cloudflare to connect to your origin server using a - client certificate (Enterprise Only). - - Args: - zone_id: Identifier - - value: value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/tls_client_auth", - body=await async_maybe_transform({"value": value}, tls_client_auth_edit_params.TLSClientAuthEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TLSClientAuth]: - """ - TLS Client Auth requires Cloudflare to connect to your origin server using a - client certificate (Enterprise Only). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/tls_client_auth", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TLSClientAuth]]._unwrapper, - ), - cast_to=cast(Type[Optional[TLSClientAuth]], ResultWrapper[TLSClientAuth]), - ) - - -class TLSClientAuthResourceWithRawResponse: - def __init__(self, tls_client_auth: TLSClientAuthResource) -> None: - self._tls_client_auth = tls_client_auth - - self.edit = to_raw_response_wrapper( - tls_client_auth.edit, - ) - self.get = to_raw_response_wrapper( - tls_client_auth.get, - ) - - -class AsyncTLSClientAuthResourceWithRawResponse: - def __init__(self, tls_client_auth: AsyncTLSClientAuthResource) -> None: - self._tls_client_auth = tls_client_auth - - self.edit = async_to_raw_response_wrapper( - tls_client_auth.edit, - ) - self.get = async_to_raw_response_wrapper( - tls_client_auth.get, - ) - - -class TLSClientAuthResourceWithStreamingResponse: - def __init__(self, tls_client_auth: TLSClientAuthResource) -> None: - self._tls_client_auth = tls_client_auth - - self.edit = to_streamed_response_wrapper( - tls_client_auth.edit, - ) - self.get = to_streamed_response_wrapper( - tls_client_auth.get, - ) - - -class AsyncTLSClientAuthResourceWithStreamingResponse: - def __init__(self, tls_client_auth: AsyncTLSClientAuthResource) -> None: - self._tls_client_auth = tls_client_auth - - self.edit = async_to_streamed_response_wrapper( - tls_client_auth.edit, - ) - self.get = async_to_streamed_response_wrapper( - tls_client_auth.get, - ) diff --git a/src/cloudflare/resources/zones/settings/true_client_ip_header.py b/src/cloudflare/resources/zones/settings/true_client_ip_header.py deleted file mode 100644 index ebe9635793b..00000000000 --- a/src/cloudflare/resources/zones/settings/true_client_ip_header.py +++ /dev/null @@ -1,268 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import true_client_ip_header_edit_params -from ....types.zones.settings.true_client_ip_header import TrueClientIPHeader - -__all__ = ["TrueClientIPHeaderResource", "AsyncTrueClientIPHeaderResource"] - - -class TrueClientIPHeaderResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TrueClientIPHeaderResourceWithRawResponse: - return TrueClientIPHeaderResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TrueClientIPHeaderResourceWithStreamingResponse: - return TrueClientIPHeaderResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[TrueClientIPHeader]: - """ - Allows customer to continue to use True Client IP (Akamai feature) in the - headers we send to the origin. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/true_client_ip_header", - body=maybe_transform({"value": value}, true_client_ip_header_edit_params.TrueClientIPHeaderEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, - ), - cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TrueClientIPHeader]: - """ - Allows customer to continue to use True Client IP (Akamai feature) in the - headers we send to the origin. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/true_client_ip_header", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, - ), - cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), - ) - - -class AsyncTrueClientIPHeaderResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTrueClientIPHeaderResourceWithRawResponse: - return AsyncTrueClientIPHeaderResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTrueClientIPHeaderResourceWithStreamingResponse: - return AsyncTrueClientIPHeaderResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[TrueClientIPHeader]: - """ - Allows customer to continue to use True Client IP (Akamai feature) in the - headers we send to the origin. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/true_client_ip_header", - body=await async_maybe_transform( - {"value": value}, true_client_ip_header_edit_params.TrueClientIPHeaderEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, - ), - cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TrueClientIPHeader]: - """ - Allows customer to continue to use True Client IP (Akamai feature) in the - headers we send to the origin. This is limited to Enterprise Zones. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/true_client_ip_header", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[TrueClientIPHeader]]._unwrapper, - ), - cast_to=cast(Type[Optional[TrueClientIPHeader]], ResultWrapper[TrueClientIPHeader]), - ) - - -class TrueClientIPHeaderResourceWithRawResponse: - def __init__(self, true_client_ip_header: TrueClientIPHeaderResource) -> None: - self._true_client_ip_header = true_client_ip_header - - self.edit = to_raw_response_wrapper( - true_client_ip_header.edit, - ) - self.get = to_raw_response_wrapper( - true_client_ip_header.get, - ) - - -class AsyncTrueClientIPHeaderResourceWithRawResponse: - def __init__(self, true_client_ip_header: AsyncTrueClientIPHeaderResource) -> None: - self._true_client_ip_header = true_client_ip_header - - self.edit = async_to_raw_response_wrapper( - true_client_ip_header.edit, - ) - self.get = async_to_raw_response_wrapper( - true_client_ip_header.get, - ) - - -class TrueClientIPHeaderResourceWithStreamingResponse: - def __init__(self, true_client_ip_header: TrueClientIPHeaderResource) -> None: - self._true_client_ip_header = true_client_ip_header - - self.edit = to_streamed_response_wrapper( - true_client_ip_header.edit, - ) - self.get = to_streamed_response_wrapper( - true_client_ip_header.get, - ) - - -class AsyncTrueClientIPHeaderResourceWithStreamingResponse: - def __init__(self, true_client_ip_header: AsyncTrueClientIPHeaderResource) -> None: - self._true_client_ip_header = true_client_ip_header - - self.edit = async_to_streamed_response_wrapper( - true_client_ip_header.edit, - ) - self.get = async_to_streamed_response_wrapper( - true_client_ip_header.get, - ) diff --git a/src/cloudflare/resources/zones/settings/waf.py b/src/cloudflare/resources/zones/settings/waf.py deleted file mode 100644 index 42ce04861e0..00000000000 --- a/src/cloudflare/resources/zones/settings/waf.py +++ /dev/null @@ -1,302 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import waf_edit_params -from ....types.zones.settings.waf import WAF - -__all__ = ["WAFResource", "AsyncWAFResource"] - - -class WAFResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> WAFResourceWithRawResponse: - return WAFResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WAFResourceWithStreamingResponse: - return WAFResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[WAF]: - """The WAF examines HTTP requests to your website. - - It inspects both GET and POST - requests and applies rules to help filter out illegitimate traffic from - legitimate website visitors. The Cloudflare WAF inspects website addresses or - URLs to detect anything out of the ordinary. If the Cloudflare WAF determines - suspicious user behavior, then the WAF will 'challenge' the web visitor with a - page that asks them to submit a CAPTCHA successfully to continue their action. - If the challenge is failed, the action will be stopped. What this means is that - Cloudflare's WAF will block any traffic identified as illegitimate before it - reaches your origin web server. - (https://support.cloudflare.com/hc/en-us/articles/200172016). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/waf", - body=maybe_transform({"value": value}, waf_edit_params.WAFEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WAF]]._unwrapper, - ), - cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAF]: - """The WAF examines HTTP requests to your website. - - It inspects both GET and POST - requests and applies rules to help filter out illegitimate traffic from - legitimate website visitors. The Cloudflare WAF inspects website addresses or - URLs to detect anything out of the ordinary. If the Cloudflare WAF determines - suspicious user behavior, then the WAF will 'challenge' the web visitor with a - page that asks them to submit a CAPTCHA successfully to continue their action. - If the challenge is failed, the action will be stopped. What this means is that - Cloudflare's WAF will block any traffic identified as illegitimate before it - reaches your origin web server. - (https://support.cloudflare.com/hc/en-us/articles/200172016). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/waf", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WAF]]._unwrapper, - ), - cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), - ) - - -class AsyncWAFResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncWAFResourceWithRawResponse: - return AsyncWAFResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWAFResourceWithStreamingResponse: - return AsyncWAFResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[WAF]: - """The WAF examines HTTP requests to your website. - - It inspects both GET and POST - requests and applies rules to help filter out illegitimate traffic from - legitimate website visitors. The Cloudflare WAF inspects website addresses or - URLs to detect anything out of the ordinary. If the Cloudflare WAF determines - suspicious user behavior, then the WAF will 'challenge' the web visitor with a - page that asks them to submit a CAPTCHA successfully to continue their action. - If the challenge is failed, the action will be stopped. What this means is that - Cloudflare's WAF will block any traffic identified as illegitimate before it - reaches your origin web server. - (https://support.cloudflare.com/hc/en-us/articles/200172016). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/waf", - body=await async_maybe_transform({"value": value}, waf_edit_params.WAFEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WAF]]._unwrapper, - ), - cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WAF]: - """The WAF examines HTTP requests to your website. - - It inspects both GET and POST - requests and applies rules to help filter out illegitimate traffic from - legitimate website visitors. The Cloudflare WAF inspects website addresses or - URLs to detect anything out of the ordinary. If the Cloudflare WAF determines - suspicious user behavior, then the WAF will 'challenge' the web visitor with a - page that asks them to submit a CAPTCHA successfully to continue their action. - If the challenge is failed, the action will be stopped. What this means is that - Cloudflare's WAF will block any traffic identified as illegitimate before it - reaches your origin web server. - (https://support.cloudflare.com/hc/en-us/articles/200172016). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/waf", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WAF]]._unwrapper, - ), - cast_to=cast(Type[Optional[WAF]], ResultWrapper[WAF]), - ) - - -class WAFResourceWithRawResponse: - def __init__(self, waf: WAFResource) -> None: - self._waf = waf - - self.edit = to_raw_response_wrapper( - waf.edit, - ) - self.get = to_raw_response_wrapper( - waf.get, - ) - - -class AsyncWAFResourceWithRawResponse: - def __init__(self, waf: AsyncWAFResource) -> None: - self._waf = waf - - self.edit = async_to_raw_response_wrapper( - waf.edit, - ) - self.get = async_to_raw_response_wrapper( - waf.get, - ) - - -class WAFResourceWithStreamingResponse: - def __init__(self, waf: WAFResource) -> None: - self._waf = waf - - self.edit = to_streamed_response_wrapper( - waf.edit, - ) - self.get = to_streamed_response_wrapper( - waf.get, - ) - - -class AsyncWAFResourceWithStreamingResponse: - def __init__(self, waf: AsyncWAFResource) -> None: - self._waf = waf - - self.edit = async_to_streamed_response_wrapper( - waf.edit, - ) - self.get = async_to_streamed_response_wrapper( - waf.get, - ) diff --git a/src/cloudflare/resources/zones/settings/webp.py b/src/cloudflare/resources/zones/settings/webp.py deleted file mode 100644 index e6fc0ac0ab4..00000000000 --- a/src/cloudflare/resources/zones/settings/webp.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import webp_edit_params -from ....types.zones.settings.webp import WebP - -__all__ = ["WebPResource", "AsyncWebPResource"] - - -class WebPResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> WebPResourceWithRawResponse: - return WebPResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WebPResourceWithStreamingResponse: - return WebPResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[WebP]: - """ - When the client requesting the image supports the WebP image codec, and WebP - offers a performance advantage over the original image format, Cloudflare will - serve a WebP version of the original image. - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/webp", - body=maybe_transform({"value": value}, webp_edit_params.WebPEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WebP]]._unwrapper, - ), - cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WebP]: - """ - When the client requesting the image supports the WebP image codec, and WebP - offers a performance advantage over the original image format, Cloudflare will - serve a WebP version of the original image. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/webp", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WebP]]._unwrapper, - ), - cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), - ) - - -class AsyncWebPResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncWebPResourceWithRawResponse: - return AsyncWebPResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWebPResourceWithStreamingResponse: - return AsyncWebPResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[WebP]: - """ - When the client requesting the image supports the WebP image codec, and WebP - offers a performance advantage over the original image format, Cloudflare will - serve a WebP version of the original image. - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/webp", - body=await async_maybe_transform({"value": value}, webp_edit_params.WebPEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WebP]]._unwrapper, - ), - cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WebP]: - """ - When the client requesting the image supports the WebP image codec, and WebP - offers a performance advantage over the original image format, Cloudflare will - serve a WebP version of the original image. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/webp", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WebP]]._unwrapper, - ), - cast_to=cast(Type[Optional[WebP]], ResultWrapper[WebP]), - ) - - -class WebPResourceWithRawResponse: - def __init__(self, webp: WebPResource) -> None: - self._webp = webp - - self.edit = to_raw_response_wrapper( - webp.edit, - ) - self.get = to_raw_response_wrapper( - webp.get, - ) - - -class AsyncWebPResourceWithRawResponse: - def __init__(self, webp: AsyncWebPResource) -> None: - self._webp = webp - - self.edit = async_to_raw_response_wrapper( - webp.edit, - ) - self.get = async_to_raw_response_wrapper( - webp.get, - ) - - -class WebPResourceWithStreamingResponse: - def __init__(self, webp: WebPResource) -> None: - self._webp = webp - - self.edit = to_streamed_response_wrapper( - webp.edit, - ) - self.get = to_streamed_response_wrapper( - webp.get, - ) - - -class AsyncWebPResourceWithStreamingResponse: - def __init__(self, webp: AsyncWebPResource) -> None: - self._webp = webp - - self.edit = async_to_streamed_response_wrapper( - webp.edit, - ) - self.get = async_to_streamed_response_wrapper( - webp.get, - ) diff --git a/src/cloudflare/resources/zones/settings/websocket.py b/src/cloudflare/resources/zones/settings/websocket.py deleted file mode 100644 index 9caba287e7d..00000000000 --- a/src/cloudflare/resources/zones/settings/websocket.py +++ /dev/null @@ -1,272 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import websocket_edit_params -from ....types.zones.settings.websocket import Websocket - -__all__ = ["WebsocketResource", "AsyncWebsocketResource"] - - -class WebsocketResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> WebsocketResourceWithRawResponse: - return WebsocketResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WebsocketResourceWithStreamingResponse: - return WebsocketResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[Websocket]: - """Changes Websockets setting. - - For more information about Websockets, please refer - to - [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). - - Args: - zone_id: Identifier - - value: Value of the zone 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 self._patch( - f"/zones/{zone_id}/settings/websockets", - body=maybe_transform({"value": value}, websocket_edit_params.WebsocketEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, - ), - cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Websocket]: - """Gets Websockets setting. - - For more information about Websockets, please refer to - [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/websockets", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, - ), - cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), - ) - - -class AsyncWebsocketResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncWebsocketResourceWithRawResponse: - return AsyncWebsocketResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWebsocketResourceWithStreamingResponse: - return AsyncWebsocketResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["off", "on"], - # 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, - ) -> Optional[Websocket]: - """Changes Websockets setting. - - For more information about Websockets, please refer - to - [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). - - Args: - zone_id: Identifier - - value: Value of the zone 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 await self._patch( - f"/zones/{zone_id}/settings/websockets", - body=await async_maybe_transform({"value": value}, websocket_edit_params.WebsocketEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, - ), - cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Websocket]: - """Gets Websockets setting. - - For more information about Websockets, please refer to - [Using Cloudflare with WebSockets](https://support.cloudflare.com/hc/en-us/articles/200169466-Using-Cloudflare-with-WebSockets). - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/websockets", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[Websocket]]._unwrapper, - ), - cast_to=cast(Type[Optional[Websocket]], ResultWrapper[Websocket]), - ) - - -class WebsocketResourceWithRawResponse: - def __init__(self, websocket: WebsocketResource) -> None: - self._websocket = websocket - - self.edit = to_raw_response_wrapper( - websocket.edit, - ) - self.get = to_raw_response_wrapper( - websocket.get, - ) - - -class AsyncWebsocketResourceWithRawResponse: - def __init__(self, websocket: AsyncWebsocketResource) -> None: - self._websocket = websocket - - self.edit = async_to_raw_response_wrapper( - websocket.edit, - ) - self.get = async_to_raw_response_wrapper( - websocket.get, - ) - - -class WebsocketResourceWithStreamingResponse: - def __init__(self, websocket: WebsocketResource) -> None: - self._websocket = websocket - - self.edit = to_streamed_response_wrapper( - websocket.edit, - ) - self.get = to_streamed_response_wrapper( - websocket.get, - ) - - -class AsyncWebsocketResourceWithStreamingResponse: - def __init__(self, websocket: AsyncWebsocketResource) -> None: - self._websocket = websocket - - self.edit = async_to_streamed_response_wrapper( - websocket.edit, - ) - self.get = async_to_streamed_response_wrapper( - websocket.get, - ) diff --git a/src/cloudflare/resources/zones/settings/zero_rtt.py b/src/cloudflare/resources/zones/settings/zero_rtt.py deleted file mode 100644 index fafd4dea55d..00000000000 --- a/src/cloudflare/resources/zones/settings/zero_rtt.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -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 ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._wrappers import ResultWrapper -from ...._base_client import ( - make_request_options, -) -from ....types.zones.settings import zero_rtt_edit_params -from ....types.zones.settings.zero_rtt import ZeroRTT - -__all__ = ["ZeroRTTResource", "AsyncZeroRTTResource"] - - -class ZeroRTTResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ZeroRTTResourceWithRawResponse: - return ZeroRTTResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ZeroRTTResourceWithStreamingResponse: - return ZeroRTTResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[ZeroRTT]: - """ - Changes the 0-RTT session resumption setting. - - Args: - zone_id: Identifier - - value: Value of the 0-RTT 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 self._patch( - f"/zones/{zone_id}/settings/0rtt", - body=maybe_transform({"value": value}, zero_rtt_edit_params.ZeroRTTEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), - ) - - def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroRTT]: - """ - Gets 0-RTT session resumption setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( - f"/zones/{zone_id}/settings/0rtt", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), - ) - - -class AsyncZeroRTTResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncZeroRTTResourceWithRawResponse: - return AsyncZeroRTTResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncZeroRTTResourceWithStreamingResponse: - return AsyncZeroRTTResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["on", "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, - ) -> Optional[ZeroRTT]: - """ - Changes the 0-RTT session resumption setting. - - Args: - zone_id: Identifier - - value: Value of the 0-RTT 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 await self._patch( - f"/zones/{zone_id}/settings/0rtt", - body=await async_maybe_transform({"value": value}, zero_rtt_edit_params.ZeroRTTEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), - ) - - async def get( - self, - *, - zone_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ZeroRTT]: - """ - Gets 0-RTT session resumption setting. - - Args: - zone_id: Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not zone_id: - raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( - f"/zones/{zone_id}/settings/0rtt", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[ZeroRTT]]._unwrapper, - ), - cast_to=cast(Type[Optional[ZeroRTT]], ResultWrapper[ZeroRTT]), - ) - - -class ZeroRTTResourceWithRawResponse: - def __init__(self, zero_rtt: ZeroRTTResource) -> None: - self._zero_rtt = zero_rtt - - self.edit = to_raw_response_wrapper( - zero_rtt.edit, - ) - self.get = to_raw_response_wrapper( - zero_rtt.get, - ) - - -class AsyncZeroRTTResourceWithRawResponse: - def __init__(self, zero_rtt: AsyncZeroRTTResource) -> None: - self._zero_rtt = zero_rtt - - self.edit = async_to_raw_response_wrapper( - zero_rtt.edit, - ) - self.get = async_to_raw_response_wrapper( - zero_rtt.get, - ) - - -class ZeroRTTResourceWithStreamingResponse: - def __init__(self, zero_rtt: ZeroRTTResource) -> None: - self._zero_rtt = zero_rtt - - self.edit = to_streamed_response_wrapper( - zero_rtt.edit, - ) - self.get = to_streamed_response_wrapper( - zero_rtt.get, - ) - - -class AsyncZeroRTTResourceWithStreamingResponse: - def __init__(self, zero_rtt: AsyncZeroRTTResource) -> None: - self._zero_rtt = zero_rtt - - self.edit = async_to_streamed_response_wrapper( - zero_rtt.edit, - ) - self.get = async_to_streamed_response_wrapper( - zero_rtt.get, - ) diff --git a/src/cloudflare/types/zones/settings/__init__.py b/src/cloudflare/types/zones/settings/__init__.py index 28f4f4e8a01..b44583a9742 100644 --- a/src/cloudflare/types/zones/settings/__init__.py +++ b/src/cloudflare/types/zones/settings/__init__.py @@ -2,123 +2,9 @@ from __future__ import annotations -from .nel import NEL as NEL -from .ssl import SSL as SSL -from .waf import WAF as WAF -from .ipv6 import IPV6 as IPV6 -from .webp import WebP as WebP -from .http2 import HTTP2 as HTTP2 -from .http3 import HTTP3 as HTTP3 -from .brotli import Brotli as Brotli -from .minify import Minify as Minify -from .mirage import Mirage as Mirage -from .polish import Polish as Polish -from .ciphers import Ciphers as Ciphers -from .tls_1_3 import TLS1_3 as TLS1_3 -from .zero_rtt import ZeroRTT as ZeroRTT -from .nel_param import NELParam as NELParam -from .websocket import Websocket as Websocket -from .cache_level import CacheLevel as CacheLevel -from .early_hints import EarlyHints as EarlyHints -from .pseudo_ipv4 import PseudoIPV4 as PseudoIPV4 -from .polish_param import PolishParam as PolishParam -from .advanced_ddos import AdvancedDDoS as AdvancedDDoS -from .always_online import AlwaysOnline as AlwaysOnline -from .browser_check import BrowserCheck as BrowserCheck -from .challenge_ttl import ChallengeTTL as ChallengeTTL from .font_settings import FontSettings as FontSettings -from .rocket_loader import RocketLoader as RocketLoader -from .image_resizing import ImageResizing as ImageResizing -from .ip_geolocation import IPGeolocation as IPGeolocation -from .security_level import SecurityLevel as SecurityLevel -from .min_tls_version import MinTLSVersion as MinTLSVersion -from .mobile_redirect import MobileRedirect as MobileRedirect -from .nel_edit_params import NELEditParams as NELEditParams -from .ssl_edit_params import SSLEditParams as SSLEditParams -from .ssl_recommender import SSLRecommender as SSLRecommender -from .tls_client_auth import TLSClientAuth as TLSClientAuth -from .waf_edit_params import WAFEditParams as WAFEditParams -from .always_use_https import AlwaysUseHTTPS as AlwaysUseHTTPS -from .development_mode import DevelopmentMode as DevelopmentMode -from .ipv6_edit_params import IPV6EditParams as IPV6EditParams -from .orange_to_orange import OrangeToOrange as OrangeToOrange -from .prefetch_preload import PrefetchPreload as PrefetchPreload -from .security_headers import SecurityHeaders as SecurityHeaders -from .webp_edit_params import WebPEditParams as WebPEditParams -from .browser_cache_ttl import BrowserCacheTTL as BrowserCacheTTL -from .email_obfuscation import EmailObfuscation as EmailObfuscation -from .h2_prioritization import H2Prioritization as H2Prioritization -from .http2_edit_params import HTTP2EditParams as HTTP2EditParams -from .http3_edit_params import HTTP3EditParams as HTTP3EditParams -from .brotli_edit_params import BrotliEditParams as BrotliEditParams -from .cipher_edit_params import CipherEditParams as CipherEditParams -from .hotlink_protection import HotlinkProtection as HotlinkProtection -from .minify_edit_params import MinifyEditParams as MinifyEditParams -from .mirage_edit_params import MirageEditParams as MirageEditParams -from .polish_edit_params import PolishEditParams as PolishEditParams -from .proxy_read_timeout import ProxyReadTimeout as ProxyReadTimeout -from .response_buffering import ResponseBuffering as ResponseBuffering -from .opportunistic_onion import OpportunisticOnion as OpportunisticOnion -from .rocket_loader_param import RocketLoaderParam as RocketLoaderParam -from .tls_1_3_edit_params import TLS1_3EditParams as TLS1_3EditParams -from .image_resizing_param import ImageResizingParam as ImageResizingParam -from .server_side_excludes import ServerSideExcludes as ServerSideExcludes -from .zero_rtt_edit_params import ZeroRTTEditParams as ZeroRTTEditParams -from .ssl_recommender_param import SSLRecommenderParam as SSLRecommenderParam -from .true_client_ip_header import TrueClientIPHeader as TrueClientIPHeader -from .websocket_edit_params import WebsocketEditParams as WebsocketEditParams -from .early_hint_edit_params import EarlyHintEditParams as EarlyHintEditParams -from .orange_to_orange_param import OrangeToOrangeParam as OrangeToOrangeParam -from .cache_level_edit_params import CacheLevelEditParams as CacheLevelEditParams -from .h2_prioritization_param import H2PrioritizationParam as H2PrioritizationParam from .origin_max_http_version import OriginMaxHTTPVersion as OriginMaxHTTPVersion -from .pseudo_ipv4_edit_params import PseudoIPV4EditParams as PseudoIPV4EditParams -from .automatic_https_rewrites import AutomaticHTTPSRewrites as AutomaticHTTPSRewrites from .font_setting_edit_params import FontSettingEditParams as FontSettingEditParams -from .opportunistic_encryption import OpportunisticEncryption as OpportunisticEncryption -from .proxy_read_timeout_param import ProxyReadTimeoutParam as ProxyReadTimeoutParam -from .always_online_edit_params import AlwaysOnlineEditParams as AlwaysOnlineEditParams -from .browser_check_edit_params import BrowserCheckEditParams as BrowserCheckEditParams -from .challenge_ttl_edit_params import ChallengeTTLEditParams as ChallengeTTLEditParams -from .rocket_loader_edit_params import RocketLoaderEditParams as RocketLoaderEditParams -from .image_resizing_edit_params import ImageResizingEditParams as ImageResizingEditParams -from .ip_geolocation_edit_params import IPGeolocationEditParams as IPGeolocationEditParams -from .security_level_edit_params import SecurityLevelEditParams as SecurityLevelEditParams -from .min_tls_version_edit_params import MinTLSVersionEditParams as MinTLSVersionEditParams -from .mobile_redirect_edit_params import MobileRedirectEditParams as MobileRedirectEditParams -from .origin_error_page_pass_thru import OriginErrorPagePassThru as OriginErrorPagePassThru -from .security_header_edit_params import SecurityHeaderEditParams as SecurityHeaderEditParams -from .sort_query_string_for_cache import SortQueryStringForCache as SortQueryStringForCache -from .ssl_recommender_edit_params import SSLRecommenderEditParams as SSLRecommenderEditParams -from .tls_client_auth_edit_params import TLSClientAuthEditParams as TLSClientAuthEditParams -from .always_use_https_edit_params import AlwaysUseHTTPSEditParams as AlwaysUseHTTPSEditParams -from .development_mode_edit_params import DevelopmentModeEditParams as DevelopmentModeEditParams -from .orange_to_orange_edit_params import OrangeToOrangeEditParams as OrangeToOrangeEditParams -from .prefetch_preload_edit_params import PrefetchPreloadEditParams as PrefetchPreloadEditParams -from .browser_cache_ttl_edit_params import BrowserCacheTTLEditParams as BrowserCacheTTLEditParams -from .email_obfuscation_edit_params import EmailObfuscationEditParams as EmailObfuscationEditParams -from .h2_prioritization_edit_params import H2PrioritizationEditParams as H2PrioritizationEditParams -from .hotlink_protection_edit_params import HotlinkProtectionEditParams as HotlinkProtectionEditParams -from .proxy_read_timeout_edit_params import ProxyReadTimeoutEditParams as ProxyReadTimeoutEditParams -from .response_buffering_edit_params import ResponseBufferingEditParams as ResponseBufferingEditParams -from .automatic_platform_optimization import AutomaticPlatformOptimization as AutomaticPlatformOptimization -from .opportunistic_onion_edit_params import OpportunisticOnionEditParams as OpportunisticOnionEditParams -from .server_side_exclude_edit_params import ServerSideExcludeEditParams as ServerSideExcludeEditParams -from .true_client_ip_header_edit_params import TrueClientIPHeaderEditParams as TrueClientIPHeaderEditParams -from .automatic_https_rewrite_edit_params import AutomaticHTTPSRewriteEditParams as AutomaticHTTPSRewriteEditParams from .origin_max_http_version_edit_params import OriginMaxHTTPVersionEditParams as OriginMaxHTTPVersionEditParams -from .opportunistic_encryption_edit_params import OpportunisticEncryptionEditParams as OpportunisticEncryptionEditParams from .origin_max_http_version_get_response import OriginMaxHTTPVersionGetResponse as OriginMaxHTTPVersionGetResponse -from .automatic_platform_optimization_param import ( - AutomaticPlatformOptimizationParam as AutomaticPlatformOptimizationParam, -) from .origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse as OriginMaxHTTPVersionEditResponse -from .origin_error_page_pass_thru_edit_params import ( - OriginErrorPagePassThruEditParams as OriginErrorPagePassThruEditParams, -) -from .sort_query_string_for_cache_edit_params import ( - SortQueryStringForCacheEditParams as SortQueryStringForCacheEditParams, -) -from .automatic_platform_optimization_edit_params import ( - AutomaticPlatformOptimizationEditParams as AutomaticPlatformOptimizationEditParams, -) diff --git a/src/cloudflare/types/zones/settings/always_online_edit_params.py b/src/cloudflare/types/zones/settings/always_online_edit_params.py deleted file mode 100644 index 9ab0ad39a56..00000000000 --- a/src/cloudflare/types/zones/settings/always_online_edit_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__ = ["AlwaysOnlineEditParams"] - - -class AlwaysOnlineEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/always_use_https_edit_params.py b/src/cloudflare/types/zones/settings/always_use_https_edit_params.py deleted file mode 100644 index c50e7c29249..00000000000 --- a/src/cloudflare/types/zones/settings/always_use_https_edit_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__ = ["AlwaysUseHTTPSEditParams"] - - -class AlwaysUseHTTPSEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/automatic_https_rewrite_edit_params.py b/src/cloudflare/types/zones/settings/automatic_https_rewrite_edit_params.py deleted file mode 100644 index 2122aa8e28c..00000000000 --- a/src/cloudflare/types/zones/settings/automatic_https_rewrite_edit_params.py +++ /dev/null @@ -1,18 +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__ = ["AutomaticHTTPSRewriteEditParams"] - - -class AutomaticHTTPSRewriteEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """ - Value of the zone setting. Notes: Default value depends on the zone's plan - level. - """ diff --git a/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py b/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py deleted file mode 100644 index a0f822dc9e1..00000000000 --- a/src/cloudflare/types/zones/settings/automatic_platform_optimization_edit_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .automatic_platform_optimization_param import AutomaticPlatformOptimizationParam - -__all__ = ["AutomaticPlatformOptimizationEditParams"] - - -class AutomaticPlatformOptimizationEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[AutomaticPlatformOptimizationParam] diff --git a/src/cloudflare/types/zones/settings/automatic_platform_optimization_param.py b/src/cloudflare/types/zones/settings/automatic_platform_optimization_param.py deleted file mode 100644 index b39664ca0e8..00000000000 --- a/src/cloudflare/types/zones/settings/automatic_platform_optimization_param.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, TypedDict - -__all__ = ["AutomaticPlatformOptimizationParam"] - - -class AutomaticPlatformOptimizationParam(TypedDict, total=False): - cache_by_device_type: Required[bool] - """ - Indicates whether or not - [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) - is enabled. - """ - - cf: Required[bool] - """Indicates whether or not Cloudflare proxy is enabled.""" - - enabled: Required[bool] - """Indicates whether or not Automatic Platform Optimization is enabled.""" - - hostnames: Required[List[str]] - """ - An array of hostnames where Automatic Platform Optimization for WordPress is - activated. - """ - - wordpress: Required[bool] - """Indicates whether or not site is powered by WordPress.""" - - wp_plugin: Required[bool] - """ - Indicates whether or not - [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is - installed. - """ diff --git a/src/cloudflare/types/zones/settings/brotli_edit_params.py b/src/cloudflare/types/zones/settings/brotli_edit_params.py deleted file mode 100644 index d2736f826af..00000000000 --- a/src/cloudflare/types/zones/settings/brotli_edit_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__ = ["BrotliEditParams"] - - -class BrotliEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "on"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/browser_cache_ttl_edit_params.py b/src/cloudflare/types/zones/settings/browser_cache_ttl_edit_params.py deleted file mode 100644 index 64438e8bbf6..00000000000 --- a/src/cloudflare/types/zones/settings/browser_cache_ttl_edit_params.py +++ /dev/null @@ -1,49 +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__ = ["BrowserCacheTTLEditParams"] - - -class BrowserCacheTTLEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[ - Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ] - ] - """ - Value of the zone setting. Notes: Setting a TTL of 0 is equivalent to selecting - `Respect Existing Headers` - """ diff --git a/src/cloudflare/types/zones/settings/browser_check_edit_params.py b/src/cloudflare/types/zones/settings/browser_check_edit_params.py deleted file mode 100644 index 3fea828d352..00000000000 --- a/src/cloudflare/types/zones/settings/browser_check_edit_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__ = ["BrowserCheckEditParams"] - - -class BrowserCheckEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/cache_level_edit_params.py b/src/cloudflare/types/zones/settings/cache_level_edit_params.py deleted file mode 100644 index e1906e13a11..00000000000 --- a/src/cloudflare/types/zones/settings/cache_level_edit_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__ = ["CacheLevelEditParams"] - - -class CacheLevelEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["aggressive", "basic", "simplified"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/challenge_ttl_edit_params.py b/src/cloudflare/types/zones/settings/challenge_ttl_edit_params.py deleted file mode 100644 index 4aab25dfdc1..00000000000 --- a/src/cloudflare/types/zones/settings/challenge_ttl_edit_params.py +++ /dev/null @@ -1,17 +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__ = ["ChallengeTTLEditParams"] - - -class ChallengeTTLEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[ - Literal[300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000] - ] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/cipher_edit_params.py b/src/cloudflare/types/zones/settings/cipher_edit_params.py deleted file mode 100644 index cdf75ea4084..00000000000 --- a/src/cloudflare/types/zones/settings/cipher_edit_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, TypedDict - -__all__ = ["CipherEditParams"] - - -class CipherEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[List[str]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/development_mode_edit_params.py b/src/cloudflare/types/zones/settings/development_mode_edit_params.py deleted file mode 100644 index 6966b2ee44a..00000000000 --- a/src/cloudflare/types/zones/settings/development_mode_edit_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__ = ["DevelopmentModeEditParams"] - - -class DevelopmentModeEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/early_hint_edit_params.py b/src/cloudflare/types/zones/settings/early_hint_edit_params.py deleted file mode 100644 index 70af441c98a..00000000000 --- a/src/cloudflare/types/zones/settings/early_hint_edit_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__ = ["EarlyHintEditParams"] - - -class EarlyHintEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/email_obfuscation_edit_params.py b/src/cloudflare/types/zones/settings/email_obfuscation_edit_params.py deleted file mode 100644 index b9e7ab5b6ca..00000000000 --- a/src/cloudflare/types/zones/settings/email_obfuscation_edit_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__ = ["EmailObfuscationEditParams"] - - -class EmailObfuscationEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py b/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py deleted file mode 100644 index 1b51b6116d1..00000000000 --- a/src/cloudflare/types/zones/settings/h2_prioritization_edit_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .h2_prioritization_param import H2PrioritizationParam - -__all__ = ["H2PrioritizationEditParams"] - - -class H2PrioritizationEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[H2PrioritizationParam] - """ - HTTP/2 Edge Prioritization optimises the delivery of resources served through - HTTP/2 to improve page load performance. It also supports fine control of - content delivery when used in conjunction with Workers. - """ diff --git a/src/cloudflare/types/zones/settings/h2_prioritization_param.py b/src/cloudflare/types/zones/settings/h2_prioritization_param.py deleted file mode 100644 index 0d3cc769689..00000000000 --- a/src/cloudflare/types/zones/settings/h2_prioritization_param.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__ = ["H2PrioritizationParam"] - - -class H2PrioritizationParam(TypedDict, total=False): - id: Required[Literal["h2_prioritization"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off", "custom"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/hotlink_protection_edit_params.py b/src/cloudflare/types/zones/settings/hotlink_protection_edit_params.py deleted file mode 100644 index 98a2005e715..00000000000 --- a/src/cloudflare/types/zones/settings/hotlink_protection_edit_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__ = ["HotlinkProtectionEditParams"] - - -class HotlinkProtectionEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/http2_edit_params.py b/src/cloudflare/types/zones/settings/http2_edit_params.py deleted file mode 100644 index 2260d416ef0..00000000000 --- a/src/cloudflare/types/zones/settings/http2_edit_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__ = ["HTTP2EditParams"] - - -class HTTP2EditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the HTTP2 setting.""" diff --git a/src/cloudflare/types/zones/settings/http3_edit_params.py b/src/cloudflare/types/zones/settings/http3_edit_params.py deleted file mode 100644 index 3a4dc28ce07..00000000000 --- a/src/cloudflare/types/zones/settings/http3_edit_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__ = ["HTTP3EditParams"] - - -class HTTP3EditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the HTTP3 setting.""" diff --git a/src/cloudflare/types/zones/settings/image_resizing_edit_params.py b/src/cloudflare/types/zones/settings/image_resizing_edit_params.py deleted file mode 100644 index 4425d3e42c6..00000000000 --- a/src/cloudflare/types/zones/settings/image_resizing_edit_params.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .image_resizing_param import ImageResizingParam - -__all__ = ["ImageResizingEditParams"] - - -class ImageResizingEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[ImageResizingParam] - """ - Image Resizing provides on-demand resizing, conversion and optimisation for - images served through Cloudflare's network. Refer to the - [Image Resizing documentation](https://developers.cloudflare.com/images/) for - more information. - """ diff --git a/src/cloudflare/types/zones/settings/image_resizing_param.py b/src/cloudflare/types/zones/settings/image_resizing_param.py deleted file mode 100644 index 0b6d7c66979..00000000000 --- a/src/cloudflare/types/zones/settings/image_resizing_param.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__ = ["ImageResizingParam"] - - -class ImageResizingParam(TypedDict, total=False): - id: Required[Literal["image_resizing"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off", "open"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/ip_geolocation_edit_params.py b/src/cloudflare/types/zones/settings/ip_geolocation_edit_params.py deleted file mode 100644 index 5d06f9b8cfa..00000000000 --- a/src/cloudflare/types/zones/settings/ip_geolocation_edit_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__ = ["IPGeolocationEditParams"] - - -class IPGeolocationEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/ipv6_edit_params.py b/src/cloudflare/types/zones/settings/ipv6_edit_params.py deleted file mode 100644 index 930e55e5270..00000000000 --- a/src/cloudflare/types/zones/settings/ipv6_edit_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__ = ["IPV6EditParams"] - - -class IPV6EditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "on"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/min_tls_version_edit_params.py b/src/cloudflare/types/zones/settings/min_tls_version_edit_params.py deleted file mode 100644 index a65feb7e134..00000000000 --- a/src/cloudflare/types/zones/settings/min_tls_version_edit_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__ = ["MinTLSVersionEditParams"] - - -class MinTLSVersionEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["1.0", "1.1", "1.2", "1.3"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/minify_edit_params.py b/src/cloudflare/types/zones/settings/minify_edit_params.py deleted file mode 100644 index 71a2e4988cf..00000000000 --- a/src/cloudflare/types/zones/settings/minify_edit_params.py +++ /dev/null @@ -1,26 +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__ = ["MinifyEditParams", "Value"] - - -class MinifyEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Value] - """Value of the zone setting.""" - - -class Value(TypedDict, total=False): - css: Literal["on", "off"] - """Automatically minify all CSS files for your website.""" - - html: Literal["on", "off"] - """Automatically minify all HTML files for your website.""" - - js: Literal["on", "off"] - """Automatically minify all JavaScript files for your website.""" diff --git a/src/cloudflare/types/zones/settings/mirage_edit_params.py b/src/cloudflare/types/zones/settings/mirage_edit_params.py deleted file mode 100644 index 3ad412bf012..00000000000 --- a/src/cloudflare/types/zones/settings/mirage_edit_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__ = ["MirageEditParams"] - - -class MirageEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/mobile_redirect.py b/src/cloudflare/types/zones/settings/mobile_redirect.py index 66bab1b5ff9..1b6be5aa420 100644 --- a/src/cloudflare/types/zones/settings/mobile_redirect.py +++ b/src/cloudflare/types/zones/settings/mobile_redirect.py @@ -17,7 +17,11 @@ class Value(BaseModel): """ status: Optional[Literal["on", "off"]] = None - """Whether or not mobile redirect is enabled.""" + """ + Deprecated: Use Single Redirects instead + https://developers.cloudflare.com/rules/url-forwarding/single-redirects/examples/#perform-mobile-redirects. + Whether or not mobile redirect is enabled. + """ strip_uri: Optional[bool] = None """ diff --git a/src/cloudflare/types/zones/settings/mobile_redirect_edit_params.py b/src/cloudflare/types/zones/settings/mobile_redirect_edit_params.py deleted file mode 100644 index da3cac23a24..00000000000 --- a/src/cloudflare/types/zones/settings/mobile_redirect_edit_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["MobileRedirectEditParams", "Value"] - - -class MobileRedirectEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Value] - """Value of the zone setting.""" - - -class Value(TypedDict, total=False): - mobile_subdomain: Optional[str] - """ - Which subdomain prefix you wish to redirect visitors on mobile devices to - (subdomain must already exist). - """ - - status: Literal["on", "off"] - """Whether or not mobile redirect is enabled.""" - - strip_uri: bool - """ - Whether to drop the current page path and redirect to the mobile subdomain URL - root, or keep the path and redirect to the same page on the mobile subdomain. - """ diff --git a/src/cloudflare/types/zones/settings/nel_edit_params.py b/src/cloudflare/types/zones/settings/nel_edit_params.py deleted file mode 100644 index 114d1000df4..00000000000 --- a/src/cloudflare/types/zones/settings/nel_edit_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .nel_param import NELParam - -__all__ = ["NELEditParams"] - - -class NELEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[NELParam] - """Enable Network Error Logging reporting on your zone. (Beta)""" diff --git a/src/cloudflare/types/zones/settings/nel_param.py b/src/cloudflare/types/zones/settings/nel_param.py deleted file mode 100644 index c692f294f67..00000000000 --- a/src/cloudflare/types/zones/settings/nel_param.py +++ /dev/null @@ -1,19 +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__ = ["NELParam", "Value"] - - -class Value(TypedDict, total=False): - enabled: bool - - -class NELParam(TypedDict, total=False): - id: Required[Literal["nel"]] - """Zone setting identifier.""" - - value: Required[Value] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/opportunistic_encryption_edit_params.py b/src/cloudflare/types/zones/settings/opportunistic_encryption_edit_params.py deleted file mode 100644 index 404adf6e9af..00000000000 --- a/src/cloudflare/types/zones/settings/opportunistic_encryption_edit_params.py +++ /dev/null @@ -1,18 +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__ = ["OpportunisticEncryptionEditParams"] - - -class OpportunisticEncryptionEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """ - Value of the zone setting. Notes: Default value depends on the zone's plan - level. - """ diff --git a/src/cloudflare/types/zones/settings/opportunistic_onion_edit_params.py b/src/cloudflare/types/zones/settings/opportunistic_onion_edit_params.py deleted file mode 100644 index 197c7dd631d..00000000000 --- a/src/cloudflare/types/zones/settings/opportunistic_onion_edit_params.py +++ /dev/null @@ -1,18 +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__ = ["OpportunisticOnionEditParams"] - - -class OpportunisticOnionEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """ - Value of the zone setting. Notes: Default value depends on the zone's plan - level. - """ diff --git a/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py b/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py deleted file mode 100644 index d2b659926cf..00000000000 --- a/src/cloudflare/types/zones/settings/orange_to_orange_edit_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .orange_to_orange_param import OrangeToOrangeParam - -__all__ = ["OrangeToOrangeEditParams"] - - -class OrangeToOrangeEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[OrangeToOrangeParam] - """ - Orange to Orange (O2O) allows zones on Cloudflare to CNAME to other zones also - on Cloudflare. - """ diff --git a/src/cloudflare/types/zones/settings/orange_to_orange_param.py b/src/cloudflare/types/zones/settings/orange_to_orange_param.py deleted file mode 100644 index 9a28f503c63..00000000000 --- a/src/cloudflare/types/zones/settings/orange_to_orange_param.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__ = ["OrangeToOrangeParam"] - - -class OrangeToOrangeParam(TypedDict, total=False): - id: Required[Literal["orange_to_orange"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/origin_error_page_pass_thru_edit_params.py b/src/cloudflare/types/zones/settings/origin_error_page_pass_thru_edit_params.py deleted file mode 100644 index 2adafcd3433..00000000000 --- a/src/cloudflare/types/zones/settings/origin_error_page_pass_thru_edit_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__ = ["OriginErrorPagePassThruEditParams"] - - -class OriginErrorPagePassThruEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/polish_edit_params.py b/src/cloudflare/types/zones/settings/polish_edit_params.py deleted file mode 100644 index 044f3b98989..00000000000 --- a/src/cloudflare/types/zones/settings/polish_edit_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .polish_param import PolishParam - -__all__ = ["PolishEditParams"] - - -class PolishEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[PolishParam] - """Removes metadata and compresses your images for faster page load times. - - Basic (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on - visual quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for - faster image loading. Larger JPEGs are converted to progressive images, loading - a lower-resolution image first and ending in a higher-resolution version. Not - recommended for hi-res photography sites. - """ diff --git a/src/cloudflare/types/zones/settings/polish_param.py b/src/cloudflare/types/zones/settings/polish_param.py deleted file mode 100644 index 84f4c0b65c9..00000000000 --- a/src/cloudflare/types/zones/settings/polish_param.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__ = ["PolishParam"] - - -class PolishParam(TypedDict, total=False): - id: Required[Literal["polish"]] - """ID of the zone setting.""" - - value: Required[Literal["off", "lossless", "lossy"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/prefetch_preload_edit_params.py b/src/cloudflare/types/zones/settings/prefetch_preload_edit_params.py deleted file mode 100644 index 5164941cfb4..00000000000 --- a/src/cloudflare/types/zones/settings/prefetch_preload_edit_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__ = ["PrefetchPreloadEditParams"] - - -class PrefetchPreloadEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py b/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py deleted file mode 100644 index 7813472d0e3..00000000000 --- a/src/cloudflare/types/zones/settings/proxy_read_timeout_edit_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .proxy_read_timeout_param import ProxyReadTimeoutParam - -__all__ = ["ProxyReadTimeoutEditParams"] - - -class ProxyReadTimeoutEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[ProxyReadTimeoutParam] - """Maximum time between two read operations from origin.""" diff --git a/src/cloudflare/types/zones/settings/proxy_read_timeout_param.py b/src/cloudflare/types/zones/settings/proxy_read_timeout_param.py deleted file mode 100644 index 5db20403058..00000000000 --- a/src/cloudflare/types/zones/settings/proxy_read_timeout_param.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__ = ["ProxyReadTimeoutParam"] - - -class ProxyReadTimeoutParam(TypedDict, total=False): - id: Required[Literal["proxy_read_timeout"]] - """ID of the zone setting.""" - - value: Required[float] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/pseudo_ipv4_edit_params.py b/src/cloudflare/types/zones/settings/pseudo_ipv4_edit_params.py deleted file mode 100644 index 833d68f2706..00000000000 --- a/src/cloudflare/types/zones/settings/pseudo_ipv4_edit_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__ = ["PseudoIPV4EditParams"] - - -class PseudoIPV4EditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "add_header", "overwrite_header"]] - """Value of the Pseudo IPv4 setting.""" diff --git a/src/cloudflare/types/zones/settings/response_buffering_edit_params.py b/src/cloudflare/types/zones/settings/response_buffering_edit_params.py deleted file mode 100644 index 7d1135c5253..00000000000 --- a/src/cloudflare/types/zones/settings/response_buffering_edit_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__ = ["ResponseBufferingEditParams"] - - -class ResponseBufferingEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py b/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py deleted file mode 100644 index e66a7c774cb..00000000000 --- a/src/cloudflare/types/zones/settings/rocket_loader_edit_params.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .rocket_loader_param import RocketLoaderParam - -__all__ = ["RocketLoaderEditParams"] - - -class RocketLoaderEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[RocketLoaderParam] - """ - Rocket Loader is a general-purpose asynchronous JavaScript optimisation that - prioritises rendering your content while loading your site's Javascript - asynchronously. Turning on Rocket Loader will immediately improve a web page's - rendering time sometimes measured as Time to First Paint (TTFP), and also the - `window.onload` time (assuming there is JavaScript on the page). This can have a - positive impact on your Google search ranking. When turned on, Rocket Loader - will automatically defer the loading of all Javascript referenced in your HTML, - with no configuration required. Refer to - [Understanding Rocket Loader](https://support.cloudflare.com/hc/articles/200168056) - for more information. - """ diff --git a/src/cloudflare/types/zones/settings/rocket_loader_param.py b/src/cloudflare/types/zones/settings/rocket_loader_param.py deleted file mode 100644 index d72dfe24e23..00000000000 --- a/src/cloudflare/types/zones/settings/rocket_loader_param.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__ = ["RocketLoaderParam"] - - -class RocketLoaderParam(TypedDict, total=False): - id: Required[Literal["rocket_loader"]] - """ID of the zone setting.""" - - value: Required[Literal["on", "off"]] - """Current value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/security_header_edit_params.py b/src/cloudflare/types/zones/settings/security_header_edit_params.py deleted file mode 100644 index 4efdddffb6f..00000000000 --- a/src/cloudflare/types/zones/settings/security_header_edit_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["SecurityHeaderEditParams", "Value", "ValueStrictTransportSecurity"] - - -class SecurityHeaderEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Value] - - -class ValueStrictTransportSecurity(TypedDict, total=False): - enabled: bool - """Whether or not strict transport security is enabled.""" - - include_subdomains: bool - """Include all subdomains for strict transport security.""" - - max_age: float - """Max age in seconds of the strict transport security.""" - - nosniff: bool - """Whether or not to include 'X-Content-Type-Options: nosniff' header.""" - - -class Value(TypedDict, total=False): - strict_transport_security: ValueStrictTransportSecurity - """Strict Transport Security.""" diff --git a/src/cloudflare/types/zones/settings/security_level_edit_params.py b/src/cloudflare/types/zones/settings/security_level_edit_params.py deleted file mode 100644 index cf010882c34..00000000000 --- a/src/cloudflare/types/zones/settings/security_level_edit_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__ = ["SecurityLevelEditParams"] - - -class SecurityLevelEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/server_side_exclude_edit_params.py b/src/cloudflare/types/zones/settings/server_side_exclude_edit_params.py deleted file mode 100644 index 37de328a488..00000000000 --- a/src/cloudflare/types/zones/settings/server_side_exclude_edit_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__ = ["ServerSideExcludeEditParams"] - - -class ServerSideExcludeEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/sort_query_string_for_cache_edit_params.py b/src/cloudflare/types/zones/settings/sort_query_string_for_cache_edit_params.py deleted file mode 100644 index d99c398a030..00000000000 --- a/src/cloudflare/types/zones/settings/sort_query_string_for_cache_edit_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__ = ["SortQueryStringForCacheEditParams"] - - -class SortQueryStringForCacheEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/ssl_edit_params.py b/src/cloudflare/types/zones/settings/ssl_edit_params.py deleted file mode 100644 index f64682e0fa5..00000000000 --- a/src/cloudflare/types/zones/settings/ssl_edit_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__ = ["SSLEditParams"] - - -class SSLEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "flexible", "full", "strict"]] - """Value of the zone setting. Notes: Depends on the zone's plan level""" diff --git a/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py b/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py deleted file mode 100644 index 4006b39479e..00000000000 --- a/src/cloudflare/types/zones/settings/ssl_recommender_edit_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .ssl_recommender_param import SSLRecommenderParam - -__all__ = ["SSLRecommenderEditParams"] - - -class SSLRecommenderEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[SSLRecommenderParam] - """ - Enrollment in the SSL/TLS Recommender service which tries to detect and - recommend (by sending periodic emails) the most secure SSL/TLS setting your - origin servers support. - """ diff --git a/src/cloudflare/types/zones/settings/ssl_recommender_param.py b/src/cloudflare/types/zones/settings/ssl_recommender_param.py deleted file mode 100644 index 0189ce02e60..00000000000 --- a/src/cloudflare/types/zones/settings/ssl_recommender_param.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, TypedDict - -__all__ = ["SSLRecommenderParam"] - - -class SSLRecommenderParam(TypedDict, total=False): - id: Literal["ssl_recommender"] - """Enrollment value for SSL/TLS Recommender.""" - - enabled: bool - """ssl-recommender enrollment setting.""" diff --git a/src/cloudflare/types/zones/settings/tls_1_3_edit_params.py b/src/cloudflare/types/zones/settings/tls_1_3_edit_params.py deleted file mode 100644 index 08a0c83eb0f..00000000000 --- a/src/cloudflare/types/zones/settings/tls_1_3_edit_params.py +++ /dev/null @@ -1,18 +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__ = ["TLS1_3EditParams"] - - -class TLS1_3EditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off", "zrt"]] - """ - Value of the zone setting. Notes: Default value depends on the zone's plan - level. - """ diff --git a/src/cloudflare/types/zones/settings/tls_client_auth_edit_params.py b/src/cloudflare/types/zones/settings/tls_client_auth_edit_params.py deleted file mode 100644 index f75957d0b10..00000000000 --- a/src/cloudflare/types/zones/settings/tls_client_auth_edit_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__ = ["TLSClientAuthEditParams"] - - -class TLSClientAuthEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/true_client_ip_header_edit_params.py b/src/cloudflare/types/zones/settings/true_client_ip_header_edit_params.py deleted file mode 100644 index 2bf86f31050..00000000000 --- a/src/cloudflare/types/zones/settings/true_client_ip_header_edit_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__ = ["TrueClientIPHeaderEditParams"] - - -class TrueClientIPHeaderEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/waf_edit_params.py b/src/cloudflare/types/zones/settings/waf_edit_params.py deleted file mode 100644 index eb1fc28a612..00000000000 --- a/src/cloudflare/types/zones/settings/waf_edit_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__ = ["WAFEditParams"] - - -class WAFEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/webp_edit_params.py b/src/cloudflare/types/zones/settings/webp_edit_params.py deleted file mode 100644 index 7850fcfcc33..00000000000 --- a/src/cloudflare/types/zones/settings/webp_edit_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__ = ["WebPEditParams"] - - -class WebPEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "on"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/websocket_edit_params.py b/src/cloudflare/types/zones/settings/websocket_edit_params.py deleted file mode 100644 index 5cafa6ddb08..00000000000 --- a/src/cloudflare/types/zones/settings/websocket_edit_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__ = ["WebsocketEditParams"] - - -class WebsocketEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["off", "on"]] - """Value of the zone setting.""" diff --git a/src/cloudflare/types/zones/settings/zero_rtt_edit_params.py b/src/cloudflare/types/zones/settings/zero_rtt_edit_params.py deleted file mode 100644 index 360185bff7a..00000000000 --- a/src/cloudflare/types/zones/settings/zero_rtt_edit_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__ = ["ZeroRTTEditParams"] - - -class ZeroRTTEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Value of the 0-RTT setting.""" diff --git a/tests/api_resources/zones/settings/test_advanced_ddos.py b/tests/api_resources/zones/settings/test_advanced_ddos.py deleted file mode 100644 index 0a02d5d3923..00000000000 --- a/tests/api_resources/zones/settings/test_advanced_ddos.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import AdvancedDDoS - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAdvancedDDoS: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - advanced_ddos = client.zones.settings.advanced_ddos.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.advanced_ddos.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - advanced_ddos = response.parse() - assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.advanced_ddos.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - advanced_ddos = response.parse() - assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.advanced_ddos.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncAdvancedDDoS: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - advanced_ddos = await async_client.zones.settings.advanced_ddos.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.advanced_ddos.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - advanced_ddos = await response.parse() - assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.advanced_ddos.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - advanced_ddos = await response.parse() - assert_matches_type(Optional[AdvancedDDoS], advanced_ddos, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.advanced_ddos.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_always_online.py b/tests/api_resources/zones/settings/test_always_online.py deleted file mode 100644 index 3f2165813c2..00000000000 --- a/tests/api_resources/zones/settings/test_always_online.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import AlwaysOnline - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAlwaysOnline: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - always_online = client.zones.settings.always_online.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.always_online.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_online = response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.always_online.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_online = response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.always_online.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - always_online = client.zones.settings.always_online.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.always_online.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_online = response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.always_online.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_online = response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.always_online.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncAlwaysOnline: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - always_online = await async_client.zones.settings.always_online.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.always_online.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_online = await response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.always_online.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_online = await response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.always_online.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - always_online = await async_client.zones.settings.always_online.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.always_online.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_online = await response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.always_online.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_online = await response.parse() - assert_matches_type(Optional[AlwaysOnline], always_online, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.always_online.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_always_use_https.py b/tests/api_resources/zones/settings/test_always_use_https.py deleted file mode 100644 index 3f800f69e91..00000000000 --- a/tests/api_resources/zones/settings/test_always_use_https.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import AlwaysUseHTTPS - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAlwaysUseHTTPS: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - always_use_https = client.zones.settings.always_use_https.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.always_use_https.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_use_https = response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.always_use_https.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_use_https = response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.always_use_https.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - always_use_https = client.zones.settings.always_use_https.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.always_use_https.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_use_https = response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.always_use_https.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_use_https = response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.always_use_https.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncAlwaysUseHTTPS: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - always_use_https = await async_client.zones.settings.always_use_https.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.always_use_https.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_use_https = await response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.always_use_https.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_use_https = await response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.always_use_https.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - always_use_https = await async_client.zones.settings.always_use_https.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.always_use_https.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - always_use_https = await response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.always_use_https.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - always_use_https = await response.parse() - assert_matches_type(Optional[AlwaysUseHTTPS], always_use_https, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.always_use_https.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_automatic_https_rewrites.py b/tests/api_resources/zones/settings/test_automatic_https_rewrites.py deleted file mode 100644 index 727e05ba67a..00000000000 --- a/tests/api_resources/zones/settings/test_automatic_https_rewrites.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import AutomaticHTTPSRewrites - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAutomaticHTTPSRewrites: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - automatic_https_rewrite = client.zones.settings.automatic_https_rewrites.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.automatic_https_rewrites.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_https_rewrite = response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.automatic_https_rewrites.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_https_rewrite = response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.automatic_https_rewrites.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - automatic_https_rewrite = client.zones.settings.automatic_https_rewrites.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.automatic_https_rewrites.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_https_rewrite = response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.automatic_https_rewrites.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_https_rewrite = response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.automatic_https_rewrites.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncAutomaticHTTPSRewrites: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - automatic_https_rewrite = await async_client.zones.settings.automatic_https_rewrites.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.automatic_https_rewrites.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.automatic_https_rewrites.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.automatic_https_rewrites.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - automatic_https_rewrite = await async_client.zones.settings.automatic_https_rewrites.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.automatic_https_rewrites.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.automatic_https_rewrites.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_https_rewrite = await response.parse() - assert_matches_type(Optional[AutomaticHTTPSRewrites], automatic_https_rewrite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.automatic_https_rewrites.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_automatic_platform_optimization.py b/tests/api_resources/zones/settings/test_automatic_platform_optimization.py deleted file mode 100644 index f642c020a35..00000000000 --- a/tests/api_resources/zones/settings/test_automatic_platform_optimization.py +++ /dev/null @@ -1,246 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import AutomaticPlatformOptimization - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAutomaticPlatformOptimization: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - automatic_platform_optimization = client.zones.settings.automatic_platform_optimization.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.automatic_platform_optimization.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_platform_optimization = response.parse() - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.automatic_platform_optimization.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_platform_optimization = response.parse() - assert_matches_type( - Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.automatic_platform_optimization.with_raw_response.edit( - zone_id="", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - automatic_platform_optimization = client.zones.settings.automatic_platform_optimization.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.automatic_platform_optimization.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_platform_optimization = response.parse() - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.automatic_platform_optimization.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_platform_optimization = response.parse() - assert_matches_type( - Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.automatic_platform_optimization.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncAutomaticPlatformOptimization: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - automatic_platform_optimization = await async_client.zones.settings.automatic_platform_optimization.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.automatic_platform_optimization.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_platform_optimization = await response.parse() - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.automatic_platform_optimization.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_platform_optimization = await response.parse() - assert_matches_type( - Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.automatic_platform_optimization.with_raw_response.edit( - zone_id="", - value={ - "cache_by_device_type": False, - "cf": True, - "enabled": True, - "hostnames": ["www.example.com", "example.com", "shop.example.com"], - "wordpress": True, - "wp_plugin": True, - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - automatic_platform_optimization = await async_client.zones.settings.automatic_platform_optimization.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.automatic_platform_optimization.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - automatic_platform_optimization = await response.parse() - assert_matches_type(Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.automatic_platform_optimization.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - automatic_platform_optimization = await response.parse() - assert_matches_type( - Optional[AutomaticPlatformOptimization], automatic_platform_optimization, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.automatic_platform_optimization.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_brotli.py b/tests/api_resources/zones/settings/test_brotli.py deleted file mode 100644 index 692acd2ff7f..00000000000 --- a/tests/api_resources/zones/settings/test_brotli.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import Brotli - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBrotli: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - brotli = client.zones.settings.brotli.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.brotli.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - brotli = response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.brotli.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - brotli = response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.brotli.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - brotli = client.zones.settings.brotli.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.brotli.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - brotli = response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.brotli.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - brotli = response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.brotli.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncBrotli: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - brotli = await async_client.zones.settings.brotli.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.brotli.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - brotli = await response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.brotli.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - brotli = await response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.brotli.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - brotli = await async_client.zones.settings.brotli.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.brotli.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - brotli = await response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.brotli.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - brotli = await response.parse() - assert_matches_type(Optional[Brotli], brotli, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.brotli.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_browser_cache_ttl.py b/tests/api_resources/zones/settings/test_browser_cache_ttl.py deleted file mode 100644 index b8bdfd7d4f3..00000000000 --- a/tests/api_resources/zones/settings/test_browser_cache_ttl.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import BrowserCacheTTL - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBrowserCacheTTL: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - browser_cache_ttl = client.zones.settings.browser_cache_ttl.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=0, - ) - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.browser_cache_ttl.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_cache_ttl = response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.browser_cache_ttl.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_cache_ttl = response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.browser_cache_ttl.with_raw_response.edit( - zone_id="", - value=0, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - browser_cache_ttl = client.zones.settings.browser_cache_ttl.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.browser_cache_ttl.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_cache_ttl = response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.browser_cache_ttl.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_cache_ttl = response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.browser_cache_ttl.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncBrowserCacheTTL: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - browser_cache_ttl = await async_client.zones.settings.browser_cache_ttl.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=0, - ) - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.browser_cache_ttl.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_cache_ttl = await response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.browser_cache_ttl.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_cache_ttl = await response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.browser_cache_ttl.with_raw_response.edit( - zone_id="", - value=0, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - browser_cache_ttl = await async_client.zones.settings.browser_cache_ttl.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.browser_cache_ttl.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_cache_ttl = await response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.browser_cache_ttl.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_cache_ttl = await response.parse() - assert_matches_type(Optional[BrowserCacheTTL], browser_cache_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.browser_cache_ttl.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_browser_check.py b/tests/api_resources/zones/settings/test_browser_check.py deleted file mode 100644 index 4f783e9ffb4..00000000000 --- a/tests/api_resources/zones/settings/test_browser_check.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import BrowserCheck - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBrowserCheck: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - browser_check = client.zones.settings.browser_check.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.browser_check.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_check = response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.browser_check.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_check = response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.browser_check.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - browser_check = client.zones.settings.browser_check.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.browser_check.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_check = response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.browser_check.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_check = response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.browser_check.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncBrowserCheck: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - browser_check = await async_client.zones.settings.browser_check.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.browser_check.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_check = await response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.browser_check.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_check = await response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.browser_check.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - browser_check = await async_client.zones.settings.browser_check.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.browser_check.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - browser_check = await response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.browser_check.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - browser_check = await response.parse() - assert_matches_type(Optional[BrowserCheck], browser_check, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.browser_check.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_cache_level.py b/tests/api_resources/zones/settings/test_cache_level.py deleted file mode 100644 index e9b5c0b6674..00000000000 --- a/tests/api_resources/zones/settings/test_cache_level.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import CacheLevel - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCacheLevel: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - cache_level = client.zones.settings.cache_level.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="aggressive", - ) - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.cache_level.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="aggressive", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cache_level = response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.cache_level.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="aggressive", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cache_level = response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.cache_level.with_raw_response.edit( - zone_id="", - value="aggressive", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - cache_level = client.zones.settings.cache_level.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.cache_level.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cache_level = response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.cache_level.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cache_level = response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.cache_level.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncCacheLevel: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - cache_level = await async_client.zones.settings.cache_level.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="aggressive", - ) - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.cache_level.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="aggressive", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cache_level = await response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.cache_level.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="aggressive", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cache_level = await response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.cache_level.with_raw_response.edit( - zone_id="", - value="aggressive", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - cache_level = await async_client.zones.settings.cache_level.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.cache_level.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cache_level = await response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.cache_level.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cache_level = await response.parse() - assert_matches_type(Optional[CacheLevel], cache_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.cache_level.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_challenge_ttl.py b/tests/api_resources/zones/settings/test_challenge_ttl.py deleted file mode 100644 index 2a1b284b755..00000000000 --- a/tests/api_resources/zones/settings/test_challenge_ttl.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ChallengeTTL - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestChallengeTTL: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - challenge_ttl = client.zones.settings.challenge_ttl.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=300, - ) - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.challenge_ttl.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=300, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - challenge_ttl = response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.challenge_ttl.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=300, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - challenge_ttl = response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.challenge_ttl.with_raw_response.edit( - zone_id="", - value=300, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - challenge_ttl = client.zones.settings.challenge_ttl.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.challenge_ttl.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - challenge_ttl = response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.challenge_ttl.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - challenge_ttl = response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.challenge_ttl.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncChallengeTTL: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - challenge_ttl = await async_client.zones.settings.challenge_ttl.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=300, - ) - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.challenge_ttl.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=300, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - challenge_ttl = await response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.challenge_ttl.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=300, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - challenge_ttl = await response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.challenge_ttl.with_raw_response.edit( - zone_id="", - value=300, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - challenge_ttl = await async_client.zones.settings.challenge_ttl.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.challenge_ttl.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - challenge_ttl = await response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.challenge_ttl.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - challenge_ttl = await response.parse() - assert_matches_type(Optional[ChallengeTTL], challenge_ttl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.challenge_ttl.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_ciphers.py b/tests/api_resources/zones/settings/test_ciphers.py deleted file mode 100644 index 369f2870999..00000000000 --- a/tests/api_resources/zones/settings/test_ciphers.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import Ciphers - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCiphers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - cipher = client.zones.settings.ciphers.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.ciphers.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cipher = response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.ciphers.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cipher = response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ciphers.with_raw_response.edit( - zone_id="", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - cipher = client.zones.settings.ciphers.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.ciphers.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cipher = response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.ciphers.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cipher = response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ciphers.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncCiphers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - cipher = await async_client.zones.settings.ciphers.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ciphers.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cipher = await response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ciphers.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cipher = await response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ciphers.with_raw_response.edit( - zone_id="", - value=["ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA"], - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - cipher = await async_client.zones.settings.ciphers.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ciphers.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cipher = await response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ciphers.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cipher = await response.parse() - assert_matches_type(Optional[Ciphers], cipher, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ciphers.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_development_mode.py b/tests/api_resources/zones/settings/test_development_mode.py deleted file mode 100644 index c0dcd89d40f..00000000000 --- a/tests/api_resources/zones/settings/test_development_mode.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import DevelopmentMode - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDevelopmentMode: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - development_mode = client.zones.settings.development_mode.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.development_mode.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - development_mode = response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.development_mode.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - development_mode = response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.development_mode.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - development_mode = client.zones.settings.development_mode.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.development_mode.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - development_mode = response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.development_mode.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - development_mode = response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.development_mode.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncDevelopmentMode: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - development_mode = await async_client.zones.settings.development_mode.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.development_mode.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - development_mode = await response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.development_mode.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - development_mode = await response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.development_mode.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - development_mode = await async_client.zones.settings.development_mode.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.development_mode.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - development_mode = await response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.development_mode.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - development_mode = await response.parse() - assert_matches_type(Optional[DevelopmentMode], development_mode, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.development_mode.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_early_hints.py b/tests/api_resources/zones/settings/test_early_hints.py deleted file mode 100644 index a7979ce0e77..00000000000 --- a/tests/api_resources/zones/settings/test_early_hints.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import EarlyHints - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEarlyHints: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - early_hint = client.zones.settings.early_hints.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.early_hints.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - early_hint = response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.early_hints.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - early_hint = response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.early_hints.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - early_hint = client.zones.settings.early_hints.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.early_hints.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - early_hint = response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.early_hints.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - early_hint = response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.early_hints.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncEarlyHints: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - early_hint = await async_client.zones.settings.early_hints.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.early_hints.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - early_hint = await response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.early_hints.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - early_hint = await response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.early_hints.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - early_hint = await async_client.zones.settings.early_hints.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.early_hints.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - early_hint = await response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.early_hints.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - early_hint = await response.parse() - assert_matches_type(Optional[EarlyHints], early_hint, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.early_hints.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_email_obfuscation.py b/tests/api_resources/zones/settings/test_email_obfuscation.py deleted file mode 100644 index c9ef6769ae1..00000000000 --- a/tests/api_resources/zones/settings/test_email_obfuscation.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import EmailObfuscation - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEmailObfuscation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - email_obfuscation = client.zones.settings.email_obfuscation.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.email_obfuscation.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - email_obfuscation = response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.email_obfuscation.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - email_obfuscation = response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.email_obfuscation.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - email_obfuscation = client.zones.settings.email_obfuscation.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.email_obfuscation.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - email_obfuscation = response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.email_obfuscation.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - email_obfuscation = response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.email_obfuscation.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncEmailObfuscation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - email_obfuscation = await async_client.zones.settings.email_obfuscation.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.email_obfuscation.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - email_obfuscation = await response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.email_obfuscation.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - email_obfuscation = await response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.email_obfuscation.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - email_obfuscation = await async_client.zones.settings.email_obfuscation.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.email_obfuscation.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - email_obfuscation = await response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.email_obfuscation.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - email_obfuscation = await response.parse() - assert_matches_type(Optional[EmailObfuscation], email_obfuscation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.email_obfuscation.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_h2_prioritization.py b/tests/api_resources/zones/settings/test_h2_prioritization.py deleted file mode 100644 index 2500447e342..00000000000 --- a/tests/api_resources/zones/settings/test_h2_prioritization.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import H2Prioritization - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestH2Prioritization: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - h2_prioritization = client.zones.settings.h2_prioritization.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - h2_prioritization = client.zones.settings.h2_prioritization.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.h2_prioritization.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - h2_prioritization = response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.h2_prioritization.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - h2_prioritization = response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.h2_prioritization.with_raw_response.edit( - zone_id="", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - h2_prioritization = client.zones.settings.h2_prioritization.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.h2_prioritization.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - h2_prioritization = response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.h2_prioritization.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - h2_prioritization = response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.h2_prioritization.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncH2Prioritization: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - h2_prioritization = await async_client.zones.settings.h2_prioritization.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - h2_prioritization = await async_client.zones.settings.h2_prioritization.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.h2_prioritization.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - h2_prioritization = await response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.h2_prioritization.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - h2_prioritization = await response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.h2_prioritization.with_raw_response.edit( - zone_id="", - value={ - "id": "h2_prioritization", - "value": "on", - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - h2_prioritization = await async_client.zones.settings.h2_prioritization.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.h2_prioritization.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - h2_prioritization = await response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.h2_prioritization.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - h2_prioritization = await response.parse() - assert_matches_type(Optional[H2Prioritization], h2_prioritization, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.h2_prioritization.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_hotlink_protection.py b/tests/api_resources/zones/settings/test_hotlink_protection.py deleted file mode 100644 index 8c077ae9b8f..00000000000 --- a/tests/api_resources/zones/settings/test_hotlink_protection.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import HotlinkProtection - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestHotlinkProtection: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - hotlink_protection = client.zones.settings.hotlink_protection.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.hotlink_protection.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hotlink_protection = response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.hotlink_protection.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hotlink_protection = response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.hotlink_protection.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - hotlink_protection = client.zones.settings.hotlink_protection.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.hotlink_protection.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hotlink_protection = response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.hotlink_protection.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hotlink_protection = response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.hotlink_protection.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncHotlinkProtection: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - hotlink_protection = await async_client.zones.settings.hotlink_protection.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.hotlink_protection.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hotlink_protection = await response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.hotlink_protection.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hotlink_protection = await response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.hotlink_protection.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - hotlink_protection = await async_client.zones.settings.hotlink_protection.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.hotlink_protection.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - hotlink_protection = await response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.hotlink_protection.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - hotlink_protection = await response.parse() - assert_matches_type(Optional[HotlinkProtection], hotlink_protection, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.hotlink_protection.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_http2.py b/tests/api_resources/zones/settings/test_http2.py deleted file mode 100644 index 26aa47b9428..00000000000 --- a/tests/api_resources/zones/settings/test_http2.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import HTTP2 - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestHTTP2: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - http2 = client.zones.settings.http2.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.http2.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http2 = response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.http2.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http2 = response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.http2.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - http2 = client.zones.settings.http2.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.http2.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http2 = response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.http2.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http2 = response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.http2.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncHTTP2: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - http2 = await async_client.zones.settings.http2.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.http2.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http2 = await response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.http2.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http2 = await response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.http2.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - http2 = await async_client.zones.settings.http2.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.http2.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http2 = await response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.http2.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http2 = await response.parse() - assert_matches_type(Optional[HTTP2], http2, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.http2.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_http3.py b/tests/api_resources/zones/settings/test_http3.py deleted file mode 100644 index e30a60a4181..00000000000 --- a/tests/api_resources/zones/settings/test_http3.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import HTTP3 - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestHTTP3: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - http3 = client.zones.settings.http3.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.http3.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http3 = response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.http3.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http3 = response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.http3.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - http3 = client.zones.settings.http3.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.http3.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http3 = response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.http3.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http3 = response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.http3.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncHTTP3: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - http3 = await async_client.zones.settings.http3.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.http3.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http3 = await response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.http3.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http3 = await response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.http3.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - http3 = await async_client.zones.settings.http3.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.http3.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - http3 = await response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.http3.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - http3 = await response.parse() - assert_matches_type(Optional[HTTP3], http3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.http3.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_image_resizing.py b/tests/api_resources/zones/settings/test_image_resizing.py deleted file mode 100644 index 6d81d767869..00000000000 --- a/tests/api_resources/zones/settings/test_image_resizing.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ImageResizing - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestImageResizing: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - image_resizing = client.zones.settings.image_resizing.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - image_resizing = client.zones.settings.image_resizing.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.image_resizing.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - image_resizing = response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.image_resizing.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - image_resizing = response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.image_resizing.with_raw_response.edit( - zone_id="", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - image_resizing = client.zones.settings.image_resizing.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.image_resizing.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - image_resizing = response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.image_resizing.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - image_resizing = response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.image_resizing.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncImageResizing: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - image_resizing = await async_client.zones.settings.image_resizing.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - image_resizing = await async_client.zones.settings.image_resizing.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.image_resizing.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - image_resizing = await response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.image_resizing.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "image_resizing", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - image_resizing = await response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.image_resizing.with_raw_response.edit( - zone_id="", - value={ - "id": "image_resizing", - "value": "on", - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - image_resizing = await async_client.zones.settings.image_resizing.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.image_resizing.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - image_resizing = await response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.image_resizing.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - image_resizing = await response.parse() - assert_matches_type(Optional[ImageResizing], image_resizing, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.image_resizing.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_ip_geolocation.py b/tests/api_resources/zones/settings/test_ip_geolocation.py deleted file mode 100644 index 20ff1c44111..00000000000 --- a/tests/api_resources/zones/settings/test_ip_geolocation.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import IPGeolocation - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestIPGeolocation: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - ip_geolocation = client.zones.settings.ip_geolocation.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.ip_geolocation.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_geolocation = response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.ip_geolocation.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_geolocation = response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ip_geolocation.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - ip_geolocation = client.zones.settings.ip_geolocation.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.ip_geolocation.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_geolocation = response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.ip_geolocation.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_geolocation = response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ip_geolocation.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncIPGeolocation: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - ip_geolocation = await async_client.zones.settings.ip_geolocation.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ip_geolocation.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_geolocation = await response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ip_geolocation.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_geolocation = await response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ip_geolocation.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - ip_geolocation = await async_client.zones.settings.ip_geolocation.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ip_geolocation.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_geolocation = await response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ip_geolocation.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_geolocation = await response.parse() - assert_matches_type(Optional[IPGeolocation], ip_geolocation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ip_geolocation.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_ipv6.py b/tests/api_resources/zones/settings/test_ipv6.py deleted file mode 100644 index f2733ddfc77..00000000000 --- a/tests/api_resources/zones/settings/test_ipv6.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import IPV6 - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestIPV6: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - ipv6 = client.zones.settings.ipv6.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.ipv6.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ipv6 = response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.ipv6.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ipv6 = response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ipv6.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - ipv6 = client.zones.settings.ipv6.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.ipv6.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ipv6 = response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.ipv6.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ipv6 = response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ipv6.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncIPV6: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - ipv6 = await async_client.zones.settings.ipv6.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ipv6.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ipv6 = await response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ipv6.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ipv6 = await response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ipv6.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - ipv6 = await async_client.zones.settings.ipv6.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ipv6.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ipv6 = await response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ipv6.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ipv6 = await response.parse() - assert_matches_type(Optional[IPV6], ipv6, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ipv6.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_min_tls_version.py b/tests/api_resources/zones/settings/test_min_tls_version.py deleted file mode 100644 index 043a46e0660..00000000000 --- a/tests/api_resources/zones/settings/test_min_tls_version.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import MinTLSVersion - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMinTLSVersion: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - min_tls_version = client.zones.settings.min_tls_version.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="1.0", - ) - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.min_tls_version.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="1.0", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - min_tls_version = response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.min_tls_version.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="1.0", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - min_tls_version = response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.min_tls_version.with_raw_response.edit( - zone_id="", - value="1.0", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - min_tls_version = client.zones.settings.min_tls_version.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.min_tls_version.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - min_tls_version = response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.min_tls_version.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - min_tls_version = response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.min_tls_version.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncMinTLSVersion: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - min_tls_version = await async_client.zones.settings.min_tls_version.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="1.0", - ) - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.min_tls_version.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="1.0", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - min_tls_version = await response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.min_tls_version.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="1.0", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - min_tls_version = await response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.min_tls_version.with_raw_response.edit( - zone_id="", - value="1.0", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - min_tls_version = await async_client.zones.settings.min_tls_version.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.min_tls_version.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - min_tls_version = await response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.min_tls_version.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - min_tls_version = await response.parse() - assert_matches_type(Optional[MinTLSVersion], min_tls_version, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.min_tls_version.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_minify.py b/tests/api_resources/zones/settings/test_minify.py deleted file mode 100644 index fc2feb6e152..00000000000 --- a/tests/api_resources/zones/settings/test_minify.py +++ /dev/null @@ -1,206 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import Minify - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMinify: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - minify = client.zones.settings.minify.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - minify = client.zones.settings.minify.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "css": "on", - "html": "on", - "js": "on", - }, - ) - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.minify.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - minify = response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.minify.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - minify = response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.minify.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - minify = client.zones.settings.minify.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.minify.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - minify = response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.minify.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - minify = response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.minify.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncMinify: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - minify = await async_client.zones.settings.minify.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - minify = await async_client.zones.settings.minify.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "css": "on", - "html": "on", - "js": "on", - }, - ) - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.minify.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - minify = await response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.minify.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - minify = await response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.minify.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - minify = await async_client.zones.settings.minify.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.minify.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - minify = await response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.minify.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - minify = await response.parse() - assert_matches_type(Optional[Minify], minify, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.minify.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_mirage.py b/tests/api_resources/zones/settings/test_mirage.py deleted file mode 100644 index 57f995c5ca0..00000000000 --- a/tests/api_resources/zones/settings/test_mirage.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import Mirage - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMirage: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - mirage = client.zones.settings.mirage.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.mirage.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mirage = response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.mirage.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mirage = response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.mirage.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - mirage = client.zones.settings.mirage.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.mirage.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mirage = response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.mirage.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mirage = response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.mirage.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncMirage: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - mirage = await async_client.zones.settings.mirage.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.mirage.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mirage = await response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.mirage.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mirage = await response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.mirage.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - mirage = await async_client.zones.settings.mirage.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.mirage.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mirage = await response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.mirage.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mirage = await response.parse() - assert_matches_type(Optional[Mirage], mirage, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.mirage.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_mobile_redirect.py b/tests/api_resources/zones/settings/test_mobile_redirect.py deleted file mode 100644 index b405bcd0582..00000000000 --- a/tests/api_resources/zones/settings/test_mobile_redirect.py +++ /dev/null @@ -1,206 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import MobileRedirect - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMobileRedirect: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - mobile_redirect = client.zones.settings.mobile_redirect.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - mobile_redirect = client.zones.settings.mobile_redirect.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "mobile_subdomain": "m", - "status": "on", - "strip_uri": False, - }, - ) - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.mobile_redirect.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mobile_redirect = response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.mobile_redirect.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mobile_redirect = response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.mobile_redirect.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - mobile_redirect = client.zones.settings.mobile_redirect.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.mobile_redirect.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mobile_redirect = response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.mobile_redirect.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mobile_redirect = response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.mobile_redirect.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncMobileRedirect: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - mobile_redirect = await async_client.zones.settings.mobile_redirect.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - mobile_redirect = await async_client.zones.settings.mobile_redirect.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "mobile_subdomain": "m", - "status": "on", - "strip_uri": False, - }, - ) - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.mobile_redirect.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mobile_redirect = await response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.mobile_redirect.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mobile_redirect = await response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.mobile_redirect.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - mobile_redirect = await async_client.zones.settings.mobile_redirect.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.mobile_redirect.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - mobile_redirect = await response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.mobile_redirect.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - mobile_redirect = await response.parse() - assert_matches_type(Optional[MobileRedirect], mobile_redirect, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.mobile_redirect.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_nel.py b/tests/api_resources/zones/settings/test_nel.py deleted file mode 100644 index e0e5f831a8f..00000000000 --- a/tests/api_resources/zones/settings/test_nel.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import NEL - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestNEL: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - nel = client.zones.settings.nel.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {}, - }, - ) - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - nel = client.zones.settings.nel.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {"enabled": False}, - }, - ) - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.nel.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {}, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - nel = response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.nel.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {}, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - nel = response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.nel.with_raw_response.edit( - zone_id="", - value={ - "id": "nel", - "value": {}, - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - nel = client.zones.settings.nel.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.nel.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - nel = response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.nel.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - nel = response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.nel.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncNEL: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - nel = await async_client.zones.settings.nel.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {}, - }, - ) - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - nel = await async_client.zones.settings.nel.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {"enabled": False}, - }, - ) - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.nel.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {}, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - nel = await response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.nel.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "nel", - "value": {}, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - nel = await response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.nel.with_raw_response.edit( - zone_id="", - value={ - "id": "nel", - "value": {}, - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - nel = await async_client.zones.settings.nel.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.nel.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - nel = await response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.nel.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - nel = await response.parse() - assert_matches_type(Optional[NEL], nel, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.nel.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_opportunistic_encryption.py b/tests/api_resources/zones/settings/test_opportunistic_encryption.py deleted file mode 100644 index 41f4ff13934..00000000000 --- a/tests/api_resources/zones/settings/test_opportunistic_encryption.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import OpportunisticEncryption - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestOpportunisticEncryption: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - opportunistic_encryption = client.zones.settings.opportunistic_encryption.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.opportunistic_encryption.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_encryption = response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.opportunistic_encryption.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_encryption = response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.opportunistic_encryption.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - opportunistic_encryption = client.zones.settings.opportunistic_encryption.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.opportunistic_encryption.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_encryption = response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.opportunistic_encryption.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_encryption = response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.opportunistic_encryption.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncOpportunisticEncryption: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - opportunistic_encryption = await async_client.zones.settings.opportunistic_encryption.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.opportunistic_encryption.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_encryption = await response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.opportunistic_encryption.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_encryption = await response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.opportunistic_encryption.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - opportunistic_encryption = await async_client.zones.settings.opportunistic_encryption.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.opportunistic_encryption.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_encryption = await response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.opportunistic_encryption.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_encryption = await response.parse() - assert_matches_type(Optional[OpportunisticEncryption], opportunistic_encryption, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.opportunistic_encryption.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_opportunistic_onion.py b/tests/api_resources/zones/settings/test_opportunistic_onion.py deleted file mode 100644 index 726c7245b59..00000000000 --- a/tests/api_resources/zones/settings/test_opportunistic_onion.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import OpportunisticOnion - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestOpportunisticOnion: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - opportunistic_onion = client.zones.settings.opportunistic_onion.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.opportunistic_onion.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_onion = response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.opportunistic_onion.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_onion = response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.opportunistic_onion.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - opportunistic_onion = client.zones.settings.opportunistic_onion.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.opportunistic_onion.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_onion = response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.opportunistic_onion.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_onion = response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.opportunistic_onion.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncOpportunisticOnion: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - opportunistic_onion = await async_client.zones.settings.opportunistic_onion.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.opportunistic_onion.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_onion = await response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.opportunistic_onion.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_onion = await response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.opportunistic_onion.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - opportunistic_onion = await async_client.zones.settings.opportunistic_onion.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.opportunistic_onion.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - opportunistic_onion = await response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.opportunistic_onion.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - opportunistic_onion = await response.parse() - assert_matches_type(Optional[OpportunisticOnion], opportunistic_onion, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.opportunistic_onion.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_orange_to_orange.py b/tests/api_resources/zones/settings/test_orange_to_orange.py deleted file mode 100644 index c96a6653f98..00000000000 --- a/tests/api_resources/zones/settings/test_orange_to_orange.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import OrangeToOrange - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestOrangeToOrange: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - orange_to_orange = client.zones.settings.orange_to_orange.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - orange_to_orange = client.zones.settings.orange_to_orange.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.orange_to_orange.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - orange_to_orange = response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.orange_to_orange.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - orange_to_orange = response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.orange_to_orange.with_raw_response.edit( - zone_id="", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - orange_to_orange = client.zones.settings.orange_to_orange.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.orange_to_orange.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - orange_to_orange = response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.orange_to_orange.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - orange_to_orange = response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.orange_to_orange.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncOrangeToOrange: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - orange_to_orange = await async_client.zones.settings.orange_to_orange.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - orange_to_orange = await async_client.zones.settings.orange_to_orange.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.orange_to_orange.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - orange_to_orange = await response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.orange_to_orange.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - orange_to_orange = await response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.orange_to_orange.with_raw_response.edit( - zone_id="", - value={ - "id": "orange_to_orange", - "value": "on", - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - orange_to_orange = await async_client.zones.settings.orange_to_orange.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.orange_to_orange.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - orange_to_orange = await response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.orange_to_orange.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - orange_to_orange = await response.parse() - assert_matches_type(Optional[OrangeToOrange], orange_to_orange, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.orange_to_orange.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py b/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py deleted file mode 100644 index 2b239031bc4..00000000000 --- a/tests/api_resources/zones/settings/test_origin_error_page_pass_thru.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import OriginErrorPagePassThru - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestOriginErrorPagePassThru: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - origin_error_page_pass_thru = client.zones.settings.origin_error_page_pass_thru.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.origin_error_page_pass_thru.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_error_page_pass_thru = response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.origin_error_page_pass_thru.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - origin_error_page_pass_thru = response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.origin_error_page_pass_thru.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - origin_error_page_pass_thru = client.zones.settings.origin_error_page_pass_thru.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.origin_error_page_pass_thru.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_error_page_pass_thru = response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.origin_error_page_pass_thru.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - origin_error_page_pass_thru = response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.origin_error_page_pass_thru.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncOriginErrorPagePassThru: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - origin_error_page_pass_thru = await async_client.zones.settings.origin_error_page_pass_thru.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.origin_error_page_pass_thru.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_error_page_pass_thru = await response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.origin_error_page_pass_thru.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - origin_error_page_pass_thru = await response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.origin_error_page_pass_thru.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - origin_error_page_pass_thru = await async_client.zones.settings.origin_error_page_pass_thru.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.origin_error_page_pass_thru.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_error_page_pass_thru = await response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.origin_error_page_pass_thru.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - origin_error_page_pass_thru = await response.parse() - assert_matches_type(Optional[OriginErrorPagePassThru], origin_error_page_pass_thru, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.origin_error_page_pass_thru.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_polish.py b/tests/api_resources/zones/settings/test_polish.py deleted file mode 100644 index 8b465821171..00000000000 --- a/tests/api_resources/zones/settings/test_polish.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import Polish - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPolish: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - polish = client.zones.settings.polish.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - polish = client.zones.settings.polish.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.polish.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - polish = response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.polish.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - polish = response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.polish.with_raw_response.edit( - zone_id="", - value={ - "id": "polish", - "value": "off", - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - polish = client.zones.settings.polish.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.polish.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - polish = response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.polish.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - polish = response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.polish.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncPolish: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - polish = await async_client.zones.settings.polish.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - polish = await async_client.zones.settings.polish.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.polish.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - polish = await response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.polish.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "polish", - "value": "off", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - polish = await response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.polish.with_raw_response.edit( - zone_id="", - value={ - "id": "polish", - "value": "off", - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - polish = await async_client.zones.settings.polish.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.polish.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - polish = await response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.polish.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - polish = await response.parse() - assert_matches_type(Optional[Polish], polish, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.polish.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_prefetch_preload.py b/tests/api_resources/zones/settings/test_prefetch_preload.py deleted file mode 100644 index 274077451cc..00000000000 --- a/tests/api_resources/zones/settings/test_prefetch_preload.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import PrefetchPreload - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPrefetchPreload: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - prefetch_preload = client.zones.settings.prefetch_preload.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.prefetch_preload.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefetch_preload = response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.prefetch_preload.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefetch_preload = response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.prefetch_preload.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - prefetch_preload = client.zones.settings.prefetch_preload.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.prefetch_preload.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefetch_preload = response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.prefetch_preload.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefetch_preload = response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.prefetch_preload.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncPrefetchPreload: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - prefetch_preload = await async_client.zones.settings.prefetch_preload.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.prefetch_preload.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefetch_preload = await response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.prefetch_preload.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefetch_preload = await response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.prefetch_preload.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - prefetch_preload = await async_client.zones.settings.prefetch_preload.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.prefetch_preload.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - prefetch_preload = await response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.prefetch_preload.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - prefetch_preload = await response.parse() - assert_matches_type(Optional[PrefetchPreload], prefetch_preload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.prefetch_preload.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_proxy_read_timeout.py b/tests/api_resources/zones/settings/test_proxy_read_timeout.py deleted file mode 100644 index 0d77c45109d..00000000000 --- a/tests/api_resources/zones/settings/test_proxy_read_timeout.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ProxyReadTimeout - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProxyReadTimeout: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - proxy_read_timeout = client.zones.settings.proxy_read_timeout.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - proxy_read_timeout = client.zones.settings.proxy_read_timeout.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.proxy_read_timeout.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy_read_timeout = response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.proxy_read_timeout.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy_read_timeout = response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.proxy_read_timeout.with_raw_response.edit( - zone_id="", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - proxy_read_timeout = client.zones.settings.proxy_read_timeout.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.proxy_read_timeout.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy_read_timeout = response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.proxy_read_timeout.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy_read_timeout = response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.proxy_read_timeout.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncProxyReadTimeout: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - proxy_read_timeout = await async_client.zones.settings.proxy_read_timeout.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - proxy_read_timeout = await async_client.zones.settings.proxy_read_timeout.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.proxy_read_timeout.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.proxy_read_timeout.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.proxy_read_timeout.with_raw_response.edit( - zone_id="", - value={ - "id": "proxy_read_timeout", - "value": 0, - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - proxy_read_timeout = await async_client.zones.settings.proxy_read_timeout.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.proxy_read_timeout.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.proxy_read_timeout.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proxy_read_timeout = await response.parse() - assert_matches_type(Optional[ProxyReadTimeout], proxy_read_timeout, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.proxy_read_timeout.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_pseudo_ipv4.py b/tests/api_resources/zones/settings/test_pseudo_ipv4.py deleted file mode 100644 index cec2b5def7d..00000000000 --- a/tests/api_resources/zones/settings/test_pseudo_ipv4.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import PseudoIPV4 - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPseudoIPV4: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - pseudo_ipv4 = client.zones.settings.pseudo_ipv4.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.pseudo_ipv4.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pseudo_ipv4 = response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.pseudo_ipv4.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pseudo_ipv4 = response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.pseudo_ipv4.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - pseudo_ipv4 = client.zones.settings.pseudo_ipv4.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.pseudo_ipv4.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pseudo_ipv4 = response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.pseudo_ipv4.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pseudo_ipv4 = response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.pseudo_ipv4.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncPseudoIPV4: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - pseudo_ipv4 = await async_client.zones.settings.pseudo_ipv4.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.pseudo_ipv4.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.pseudo_ipv4.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.pseudo_ipv4.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - pseudo_ipv4 = await async_client.zones.settings.pseudo_ipv4.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.pseudo_ipv4.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.pseudo_ipv4.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pseudo_ipv4 = await response.parse() - assert_matches_type(Optional[PseudoIPV4], pseudo_ipv4, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.pseudo_ipv4.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_response_buffering.py b/tests/api_resources/zones/settings/test_response_buffering.py deleted file mode 100644 index 9fd7a863594..00000000000 --- a/tests/api_resources/zones/settings/test_response_buffering.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ResponseBuffering - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestResponseBuffering: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - response_buffering = client.zones.settings.response_buffering.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.response_buffering.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - response_buffering = response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.response_buffering.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - response_buffering = response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.response_buffering.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - response_buffering = client.zones.settings.response_buffering.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.response_buffering.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - response_buffering = response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.response_buffering.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - response_buffering = response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.response_buffering.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncResponseBuffering: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - response_buffering = await async_client.zones.settings.response_buffering.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.response_buffering.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - response_buffering = await response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.response_buffering.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - response_buffering = await response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.response_buffering.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - response_buffering = await async_client.zones.settings.response_buffering.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.response_buffering.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - response_buffering = await response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.response_buffering.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - response_buffering = await response.parse() - assert_matches_type(Optional[ResponseBuffering], response_buffering, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.response_buffering.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_rocket_loader.py b/tests/api_resources/zones/settings/test_rocket_loader.py deleted file mode 100644 index 1cf85e80da2..00000000000 --- a/tests/api_resources/zones/settings/test_rocket_loader.py +++ /dev/null @@ -1,228 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import RocketLoader - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRocketLoader: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - rocket_loader = client.zones.settings.rocket_loader.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - rocket_loader = client.zones.settings.rocket_loader.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.rocket_loader.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rocket_loader = response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.rocket_loader.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rocket_loader = response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.rocket_loader.with_raw_response.edit( - zone_id="", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - rocket_loader = client.zones.settings.rocket_loader.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.rocket_loader.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rocket_loader = response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.rocket_loader.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rocket_loader = response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.rocket_loader.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncRocketLoader: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - rocket_loader = await async_client.zones.settings.rocket_loader.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - rocket_loader = await async_client.zones.settings.rocket_loader.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.rocket_loader.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rocket_loader = await response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.rocket_loader.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rocket_loader = await response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.rocket_loader.with_raw_response.edit( - zone_id="", - value={ - "id": "rocket_loader", - "value": "on", - }, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - rocket_loader = await async_client.zones.settings.rocket_loader.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.rocket_loader.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rocket_loader = await response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.rocket_loader.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rocket_loader = await response.parse() - assert_matches_type(Optional[RocketLoader], rocket_loader, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.rocket_loader.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_security_headers.py b/tests/api_resources/zones/settings/test_security_headers.py deleted file mode 100644 index c6b2a4ca32d..00000000000 --- a/tests/api_resources/zones/settings/test_security_headers.py +++ /dev/null @@ -1,212 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import SecurityHeaders - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSecurityHeaders: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - security_header = client.zones.settings.security_headers.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - security_header = client.zones.settings.security_headers.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "strict_transport_security": { - "enabled": True, - "include_subdomains": True, - "max_age": 86400, - "nosniff": True, - } - }, - ) - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.security_headers.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_header = response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.security_headers.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_header = response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.security_headers.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - security_header = client.zones.settings.security_headers.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.security_headers.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_header = response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.security_headers.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_header = response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.security_headers.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncSecurityHeaders: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - security_header = await async_client.zones.settings.security_headers.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - security_header = await async_client.zones.settings.security_headers.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "strict_transport_security": { - "enabled": True, - "include_subdomains": True, - "max_age": 86400, - "nosniff": True, - } - }, - ) - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.security_headers.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_header = await response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.security_headers.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_header = await response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.security_headers.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - security_header = await async_client.zones.settings.security_headers.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.security_headers.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_header = await response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.security_headers.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_header = await response.parse() - assert_matches_type(Optional[SecurityHeaders], security_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.security_headers.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_security_level.py b/tests/api_resources/zones/settings/test_security_level.py deleted file mode 100644 index 4fcd8c7f760..00000000000 --- a/tests/api_resources/zones/settings/test_security_level.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import SecurityLevel - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSecurityLevel: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - security_level = client.zones.settings.security_level.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.security_level.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_level = response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.security_level.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_level = response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.security_level.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - security_level = client.zones.settings.security_level.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.security_level.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_level = response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.security_level.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_level = response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.security_level.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncSecurityLevel: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - security_level = await async_client.zones.settings.security_level.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.security_level.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_level = await response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.security_level.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_level = await response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.security_level.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - security_level = await async_client.zones.settings.security_level.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.security_level.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_level = await response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.security_level.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - security_level = await response.parse() - assert_matches_type(Optional[SecurityLevel], security_level, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.security_level.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_server_side_excludes.py b/tests/api_resources/zones/settings/test_server_side_excludes.py deleted file mode 100644 index f57a4aa6685..00000000000 --- a/tests/api_resources/zones/settings/test_server_side_excludes.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ServerSideExcludes - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestServerSideExcludes: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - server_side_exclude = client.zones.settings.server_side_excludes.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.server_side_excludes.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server_side_exclude = response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.server_side_excludes.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server_side_exclude = response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.server_side_excludes.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - server_side_exclude = client.zones.settings.server_side_excludes.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.server_side_excludes.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server_side_exclude = response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.server_side_excludes.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server_side_exclude = response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.server_side_excludes.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncServerSideExcludes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - server_side_exclude = await async_client.zones.settings.server_side_excludes.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.server_side_excludes.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server_side_exclude = await response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.server_side_excludes.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server_side_exclude = await response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.server_side_excludes.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - server_side_exclude = await async_client.zones.settings.server_side_excludes.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.server_side_excludes.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server_side_exclude = await response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.server_side_excludes.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server_side_exclude = await response.parse() - assert_matches_type(Optional[ServerSideExcludes], server_side_exclude, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.server_side_excludes.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py b/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py deleted file mode 100644 index 99e3d2e9bcf..00000000000 --- a/tests/api_resources/zones/settings/test_sort_query_string_for_cache.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import SortQueryStringForCache - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSortQueryStringForCache: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - sort_query_string_for_cache = client.zones.settings.sort_query_string_for_cache.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.sort_query_string_for_cache.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sort_query_string_for_cache = response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.sort_query_string_for_cache.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sort_query_string_for_cache = response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.sort_query_string_for_cache.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - sort_query_string_for_cache = client.zones.settings.sort_query_string_for_cache.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.sort_query_string_for_cache.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sort_query_string_for_cache = response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.sort_query_string_for_cache.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sort_query_string_for_cache = response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.sort_query_string_for_cache.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncSortQueryStringForCache: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - sort_query_string_for_cache = await async_client.zones.settings.sort_query_string_for_cache.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.sort_query_string_for_cache.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sort_query_string_for_cache = await response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.sort_query_string_for_cache.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sort_query_string_for_cache = await response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.sort_query_string_for_cache.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - sort_query_string_for_cache = await async_client.zones.settings.sort_query_string_for_cache.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.sort_query_string_for_cache.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sort_query_string_for_cache = await response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.sort_query_string_for_cache.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sort_query_string_for_cache = await response.parse() - assert_matches_type(Optional[SortQueryStringForCache], sort_query_string_for_cache, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.sort_query_string_for_cache.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_ssl.py b/tests/api_resources/zones/settings/test_ssl.py deleted file mode 100644 index 812f91087f4..00000000000 --- a/tests/api_resources/zones/settings/test_ssl.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import SSL - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSSL: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - ssl = client.zones.settings.ssl.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.ssl.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl = response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.ssl.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl = response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ssl.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - ssl = client.zones.settings.ssl.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.ssl.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl = response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.ssl.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl = response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ssl.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncSSL: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - ssl = await async_client.zones.settings.ssl.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ssl.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl = await response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ssl.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl = await response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ssl.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - ssl = await async_client.zones.settings.ssl.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ssl.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl = await response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ssl.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl = await response.parse() - assert_matches_type(Optional[SSL], ssl, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ssl.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_ssl_recommender.py b/tests/api_resources/zones/settings/test_ssl_recommender.py deleted file mode 100644 index ecda7d7ddff..00000000000 --- a/tests/api_resources/zones/settings/test_ssl_recommender.py +++ /dev/null @@ -1,204 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import SSLRecommender - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSSLRecommender: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - ssl_recommender = client.zones.settings.ssl_recommender.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - ssl_recommender = client.zones.settings.ssl_recommender.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "enabled": True, - "id": "ssl_recommender", - }, - ) - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.ssl_recommender.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl_recommender = response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.ssl_recommender.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl_recommender = response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ssl_recommender.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - ssl_recommender = client.zones.settings.ssl_recommender.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.ssl_recommender.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl_recommender = response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.ssl_recommender.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl_recommender = response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.ssl_recommender.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncSSLRecommender: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - ssl_recommender = await async_client.zones.settings.ssl_recommender.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - ssl_recommender = await async_client.zones.settings.ssl_recommender.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={ - "enabled": True, - "id": "ssl_recommender", - }, - ) - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ssl_recommender.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl_recommender = await response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ssl_recommender.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl_recommender = await response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ssl_recommender.with_raw_response.edit( - zone_id="", - value={}, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - ssl_recommender = await async_client.zones.settings.ssl_recommender.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.ssl_recommender.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ssl_recommender = await response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.ssl_recommender.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ssl_recommender = await response.parse() - assert_matches_type(Optional[SSLRecommender], ssl_recommender, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.ssl_recommender.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_tls_1_3.py b/tests/api_resources/zones/settings/test_tls_1_3.py deleted file mode 100644 index 1b0d4be49cf..00000000000 --- a/tests/api_resources/zones/settings/test_tls_1_3.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import TLS1_3 - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTLS1_3: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - tls_1_3 = client.zones.settings.tls_1_3.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.tls_1_3.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_1_3 = response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.tls_1_3.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_1_3 = response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.tls_1_3.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - tls_1_3 = client.zones.settings.tls_1_3.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.tls_1_3.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_1_3 = response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.tls_1_3.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_1_3 = response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.tls_1_3.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncTLS1_3: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - tls_1_3 = await async_client.zones.settings.tls_1_3.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.tls_1_3.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_1_3 = await response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.tls_1_3.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_1_3 = await response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.tls_1_3.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - tls_1_3 = await async_client.zones.settings.tls_1_3.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.tls_1_3.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_1_3 = await response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.tls_1_3.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_1_3 = await response.parse() - assert_matches_type(Optional[TLS1_3], tls_1_3, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.tls_1_3.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_tls_client_auth.py b/tests/api_resources/zones/settings/test_tls_client_auth.py deleted file mode 100644 index bb46f15a6cb..00000000000 --- a/tests/api_resources/zones/settings/test_tls_client_auth.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import TLSClientAuth - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTLSClientAuth: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - tls_client_auth = client.zones.settings.tls_client_auth.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.tls_client_auth.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_client_auth = response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.tls_client_auth.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_client_auth = response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.tls_client_auth.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - tls_client_auth = client.zones.settings.tls_client_auth.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.tls_client_auth.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_client_auth = response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.tls_client_auth.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_client_auth = response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.tls_client_auth.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncTLSClientAuth: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - tls_client_auth = await async_client.zones.settings.tls_client_auth.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.tls_client_auth.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_client_auth = await response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.tls_client_auth.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_client_auth = await response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.tls_client_auth.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - tls_client_auth = await async_client.zones.settings.tls_client_auth.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.tls_client_auth.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - tls_client_auth = await response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.tls_client_auth.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - tls_client_auth = await response.parse() - assert_matches_type(Optional[TLSClientAuth], tls_client_auth, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.tls_client_auth.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_true_client_ip_header.py b/tests/api_resources/zones/settings/test_true_client_ip_header.py deleted file mode 100644 index 0f412bb997c..00000000000 --- a/tests/api_resources/zones/settings/test_true_client_ip_header.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import TrueClientIPHeader - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTrueClientIPHeader: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - true_client_ip_header = client.zones.settings.true_client_ip_header.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.true_client_ip_header.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - true_client_ip_header = response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.true_client_ip_header.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - true_client_ip_header = response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.true_client_ip_header.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - true_client_ip_header = client.zones.settings.true_client_ip_header.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.true_client_ip_header.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - true_client_ip_header = response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.true_client_ip_header.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - true_client_ip_header = response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.true_client_ip_header.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncTrueClientIPHeader: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - true_client_ip_header = await async_client.zones.settings.true_client_ip_header.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.true_client_ip_header.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - true_client_ip_header = await response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.true_client_ip_header.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - true_client_ip_header = await response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.true_client_ip_header.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - true_client_ip_header = await async_client.zones.settings.true_client_ip_header.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.true_client_ip_header.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - true_client_ip_header = await response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.true_client_ip_header.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - true_client_ip_header = await response.parse() - assert_matches_type(Optional[TrueClientIPHeader], true_client_ip_header, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.true_client_ip_header.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_waf.py b/tests/api_resources/zones/settings/test_waf.py deleted file mode 100644 index 954a0f04228..00000000000 --- a/tests/api_resources/zones/settings/test_waf.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import WAF - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestWAF: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - waf = client.zones.settings.waf.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.waf.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waf = response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.waf.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waf = response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.waf.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - waf = client.zones.settings.waf.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.waf.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waf = response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.waf.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waf = response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.waf.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncWAF: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - waf = await async_client.zones.settings.waf.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.waf.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waf = await response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.waf.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waf = await response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.waf.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - waf = await async_client.zones.settings.waf.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.waf.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - waf = await response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.waf.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - waf = await response.parse() - assert_matches_type(Optional[WAF], waf, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.waf.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_webp.py b/tests/api_resources/zones/settings/test_webp.py deleted file mode 100644 index 9595a35a1d0..00000000000 --- a/tests/api_resources/zones/settings/test_webp.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import WebP - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestWebP: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - webp = client.zones.settings.webp.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.webp.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - webp = response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.webp.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - webp = response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.webp.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - webp = client.zones.settings.webp.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.webp.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - webp = response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.webp.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - webp = response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.webp.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncWebP: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - webp = await async_client.zones.settings.webp.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.webp.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - webp = await response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.webp.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - webp = await response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.webp.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - webp = await async_client.zones.settings.webp.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.webp.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - webp = await response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.webp.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - webp = await response.parse() - assert_matches_type(Optional[WebP], webp, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.webp.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_websocket.py b/tests/api_resources/zones/settings/test_websocket.py deleted file mode 100644 index 6d51c9b1673..00000000000 --- a/tests/api_resources/zones/settings/test_websocket.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import Websocket - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestWebsocket: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - websocket = client.zones.settings.websocket.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.websocket.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - websocket = response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.websocket.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - websocket = response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.websocket.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - websocket = client.zones.settings.websocket.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.websocket.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - websocket = response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.websocket.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - websocket = response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.websocket.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncWebsocket: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - websocket = await async_client.zones.settings.websocket.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.websocket.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - websocket = await response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.websocket.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="off", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - websocket = await response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.websocket.with_raw_response.edit( - zone_id="", - value="off", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - websocket = await async_client.zones.settings.websocket.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.websocket.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - websocket = await response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.websocket.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - websocket = await response.parse() - assert_matches_type(Optional[Websocket], websocket, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.websocket.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_zero_rtt.py b/tests/api_resources/zones/settings/test_zero_rtt.py deleted file mode 100644 index 2901897e0d8..00000000000 --- a/tests/api_resources/zones/settings/test_zero_rtt.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, Optional, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ZeroRTT - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestZeroRTT: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - zero_rtt = client.zones.settings.zero_rtt.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.zero_rtt.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zero_rtt = response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.zero_rtt.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zero_rtt = response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.zero_rtt.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - zero_rtt = client.zones.settings.zero_rtt.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.zero_rtt.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zero_rtt = response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.zero_rtt.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zero_rtt = response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.settings.zero_rtt.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncZeroRTT: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - zero_rtt = await async_client.zones.settings.zero_rtt.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.zero_rtt.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zero_rtt = await response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.zero_rtt.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zero_rtt = await response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.zero_rtt.with_raw_response.edit( - zone_id="", - value="on", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - zero_rtt = await async_client.zones.settings.zero_rtt.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.zero_rtt.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zero_rtt = await response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.zero_rtt.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zero_rtt = await response.parse() - assert_matches_type(Optional[ZeroRTT], zero_rtt, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.settings.zero_rtt.with_raw_response.get( - zone_id="", - )