feat(api): update via SDK Studio (#1146)

This commit is contained in:
stainless-app[bot] 2024-06-26 20:14:34 +00:00 committed by stainless-bot
parent f02688168e
commit 4fc14538dc
69 changed files with 877 additions and 1347 deletions

View file

@ -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

467
api.md
View file

@ -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:
- <code title="patch /zones/{zone_id}/settings/origin_max_http_version">client.zones.settings.origin_max_http_version.<a href="./src/cloudflare/resources/zones/settings/origin_max_http_version.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/settings/origin_max_http_version_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/settings/origin_max_http_version_edit_response.py">OriginMaxHTTPVersionEditResponse</a></code>
- <code title="get /zones/{zone_id}/settings/origin_max_http_version">client.zones.settings.origin_max_http_version.<a href="./src/cloudflare/resources/zones/settings/origin_max_http_version.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/settings/origin_max_http_version_get_response.py">OriginMaxHTTPVersionGetResponse</a></code>
### 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:
- <code title="patch /zones/{zone_id}/settings/fonts">client.zones.settings.font_settings.<a href="./src/cloudflare/resources/zones/settings/font_settings.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/settings/font_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/settings/font_settings.py">Optional</a></code>
- <code title="get /zones/{zone_id}/settings/fonts">client.zones.settings.font_settings.<a href="./src/cloudflare/resources/zones/settings/font_settings.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/settings/font_settings.py">Optional</a></code>
- <code title="patch /zones/{zone_id}/settings/{setting_id}">client.zones.settings.<a href="./src/cloudflare/resources/zones/settings.py">edit</a>(setting_id, \*, zone_id) -> <a href="./src/cloudflare/types/zones/setting_edit_response.py">Optional</a></code>
- <code title="get /zones/{zone_id}/settings/{setting_id}">client.zones.settings.<a href="./src/cloudflare/resources/zones/settings.py">get</a>(setting_id, \*, zone_id) -> <a href="./src/cloudflare/types/zones/setting_get_response.py">Optional</a></code>
## CustomNameservers

View file

@ -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 @@ class FontSettingsResource(SyncAPIResource):
"""
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 @@ class FontSettingsResource(SyncAPIResource):
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 @@ class FontSettingsResource(SyncAPIResource):
"""
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 @@ class AsyncFontSettingsResource(AsyncAPIResource):
"""
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 @@ class AsyncFontSettingsResource(AsyncAPIResource):
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 @@ class AsyncFontSettingsResource(AsyncAPIResource):
"""
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,
)

View file

@ -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",
]

View file

@ -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,
)

View file

@ -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)

View file

@ -59,7 +59,6 @@ from .activation_check import (
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 (

View file

@ -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

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["AdvancedDDoS"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["AlwaysOnline"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["AlwaysUseHTTPS"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["AutomaticHTTPSRewrites"]

View file

@ -2,7 +2,7 @@
from typing import List
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["AutomaticPlatformOptimization"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["Brotli"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["BrowserCacheTTL"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["BrowserCheck"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["CacheLevel"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["ChallengeTTL"]

View file

@ -4,7 +4,7 @@ from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["Ciphers"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["DevelopmentMode"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["EarlyHints"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["EmailObfuscation"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["H2Prioritization"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["HotlinkProtection"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["HTTP2"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["HTTP3"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["ImageResizing"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["IPGeolocation"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["IPV6"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["MinTLSVersion"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["Minify", "Value"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["Mirage"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["MobileRedirect", "Value"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["NEL", "Value"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["OpportunisticEncryption"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["OpportunisticOnion"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["OrangeToOrange"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["OriginErrorPagePassThru"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["Polish"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["PrefetchPreload"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["ProxyReadTimeout"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["PseudoIPV4"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["ResponseBuffering"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["RocketLoader"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["SecurityHeaders", "Value", "ValueStrictTransportSecurity"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["SecurityLevel"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["ServerSideExcludes"]

View file

@ -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]

View file

@ -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,
]

View file

@ -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

View file

@ -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."""

View file

@ -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."""

View file

@ -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."""

View file

@ -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."""

View file

@ -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."""

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["SortQueryStringForCache"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["SSL"]

View file

@ -3,7 +3,7 @@
from typing import Optional
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["SSLRecommender"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["TLS1_3"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["TLSClientAuth"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["TrueClientIPHeader"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["WAF"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["WebP"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["Websocket"]

View file

@ -4,7 +4,7 @@ from typing import Optional
from datetime import datetime
from typing_extensions import Literal
from ...._models import BaseModel
from ..._models import BaseModel
__all__ = ["ZeroRTT"]

View file

@ -1 +0,0 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

View file

@ -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="",
)

View file

@ -9,174 +9,206 @@ import pytest
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",
)