diff --git a/.stats.yml b/.stats.yml index 12e2b6fafa5..c6fd4e3d54d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1256 +configured_endpoints: 1254 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4b5d09861a06c00be9bfe41e442a9ed48d4e0dca267ed70d7677ef78159ab997.yml diff --git a/api.md b/api.md index 4a571e0960a..f005ad1776f 100644 --- a/api.md +++ b/api.md @@ -307,427 +307,70 @@ Methods: ## Settings -### ZeroRTT - -Types: - -```python -from cloudflare.types.zones.settings import ZeroRTT -``` - -### AdvancedDDoS - -Types: - -```python -from cloudflare.types.zones.settings import AdvancedDDoS -``` - -### AlwaysOnline - -Types: - -```python -from cloudflare.types.zones.settings import AlwaysOnline -``` - -### AlwaysUseHTTPS - -Types: - -```python -from cloudflare.types.zones.settings import AlwaysUseHTTPS -``` - -### AutomaticHTTPSRewrites - -Types: - -```python -from cloudflare.types.zones.settings import AutomaticHTTPSRewrites -``` - -### AutomaticPlatformOptimization - -Types: - -```python -from cloudflare.types.zones.settings import AutomaticPlatformOptimization -``` - -### Brotli - -Types: - -```python -from cloudflare.types.zones.settings import Brotli -``` - -### BrowserCacheTTL - -Types: - -```python -from cloudflare.types.zones.settings import BrowserCacheTTL -``` - -### BrowserCheck - -Types: - -```python -from cloudflare.types.zones.settings import BrowserCheck -``` - -### CacheLevel - -Types: - -```python -from cloudflare.types.zones.settings import CacheLevel -``` - -### ChallengeTTL - -Types: - -```python -from cloudflare.types.zones.settings import ChallengeTTL -``` - -### Ciphers - -Types: - -```python -from cloudflare.types.zones.settings import Ciphers -``` - -### DevelopmentMode - -Types: - -```python -from cloudflare.types.zones.settings import DevelopmentMode -``` - -### EarlyHints - -Types: - -```python -from cloudflare.types.zones.settings import EarlyHints -``` - -### EmailObfuscation - -Types: - -```python -from cloudflare.types.zones.settings import EmailObfuscation -``` - -### H2Prioritization - -Types: - -```python -from cloudflare.types.zones.settings import H2Prioritization -``` - -### HotlinkProtection - -Types: - -```python -from cloudflare.types.zones.settings import HotlinkProtection -``` - -### HTTP2 - -Types: - -```python -from cloudflare.types.zones.settings import HTTP2 -``` - -### HTTP3 - -Types: - -```python -from cloudflare.types.zones.settings import HTTP3 -``` - -### ImageResizing - -Types: - -```python -from cloudflare.types.zones.settings import ImageResizing -``` - -### IPGeolocation - -Types: - -```python -from cloudflare.types.zones.settings import IPGeolocation -``` - -### IPV6 - -Types: - -```python -from cloudflare.types.zones.settings import IPV6 -``` - -### MinTLSVersion - -Types: - -```python -from cloudflare.types.zones.settings import MinTLSVersion -``` - -### Minify - -Types: - -```python -from cloudflare.types.zones.settings import Minify -``` - -### Mirage - -Types: - -```python -from cloudflare.types.zones.settings import Mirage -``` - -### MobileRedirect - -Types: - -```python -from cloudflare.types.zones.settings import MobileRedirect -``` - -### NEL - -Types: - -```python -from cloudflare.types.zones.settings import NEL -``` - -### OpportunisticEncryption - Types: ```python -from cloudflare.types.zones.settings import OpportunisticEncryption -``` - -### OpportunisticOnion - -Types: - -```python -from cloudflare.types.zones.settings import OpportunisticOnion -``` - -### OrangeToOrange - -Types: - -```python -from cloudflare.types.zones.settings import OrangeToOrange -``` - -### OriginErrorPagePassThru - -Types: - -```python -from cloudflare.types.zones.settings import OriginErrorPagePassThru -``` - -### OriginMaxHTTPVersion - -Types: - -```python -from cloudflare.types.zones.settings import ( +from cloudflare.types.zones import ( + AdvancedDDoS, + AlwaysOnline, + AlwaysUseHTTPS, + AutomaticHTTPSRewrites, + AutomaticPlatformOptimization, + Brotli, + BrowserCacheTTL, + BrowserCheck, + CacheLevel, + ChallengeTTL, + Ciphers, + DevelopmentMode, + EarlyHints, + EmailObfuscation, + FontSettings, + H2Prioritization, + HotlinkProtection, + HTTP2, + HTTP3, + ImageResizing, + IPGeolocation, + IPV6, + MinTLSVersion, + Minify, + Mirage, + MobileRedirect, + NEL, + OpportunisticEncryption, + OpportunisticOnion, + OrangeToOrange, + OriginErrorPagePassThru, OriginMaxHTTPVersion, - OriginMaxHTTPVersionEditResponse, - OriginMaxHTTPVersionGetResponse, + Polish, + PrefetchPreload, + ProxyReadTimeout, + PseudoIPV4, + ResponseBuffering, + RocketLoader, + SecurityHeaders, + SecurityLevel, + ServerSideExcludes, + SortQueryStringForCache, + SSL, + SSLRecommender, + TLS1_3, + TLSClientAuth, + TrueClientIPHeader, + WAF, + WebP, + Websocket, + ZeroRTT, + SettingEditResponse, + SettingGetResponse, ) ``` Methods: -- client.zones.settings.origin_max_http_version.edit(\*, zone_id, \*\*params) -> OriginMaxHTTPVersionEditResponse -- client.zones.settings.origin_max_http_version.get(\*, zone_id) -> OriginMaxHTTPVersionGetResponse - -### Polish - -Types: - -```python -from cloudflare.types.zones.settings import Polish -``` - -### PrefetchPreload - -Types: - -```python -from cloudflare.types.zones.settings import PrefetchPreload -``` - -### ProxyReadTimeout - -Types: - -```python -from cloudflare.types.zones.settings import ProxyReadTimeout -``` - -### PseudoIPV4 - -Types: - -```python -from cloudflare.types.zones.settings import PseudoIPV4 -``` - -### ResponseBuffering - -Types: - -```python -from cloudflare.types.zones.settings import ResponseBuffering -``` - -### RocketLoader - -Types: - -```python -from cloudflare.types.zones.settings import RocketLoader -``` - -### SecurityHeaders - -Types: - -```python -from cloudflare.types.zones.settings import SecurityHeaders -``` - -### SecurityLevel - -Types: - -```python -from cloudflare.types.zones.settings import SecurityLevel -``` - -### ServerSideExcludes - -Types: - -```python -from cloudflare.types.zones.settings import ServerSideExcludes -``` - -### SortQueryStringForCache - -Types: - -```python -from cloudflare.types.zones.settings import SortQueryStringForCache -``` - -### SSL - -Types: - -```python -from cloudflare.types.zones.settings import SSL -``` - -### SSLRecommender - -Types: - -```python -from cloudflare.types.zones.settings import SSLRecommender -``` - -### TLS1_3 - -Types: - -```python -from cloudflare.types.zones.settings import TLS1_3 -``` - -### TLSClientAuth - -Types: - -```python -from cloudflare.types.zones.settings import TLSClientAuth -``` - -### TrueClientIPHeader - -Types: - -```python -from cloudflare.types.zones.settings import TrueClientIPHeader -``` - -### WAF - -Types: - -```python -from cloudflare.types.zones.settings import WAF -``` - -### WebP - -Types: - -```python -from cloudflare.types.zones.settings import WebP -``` - -### Websocket - -Types: - -```python -from cloudflare.types.zones.settings import Websocket -``` - -### FontSettings - -Types: - -```python -from cloudflare.types.zones.settings import FontSettings -``` - -Methods: - -- client.zones.settings.font_settings.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.settings.font_settings.get(\*, zone_id) -> Optional +- client.zones.settings.edit(setting_id, \*, zone_id) -> Optional +- client.zones.settings.get(setting_id, \*, zone_id) -> Optional ## CustomNameservers diff --git a/src/cloudflare/resources/zones/settings/font_settings.py b/src/cloudflare/resources/zones/settings.py similarity index 51% rename from src/cloudflare/resources/zones/settings/font_settings.py rename to src/cloudflare/resources/zones/settings.py index 6749ed07faa..480341ab1ce 100644 --- a/src/cloudflare/resources/zones/settings/font_settings.py +++ b/src/cloudflare/resources/zones/settings.py @@ -2,65 +2,57 @@ from __future__ import annotations -from typing import Type, Optional, cast -from typing_extensions import Literal +from typing import Any, 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 ( +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 ( +from ..._wrappers import ResultWrapper +from ..._base_client import ( make_request_options, ) -from ....types.zones.settings import font_setting_edit_params -from ....types.zones.settings.font_settings import FontSettings +from ...types.zones.setting_get_response import SettingGetResponse +from ...types.zones.setting_edit_response import SettingEditResponse -__all__ = ["FontSettingsResource", "AsyncFontSettingsResource"] +__all__ = ["SettingsResource", "AsyncSettingsResource"] -class FontSettingsResource(SyncAPIResource): +class SettingsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FontSettingsResourceWithRawResponse: - return FontSettingsResourceWithRawResponse(self) + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FontSettingsResourceWithStreamingResponse: - return FontSettingsResourceWithStreamingResponse(self) + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) def edit( self, + setting_id: str, *, 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[FontSettings]: - """Enhance your website's font delivery with Cloudflare Fonts. - - Deliver Google - Hosted fonts from your own domain, boost performance, and enhance user privacy. - Refer to the Cloudflare Fonts documentation for more information. + ) -> Optional[SettingEditResponse]: + """ + Updates a single zone setting by the identifier Args: zone_id: Identifier - value: Whether the feature is enabled or disabled. + setting_id: Setting name extra_headers: Send extra headers @@ -72,21 +64,23 @@ def edit( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not setting_id: + raise ValueError(f"Expected a non-empty value for `setting_id` but received {setting_id!r}") return self._patch( - f"/zones/{zone_id}/settings/fonts", - body=maybe_transform({"value": value}, font_setting_edit_params.FontSettingEditParams), + f"/zones/{zone_id}/settings/{setting_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, + post_parser=ResultWrapper[Optional[SettingEditResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), ) def get( self, + setting_id: str, *, zone_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -95,16 +89,15 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FontSettings]: - """Enhance your website's font delivery with Cloudflare Fonts. - - Deliver Google - Hosted fonts from your own domain, boost performance, and enhance user privacy. - Refer to the Cloudflare Fonts documentation for more information. + ) -> Optional[SettingGetResponse]: + """ + Fetch a single zone setting by name Args: zone_id: Identifier + setting_id: Setting name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -115,50 +108,54 @@ def get( """ 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/fonts", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, + if not setting_id: + raise ValueError(f"Expected a non-empty value for `setting_id` but received {setting_id!r}") + return cast( + Optional[SettingGetResponse], + self._get( + f"/zones/{zone_id}/settings/{setting_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[SettingGetResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), ) -class AsyncFontSettingsResource(AsyncAPIResource): +class AsyncSettingsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFontSettingsResourceWithRawResponse: - return AsyncFontSettingsResourceWithRawResponse(self) + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFontSettingsResourceWithStreamingResponse: - return AsyncFontSettingsResourceWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) async def edit( self, + setting_id: str, *, 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[FontSettings]: - """Enhance your website's font delivery with Cloudflare Fonts. - - Deliver Google - Hosted fonts from your own domain, boost performance, and enhance user privacy. - Refer to the Cloudflare Fonts documentation for more information. + ) -> Optional[SettingEditResponse]: + """ + Updates a single zone setting by the identifier Args: zone_id: Identifier - value: Whether the feature is enabled or disabled. + setting_id: Setting name extra_headers: Send extra headers @@ -170,21 +167,23 @@ async def edit( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + if not setting_id: + raise ValueError(f"Expected a non-empty value for `setting_id` but received {setting_id!r}") return await self._patch( - f"/zones/{zone_id}/settings/fonts", - body=await async_maybe_transform({"value": value}, font_setting_edit_params.FontSettingEditParams), + f"/zones/{zone_id}/settings/{setting_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, + post_parser=ResultWrapper[Optional[SettingEditResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), ) async def get( self, + setting_id: str, *, zone_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -193,16 +192,15 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FontSettings]: - """Enhance your website's font delivery with Cloudflare Fonts. - - Deliver Google - Hosted fonts from your own domain, boost performance, and enhance user privacy. - Refer to the Cloudflare Fonts documentation for more information. + ) -> Optional[SettingGetResponse]: + """ + Fetch a single zone setting by name Args: zone_id: Identifier + setting_id: Setting name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -213,62 +211,69 @@ async def get( """ 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/fonts", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[FontSettings]]._unwrapper, + if not setting_id: + raise ValueError(f"Expected a non-empty value for `setting_id` but received {setting_id!r}") + return cast( + Optional[SettingGetResponse], + await self._get( + f"/zones/{zone_id}/settings/{setting_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[SettingGetResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=cast(Type[Optional[FontSettings]], ResultWrapper[FontSettings]), ) -class FontSettingsResourceWithRawResponse: - def __init__(self, font_settings: FontSettingsResource) -> None: - self._font_settings = font_settings +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings self.edit = to_raw_response_wrapper( - font_settings.edit, + settings.edit, ) self.get = to_raw_response_wrapper( - font_settings.get, + settings.get, ) -class AsyncFontSettingsResourceWithRawResponse: - def __init__(self, font_settings: AsyncFontSettingsResource) -> None: - self._font_settings = font_settings +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings self.edit = async_to_raw_response_wrapper( - font_settings.edit, + settings.edit, ) self.get = async_to_raw_response_wrapper( - font_settings.get, + settings.get, ) -class FontSettingsResourceWithStreamingResponse: - def __init__(self, font_settings: FontSettingsResource) -> None: - self._font_settings = font_settings +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings self.edit = to_streamed_response_wrapper( - font_settings.edit, + settings.edit, ) self.get = to_streamed_response_wrapper( - font_settings.get, + settings.get, ) -class AsyncFontSettingsResourceWithStreamingResponse: - def __init__(self, font_settings: AsyncFontSettingsResource) -> None: - self._font_settings = font_settings +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings self.edit = async_to_streamed_response_wrapper( - font_settings.edit, + settings.edit, ) self.get = async_to_streamed_response_wrapper( - font_settings.get, + settings.get, ) diff --git a/src/cloudflare/resources/zones/settings/__init__.py b/src/cloudflare/resources/zones/settings/__init__.py deleted file mode 100644 index ae9eeaf9d4a..00000000000 --- a/src/cloudflare/resources/zones/settings/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .settings import ( - SettingsResource, - AsyncSettingsResource, - SettingsResourceWithRawResponse, - AsyncSettingsResourceWithRawResponse, - SettingsResourceWithStreamingResponse, - AsyncSettingsResourceWithStreamingResponse, -) -from .font_settings import ( - FontSettingsResource, - AsyncFontSettingsResource, - FontSettingsResourceWithRawResponse, - AsyncFontSettingsResourceWithRawResponse, - FontSettingsResourceWithStreamingResponse, - AsyncFontSettingsResourceWithStreamingResponse, -) -from .origin_max_http_version import ( - OriginMaxHTTPVersionResource, - AsyncOriginMaxHTTPVersionResource, - OriginMaxHTTPVersionResourceWithRawResponse, - AsyncOriginMaxHTTPVersionResourceWithRawResponse, - OriginMaxHTTPVersionResourceWithStreamingResponse, - AsyncOriginMaxHTTPVersionResourceWithStreamingResponse, -) - -__all__ = [ - "OriginMaxHTTPVersionResource", - "AsyncOriginMaxHTTPVersionResource", - "OriginMaxHTTPVersionResourceWithRawResponse", - "AsyncOriginMaxHTTPVersionResourceWithRawResponse", - "OriginMaxHTTPVersionResourceWithStreamingResponse", - "AsyncOriginMaxHTTPVersionResourceWithStreamingResponse", - "FontSettingsResource", - "AsyncFontSettingsResource", - "FontSettingsResourceWithRawResponse", - "AsyncFontSettingsResourceWithRawResponse", - "FontSettingsResourceWithStreamingResponse", - "AsyncFontSettingsResourceWithStreamingResponse", - "SettingsResource", - "AsyncSettingsResource", - "SettingsResourceWithRawResponse", - "AsyncSettingsResourceWithRawResponse", - "SettingsResourceWithStreamingResponse", - "AsyncSettingsResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/zones/settings/origin_max_http_version.py b/src/cloudflare/resources/zones/settings/origin_max_http_version.py deleted file mode 100644 index 29a7f3fff2a..00000000000 --- a/src/cloudflare/resources/zones/settings/origin_max_http_version.py +++ /dev/null @@ -1,285 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, 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_max_http_version_edit_params -from ....types.zones.settings.origin_max_http_version_get_response import OriginMaxHTTPVersionGetResponse -from ....types.zones.settings.origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse - -__all__ = ["OriginMaxHTTPVersionResource", "AsyncOriginMaxHTTPVersionResource"] - - -class OriginMaxHTTPVersionResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> OriginMaxHTTPVersionResourceWithRawResponse: - return OriginMaxHTTPVersionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> OriginMaxHTTPVersionResourceWithStreamingResponse: - return OriginMaxHTTPVersionResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - value: Literal["2", "1"], - # 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, - ) -> OriginMaxHTTPVersionEditResponse: - """ - Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will - attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 - requests to your origin. (Refer to - [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), - for more information.). The default value is "2" for all plan types except ENT - where it is "1" - - Args: - zone_id: Identifier - - value: Value of the Origin Max HTTP Version 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_max_http_version", - body=maybe_transform({"value": value}, origin_max_http_version_edit_params.OriginMaxHTTPVersionEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginMaxHTTPVersionEditResponse]._unwrapper, - ), - cast_to=cast(Type[OriginMaxHTTPVersionEditResponse], ResultWrapper[OriginMaxHTTPVersionEditResponse]), - ) - - 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, - ) -> OriginMaxHTTPVersionGetResponse: - """ - Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will - attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 - requests to your origin. (Refer to - [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), - for more information.). The default value is "2" for all plan types except ENT - where it is "1" - - 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_max_http_version", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginMaxHTTPVersionGetResponse]._unwrapper, - ), - cast_to=cast(Type[OriginMaxHTTPVersionGetResponse], ResultWrapper[OriginMaxHTTPVersionGetResponse]), - ) - - -class AsyncOriginMaxHTTPVersionResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncOriginMaxHTTPVersionResourceWithRawResponse: - return AsyncOriginMaxHTTPVersionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: - return AsyncOriginMaxHTTPVersionResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - value: Literal["2", "1"], - # 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, - ) -> OriginMaxHTTPVersionEditResponse: - """ - Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will - attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 - requests to your origin. (Refer to - [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), - for more information.). The default value is "2" for all plan types except ENT - where it is "1" - - Args: - zone_id: Identifier - - value: Value of the Origin Max HTTP Version 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_max_http_version", - body=await async_maybe_transform( - {"value": value}, origin_max_http_version_edit_params.OriginMaxHTTPVersionEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginMaxHTTPVersionEditResponse]._unwrapper, - ), - cast_to=cast(Type[OriginMaxHTTPVersionEditResponse], ResultWrapper[OriginMaxHTTPVersionEditResponse]), - ) - - 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, - ) -> OriginMaxHTTPVersionGetResponse: - """ - Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will - attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 - requests to your origin. (Refer to - [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), - for more information.). The default value is "2" for all plan types except ENT - where it is "1" - - 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_max_http_version", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OriginMaxHTTPVersionGetResponse]._unwrapper, - ), - cast_to=cast(Type[OriginMaxHTTPVersionGetResponse], ResultWrapper[OriginMaxHTTPVersionGetResponse]), - ) - - -class OriginMaxHTTPVersionResourceWithRawResponse: - def __init__(self, origin_max_http_version: OriginMaxHTTPVersionResource) -> None: - self._origin_max_http_version = origin_max_http_version - - self.edit = to_raw_response_wrapper( - origin_max_http_version.edit, - ) - self.get = to_raw_response_wrapper( - origin_max_http_version.get, - ) - - -class AsyncOriginMaxHTTPVersionResourceWithRawResponse: - def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersionResource) -> None: - self._origin_max_http_version = origin_max_http_version - - self.edit = async_to_raw_response_wrapper( - origin_max_http_version.edit, - ) - self.get = async_to_raw_response_wrapper( - origin_max_http_version.get, - ) - - -class OriginMaxHTTPVersionResourceWithStreamingResponse: - def __init__(self, origin_max_http_version: OriginMaxHTTPVersionResource) -> None: - self._origin_max_http_version = origin_max_http_version - - self.edit = to_streamed_response_wrapper( - origin_max_http_version.edit, - ) - self.get = to_streamed_response_wrapper( - origin_max_http_version.get, - ) - - -class AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: - def __init__(self, origin_max_http_version: AsyncOriginMaxHTTPVersionResource) -> None: - self._origin_max_http_version = origin_max_http_version - - self.edit = async_to_streamed_response_wrapper( - origin_max_http_version.edit, - ) - self.get = async_to_streamed_response_wrapper( - origin_max_http_version.get, - ) diff --git a/src/cloudflare/resources/zones/settings/settings.py b/src/cloudflare/resources/zones/settings/settings.py deleted file mode 100644 index 48b3522b37e..00000000000 --- a/src/cloudflare/resources/zones/settings/settings.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .font_settings import ( - FontSettingsResource, - AsyncFontSettingsResource, - FontSettingsResourceWithRawResponse, - AsyncFontSettingsResourceWithRawResponse, - FontSettingsResourceWithStreamingResponse, - AsyncFontSettingsResourceWithStreamingResponse, -) -from .origin_max_http_version import ( - OriginMaxHTTPVersionResource, - AsyncOriginMaxHTTPVersionResource, - OriginMaxHTTPVersionResourceWithRawResponse, - AsyncOriginMaxHTTPVersionResourceWithRawResponse, - OriginMaxHTTPVersionResourceWithStreamingResponse, - AsyncOriginMaxHTTPVersionResourceWithStreamingResponse, -) - -__all__ = ["SettingsResource", "AsyncSettingsResource"] - - -class SettingsResource(SyncAPIResource): - @cached_property - def origin_max_http_version(self) -> OriginMaxHTTPVersionResource: - return OriginMaxHTTPVersionResource(self._client) - - @cached_property - def font_settings(self) -> FontSettingsResource: - return FontSettingsResource(self._client) - - @cached_property - def with_raw_response(self) -> SettingsResourceWithRawResponse: - return SettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: - return SettingsResourceWithStreamingResponse(self) - - -class AsyncSettingsResource(AsyncAPIResource): - @cached_property - def origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResource: - return AsyncOriginMaxHTTPVersionResource(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 origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithRawResponse: - return OriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) - - @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 origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithRawResponse: - return AsyncOriginMaxHTTPVersionResourceWithRawResponse(self._settings.origin_max_http_version) - - @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 origin_max_http_version(self) -> OriginMaxHTTPVersionResourceWithStreamingResponse: - return OriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) - - @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 origin_max_http_version(self) -> AsyncOriginMaxHTTPVersionResourceWithStreamingResponse: - return AsyncOriginMaxHTTPVersionResourceWithStreamingResponse(self._settings.origin_max_http_version) - - @cached_property - def font_settings(self) -> AsyncFontSettingsResourceWithStreamingResponse: - return AsyncFontSettingsResourceWithStreamingResponse(self._settings.font_settings) diff --git a/src/cloudflare/resources/zones/zones.py b/src/cloudflare/resources/zones/zones.py index 2584b9a48a9..03e2d448793 100644 --- a/src/cloudflare/resources/zones/zones.py +++ b/src/cloudflare/resources/zones/zones.py @@ -59,7 +59,6 @@ ActivationCheckResourceWithStreamingResponse, AsyncActivationCheckResourceWithStreamingResponse, ) -from .settings.settings import SettingsResource, AsyncSettingsResource from ...types.zones.type import Type as ZonesType from ...types.zones.zone import Zone from .custom_nameservers import ( diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index c7b972f4d45..bccc236417f 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -2,19 +2,71 @@ 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 .type import Type as Type +from .webp import WebP as WebP from .zone import Zone as Zone +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 .websocket import Websocket as Websocket from .zone_hold import ZoneHold as ZoneHold +from .cache_level import CacheLevel as CacheLevel +from .early_hints import EarlyHints as EarlyHints +from .pseudo_ipv4 import PseudoIPV4 as PseudoIPV4 +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 .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 .ssl_recommender import SSLRecommender as SSLRecommender +from .tls_client_auth import TLSClientAuth as TLSClientAuth +from .always_use_https import AlwaysUseHTTPS as AlwaysUseHTTPS +from .development_mode import DevelopmentMode as DevelopmentMode +from .orange_to_orange import OrangeToOrange as OrangeToOrange +from .prefetch_preload import PrefetchPreload as PrefetchPreload +from .security_headers import SecurityHeaders as SecurityHeaders from .zone_edit_params import ZoneEditParams as ZoneEditParams from .zone_list_params import ZoneListParams as ZoneListParams +from .browser_cache_ttl import BrowserCacheTTL as BrowserCacheTTL +from .email_obfuscation import EmailObfuscation as EmailObfuscation +from .h2_prioritization import H2Prioritization as H2Prioritization from .hold_create_params import HoldCreateParams as HoldCreateParams from .hold_delete_params import HoldDeleteParams as HoldDeleteParams +from .hotlink_protection import HotlinkProtection as HotlinkProtection +from .proxy_read_timeout import ProxyReadTimeout as ProxyReadTimeout +from .response_buffering import ResponseBuffering as ResponseBuffering from .zone_create_params import ZoneCreateParams as ZoneCreateParams +from .opportunistic_onion import OpportunisticOnion as OpportunisticOnion +from .server_side_excludes import ServerSideExcludes as ServerSideExcludes +from .setting_get_response import SettingGetResponse as SettingGetResponse from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse +from .setting_edit_response import SettingEditResponse as SettingEditResponse +from .true_client_ip_header import TrueClientIPHeader as TrueClientIPHeader +from .origin_max_http_version import OriginMaxHTTPVersion as OriginMaxHTTPVersion +from .automatic_https_rewrites import AutomaticHTTPSRewrites as AutomaticHTTPSRewrites +from .opportunistic_encryption import OpportunisticEncryption as OpportunisticEncryption from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams +from .origin_error_page_pass_thru import OriginErrorPagePassThru as OriginErrorPagePassThru +from .sort_query_string_for_cache import SortQueryStringForCache as SortQueryStringForCache from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse +from .automatic_platform_optimization import AutomaticPlatformOptimization as AutomaticPlatformOptimization from .custom_nameserver_update_params import CustomNameserverUpdateParams as CustomNameserverUpdateParams from .activation_check_trigger_response import ActivationCheckTriggerResponse as ActivationCheckTriggerResponse from .custom_nameserver_update_response import CustomNameserverUpdateResponse as CustomNameserverUpdateResponse diff --git a/src/cloudflare/types/zones/settings/advanced_ddos.py b/src/cloudflare/types/zones/advanced_ddos.py similarity index 95% rename from src/cloudflare/types/zones/settings/advanced_ddos.py rename to src/cloudflare/types/zones/advanced_ddos.py index b399aa5033b..f9fc9f46d39 100644 --- a/src/cloudflare/types/zones/settings/advanced_ddos.py +++ b/src/cloudflare/types/zones/advanced_ddos.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["AdvancedDDoS"] diff --git a/src/cloudflare/types/zones/settings/always_online.py b/src/cloudflare/types/zones/always_online.py similarity index 95% rename from src/cloudflare/types/zones/settings/always_online.py rename to src/cloudflare/types/zones/always_online.py index 8e6e3530c86..d37202571b6 100644 --- a/src/cloudflare/types/zones/settings/always_online.py +++ b/src/cloudflare/types/zones/always_online.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["AlwaysOnline"] diff --git a/src/cloudflare/types/zones/settings/always_use_https.py b/src/cloudflare/types/zones/always_use_https.py similarity index 95% rename from src/cloudflare/types/zones/settings/always_use_https.py rename to src/cloudflare/types/zones/always_use_https.py index 683e5f5f23c..78f176711aa 100644 --- a/src/cloudflare/types/zones/settings/always_use_https.py +++ b/src/cloudflare/types/zones/always_use_https.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["AlwaysUseHTTPS"] diff --git a/src/cloudflare/types/zones/settings/automatic_https_rewrites.py b/src/cloudflare/types/zones/automatic_https_rewrites.py similarity index 95% rename from src/cloudflare/types/zones/settings/automatic_https_rewrites.py rename to src/cloudflare/types/zones/automatic_https_rewrites.py index bc1d055b2c9..ced7a3e50f5 100644 --- a/src/cloudflare/types/zones/settings/automatic_https_rewrites.py +++ b/src/cloudflare/types/zones/automatic_https_rewrites.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["AutomaticHTTPSRewrites"] diff --git a/src/cloudflare/types/zones/settings/automatic_platform_optimization.py b/src/cloudflare/types/zones/automatic_platform_optimization.py similarity index 96% rename from src/cloudflare/types/zones/settings/automatic_platform_optimization.py rename to src/cloudflare/types/zones/automatic_platform_optimization.py index 1523e6d792d..dbf8d141501 100644 --- a/src/cloudflare/types/zones/settings/automatic_platform_optimization.py +++ b/src/cloudflare/types/zones/automatic_platform_optimization.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["AutomaticPlatformOptimization"] diff --git a/src/cloudflare/types/zones/settings/brotli.py b/src/cloudflare/types/zones/brotli.py similarity index 94% rename from src/cloudflare/types/zones/settings/brotli.py rename to src/cloudflare/types/zones/brotli.py index b950810ee41..74f62f42deb 100644 --- a/src/cloudflare/types/zones/settings/brotli.py +++ b/src/cloudflare/types/zones/brotli.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Brotli"] diff --git a/src/cloudflare/types/zones/settings/browser_cache_ttl.py b/src/cloudflare/types/zones/browser_cache_ttl.py similarity index 96% rename from src/cloudflare/types/zones/settings/browser_cache_ttl.py rename to src/cloudflare/types/zones/browser_cache_ttl.py index f24f141978c..77393c400dc 100644 --- a/src/cloudflare/types/zones/settings/browser_cache_ttl.py +++ b/src/cloudflare/types/zones/browser_cache_ttl.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["BrowserCacheTTL"] diff --git a/src/cloudflare/types/zones/settings/browser_check.py b/src/cloudflare/types/zones/browser_check.py similarity index 95% rename from src/cloudflare/types/zones/settings/browser_check.py rename to src/cloudflare/types/zones/browser_check.py index eadee65af2a..9de5013bcaa 100644 --- a/src/cloudflare/types/zones/settings/browser_check.py +++ b/src/cloudflare/types/zones/browser_check.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["BrowserCheck"] diff --git a/src/cloudflare/types/zones/settings/cache_level.py b/src/cloudflare/types/zones/cache_level.py similarity index 95% rename from src/cloudflare/types/zones/settings/cache_level.py rename to src/cloudflare/types/zones/cache_level.py index d383d1f6f60..7aaf4433499 100644 --- a/src/cloudflare/types/zones/settings/cache_level.py +++ b/src/cloudflare/types/zones/cache_level.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["CacheLevel"] diff --git a/src/cloudflare/types/zones/settings/challenge_ttl.py b/src/cloudflare/types/zones/challenge_ttl.py similarity index 95% rename from src/cloudflare/types/zones/settings/challenge_ttl.py rename to src/cloudflare/types/zones/challenge_ttl.py index 3006c3220d0..c7f1057d65b 100644 --- a/src/cloudflare/types/zones/settings/challenge_ttl.py +++ b/src/cloudflare/types/zones/challenge_ttl.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["ChallengeTTL"] diff --git a/src/cloudflare/types/zones/settings/ciphers.py b/src/cloudflare/types/zones/ciphers.py similarity index 94% rename from src/cloudflare/types/zones/settings/ciphers.py rename to src/cloudflare/types/zones/ciphers.py index a27c8eed620..90ac369b89d 100644 --- a/src/cloudflare/types/zones/settings/ciphers.py +++ b/src/cloudflare/types/zones/ciphers.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Ciphers"] diff --git a/src/cloudflare/types/zones/settings/development_mode.py b/src/cloudflare/types/zones/development_mode.py similarity index 96% rename from src/cloudflare/types/zones/settings/development_mode.py rename to src/cloudflare/types/zones/development_mode.py index d5f856dd284..06c81d58b5f 100644 --- a/src/cloudflare/types/zones/settings/development_mode.py +++ b/src/cloudflare/types/zones/development_mode.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["DevelopmentMode"] diff --git a/src/cloudflare/types/zones/settings/early_hints.py b/src/cloudflare/types/zones/early_hints.py similarity index 95% rename from src/cloudflare/types/zones/settings/early_hints.py rename to src/cloudflare/types/zones/early_hints.py index db3e20a7e80..61b3e7421db 100644 --- a/src/cloudflare/types/zones/settings/early_hints.py +++ b/src/cloudflare/types/zones/early_hints.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["EarlyHints"] diff --git a/src/cloudflare/types/zones/settings/email_obfuscation.py b/src/cloudflare/types/zones/email_obfuscation.py similarity index 95% rename from src/cloudflare/types/zones/settings/email_obfuscation.py rename to src/cloudflare/types/zones/email_obfuscation.py index 278226136b5..37ecaca46de 100644 --- a/src/cloudflare/types/zones/settings/email_obfuscation.py +++ b/src/cloudflare/types/zones/email_obfuscation.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["EmailObfuscation"] diff --git a/src/cloudflare/types/zones/settings/h2_prioritization.py b/src/cloudflare/types/zones/h2_prioritization.py similarity index 95% rename from src/cloudflare/types/zones/settings/h2_prioritization.py rename to src/cloudflare/types/zones/h2_prioritization.py index 7a9144ae8b1..3efdb72b3e3 100644 --- a/src/cloudflare/types/zones/settings/h2_prioritization.py +++ b/src/cloudflare/types/zones/h2_prioritization.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["H2Prioritization"] diff --git a/src/cloudflare/types/zones/settings/hotlink_protection.py b/src/cloudflare/types/zones/hotlink_protection.py similarity index 95% rename from src/cloudflare/types/zones/settings/hotlink_protection.py rename to src/cloudflare/types/zones/hotlink_protection.py index 52fa412f29b..45d990193de 100644 --- a/src/cloudflare/types/zones/settings/hotlink_protection.py +++ b/src/cloudflare/types/zones/hotlink_protection.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["HotlinkProtection"] diff --git a/src/cloudflare/types/zones/settings/http2.py b/src/cloudflare/types/zones/http2.py similarity index 94% rename from src/cloudflare/types/zones/settings/http2.py rename to src/cloudflare/types/zones/http2.py index 8d539940248..2d959b2869f 100644 --- a/src/cloudflare/types/zones/settings/http2.py +++ b/src/cloudflare/types/zones/http2.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["HTTP2"] diff --git a/src/cloudflare/types/zones/settings/http3.py b/src/cloudflare/types/zones/http3.py similarity index 94% rename from src/cloudflare/types/zones/settings/http3.py rename to src/cloudflare/types/zones/http3.py index 2b65951e377..bfca8786793 100644 --- a/src/cloudflare/types/zones/settings/http3.py +++ b/src/cloudflare/types/zones/http3.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["HTTP3"] diff --git a/src/cloudflare/types/zones/settings/image_resizing.py b/src/cloudflare/types/zones/image_resizing.py similarity index 95% rename from src/cloudflare/types/zones/settings/image_resizing.py rename to src/cloudflare/types/zones/image_resizing.py index 8fa332009e7..5f4d4e370a6 100644 --- a/src/cloudflare/types/zones/settings/image_resizing.py +++ b/src/cloudflare/types/zones/image_resizing.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["ImageResizing"] diff --git a/src/cloudflare/types/zones/settings/ip_geolocation.py b/src/cloudflare/types/zones/ip_geolocation.py similarity index 95% rename from src/cloudflare/types/zones/settings/ip_geolocation.py rename to src/cloudflare/types/zones/ip_geolocation.py index faa0d44caec..0c378a4acc9 100644 --- a/src/cloudflare/types/zones/settings/ip_geolocation.py +++ b/src/cloudflare/types/zones/ip_geolocation.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["IPGeolocation"] diff --git a/src/cloudflare/types/zones/settings/ipv6.py b/src/cloudflare/types/zones/ipv6.py similarity index 94% rename from src/cloudflare/types/zones/settings/ipv6.py rename to src/cloudflare/types/zones/ipv6.py index d99f87c4568..3ba1ce89134 100644 --- a/src/cloudflare/types/zones/settings/ipv6.py +++ b/src/cloudflare/types/zones/ipv6.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["IPV6"] diff --git a/src/cloudflare/types/zones/settings/min_tls_version.py b/src/cloudflare/types/zones/min_tls_version.py similarity index 95% rename from src/cloudflare/types/zones/settings/min_tls_version.py rename to src/cloudflare/types/zones/min_tls_version.py index 20908024cda..107999e783e 100644 --- a/src/cloudflare/types/zones/settings/min_tls_version.py +++ b/src/cloudflare/types/zones/min_tls_version.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["MinTLSVersion"] diff --git a/src/cloudflare/types/zones/settings/minify.py b/src/cloudflare/types/zones/minify.py similarity index 96% rename from src/cloudflare/types/zones/settings/minify.py rename to src/cloudflare/types/zones/minify.py index eae119b2741..0d036564ca6 100644 --- a/src/cloudflare/types/zones/settings/minify.py +++ b/src/cloudflare/types/zones/minify.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Minify", "Value"] diff --git a/src/cloudflare/types/zones/settings/mirage.py b/src/cloudflare/types/zones/mirage.py similarity index 94% rename from src/cloudflare/types/zones/settings/mirage.py rename to src/cloudflare/types/zones/mirage.py index bbd2722212e..4679cc48ebb 100644 --- a/src/cloudflare/types/zones/settings/mirage.py +++ b/src/cloudflare/types/zones/mirage.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Mirage"] diff --git a/src/cloudflare/types/zones/settings/mobile_redirect.py b/src/cloudflare/types/zones/mobile_redirect.py similarity index 97% rename from src/cloudflare/types/zones/settings/mobile_redirect.py rename to src/cloudflare/types/zones/mobile_redirect.py index 1b6be5aa420..b787fbd3ed8 100644 --- a/src/cloudflare/types/zones/settings/mobile_redirect.py +++ b/src/cloudflare/types/zones/mobile_redirect.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["MobileRedirect", "Value"] diff --git a/src/cloudflare/types/zones/settings/nel.py b/src/cloudflare/types/zones/nel.py similarity index 95% rename from src/cloudflare/types/zones/settings/nel.py rename to src/cloudflare/types/zones/nel.py index f8b8d437e7e..bd87df59c8b 100644 --- a/src/cloudflare/types/zones/settings/nel.py +++ b/src/cloudflare/types/zones/nel.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["NEL", "Value"] diff --git a/src/cloudflare/types/zones/settings/opportunistic_encryption.py b/src/cloudflare/types/zones/opportunistic_encryption.py similarity index 95% rename from src/cloudflare/types/zones/settings/opportunistic_encryption.py rename to src/cloudflare/types/zones/opportunistic_encryption.py index 30ecc81168b..7ab0d1e8275 100644 --- a/src/cloudflare/types/zones/settings/opportunistic_encryption.py +++ b/src/cloudflare/types/zones/opportunistic_encryption.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OpportunisticEncryption"] diff --git a/src/cloudflare/types/zones/settings/opportunistic_onion.py b/src/cloudflare/types/zones/opportunistic_onion.py similarity index 95% rename from src/cloudflare/types/zones/settings/opportunistic_onion.py rename to src/cloudflare/types/zones/opportunistic_onion.py index d0beb361768..533f547d0b2 100644 --- a/src/cloudflare/types/zones/settings/opportunistic_onion.py +++ b/src/cloudflare/types/zones/opportunistic_onion.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OpportunisticOnion"] diff --git a/src/cloudflare/types/zones/settings/orange_to_orange.py b/src/cloudflare/types/zones/orange_to_orange.py similarity index 95% rename from src/cloudflare/types/zones/settings/orange_to_orange.py rename to src/cloudflare/types/zones/orange_to_orange.py index ae7a5cd519e..5605b38f011 100644 --- a/src/cloudflare/types/zones/settings/orange_to_orange.py +++ b/src/cloudflare/types/zones/orange_to_orange.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OrangeToOrange"] diff --git a/src/cloudflare/types/zones/settings/origin_error_page_pass_thru.py b/src/cloudflare/types/zones/origin_error_page_pass_thru.py similarity index 95% rename from src/cloudflare/types/zones/settings/origin_error_page_pass_thru.py rename to src/cloudflare/types/zones/origin_error_page_pass_thru.py index 000e5e4940e..24cd47f546b 100644 --- a/src/cloudflare/types/zones/settings/origin_error_page_pass_thru.py +++ b/src/cloudflare/types/zones/origin_error_page_pass_thru.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["OriginErrorPagePassThru"] diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version.py b/src/cloudflare/types/zones/origin_max_http_version.py similarity index 100% rename from src/cloudflare/types/zones/settings/origin_max_http_version.py rename to src/cloudflare/types/zones/origin_max_http_version.py diff --git a/src/cloudflare/types/zones/settings/polish.py b/src/cloudflare/types/zones/polish.py similarity index 95% rename from src/cloudflare/types/zones/settings/polish.py rename to src/cloudflare/types/zones/polish.py index 0caf6611eb3..c75f4c9c129 100644 --- a/src/cloudflare/types/zones/settings/polish.py +++ b/src/cloudflare/types/zones/polish.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Polish"] diff --git a/src/cloudflare/types/zones/settings/prefetch_preload.py b/src/cloudflare/types/zones/prefetch_preload.py similarity index 95% rename from src/cloudflare/types/zones/settings/prefetch_preload.py rename to src/cloudflare/types/zones/prefetch_preload.py index 4482bee389c..38fba5db671 100644 --- a/src/cloudflare/types/zones/settings/prefetch_preload.py +++ b/src/cloudflare/types/zones/prefetch_preload.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["PrefetchPreload"] diff --git a/src/cloudflare/types/zones/settings/proxy_read_timeout.py b/src/cloudflare/types/zones/proxy_read_timeout.py similarity index 95% rename from src/cloudflare/types/zones/settings/proxy_read_timeout.py rename to src/cloudflare/types/zones/proxy_read_timeout.py index 1533eb571fe..4ebc5dc4228 100644 --- a/src/cloudflare/types/zones/settings/proxy_read_timeout.py +++ b/src/cloudflare/types/zones/proxy_read_timeout.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["ProxyReadTimeout"] diff --git a/src/cloudflare/types/zones/settings/pseudo_ipv4.py b/src/cloudflare/types/zones/pseudo_ipv4.py similarity index 95% rename from src/cloudflare/types/zones/settings/pseudo_ipv4.py rename to src/cloudflare/types/zones/pseudo_ipv4.py index d0e154d9ed6..7e8c5077722 100644 --- a/src/cloudflare/types/zones/settings/pseudo_ipv4.py +++ b/src/cloudflare/types/zones/pseudo_ipv4.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["PseudoIPV4"] diff --git a/src/cloudflare/types/zones/settings/response_buffering.py b/src/cloudflare/types/zones/response_buffering.py similarity index 95% rename from src/cloudflare/types/zones/settings/response_buffering.py rename to src/cloudflare/types/zones/response_buffering.py index 567acd1b665..cee36587e1a 100644 --- a/src/cloudflare/types/zones/settings/response_buffering.py +++ b/src/cloudflare/types/zones/response_buffering.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["ResponseBuffering"] diff --git a/src/cloudflare/types/zones/settings/rocket_loader.py b/src/cloudflare/types/zones/rocket_loader.py similarity index 95% rename from src/cloudflare/types/zones/settings/rocket_loader.py rename to src/cloudflare/types/zones/rocket_loader.py index 92374df7dd1..1fcbbd08bea 100644 --- a/src/cloudflare/types/zones/settings/rocket_loader.py +++ b/src/cloudflare/types/zones/rocket_loader.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["RocketLoader"] diff --git a/src/cloudflare/types/zones/settings/security_headers.py b/src/cloudflare/types/zones/security_headers.py similarity index 97% rename from src/cloudflare/types/zones/settings/security_headers.py rename to src/cloudflare/types/zones/security_headers.py index 2399ebe976c..c2ad2888bbb 100644 --- a/src/cloudflare/types/zones/settings/security_headers.py +++ b/src/cloudflare/types/zones/security_headers.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["SecurityHeaders", "Value", "ValueStrictTransportSecurity"] diff --git a/src/cloudflare/types/zones/settings/security_level.py b/src/cloudflare/types/zones/security_level.py similarity index 95% rename from src/cloudflare/types/zones/settings/security_level.py rename to src/cloudflare/types/zones/security_level.py index 36676d1e644..93dfddc12ef 100644 --- a/src/cloudflare/types/zones/settings/security_level.py +++ b/src/cloudflare/types/zones/security_level.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["SecurityLevel"] diff --git a/src/cloudflare/types/zones/settings/server_side_excludes.py b/src/cloudflare/types/zones/server_side_excludes.py similarity index 95% rename from src/cloudflare/types/zones/settings/server_side_excludes.py rename to src/cloudflare/types/zones/server_side_excludes.py index 96f3581d609..2630a01b631 100644 --- a/src/cloudflare/types/zones/settings/server_side_excludes.py +++ b/src/cloudflare/types/zones/server_side_excludes.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["ServerSideExcludes"] diff --git a/src/cloudflare/types/zones/setting_edit_response.py b/src/cloudflare/types/zones/setting_edit_response.py new file mode 100644 index 00000000000..6806ed49d02 --- /dev/null +++ b/src/cloudflare/types/zones/setting_edit_response.py @@ -0,0 +1,270 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .nel import NEL +from .ssl import SSL +from .waf import WAF +from .ipv6 import IPV6 +from .webp import WebP +from .http2 import HTTP2 +from .http3 import HTTP3 +from .brotli import Brotli +from .minify import Minify +from .mirage import Mirage +from .polish import Polish +from .ciphers import Ciphers +from .tls_1_3 import TLS1_3 +from .zero_rtt import ZeroRTT +from ..._models import BaseModel +from .websocket import Websocket +from .cache_level import CacheLevel +from .early_hints import EarlyHints +from .pseudo_ipv4 import PseudoIPV4 +from .advanced_ddos import AdvancedDDoS +from .always_online import AlwaysOnline +from .browser_check import BrowserCheck +from .challenge_ttl import ChallengeTTL +from .rocket_loader import RocketLoader +from .image_resizing import ImageResizing +from .ip_geolocation import IPGeolocation +from .security_level import SecurityLevel +from .min_tls_version import MinTLSVersion +from .mobile_redirect import MobileRedirect +from .ssl_recommender import SSLRecommender +from .tls_client_auth import TLSClientAuth +from .always_use_https import AlwaysUseHTTPS +from .development_mode import DevelopmentMode +from .orange_to_orange import OrangeToOrange +from .prefetch_preload import PrefetchPreload +from .security_headers import SecurityHeaders +from .browser_cache_ttl import BrowserCacheTTL +from .email_obfuscation import EmailObfuscation +from .h2_prioritization import H2Prioritization +from .hotlink_protection import HotlinkProtection +from .proxy_read_timeout import ProxyReadTimeout +from .response_buffering import ResponseBuffering +from .opportunistic_onion import OpportunisticOnion +from .server_side_excludes import ServerSideExcludes +from .true_client_ip_header import TrueClientIPHeader +from .automatic_https_rewrites import AutomaticHTTPSRewrites +from .opportunistic_encryption import OpportunisticEncryption +from .origin_error_page_pass_thru import OriginErrorPagePassThru +from .sort_query_string_for_cache import SortQueryStringForCache +from .automatic_platform_optimization import AutomaticPlatformOptimization + +__all__ = [ + "SettingEditResponse", + "SettingEditResponseItem", + "SettingEditResponseItemZonesCNAMEFlattening", + "SettingEditResponseItemZonesEdgeCacheTTL", + "SettingEditResponseItemZonesMaxUpload", + "SettingEditResponseItemZonesReplaceInsecureJS", + "SettingEditResponseItemZonesSchemasAutomaticPlatformOptimization", + "SettingEditResponseItemZonesSha1Support", + "SettingEditResponseItemZonesTLS1_2Only", +] + + +class SettingEditResponseItemZonesCNAMEFlattening(BaseModel): + id: Literal["cname_flattening"] + """How to flatten the cname destination.""" + + value: Literal["flatten_at_root", "flatten_all"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class SettingEditResponseItemZonesEdgeCacheTTL(BaseModel): + id: Literal["edge_cache_ttl"] + """ID of the zone setting.""" + + value: Literal[ + 30, + 60, + 300, + 1200, + 1800, + 3600, + 7200, + 10800, + 14400, + 18000, + 28800, + 43200, + 57600, + 72000, + 86400, + 172800, + 259200, + 345600, + 432000, + 518400, + 604800, + ] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class SettingEditResponseItemZonesMaxUpload(BaseModel): + id: Literal["max_upload"] + """identifier of the zone setting.""" + + value: Literal[100, 200, 500] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class SettingEditResponseItemZonesReplaceInsecureJS(BaseModel): + id: Literal["replace_insecure_js"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class SettingEditResponseItemZonesSchemasAutomaticPlatformOptimization(BaseModel): + id: Literal["automatic_platform_optimization"] + """ID of the zone setting.""" + + value: AutomaticPlatformOptimization + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class SettingEditResponseItemZonesSha1Support(BaseModel): + id: Literal["sha1_support"] + """Zone setting identifier.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class SettingEditResponseItemZonesTLS1_2Only(BaseModel): + id: Literal["tls_1_2_only"] + """Zone setting identifier.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +SettingEditResponseItem = Union[ + ZeroRTT, + AdvancedDDoS, + AlwaysOnline, + AlwaysUseHTTPS, + AutomaticHTTPSRewrites, + Brotli, + BrowserCacheTTL, + BrowserCheck, + CacheLevel, + ChallengeTTL, + Ciphers, + SettingEditResponseItemZonesCNAMEFlattening, + DevelopmentMode, + EarlyHints, + SettingEditResponseItemZonesEdgeCacheTTL, + EmailObfuscation, + H2Prioritization, + HotlinkProtection, + HTTP2, + HTTP3, + ImageResizing, + IPGeolocation, + IPV6, + SettingEditResponseItemZonesMaxUpload, + MinTLSVersion, + Minify, + Mirage, + MobileRedirect, + NEL, + OpportunisticEncryption, + OpportunisticOnion, + OrangeToOrange, + OriginErrorPagePassThru, + Polish, + PrefetchPreload, + ProxyReadTimeout, + PseudoIPV4, + SettingEditResponseItemZonesReplaceInsecureJS, + ResponseBuffering, + RocketLoader, + SettingEditResponseItemZonesSchemasAutomaticPlatformOptimization, + SecurityHeaders, + SecurityLevel, + ServerSideExcludes, + SettingEditResponseItemZonesSha1Support, + SortQueryStringForCache, + SSL, + SSLRecommender, + SettingEditResponseItemZonesTLS1_2Only, + TLS1_3, + TLSClientAuth, + TrueClientIPHeader, + WAF, + WebP, + Websocket, +] + +SettingEditResponse = List[SettingEditResponseItem] diff --git a/src/cloudflare/types/zones/setting_get_response.py b/src/cloudflare/types/zones/setting_get_response.py new file mode 100644 index 00000000000..692ee89b86c --- /dev/null +++ b/src/cloudflare/types/zones/setting_get_response.py @@ -0,0 +1,267 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .nel import NEL +from .ssl import SSL +from .waf import WAF +from .ipv6 import IPV6 +from .webp import WebP +from .http2 import HTTP2 +from .http3 import HTTP3 +from .brotli import Brotli +from .minify import Minify +from .mirage import Mirage +from .polish import Polish +from .ciphers import Ciphers +from .tls_1_3 import TLS1_3 +from .zero_rtt import ZeroRTT +from ..._models import BaseModel +from .websocket import Websocket +from .cache_level import CacheLevel +from .early_hints import EarlyHints +from .pseudo_ipv4 import PseudoIPV4 +from .advanced_ddos import AdvancedDDoS +from .always_online import AlwaysOnline +from .browser_check import BrowserCheck +from .challenge_ttl import ChallengeTTL +from .rocket_loader import RocketLoader +from .image_resizing import ImageResizing +from .ip_geolocation import IPGeolocation +from .security_level import SecurityLevel +from .min_tls_version import MinTLSVersion +from .mobile_redirect import MobileRedirect +from .ssl_recommender import SSLRecommender +from .tls_client_auth import TLSClientAuth +from .always_use_https import AlwaysUseHTTPS +from .development_mode import DevelopmentMode +from .orange_to_orange import OrangeToOrange +from .prefetch_preload import PrefetchPreload +from .security_headers import SecurityHeaders +from .browser_cache_ttl import BrowserCacheTTL +from .email_obfuscation import EmailObfuscation +from .h2_prioritization import H2Prioritization +from .hotlink_protection import HotlinkProtection +from .proxy_read_timeout import ProxyReadTimeout +from .response_buffering import ResponseBuffering +from .opportunistic_onion import OpportunisticOnion +from .server_side_excludes import ServerSideExcludes +from .true_client_ip_header import TrueClientIPHeader +from .automatic_https_rewrites import AutomaticHTTPSRewrites +from .opportunistic_encryption import OpportunisticEncryption +from .origin_error_page_pass_thru import OriginErrorPagePassThru +from .sort_query_string_for_cache import SortQueryStringForCache +from .automatic_platform_optimization import AutomaticPlatformOptimization + +__all__ = [ + "SettingGetResponse", + "ZonesCNAMEFlattening", + "ZonesEdgeCacheTTL", + "ZonesMaxUpload", + "ZonesReplaceInsecureJS", + "ZonesSchemasAutomaticPlatformOptimization", + "ZonesSha1Support", + "ZonesTLS1_2Only", +] + + +class ZonesCNAMEFlattening(BaseModel): + id: Literal["cname_flattening"] + """How to flatten the cname destination.""" + + value: Literal["flatten_at_root", "flatten_all"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class ZonesEdgeCacheTTL(BaseModel): + id: Literal["edge_cache_ttl"] + """ID of the zone setting.""" + + value: Literal[ + 30, + 60, + 300, + 1200, + 1800, + 3600, + 7200, + 10800, + 14400, + 18000, + 28800, + 43200, + 57600, + 72000, + 86400, + 172800, + 259200, + 345600, + 432000, + 518400, + 604800, + ] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class ZonesMaxUpload(BaseModel): + id: Literal["max_upload"] + """identifier of the zone setting.""" + + value: Literal[100, 200, 500] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class ZonesReplaceInsecureJS(BaseModel): + id: Literal["replace_insecure_js"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class ZonesSchemasAutomaticPlatformOptimization(BaseModel): + id: Literal["automatic_platform_optimization"] + """ID of the zone setting.""" + + value: AutomaticPlatformOptimization + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class ZonesSha1Support(BaseModel): + id: Literal["sha1_support"] + """Zone setting identifier.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +class ZonesTLS1_2Only(BaseModel): + id: Literal["tls_1_2_only"] + """Zone setting identifier.""" + + value: Literal["off", "on"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + +SettingGetResponse = Union[ + ZeroRTT, + AdvancedDDoS, + AlwaysOnline, + AlwaysUseHTTPS, + AutomaticHTTPSRewrites, + Brotli, + BrowserCacheTTL, + BrowserCheck, + CacheLevel, + ChallengeTTL, + Ciphers, + ZonesCNAMEFlattening, + DevelopmentMode, + EarlyHints, + ZonesEdgeCacheTTL, + EmailObfuscation, + H2Prioritization, + HotlinkProtection, + HTTP2, + HTTP3, + ImageResizing, + IPGeolocation, + IPV6, + ZonesMaxUpload, + MinTLSVersion, + Minify, + Mirage, + MobileRedirect, + NEL, + OpportunisticEncryption, + OpportunisticOnion, + OrangeToOrange, + OriginErrorPagePassThru, + Polish, + PrefetchPreload, + ProxyReadTimeout, + PseudoIPV4, + ZonesReplaceInsecureJS, + ResponseBuffering, + RocketLoader, + ZonesSchemasAutomaticPlatformOptimization, + SecurityHeaders, + SecurityLevel, + ServerSideExcludes, + ZonesSha1Support, + SortQueryStringForCache, + SSL, + SSLRecommender, + ZonesTLS1_2Only, + TLS1_3, + TLSClientAuth, + TrueClientIPHeader, + WAF, + WebP, + Websocket, +] diff --git a/src/cloudflare/types/zones/settings/__init__.py b/src/cloudflare/types/zones/settings/__init__.py deleted file mode 100644 index b44583a9742..00000000000 --- a/src/cloudflare/types/zones/settings/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .font_settings import FontSettings as FontSettings -from .origin_max_http_version import OriginMaxHTTPVersion as OriginMaxHTTPVersion -from .font_setting_edit_params import FontSettingEditParams as FontSettingEditParams -from .origin_max_http_version_edit_params import OriginMaxHTTPVersionEditParams as OriginMaxHTTPVersionEditParams -from .origin_max_http_version_get_response import OriginMaxHTTPVersionGetResponse as OriginMaxHTTPVersionGetResponse -from .origin_max_http_version_edit_response import OriginMaxHTTPVersionEditResponse as OriginMaxHTTPVersionEditResponse diff --git a/src/cloudflare/types/zones/settings/font_setting_edit_params.py b/src/cloudflare/types/zones/settings/font_setting_edit_params.py deleted file mode 100644 index 41953c2d872..00000000000 --- a/src/cloudflare/types/zones/settings/font_setting_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__ = ["FontSettingEditParams"] - - -class FontSettingEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["on", "off"]] - """Whether the feature is enabled or disabled.""" diff --git a/src/cloudflare/types/zones/settings/font_settings.py b/src/cloudflare/types/zones/settings/font_settings.py deleted file mode 100644 index c0fc9cdfac3..00000000000 --- a/src/cloudflare/types/zones/settings/font_settings.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["FontSettings"] - - -class FontSettings(BaseModel): - id: Literal["fonts"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version_edit_params.py b/src/cloudflare/types/zones/settings/origin_max_http_version_edit_params.py deleted file mode 100644 index 9462bcaab09..00000000000 --- a/src/cloudflare/types/zones/settings/origin_max_http_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__ = ["OriginMaxHTTPVersionEditParams"] - - -class OriginMaxHTTPVersionEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - value: Required[Literal["2", "1"]] - """Value of the Origin Max HTTP Version Setting.""" diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py b/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py deleted file mode 100644 index f147194e780..00000000000 --- a/src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel -from .origin_max_http_version import OriginMaxHTTPVersion - -__all__ = ["OriginMaxHTTPVersionEditResponse"] - - -class OriginMaxHTTPVersionEditResponse(BaseModel): - id: OriginMaxHTTPVersion - """Value of the zone setting.""" - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - value: Literal["2", "1"] - """Value of the Origin Max HTTP Version Setting.""" diff --git a/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py b/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py deleted file mode 100644 index 035e11644f5..00000000000 --- a/src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel -from .origin_max_http_version import OriginMaxHTTPVersion - -__all__ = ["OriginMaxHTTPVersionGetResponse"] - - -class OriginMaxHTTPVersionGetResponse(BaseModel): - id: OriginMaxHTTPVersion - """Value of the zone setting.""" - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - value: Literal["2", "1"] - """Value of the Origin Max HTTP Version Setting.""" diff --git a/src/cloudflare/types/zones/settings/sort_query_string_for_cache.py b/src/cloudflare/types/zones/sort_query_string_for_cache.py similarity index 95% rename from src/cloudflare/types/zones/settings/sort_query_string_for_cache.py rename to src/cloudflare/types/zones/sort_query_string_for_cache.py index a60d4bfb63d..ca2fea8aaac 100644 --- a/src/cloudflare/types/zones/settings/sort_query_string_for_cache.py +++ b/src/cloudflare/types/zones/sort_query_string_for_cache.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["SortQueryStringForCache"] diff --git a/src/cloudflare/types/zones/settings/ssl.py b/src/cloudflare/types/zones/ssl.py similarity index 95% rename from src/cloudflare/types/zones/settings/ssl.py rename to src/cloudflare/types/zones/ssl.py index 43cf8ae0cb7..720c4eaa01b 100644 --- a/src/cloudflare/types/zones/settings/ssl.py +++ b/src/cloudflare/types/zones/ssl.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["SSL"] diff --git a/src/cloudflare/types/zones/settings/ssl_recommender.py b/src/cloudflare/types/zones/ssl_recommender.py similarity index 92% rename from src/cloudflare/types/zones/settings/ssl_recommender.py rename to src/cloudflare/types/zones/ssl_recommender.py index c3a36d8f3c8..3fd86d2b451 100644 --- a/src/cloudflare/types/zones/settings/ssl_recommender.py +++ b/src/cloudflare/types/zones/ssl_recommender.py @@ -3,7 +3,7 @@ from typing import Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["SSLRecommender"] diff --git a/src/cloudflare/types/zones/settings/tls_1_3.py b/src/cloudflare/types/zones/tls_1_3.py similarity index 94% rename from src/cloudflare/types/zones/settings/tls_1_3.py rename to src/cloudflare/types/zones/tls_1_3.py index 6e72f90e7b9..547b489f92a 100644 --- a/src/cloudflare/types/zones/settings/tls_1_3.py +++ b/src/cloudflare/types/zones/tls_1_3.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["TLS1_3"] diff --git a/src/cloudflare/types/zones/settings/tls_client_auth.py b/src/cloudflare/types/zones/tls_client_auth.py similarity index 95% rename from src/cloudflare/types/zones/settings/tls_client_auth.py rename to src/cloudflare/types/zones/tls_client_auth.py index e1ab61fb85b..9d9a33649ad 100644 --- a/src/cloudflare/types/zones/settings/tls_client_auth.py +++ b/src/cloudflare/types/zones/tls_client_auth.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["TLSClientAuth"] diff --git a/src/cloudflare/types/zones/settings/true_client_ip_header.py b/src/cloudflare/types/zones/true_client_ip_header.py similarity index 95% rename from src/cloudflare/types/zones/settings/true_client_ip_header.py rename to src/cloudflare/types/zones/true_client_ip_header.py index 12fd0a2d037..c81c57535bf 100644 --- a/src/cloudflare/types/zones/settings/true_client_ip_header.py +++ b/src/cloudflare/types/zones/true_client_ip_header.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["TrueClientIPHeader"] diff --git a/src/cloudflare/types/zones/settings/waf.py b/src/cloudflare/types/zones/waf.py similarity index 94% rename from src/cloudflare/types/zones/settings/waf.py rename to src/cloudflare/types/zones/waf.py index ec7a5487541..d5f4c0d363d 100644 --- a/src/cloudflare/types/zones/settings/waf.py +++ b/src/cloudflare/types/zones/waf.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["WAF"] diff --git a/src/cloudflare/types/zones/settings/webp.py b/src/cloudflare/types/zones/webp.py similarity index 94% rename from src/cloudflare/types/zones/settings/webp.py rename to src/cloudflare/types/zones/webp.py index 9f4cfaeee3f..87435839431 100644 --- a/src/cloudflare/types/zones/settings/webp.py +++ b/src/cloudflare/types/zones/webp.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["WebP"] diff --git a/src/cloudflare/types/zones/settings/websocket.py b/src/cloudflare/types/zones/websocket.py similarity index 95% rename from src/cloudflare/types/zones/settings/websocket.py rename to src/cloudflare/types/zones/websocket.py index c8471ef28f9..02d38041e08 100644 --- a/src/cloudflare/types/zones/settings/websocket.py +++ b/src/cloudflare/types/zones/websocket.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Websocket"] diff --git a/src/cloudflare/types/zones/settings/zero_rtt.py b/src/cloudflare/types/zones/zero_rtt.py similarity index 94% rename from src/cloudflare/types/zones/settings/zero_rtt.py rename to src/cloudflare/types/zones/zero_rtt.py index a627cbcc738..f47d0e91f34 100644 --- a/src/cloudflare/types/zones/settings/zero_rtt.py +++ b/src/cloudflare/types/zones/zero_rtt.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["ZeroRTT"] diff --git a/tests/api_resources/zones/settings/__init__.py b/tests/api_resources/zones/settings/__init__.py deleted file mode 100644 index fd8019a9a1a..00000000000 --- a/tests/api_resources/zones/settings/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/zones/settings/test_origin_max_http_version.py b/tests/api_resources/zones/settings/test_origin_max_http_version.py deleted file mode 100644 index d8f14784104..00000000000 --- a/tests/api_resources/zones/settings/test_origin_max_http_version.py +++ /dev/null @@ -1,185 +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, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import ( - OriginMaxHTTPVersionGetResponse, - OriginMaxHTTPVersionEditResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestOriginMaxHTTPVersion: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - origin_max_http_version = client.zones.settings.origin_max_http_version.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="2", - ) - assert_matches_type(OriginMaxHTTPVersionEditResponse, origin_max_http_version, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.origin_max_http_version.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="2", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_max_http_version = response.parse() - assert_matches_type(OriginMaxHTTPVersionEditResponse, origin_max_http_version, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.origin_max_http_version.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="2", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - origin_max_http_version = response.parse() - assert_matches_type(OriginMaxHTTPVersionEditResponse, origin_max_http_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.origin_max_http_version.with_raw_response.edit( - zone_id="", - value="2", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - origin_max_http_version = client.zones.settings.origin_max_http_version.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(OriginMaxHTTPVersionGetResponse, origin_max_http_version, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.origin_max_http_version.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_max_http_version = response.parse() - assert_matches_type(OriginMaxHTTPVersionGetResponse, origin_max_http_version, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.origin_max_http_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" - - origin_max_http_version = response.parse() - assert_matches_type(OriginMaxHTTPVersionGetResponse, origin_max_http_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.origin_max_http_version.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncOriginMaxHTTPVersion: - 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_max_http_version = await async_client.zones.settings.origin_max_http_version.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="2", - ) - assert_matches_type(OriginMaxHTTPVersionEditResponse, origin_max_http_version, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.origin_max_http_version.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="2", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_max_http_version = await response.parse() - assert_matches_type(OriginMaxHTTPVersionEditResponse, origin_max_http_version, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.origin_max_http_version.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="2", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - origin_max_http_version = await response.parse() - assert_matches_type(OriginMaxHTTPVersionEditResponse, origin_max_http_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.origin_max_http_version.with_raw_response.edit( - zone_id="", - value="2", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - origin_max_http_version = await async_client.zones.settings.origin_max_http_version.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(OriginMaxHTTPVersionGetResponse, origin_max_http_version, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.origin_max_http_version.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - origin_max_http_version = await response.parse() - assert_matches_type(OriginMaxHTTPVersionGetResponse, origin_max_http_version, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.origin_max_http_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" - - origin_max_http_version = await response.parse() - assert_matches_type(OriginMaxHTTPVersionGetResponse, origin_max_http_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.origin_max_http_version.with_raw_response.get( - zone_id="", - ) diff --git a/tests/api_resources/zones/settings/test_font_settings.py b/tests/api_resources/zones/test_settings.py similarity index 53% rename from tests/api_resources/zones/settings/test_font_settings.py rename to tests/api_resources/zones/test_settings.py index d80ff7b61db..e3fcc0ac04c 100644 --- a/tests/api_resources/zones/settings/test_font_settings.py +++ b/tests/api_resources/zones/test_settings.py @@ -9,174 +9,206 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zones.settings import FontSettings +from cloudflare.types.zones import SettingGetResponse, SettingEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestFontSettings: +class TestSettings: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_edit(self, client: Cloudflare) -> None: - font_setting = client.zones.settings.font_settings.edit( + setting = client.zones.settings.edit( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", ) - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.settings.font_settings.with_raw_response.edit( + response = client.zones.settings.with_raw_response.edit( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = response.parse() + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.settings.font_settings.with_streaming_response.edit( + with client.zones.settings.with_streaming_response.edit( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = response.parse() + assert_matches_type(Optional[SettingEditResponse], setting, 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.font_settings.with_raw_response.edit( + client.zones.settings.with_raw_response.edit( + "always_online", zone_id="", - value="on", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `setting_id` but received ''"): + client.zones.settings.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: - font_setting = client.zones.settings.font_settings.get( + setting = client.zones.settings.get( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.settings.font_settings.with_raw_response.get( + response = client.zones.settings.with_raw_response.get( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = response.parse() + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.settings.font_settings.with_streaming_response.get( + with client.zones.settings.with_streaming_response.get( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = response.parse() + assert_matches_type(Optional[SettingGetResponse], setting, 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.font_settings.with_raw_response.get( + client.zones.settings.with_raw_response.get( + "always_online", zone_id="", ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `setting_id` but received ''"): + client.zones.settings.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + -class TestAsyncFontSettings: +class TestAsyncSettings: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - font_setting = await async_client.zones.settings.font_settings.edit( + setting = await async_client.zones.settings.edit( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", ) - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.font_settings.with_raw_response.edit( + response = await async_client.zones.settings.with_raw_response.edit( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = await response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = await response.parse() + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.font_settings.with_streaming_response.edit( + async with async_client.zones.settings.with_streaming_response.edit( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", - value="on", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = await response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = await response.parse() + assert_matches_type(Optional[SettingEditResponse], setting, 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.font_settings.with_raw_response.edit( + await async_client.zones.settings.with_raw_response.edit( + "always_online", zone_id="", - value="on", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `setting_id` but received ''"): + await async_client.zones.settings.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - font_setting = await async_client.zones.settings.font_settings.get( + setting = await async_client.zones.settings.get( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.settings.font_settings.with_raw_response.get( + response = await async_client.zones.settings.with_raw_response.get( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = await response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = await response.parse() + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.settings.font_settings.with_streaming_response.get( + async with async_client.zones.settings.with_streaming_response.get( + "always_online", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - font_setting = await response.parse() - assert_matches_type(Optional[FontSettings], font_setting, path=["response"]) + setting = await response.parse() + assert_matches_type(Optional[SettingGetResponse], setting, 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.font_settings.with_raw_response.get( + await async_client.zones.settings.with_raw_response.get( + "always_online", zone_id="", ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `setting_id` but received ''"): + await async_client.zones.settings.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + )