From 86eff892d605f019f725d914670f442057d8f3fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:43:39 +0000 Subject: [PATCH] feat(api): api update (#2168) --- .stats.yml | 2 +- api.md | 14 +- .../resources/pagerules/pagerules.py | 335 ++++++++---------- .../resources/pagerules/settings.py | 14 +- .../resources/workers/scripts/subdomain.py | 28 +- src/cloudflare/types/pagerules/__init__.py | 3 - src/cloudflare/types/pagerules/page_rule.py | 43 --- .../types/pagerules/pagerule_create_params.py | 30 +- .../pagerules/pagerule_create_response.py | 67 +++- .../types/pagerules/pagerule_edit_params.py | 30 +- .../types/pagerules/pagerule_edit_response.py | 67 +++- .../types/pagerules/pagerule_get_response.py | 67 +++- .../types/pagerules/pagerule_list_response.py | 75 +++- .../types/pagerules/pagerule_update_params.py | 30 +- .../pagerules/pagerule_update_response.py | 67 +++- src/cloudflare/types/pagerules/route.py | 30 -- src/cloudflare/types/pagerules/route_param.py | 25 -- .../scripts/subdomain_create_params.py | 8 +- .../scripts/subdomain_create_response.py | 6 + .../workers/scripts/subdomain_get_response.py | 6 + .../api_resources/pagerules/test_settings.py | 14 +- tests/api_resources/test_pagerules.py | 100 +++--- .../workers/scripts/test_subdomain.py | 12 + 23 files changed, 676 insertions(+), 397 deletions(-) delete mode 100644 src/cloudflare/types/pagerules/page_rule.py delete mode 100644 src/cloudflare/types/pagerules/route.py delete mode 100644 src/cloudflare/types/pagerules/route_param.py diff --git a/.stats.yml b/.stats.yml index 4698450272a..addbf493b97 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1417 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3019ca36c889678c47db09abc7882daa9c50171912385a7bff7d83dcb3e95d57.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-472b7169e54c165dc77ae6808bcd1cf816e3033236facb08d7884730387ed9e9.yml diff --git a/api.md b/api.md index b1dcaf3fee7..439cfd73f1e 100644 --- a/api.md +++ b/api.md @@ -1852,8 +1852,6 @@ Types: ```python from cloudflare.types.pagerules import ( - PageRule, - Route, Target, PageruleCreateResponse, PageruleUpdateResponse, @@ -1866,12 +1864,12 @@ from cloudflare.types.pagerules import ( Methods: -- client.pagerules.create(\*, zone_id, \*\*params) -> PageruleCreateResponse -- client.pagerules.update(pagerule_id, \*, zone_id, \*\*params) -> PageruleUpdateResponse -- client.pagerules.list(\*, zone_id, \*\*params) -> PageruleListResponse +- client.pagerules.create(\*, zone_id, \*\*params) -> Optional +- client.pagerules.update(pagerule_id, \*, zone_id, \*\*params) -> Optional +- client.pagerules.list(\*, zone_id, \*\*params) -> Optional - client.pagerules.delete(pagerule_id, \*, zone_id) -> Optional -- client.pagerules.edit(pagerule_id, \*, zone_id, \*\*params) -> PageruleEditResponse -- client.pagerules.get(pagerule_id, \*, zone_id) -> PageruleGetResponse +- client.pagerules.edit(pagerule_id, \*, zone_id, \*\*params) -> Optional +- client.pagerules.get(pagerule_id, \*, zone_id) -> Optional ## Settings @@ -1883,7 +1881,7 @@ from cloudflare.types.pagerules import SettingListResponse Methods: -- client.pagerules.settings.list(\*, zone_id) -> SettingListResponse +- client.pagerules.settings.list(\*, zone_id) -> Optional # RateLimits diff --git a/src/cloudflare/resources/pagerules/pagerules.py b/src/cloudflare/resources/pagerules/pagerules.py index 8ad8f7fbb58..6a296dff1b9 100644 --- a/src/cloudflare/resources/pagerules/pagerules.py +++ b/src/cloudflare/resources/pagerules/pagerules.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing_extensions -from typing import Any, Type, Iterable, Optional, cast +from typing import Type, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -37,7 +37,6 @@ pagerule_create_params, pagerule_update_params, ) -from ...types.pagerules.route_param import RouteParam from ...types.pagerules.target_param import TargetParam from ...types.pagerules.pagerule_get_response import PageruleGetResponse from ...types.pagerules.pagerule_edit_response import PageruleEditResponse @@ -80,7 +79,7 @@ def create( self, *, zone_id: str, - actions: Iterable[RouteParam], + actions: Iterable[pagerule_create_params.Action], targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, @@ -90,7 +89,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleCreateResponse: + ) -> Optional[PageruleCreateResponse]: """ Creates a new Page Rule. @@ -120,30 +119,25 @@ def create( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - PageruleCreateResponse, - self._post( - f"/zones/{zone_id}/pagerules", - body=maybe_transform( - { - "actions": actions, - "targets": targets, - "priority": priority, - "status": status, - }, - pagerule_create_params.PageruleCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleCreateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._post( + f"/zones/{zone_id}/pagerules", + body=maybe_transform( + { + "actions": actions, + "targets": targets, + "priority": priority, + "status": status, + }, + pagerule_create_params.PageruleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleCreateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleCreateResponse]], ResultWrapper[PageruleCreateResponse]), ) @typing_extensions.deprecated( @@ -154,7 +148,7 @@ def update( pagerule_id: str, *, zone_id: str, - actions: Iterable[RouteParam], + actions: Iterable[pagerule_update_params.Action], targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, @@ -164,7 +158,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleUpdateResponse: + ) -> Optional[PageruleUpdateResponse]: """Replaces the configuration of an existing Page Rule. The configuration of the @@ -200,30 +194,25 @@ def update( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not pagerule_id: raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") - return cast( - PageruleUpdateResponse, - self._put( - f"/zones/{zone_id}/pagerules/{pagerule_id}", - body=maybe_transform( - { - "actions": actions, - "targets": targets, - "priority": priority, - "status": status, - }, - pagerule_update_params.PageruleUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/zones/{zone_id}/pagerules/{pagerule_id}", + body=maybe_transform( + { + "actions": actions, + "targets": targets, + "priority": priority, + "status": status, + }, + pagerule_update_params.PageruleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleUpdateResponse]], ResultWrapper[PageruleUpdateResponse]), ) @typing_extensions.deprecated( @@ -243,7 +232,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleListResponse: + ) -> Optional[PageruleListResponse]: """ Fetches Page Rules in a zone. @@ -285,9 +274,9 @@ def list( }, pagerule_list_params.PageruleListParams, ), - post_parser=ResultWrapper[PageruleListResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PageruleListResponse]]._unwrapper, ), - cast_to=cast(Type[PageruleListResponse], ResultWrapper[PageruleListResponse]), + cast_to=cast(Type[Optional[PageruleListResponse]], ResultWrapper[PageruleListResponse]), ) @typing_extensions.deprecated( @@ -345,7 +334,7 @@ def edit( pagerule_id: str, *, zone_id: str, - actions: Iterable[RouteParam] | NotGiven = NOT_GIVEN, + actions: Iterable[pagerule_edit_params.Action] | NotGiven = NOT_GIVEN, priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, targets: Iterable[TargetParam] | NotGiven = NOT_GIVEN, @@ -355,7 +344,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleEditResponse: + ) -> Optional[PageruleEditResponse]: """ Updates one or more fields of an existing Page Rule. @@ -389,30 +378,25 @@ def edit( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not pagerule_id: raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") - return cast( - PageruleEditResponse, - self._patch( - f"/zones/{zone_id}/pagerules/{pagerule_id}", - body=maybe_transform( - { - "actions": actions, - "priority": priority, - "status": status, - "targets": targets, - }, - pagerule_edit_params.PageruleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._patch( + f"/zones/{zone_id}/pagerules/{pagerule_id}", + body=maybe_transform( + { + "actions": actions, + "priority": priority, + "status": status, + "targets": targets, + }, + pagerule_edit_params.PageruleEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleEditResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleEditResponse]], ResultWrapper[PageruleEditResponse]), ) @typing_extensions.deprecated( @@ -429,7 +413,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleGetResponse: + ) -> Optional[PageruleGetResponse]: """ Fetches the details of a Page Rule. @@ -450,21 +434,16 @@ def get( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not pagerule_id: raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") - return cast( - PageruleGetResponse, - self._get( - f"/zones/{zone_id}/pagerules/{pagerule_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/zones/{zone_id}/pagerules/{pagerule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleGetResponse]], ResultWrapper[PageruleGetResponse]), ) @@ -499,7 +478,7 @@ async def create( self, *, zone_id: str, - actions: Iterable[RouteParam], + actions: Iterable[pagerule_create_params.Action], targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, @@ -509,7 +488,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleCreateResponse: + ) -> Optional[PageruleCreateResponse]: """ Creates a new Page Rule. @@ -539,30 +518,25 @@ async def create( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - PageruleCreateResponse, - await self._post( - f"/zones/{zone_id}/pagerules", - body=await async_maybe_transform( - { - "actions": actions, - "targets": targets, - "priority": priority, - "status": status, - }, - pagerule_create_params.PageruleCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleCreateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleCreateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._post( + f"/zones/{zone_id}/pagerules", + body=await async_maybe_transform( + { + "actions": actions, + "targets": targets, + "priority": priority, + "status": status, + }, + pagerule_create_params.PageruleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleCreateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleCreateResponse]], ResultWrapper[PageruleCreateResponse]), ) @typing_extensions.deprecated( @@ -573,7 +547,7 @@ async def update( pagerule_id: str, *, zone_id: str, - actions: Iterable[RouteParam], + actions: Iterable[pagerule_update_params.Action], targets: Iterable[TargetParam], priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, @@ -583,7 +557,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleUpdateResponse: + ) -> Optional[PageruleUpdateResponse]: """Replaces the configuration of an existing Page Rule. The configuration of the @@ -619,30 +593,25 @@ async def update( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not pagerule_id: raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") - return cast( - PageruleUpdateResponse, - await self._put( - f"/zones/{zone_id}/pagerules/{pagerule_id}", - body=await async_maybe_transform( - { - "actions": actions, - "targets": targets, - "priority": priority, - "status": status, - }, - pagerule_update_params.PageruleUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/zones/{zone_id}/pagerules/{pagerule_id}", + body=await async_maybe_transform( + { + "actions": actions, + "targets": targets, + "priority": priority, + "status": status, + }, + pagerule_update_params.PageruleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleUpdateResponse]], ResultWrapper[PageruleUpdateResponse]), ) @typing_extensions.deprecated( @@ -662,7 +631,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleListResponse: + ) -> Optional[PageruleListResponse]: """ Fetches Page Rules in a zone. @@ -704,9 +673,9 @@ async def list( }, pagerule_list_params.PageruleListParams, ), - post_parser=ResultWrapper[PageruleListResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PageruleListResponse]]._unwrapper, ), - cast_to=cast(Type[PageruleListResponse], ResultWrapper[PageruleListResponse]), + cast_to=cast(Type[Optional[PageruleListResponse]], ResultWrapper[PageruleListResponse]), ) @typing_extensions.deprecated( @@ -764,7 +733,7 @@ async def edit( pagerule_id: str, *, zone_id: str, - actions: Iterable[RouteParam] | NotGiven = NOT_GIVEN, + actions: Iterable[pagerule_edit_params.Action] | NotGiven = NOT_GIVEN, priority: int | NotGiven = NOT_GIVEN, status: Literal["active", "disabled"] | NotGiven = NOT_GIVEN, targets: Iterable[TargetParam] | NotGiven = NOT_GIVEN, @@ -774,7 +743,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleEditResponse: + ) -> Optional[PageruleEditResponse]: """ Updates one or more fields of an existing Page Rule. @@ -808,30 +777,25 @@ async def edit( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not pagerule_id: raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") - return cast( - PageruleEditResponse, - await self._patch( - f"/zones/{zone_id}/pagerules/{pagerule_id}", - body=await async_maybe_transform( - { - "actions": actions, - "priority": priority, - "status": status, - "targets": targets, - }, - pagerule_edit_params.PageruleEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._patch( + f"/zones/{zone_id}/pagerules/{pagerule_id}", + body=await async_maybe_transform( + { + "actions": actions, + "priority": priority, + "status": status, + "targets": targets, + }, + pagerule_edit_params.PageruleEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleEditResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleEditResponse]], ResultWrapper[PageruleEditResponse]), ) @typing_extensions.deprecated( @@ -848,7 +812,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageruleGetResponse: + ) -> Optional[PageruleGetResponse]: """ Fetches the details of a Page Rule. @@ -869,21 +833,16 @@ async def get( raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") if not pagerule_id: raise ValueError(f"Expected a non-empty value for `pagerule_id` but received {pagerule_id!r}") - return cast( - PageruleGetResponse, - await self._get( - f"/zones/{zone_id}/pagerules/{pagerule_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[PageruleGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PageruleGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/zones/{zone_id}/pagerules/{pagerule_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PageruleGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[PageruleGetResponse]], ResultWrapper[PageruleGetResponse]), ) diff --git a/src/cloudflare/resources/pagerules/settings.py b/src/cloudflare/resources/pagerules/settings.py index 0be476ffe32..bd598cff9db 100644 --- a/src/cloudflare/resources/pagerules/settings.py +++ b/src/cloudflare/resources/pagerules/settings.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -52,7 +52,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingListResponse: + ) -> Optional[SettingListResponse]: """ Returns a list of settings (and their details) that Page Rules can apply to matching requests. @@ -77,9 +77,9 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SettingListResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SettingListResponse]]._unwrapper, ), - cast_to=cast(Type[SettingListResponse], ResultWrapper[SettingListResponse]), + cast_to=cast(Type[Optional[SettingListResponse]], ResultWrapper[SettingListResponse]), ) @@ -113,7 +113,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SettingListResponse: + ) -> Optional[SettingListResponse]: """ Returns a list of settings (and their details) that Page Rules can apply to matching requests. @@ -138,9 +138,9 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[SettingListResponse]._unwrapper, + post_parser=ResultWrapper[Optional[SettingListResponse]]._unwrapper, ), - cast_to=cast(Type[SettingListResponse], ResultWrapper[SettingListResponse]), + cast_to=cast(Type[Optional[SettingListResponse]], ResultWrapper[SettingListResponse]), ) diff --git a/src/cloudflare/resources/workers/scripts/subdomain.py b/src/cloudflare/resources/workers/scripts/subdomain.py index f07507c706c..3ab95584ebd 100644 --- a/src/cloudflare/resources/workers/scripts/subdomain.py +++ b/src/cloudflare/resources/workers/scripts/subdomain.py @@ -50,7 +50,8 @@ def create( script_name: str, *, account_id: str, - enabled: bool | NotGiven = NOT_GIVEN, + enabled: bool, + previews_enabled: bool | NotGiven = NOT_GIVEN, # 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, @@ -68,6 +69,9 @@ def create( enabled: Whether the Worker should be available on the workers.dev subdomain. + previews_enabled: Whether the Worker's Preview URLs should be available on the workers.dev + subdomain. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -82,7 +86,13 @@ def create( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain", - body=maybe_transform({"enabled": enabled}, subdomain_create_params.SubdomainCreateParams), + body=maybe_transform( + { + "enabled": enabled, + "previews_enabled": previews_enabled, + }, + subdomain_create_params.SubdomainCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -155,7 +165,8 @@ async def create( script_name: str, *, account_id: str, - enabled: bool | NotGiven = NOT_GIVEN, + enabled: bool, + previews_enabled: bool | NotGiven = NOT_GIVEN, # 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, @@ -173,6 +184,9 @@ async def create( enabled: Whether the Worker should be available on the workers.dev subdomain. + previews_enabled: Whether the Worker's Preview URLs should be available on the workers.dev + subdomain. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -187,7 +201,13 @@ async def create( raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") return await self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain", - body=await async_maybe_transform({"enabled": enabled}, subdomain_create_params.SubdomainCreateParams), + body=await async_maybe_transform( + { + "enabled": enabled, + "previews_enabled": previews_enabled, + }, + subdomain_create_params.SubdomainCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/cloudflare/types/pagerules/__init__.py b/src/cloudflare/types/pagerules/__init__.py index 02d46c7b4d4..7856ec5f384 100644 --- a/src/cloudflare/types/pagerules/__init__.py +++ b/src/cloudflare/types/pagerules/__init__.py @@ -2,10 +2,7 @@ from __future__ import annotations -from .route import Route as Route from .target import Target as Target -from .page_rule import PageRule as PageRule -from .route_param import RouteParam as RouteParam from .target_param import TargetParam as TargetParam from .pagerule_edit_params import PageruleEditParams as PageruleEditParams from .pagerule_list_params import PageruleListParams as PageruleListParams diff --git a/src/cloudflare/types/pagerules/page_rule.py b/src/cloudflare/types/pagerules/page_rule.py deleted file mode 100644 index d7a0d1b8117..00000000000 --- a/src/cloudflare/types/pagerules/page_rule.py +++ /dev/null @@ -1,43 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from .route import Route -from .target import Target -from ..._models import BaseModel - -__all__ = ["PageRule"] - - -class PageRule(BaseModel): - id: str - """Identifier""" - - actions: List[Route] - """The set of actions to perform if the targets of this rule match the request. - - Actions can redirect to another URL or override settings, but not both. - """ - - created_on: datetime - """The timestamp of when the Page Rule was created.""" - - modified_on: datetime - """The timestamp of when the Page Rule was last modified.""" - - priority: int - """ - The priority of the rule, used to define which Page Rule is processed over - another. A higher number indicates a higher priority. For example, if you have a - catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to - take precedence (rule B: `/images/special/*`), specify a higher priority for - rule B so it overrides rule A. - """ - - status: Literal["active", "disabled"] - """The status of the Page Rule.""" - - targets: List[Target] - """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/pagerule_create_params.py b/src/cloudflare/types/pagerules/pagerule_create_params.py index dfbfb883782..1a554231d3a 100644 --- a/src/cloudflare/types/pagerules/pagerule_create_params.py +++ b/src/cloudflare/types/pagerules/pagerule_create_params.py @@ -5,17 +5,16 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .route_param import RouteParam from .target_param import TargetParam -__all__ = ["PageruleCreateParams"] +__all__ = ["PageruleCreateParams", "Action", "ActionValue"] class PageruleCreateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - actions: Required[Iterable[RouteParam]] + actions: Required[Iterable[Action]] """The set of actions to perform if the targets of this rule match the request. Actions can redirect to another URL or override settings, but not both. @@ -35,3 +34,28 @@ class PageruleCreateParams(TypedDict, total=False): status: Literal["active", "disabled"] """The status of the Page Rule.""" + + +class ActionValue(TypedDict, total=False): + status_code: Literal[301, 302] + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: str + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(TypedDict, total=False): + id: Literal["forwarding_url"] + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: ActionValue diff --git a/src/cloudflare/types/pagerules/pagerule_create_response.py b/src/cloudflare/types/pagerules/pagerule_create_response.py index c169da3be94..e7b0113723e 100644 --- a/src/cloudflare/types/pagerules/pagerule_create_response.py +++ b/src/cloudflare/types/pagerules/pagerule_create_response.py @@ -1,8 +1,67 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal -__all__ = ["PageruleCreateResponse"] +from .target import Target +from ..._models import BaseModel -PageruleCreateResponse: TypeAlias = Union[Optional[str], Optional[object]] +__all__ = ["PageruleCreateResponse", "Action", "ActionValue"] + + +class ActionValue(BaseModel): + status_code: Optional[Literal[301, 302]] = None + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: Optional[str] = None + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(BaseModel): + id: Optional[Literal["forwarding_url"]] = None + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: Optional[ActionValue] = None + + +class PageruleCreateResponse(BaseModel): + id: str + """Identifier""" + + actions: List[Action] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + created_on: datetime + """The timestamp of when the Page Rule was created.""" + + modified_on: datetime + """The timestamp of when the Page Rule was last modified.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: List[Target] + """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/pagerule_edit_params.py b/src/cloudflare/types/pagerules/pagerule_edit_params.py index 5d2ed4636b2..e785a2c36c0 100644 --- a/src/cloudflare/types/pagerules/pagerule_edit_params.py +++ b/src/cloudflare/types/pagerules/pagerule_edit_params.py @@ -5,17 +5,16 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .route_param import RouteParam from .target_param import TargetParam -__all__ = ["PageruleEditParams"] +__all__ = ["PageruleEditParams", "Action", "ActionValue"] class PageruleEditParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - actions: Iterable[RouteParam] + actions: Iterable[Action] """The set of actions to perform if the targets of this rule match the request. Actions can redirect to another URL or override settings, but not both. @@ -35,3 +34,28 @@ class PageruleEditParams(TypedDict, total=False): targets: Iterable[TargetParam] """The rule targets to evaluate on each request.""" + + +class ActionValue(TypedDict, total=False): + status_code: Literal[301, 302] + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: str + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(TypedDict, total=False): + id: Literal["forwarding_url"] + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: ActionValue diff --git a/src/cloudflare/types/pagerules/pagerule_edit_response.py b/src/cloudflare/types/pagerules/pagerule_edit_response.py index 7b882ba930a..dec016eb431 100644 --- a/src/cloudflare/types/pagerules/pagerule_edit_response.py +++ b/src/cloudflare/types/pagerules/pagerule_edit_response.py @@ -1,8 +1,67 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal -__all__ = ["PageruleEditResponse"] +from .target import Target +from ..._models import BaseModel -PageruleEditResponse: TypeAlias = Union[Optional[str], Optional[object]] +__all__ = ["PageruleEditResponse", "Action", "ActionValue"] + + +class ActionValue(BaseModel): + status_code: Optional[Literal[301, 302]] = None + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: Optional[str] = None + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(BaseModel): + id: Optional[Literal["forwarding_url"]] = None + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: Optional[ActionValue] = None + + +class PageruleEditResponse(BaseModel): + id: str + """Identifier""" + + actions: List[Action] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + created_on: datetime + """The timestamp of when the Page Rule was created.""" + + modified_on: datetime + """The timestamp of when the Page Rule was last modified.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: List[Target] + """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/pagerule_get_response.py b/src/cloudflare/types/pagerules/pagerule_get_response.py index 542af026355..824d0a67a53 100644 --- a/src/cloudflare/types/pagerules/pagerule_get_response.py +++ b/src/cloudflare/types/pagerules/pagerule_get_response.py @@ -1,8 +1,67 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal -__all__ = ["PageruleGetResponse"] +from .target import Target +from ..._models import BaseModel -PageruleGetResponse: TypeAlias = Union[Optional[str], Optional[object]] +__all__ = ["PageruleGetResponse", "Action", "ActionValue"] + + +class ActionValue(BaseModel): + status_code: Optional[Literal[301, 302]] = None + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: Optional[str] = None + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(BaseModel): + id: Optional[Literal["forwarding_url"]] = None + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: Optional[ActionValue] = None + + +class PageruleGetResponse(BaseModel): + id: str + """Identifier""" + + actions: List[Action] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + created_on: datetime + """The timestamp of when the Page Rule was created.""" + + modified_on: datetime + """The timestamp of when the Page Rule was last modified.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: List[Target] + """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/pagerule_list_response.py b/src/cloudflare/types/pagerules/pagerule_list_response.py index b2992e28bbd..10d4b3c6022 100644 --- a/src/cloudflare/types/pagerules/pagerule_list_response.py +++ b/src/cloudflare/types/pagerules/pagerule_list_response.py @@ -1,10 +1,75 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from typing_extensions import TypeAlias +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias -from .page_rule import PageRule +from .target import Target +from ..._models import BaseModel -__all__ = ["PageruleListResponse"] +__all__ = [ + "PageruleListResponse", + "PageruleListResponseItem", + "PageruleListResponseItemAction", + "PageruleListResponseItemActionValue", +] -PageruleListResponse: TypeAlias = List[PageRule] + +class PageruleListResponseItemActionValue(BaseModel): + status_code: Optional[Literal[301, 302]] = None + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: Optional[str] = None + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class PageruleListResponseItemAction(BaseModel): + id: Optional[Literal["forwarding_url"]] = None + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: Optional[PageruleListResponseItemActionValue] = None + + +class PageruleListResponseItem(BaseModel): + id: str + """Identifier""" + + actions: List[PageruleListResponseItemAction] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + created_on: datetime + """The timestamp of when the Page Rule was created.""" + + modified_on: datetime + """The timestamp of when the Page Rule was last modified.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: List[Target] + """The rule targets to evaluate on each request.""" + + +PageruleListResponse: TypeAlias = List[PageruleListResponseItem] diff --git a/src/cloudflare/types/pagerules/pagerule_update_params.py b/src/cloudflare/types/pagerules/pagerule_update_params.py index 4637d036a12..88e80a5b5a7 100644 --- a/src/cloudflare/types/pagerules/pagerule_update_params.py +++ b/src/cloudflare/types/pagerules/pagerule_update_params.py @@ -5,17 +5,16 @@ from typing import Iterable from typing_extensions import Literal, Required, TypedDict -from .route_param import RouteParam from .target_param import TargetParam -__all__ = ["PageruleUpdateParams"] +__all__ = ["PageruleUpdateParams", "Action", "ActionValue"] class PageruleUpdateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - actions: Required[Iterable[RouteParam]] + actions: Required[Iterable[Action]] """The set of actions to perform if the targets of this rule match the request. Actions can redirect to another URL or override settings, but not both. @@ -35,3 +34,28 @@ class PageruleUpdateParams(TypedDict, total=False): status: Literal["active", "disabled"] """The status of the Page Rule.""" + + +class ActionValue(TypedDict, total=False): + status_code: Literal[301, 302] + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: str + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(TypedDict, total=False): + id: Literal["forwarding_url"] + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: ActionValue diff --git a/src/cloudflare/types/pagerules/pagerule_update_response.py b/src/cloudflare/types/pagerules/pagerule_update_response.py index 110b4c3282b..722f9819346 100644 --- a/src/cloudflare/types/pagerules/pagerule_update_response.py +++ b/src/cloudflare/types/pagerules/pagerule_update_response.py @@ -1,8 +1,67 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional -from typing_extensions import TypeAlias +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal -__all__ = ["PageruleUpdateResponse"] +from .target import Target +from ..._models import BaseModel -PageruleUpdateResponse: TypeAlias = Union[Optional[str], Optional[object]] +__all__ = ["PageruleUpdateResponse", "Action", "ActionValue"] + + +class ActionValue(BaseModel): + status_code: Optional[Literal[301, 302]] = None + """The status code to use for the URL redirect. + + 301 is a permanent redirect. 302 is a temporary redirect. + """ + + url: Optional[str] = None + """ + The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' + in the constraint value. + """ + + +class Action(BaseModel): + id: Optional[Literal["forwarding_url"]] = None + """Redirects one URL to another using an `HTTP 301/302` redirect. + + Refer to + [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + """ + + value: Optional[ActionValue] = None + + +class PageruleUpdateResponse(BaseModel): + id: str + """Identifier""" + + actions: List[Action] + """The set of actions to perform if the targets of this rule match the request. + + Actions can redirect to another URL or override settings, but not both. + """ + + created_on: datetime + """The timestamp of when the Page Rule was created.""" + + modified_on: datetime + """The timestamp of when the Page Rule was last modified.""" + + priority: int + """ + The priority of the rule, used to define which Page Rule is processed over + another. A higher number indicates a higher priority. For example, if you have a + catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + take precedence (rule B: `/images/special/*`), specify a higher priority for + rule B so it overrides rule A. + """ + + status: Literal["active", "disabled"] + """The status of the Page Rule.""" + + targets: List[Target] + """The rule targets to evaluate on each request.""" diff --git a/src/cloudflare/types/pagerules/route.py b/src/cloudflare/types/pagerules/route.py deleted file mode 100644 index df4910ea5d4..00000000000 --- a/src/cloudflare/types/pagerules/route.py +++ /dev/null @@ -1,30 +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__ = ["Route", "Value"] - - -class Value(BaseModel): - type: Optional[Literal["temporary", "permanent"]] = None - """The response type for the URL redirect.""" - - url: Optional[str] = None - """ - The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' - in the constraint value. - """ - - -class Route(BaseModel): - modified_on: Optional[datetime] = None - """The timestamp of when the override was last modified.""" - - name: Optional[Literal["forward_url"]] = None - """The type of route.""" - - value: Optional[Value] = None diff --git a/src/cloudflare/types/pagerules/route_param.py b/src/cloudflare/types/pagerules/route_param.py deleted file mode 100644 index 3182d9be53a..00000000000 --- a/src/cloudflare/types/pagerules/route_param.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["RouteParam", "Value"] - - -class Value(TypedDict, total=False): - type: Literal["temporary", "permanent"] - """The response type for the URL redirect.""" - - url: str - """ - The URL to redirect the request to. Notes: ${num} refers to the position of '\\**' - in the constraint value. - """ - - -class RouteParam(TypedDict, total=False): - name: Literal["forward_url"] - """The type of route.""" - - value: Value diff --git a/src/cloudflare/types/workers/scripts/subdomain_create_params.py b/src/cloudflare/types/workers/scripts/subdomain_create_params.py index fe29506c463..741d3cdcf54 100644 --- a/src/cloudflare/types/workers/scripts/subdomain_create_params.py +++ b/src/cloudflare/types/workers/scripts/subdomain_create_params.py @@ -11,5 +11,11 @@ class SubdomainCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - enabled: bool + enabled: Required[bool] """Whether the Worker should be available on the workers.dev subdomain.""" + + previews_enabled: bool + """ + Whether the Worker's Preview URLs should be available on the workers.dev + subdomain. + """ diff --git a/src/cloudflare/types/workers/scripts/subdomain_create_response.py b/src/cloudflare/types/workers/scripts/subdomain_create_response.py index 15c53be0add..9974134fa0d 100644 --- a/src/cloudflare/types/workers/scripts/subdomain_create_response.py +++ b/src/cloudflare/types/workers/scripts/subdomain_create_response.py @@ -10,3 +10,9 @@ class SubdomainCreateResponse(BaseModel): enabled: Optional[bool] = None """Whether the Worker is available on the workers.dev subdomain.""" + + previews_enabled: Optional[bool] = None + """ + Whether the Worker's Preview URLs should be available on the workers.dev + subdomain. + """ diff --git a/src/cloudflare/types/workers/scripts/subdomain_get_response.py b/src/cloudflare/types/workers/scripts/subdomain_get_response.py index 0d2ed6d56c5..bd9a0530a07 100644 --- a/src/cloudflare/types/workers/scripts/subdomain_get_response.py +++ b/src/cloudflare/types/workers/scripts/subdomain_get_response.py @@ -10,3 +10,9 @@ class SubdomainGetResponse(BaseModel): enabled: Optional[bool] = None """Whether the Worker is available on the workers.dev subdomain.""" + + previews_enabled: Optional[bool] = None + """ + Whether the Worker's Preview URLs should be available on the workers.dev + subdomain. + """ diff --git a/tests/api_resources/pagerules/test_settings.py b/tests/api_resources/pagerules/test_settings.py index 7339a7f0ecc..06b7aa3a064 100644 --- a/tests/api_resources/pagerules/test_settings.py +++ b/tests/api_resources/pagerules/test_settings.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_list(self, client: Cloudflare) -> None: setting = client.pagerules.settings.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SettingListResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -33,7 +33,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingListResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -44,7 +44,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(SettingListResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -64,7 +64,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: setting = await async_client.pagerules.settings.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SettingListResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -75,7 +75,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingListResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -86,7 +86,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(SettingListResponse, setting, path=["response"]) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_pagerules.py b/tests/api_resources/test_pagerules.py index 64ceed709bb..ebe84e62cde 100644 --- a/tests/api_resources/test_pagerules.py +++ b/tests/api_resources/test_pagerules.py @@ -43,7 +43,7 @@ def test_method_create(self, client: Cloudflare) -> None: ], ) - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -52,9 +52,9 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[ { - "name": "forward_url", + "id": "forwarding_url", "value": { - "type": "temporary", + "status_code": 301, "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", }, } @@ -72,7 +72,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: status="active", ) - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -94,7 +94,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -116,7 +116,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -156,7 +156,7 @@ def test_method_update(self, client: Cloudflare) -> None: ], ) - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -166,9 +166,9 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[ { - "name": "forward_url", + "id": "forwarding_url", "value": { - "type": "temporary", + "status_code": 301, "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", }, } @@ -186,7 +186,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: status="active", ) - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -209,7 +209,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -232,7 +232,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -278,7 +278,7 @@ def test_method_list(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -291,7 +291,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="active", ) - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -303,7 +303,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -315,7 +315,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -388,7 +388,7 @@ def test_method_edit(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @@ -398,9 +398,9 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[ { - "name": "forward_url", + "id": "forwarding_url", "value": { - "type": "temporary", + "status_code": 301, "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", }, } @@ -418,7 +418,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: ], ) - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -431,7 +431,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -444,7 +444,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -471,7 +471,7 @@ def test_method_get(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleGetResponse], pagerule, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -484,7 +484,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleGetResponse], pagerule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -497,7 +497,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = response.parse() - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleGetResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -537,7 +537,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: ], ) - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -546,9 +546,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[ { - "name": "forward_url", + "id": "forwarding_url", "value": { - "type": "temporary", + "status_code": 301, "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", }, } @@ -566,7 +566,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare status="active", ) - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -588,7 +588,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -610,7 +610,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleCreateResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -650,7 +650,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: ], ) - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -660,9 +660,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[ { - "name": "forward_url", + "id": "forwarding_url", "value": { - "type": "temporary", + "status_code": 301, "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", }, } @@ -680,7 +680,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare status="active", ) - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -703,7 +703,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -726,7 +726,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleUpdateResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -772,7 +772,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -785,7 +785,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="active", ) - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -797,7 +797,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -809,7 +809,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -882,7 +882,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -892,9 +892,9 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[ { - "name": "forward_url", + "id": "forwarding_url", "value": { - "type": "temporary", + "status_code": 301, "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", }, } @@ -912,7 +912,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) ], ) - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -925,7 +925,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -938,7 +938,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleEditResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -965,7 +965,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleGetResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -978,7 +978,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleGetResponse], pagerule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -991,7 +991,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerule = await response.parse() - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + assert_matches_type(Optional[PageruleGetResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/scripts/test_subdomain.py b/tests/api_resources/workers/scripts/test_subdomain.py index 6d600836439..da7e134d4c2 100644 --- a/tests/api_resources/workers/scripts/test_subdomain.py +++ b/tests/api_resources/workers/scripts/test_subdomain.py @@ -22,6 +22,7 @@ def test_method_create(self, client: Cloudflare) -> None: subdomain = client.workers.scripts.subdomain.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"]) @@ -31,6 +32,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", enabled=True, + previews_enabled=True, ) assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"]) @@ -39,6 +41,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.workers.scripts.subdomain.with_raw_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) assert response.is_closed is True @@ -51,6 +54,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.workers.scripts.subdomain.with_streaming_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -66,12 +70,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.workers.scripts.subdomain.with_raw_response.create( script_name="this-is_my_script-01", account_id="", + enabled=True, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.subdomain.with_raw_response.create( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) @parametrize @@ -131,6 +137,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: subdomain = await async_client.workers.scripts.subdomain.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"]) @@ -140,6 +147,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", enabled=True, + previews_enabled=True, ) assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"]) @@ -148,6 +156,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.subdomain.with_raw_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) assert response.is_closed is True @@ -160,6 +169,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.subdomain.with_streaming_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -175,12 +185,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.subdomain.with_raw_response.create( script_name="this-is_my_script-01", account_id="", + enabled=True, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.subdomain.with_raw_response.create( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + enabled=True, ) @parametrize