diff --git a/.stats.yml b/.stats.yml index 9a17f3e2ed5..ae3568df740 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-18ccd4bfa5225ea54ecb087df6d6542117dc16f65b932d7e33a3e05d6c8e3c7e.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-44c89a561938bdc3a04bf86b60afa04650b1b9c246c07987e9ae26ca3cdf18fe.yml diff --git a/api.md b/api.md index 9a5286e7966..fe5e85f8451 100644 --- a/api.md +++ b/api.md @@ -2293,7 +2293,6 @@ from cloudflare.types.workers import ( R2Binding, ServiceBinding, SingleStepMigration, - SteppedMigration, WorkerMetadata, ) ``` diff --git a/src/cloudflare/resources/workers/scripts/content.py b/src/cloudflare/resources/workers/scripts/content.py index b4c91d83d61..09d1d506899 100644 --- a/src/cloudflare/resources/workers/scripts/content.py +++ b/src/cloudflare/resources/workers/scripts/content.py @@ -2,16 +2,14 @@ from __future__ import annotations -from typing import List, Type, Mapping, Optional, cast +from typing import Type, Optional, cast import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - extract_files, maybe_transform, strip_not_given, - deepcopy_minimal, async_maybe_transform, ) from ...._compat import cached_property @@ -64,8 +62,7 @@ def update( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -83,13 +80,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -113,21 +103,13 @@ def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._put( f"/accounts/{account_id}/workers/scripts/{script_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -205,8 +187,7 @@ async def update( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -224,13 +205,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -254,21 +228,13 @@ async def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._put( f"/accounts/{account_id}/workers/scripts/{script_name}/content", - body=await async_maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=await async_maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index ffc9db763a4..9301efb154e 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast +from typing import Type, Optional, cast from typing_extensions import overload import httpx @@ -39,7 +39,7 @@ VersionsResourceWithStreamingResponse, AsyncVersionsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ...._utils import ( required_args, maybe_transform, @@ -161,9 +161,8 @@ def update( script_name: str, *, account_id: str, + metadata: script_update_params.Variant0Metadata, rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | 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, @@ -182,18 +181,12 @@ def update( script_name: Name of the script, used in URLs and route configuration. + metadata: JSON encoded metadata about the uploaded parts and Worker configuration. + rollback_to: Rollback to provided deployment based on deployment ID. Request body will only parse a "message" part. You can learn more about deployments [here](https://developers.cloudflare.com/workers/platform/deployments/). - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -247,15 +240,14 @@ def update( """ ... - @required_args(["account_id"]) + @required_args(["account_id", "metadata"], ["account_id"]) def update( self, script_name: str, *, account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + rollback_to: str | NotGiven = NOT_GIVEN, message: str | 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. @@ -272,7 +264,6 @@ def update( f"/accounts/{account_id}/workers/scripts/{script_name}", body=maybe_transform( { - "any_part_name": any_part_name, "metadata": metadata, "message": message, }, @@ -478,9 +469,8 @@ async def update( script_name: str, *, account_id: str, + metadata: script_update_params.Variant0Metadata, rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | 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, @@ -499,18 +489,12 @@ async def update( script_name: Name of the script, used in URLs and route configuration. + metadata: JSON encoded metadata about the uploaded parts and Worker configuration. + rollback_to: Rollback to provided deployment based on deployment ID. Request body will only parse a "message" part. You can learn more about deployments [here](https://developers.cloudflare.com/workers/platform/deployments/). - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -564,15 +548,14 @@ async def update( """ ... - @required_args(["account_id"]) + @required_args(["account_id", "metadata"], ["account_id"]) async def update( self, script_name: str, *, account_id: str, - rollback_to: str | NotGiven = NOT_GIVEN, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + rollback_to: str | NotGiven = NOT_GIVEN, message: str | 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. @@ -589,7 +572,6 @@ async def update( f"/accounts/{account_id}/workers/scripts/{script_name}", body=await async_maybe_transform( { - "any_part_name": any_part_name, "metadata": metadata, "message": message, }, diff --git a/src/cloudflare/resources/workers/scripts/versions.py b/src/cloudflare/resources/workers/scripts/versions.py index fa1bb14105f..749b4f83f55 100644 --- a/src/cloudflare/resources/workers/scripts/versions.py +++ b/src/cloudflare/resources/workers/scripts/versions.py @@ -2,15 +2,13 @@ from __future__ import annotations -from typing import List, Type, Mapping, Optional, cast +from typing import Type, Optional, cast import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import ( - extract_files, maybe_transform, - deepcopy_minimal, async_maybe_transform, ) from ...._compat import cached_property @@ -57,8 +55,7 @@ def create( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: version_create_params.Metadata | NotGiven = NOT_GIVEN, + metadata: version_create_params.Metadata, # 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, @@ -77,10 +74,6 @@ def create( script_name: Name of the script. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module`. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -95,21 +88,13 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/versions", - body=maybe_transform(body, version_create_params.VersionCreateParams), - files=files, + body=maybe_transform({"metadata": metadata}, version_create_params.VersionCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,8 +240,7 @@ async def create( script_name: str, *, account_id: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: version_create_params.Metadata | NotGiven = NOT_GIVEN, + metadata: version_create_params.Metadata, # 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, @@ -275,10 +259,6 @@ async def create( script_name: Name of the script. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module`. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -293,21 +273,13 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not script_name: raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}") - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._post( f"/accounts/{account_id}/workers/scripts/{script_name}/versions", - body=await async_maybe_transform(body, version_create_params.VersionCreateParams), - files=files, + body=await async_maybe_transform({"metadata": metadata}, version_create_params.VersionCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py index dd445795f95..48a6af6ffc6 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py @@ -2,16 +2,14 @@ from __future__ import annotations -from typing import List, Type, Mapping, Optional, cast +from typing import Type, Optional, cast import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven from ......_utils import ( - extract_files, maybe_transform, strip_not_given, - deepcopy_minimal, async_maybe_transform, ) from ......_compat import cached_property @@ -65,8 +63,7 @@ def update( *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -86,13 +83,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -118,21 +108,13 @@ def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content", - body=maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -217,8 +199,7 @@ async def update( *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN, + metadata: WorkerMetadataParam, cf_worker_body_part: str | NotGiven = NOT_GIVEN, cf_worker_main_module_part: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -238,13 +219,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be - present. This should be referenced either in the metadata as `main_module` - (esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART` - (esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also - be included using the `application/source-map` content type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -270,21 +244,13 @@ async def update( ), **(extra_headers or {}), } - body = deepcopy_minimal( - { - "any_part_name": any_part_name, - "metadata": metadata, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["", ""]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._put( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/content", - body=await async_maybe_transform(body, content_update_params.ContentUpdateParams), - files=files, + body=await async_maybe_transform({"metadata": metadata}, content_update_params.ContentUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py index 1f29a5acbe9..edebb8bed93 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast +from typing import Type, Optional, cast from typing_extensions import overload import httpx @@ -47,7 +47,7 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes +from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ......_utils import ( required_args, maybe_transform, @@ -117,8 +117,7 @@ def update( *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Variant0Metadata, # 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, @@ -139,12 +138,6 @@ def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -198,14 +191,13 @@ def update( """ ... - @required_args(["account_id", "dispatch_namespace"]) + @required_args(["account_id", "dispatch_namespace", "metadata"], ["account_id", "dispatch_namespace"]) def update( self, script_name: str, *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, message: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -225,7 +217,6 @@ def update( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", body=maybe_transform( { - "any_part_name": any_part_name, "metadata": metadata, "message": message, }, @@ -395,8 +386,7 @@ async def update( *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, - metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, + metadata: script_update_params.Variant0Metadata, # 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, @@ -417,12 +407,6 @@ async def update( script_name: Name of the script, used in URLs and route configuration. - any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules - may be provided as separate named parts, but at least one module must be present - and referenced in the metadata as `main_module` or `body_part` by part name. - Source maps may also be included using the `application/source-map` content - type. - metadata: JSON encoded metadata about the uploaded parts and Worker configuration. extra_headers: Send extra headers @@ -476,14 +460,13 @@ async def update( """ ... - @required_args(["account_id", "dispatch_namespace"]) + @required_args(["account_id", "dispatch_namespace", "metadata"], ["account_id", "dispatch_namespace"]) async def update( self, script_name: str, *, account_id: str, dispatch_namespace: str, - any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN, metadata: script_update_params.Variant0Metadata | NotGiven = NOT_GIVEN, message: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -503,7 +486,6 @@ async def update( f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}", body=await async_maybe_transform( { - "any_part_name": any_part_name, "metadata": metadata, "message": message, }, diff --git a/src/cloudflare/types/workers/__init__.py b/src/cloudflare/types/workers/__init__.py index a467e783e03..26360cefcbd 100644 --- a/src/cloudflare/types/workers/__init__.py +++ b/src/cloudflare/types/workers/__init__.py @@ -14,7 +14,6 @@ from .d1_binding_param import D1BindingParam as D1BindingParam from .r2_binding_param import R2BindingParam as R2BindingParam from .mtls_cert_binding import MTLSCERTBinding as MTLSCERTBinding -from .stepped_migration import SteppedMigration as SteppedMigration from .domain_list_params import DomainListParams as DomainListParams from .route_get_response import RouteGetResponse as RouteGetResponse from .route_create_params import RouteCreateParams as RouteCreateParams @@ -36,7 +35,6 @@ from .subdomain_get_response import SubdomainGetResponse as SubdomainGetResponse from .mtls_cert_binding_param import MTLSCERTBindingParam as MTLSCERTBindingParam from .placement_configuration import PlacementConfiguration as PlacementConfiguration -from .stepped_migration_param import SteppedMigrationParam as SteppedMigrationParam from .subdomain_update_params import SubdomainUpdateParams as SubdomainUpdateParams from .subdomain_update_response import SubdomainUpdateResponse as SubdomainUpdateResponse from .dispatch_namespace_binding import DispatchNamespaceBinding as DispatchNamespaceBinding diff --git a/src/cloudflare/types/workers/script.py b/src/cloudflare/types/workers/script.py index f57a98a895f..80faa8751c7 100644 --- a/src/cloudflare/types/workers/script.py +++ b/src/cloudflare/types/workers/script.py @@ -2,6 +2,7 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .scripts.consumer_script import ConsumerScript @@ -37,5 +38,5 @@ class Script(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["bundled", "unbound"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers/script_update_params.py b/src/cloudflare/types/workers/script_update_params.py index ebdb23511ac..e5eaa37c4fe 100644 --- a/src/cloudflare/types/workers/script_update_params.py +++ b/src/cloudflare/types/workers/script_update_params.py @@ -3,11 +3,9 @@ from __future__ import annotations from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ..._types import FileTypes -from ..._utils import PropertyInfo -from .stepped_migration_param import SteppedMigrationParam +from .migration_step_param import MigrationStepParam from .single_step_migration_param import SingleStepMigrationParam from .placement_configuration_param import PlacementConfigurationParam from .scripts.consumer_script_param import ConsumerScriptParam @@ -20,6 +18,7 @@ "Variant0MetadataAssetsConfig", "Variant0MetadataBinding", "Variant0MetadataMigrations", + "Variant0MetadataMigrationsWorkersMultipleStepMigrations", "Variant0MetadataObservability", "Variant1", ] @@ -29,6 +28,9 @@ class Variant0(TypedDict, total=False): account_id: Required[str] """Identifier""" + metadata: Required[Variant0Metadata] + """JSON encoded metadata about the uploaded parts and Worker configuration.""" + rollback_to: str """Rollback to provided deployment based on deployment ID. @@ -37,18 +39,6 @@ class Variant0(TypedDict, total=False): [here](https://developers.cloudflare.com/workers/platform/deployments/). """ - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present and referenced in the metadata as `main_module` or - `body_part` by part name. Source maps may also be included using the - `application/source-map` content type. - """ - - metadata: Variant0Metadata - """JSON encoded metadata about the uploaded parts and Worker configuration.""" - class Variant0MetadataAssetsConfig(TypedDict, total=False): html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"] @@ -90,7 +80,24 @@ class Variant0MetadataBindingTyped(TypedDict, total=False): Variant0MetadataBinding: TypeAlias = Union[Variant0MetadataBindingTyped, Dict[str, object]] -Variant0MetadataMigrations: TypeAlias = Union[SingleStepMigrationParam, SteppedMigrationParam] + +class Variant0MetadataMigrationsWorkersMultipleStepMigrations(TypedDict, total=False): + new_tag: str + """Tag to set as the latest migration tag.""" + + old_tag: str + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Iterable[MigrationStepParam] + """Migrations to apply in order.""" + + +Variant0MetadataMigrations: TypeAlias = Union[ + SingleStepMigrationParam, Variant0MetadataMigrationsWorkersMultipleStepMigrations +] class Variant0MetadataObservability(TypedDict, total=False): @@ -165,7 +172,7 @@ class Variant0Metadata(TypedDict, total=False): """List of Workers that will consume logs from the attached Worker.""" usage_model: Literal["bundled", "unbound"] - """Usage model to apply to invocations.""" + """Usage model for the Worker invocations.""" version_tags: Dict[str, str] """Key-value pairs to use as tags for this version of this Worker.""" diff --git a/src/cloudflare/types/workers/script_update_response.py b/src/cloudflare/types/workers/script_update_response.py index b677f246eda..123fd3aa153 100644 --- a/src/cloudflare/types/workers/script_update_response.py +++ b/src/cloudflare/types/workers/script_update_response.py @@ -2,6 +2,7 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel from .scripts.consumer_script import ConsumerScript @@ -39,5 +40,5 @@ class ScriptUpdateResponse(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["bundled", "unbound"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers/scripts/content_update_params.py b/src/cloudflare/types/workers/scripts/content_update_params.py index f5c5e96e343..4228706762e 100644 --- a/src/cloudflare/types/workers/scripts/content_update_params.py +++ b/src/cloudflare/types/workers/scripts/content_update_params.py @@ -2,10 +2,8 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, Annotated, TypedDict -from ...._types import FileTypes from ...._utils import PropertyInfo from ..worker_metadata_param import WorkerMetadataParam @@ -16,18 +14,7 @@ class ContentUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present. This should be referenced either in the metadata as - `main_module` (esm)/`body_part` (service worker) or as a header - `CF-WORKER-MAIN-MODULE-PART` (esm) /`CF-WORKER-BODY-PART` (service worker) by - part name. Source maps may also be included using the `application/source-map` - content type. - """ - - metadata: WorkerMetadataParam + metadata: Required[WorkerMetadataParam] """JSON encoded metadata about the uploaded parts and Worker configuration.""" cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")] diff --git a/src/cloudflare/types/workers/scripts/version_create_params.py b/src/cloudflare/types/workers/scripts/version_create_params.py index a80b0f876e9..cf02ac8fb97 100644 --- a/src/cloudflare/types/workers/scripts/version_create_params.py +++ b/src/cloudflare/types/workers/scripts/version_create_params.py @@ -5,7 +5,6 @@ from typing import List, Iterable from typing_extensions import Literal, Required, Annotated, TypedDict -from ...._types import FileTypes from ...._utils import PropertyInfo __all__ = ["VersionCreateParams", "Metadata", "MetadataAnnotations"] @@ -15,14 +14,7 @@ class VersionCreateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present and referenced in the metadata as `main_module`. - """ - - metadata: Metadata + metadata: Required[Metadata] """JSON encoded metadata about the uploaded parts and Worker configuration.""" diff --git a/src/cloudflare/types/workers/stepped_migration.py b/src/cloudflare/types/workers/stepped_migration.py deleted file mode 100644 index 3383a9a473f..00000000000 --- a/src/cloudflare/types/workers/stepped_migration.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .migration_step import MigrationStep - -__all__ = ["SteppedMigration"] - - -class SteppedMigration(BaseModel): - new_tag: Optional[str] = None - """Tag to set as the latest migration tag.""" - - old_tag: Optional[str] = None - """Tag used to verify against the latest migration tag for this Worker. - - If they don't match, the upload is rejected. - """ - - steps: Optional[List[MigrationStep]] = None - """Migrations to apply in order.""" diff --git a/src/cloudflare/types/workers/stepped_migration_param.py b/src/cloudflare/types/workers/stepped_migration_param.py deleted file mode 100644 index 2465041142b..00000000000 --- a/src/cloudflare/types/workers/stepped_migration_param.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import TypedDict - -from .migration_step_param import MigrationStepParam - -__all__ = ["SteppedMigrationParam"] - - -class SteppedMigrationParam(TypedDict, total=False): - new_tag: str - """Tag to set as the latest migration tag.""" - - old_tag: str - """Tag used to verify against the latest migration tag for this Worker. - - If they don't match, the upload is rejected. - """ - - steps: Iterable[MigrationStepParam] - """Migrations to apply in order.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py index 13d32321c3f..42f93182535 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py @@ -3,11 +3,9 @@ from __future__ import annotations from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ....._types import FileTypes -from ....._utils import PropertyInfo -from ....workers.stepped_migration_param import SteppedMigrationParam +from ....workers.migration_step_param import MigrationStepParam from ....workers.single_step_migration_param import SingleStepMigrationParam from ....workers.placement_configuration_param import PlacementConfigurationParam from ....workers.scripts.consumer_script_param import ConsumerScriptParam @@ -20,6 +18,7 @@ "Variant0MetadataAssetsConfig", "Variant0MetadataBinding", "Variant0MetadataMigrations", + "Variant0MetadataMigrationsWorkersMultipleStepMigrations", "Variant0MetadataObservability", "Variant1", ] @@ -32,16 +31,7 @@ class Variant0(TypedDict, total=False): dispatch_namespace: Required[str] """Name of the Workers for Platforms dispatch namespace.""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present and referenced in the metadata as `main_module` or - `body_part` by part name. Source maps may also be included using the - `application/source-map` content type. - """ - - metadata: Variant0Metadata + metadata: Required[Variant0Metadata] """JSON encoded metadata about the uploaded parts and Worker configuration.""" @@ -85,7 +75,24 @@ class Variant0MetadataBindingTyped(TypedDict, total=False): Variant0MetadataBinding: TypeAlias = Union[Variant0MetadataBindingTyped, Dict[str, object]] -Variant0MetadataMigrations: TypeAlias = Union[SingleStepMigrationParam, SteppedMigrationParam] + +class Variant0MetadataMigrationsWorkersMultipleStepMigrations(TypedDict, total=False): + new_tag: str + """Tag to set as the latest migration tag.""" + + old_tag: str + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Iterable[MigrationStepParam] + """Migrations to apply in order.""" + + +Variant0MetadataMigrations: TypeAlias = Union[ + SingleStepMigrationParam, Variant0MetadataMigrationsWorkersMultipleStepMigrations +] class Variant0MetadataObservability(TypedDict, total=False): @@ -160,7 +167,7 @@ class Variant0Metadata(TypedDict, total=False): """List of Workers that will consume logs from the attached Worker.""" usage_model: Literal["bundled", "unbound"] - """Usage model to apply to invocations.""" + """Usage model for the Worker invocations.""" version_tags: Dict[str, str] """Key-value pairs to use as tags for this version of this Worker.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py index e4fd8cf4809..f6ec46c36e0 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py @@ -2,6 +2,7 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from ....._models import BaseModel from ....workers.scripts.consumer_script import ConsumerScript @@ -39,5 +40,5 @@ class ScriptUpdateResponse(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["bundled", "unbound"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py index 9f4d3118469..84e1916a5ef 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/content_update_params.py @@ -2,10 +2,8 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, Annotated, TypedDict -from ......_types import FileTypes from ......_utils import PropertyInfo from .....workers.worker_metadata_param import WorkerMetadataParam @@ -19,18 +17,7 @@ class ContentUpdateParams(TypedDict, total=False): dispatch_namespace: Required[str] """Name of the Workers for Platforms dispatch namespace.""" - any_part_name: Annotated[List[FileTypes], PropertyInfo(alias="")] - """A module comprising a Worker script, often a javascript file. - - Multiple modules may be provided as separate named parts, but at least one - module must be present. This should be referenced either in the metadata as - `main_module` (esm)/`body_part` (service worker) or as a header - `CF-WORKER-MAIN-MODULE-PART` (esm) /`CF-WORKER-BODY-PART` (service worker) by - part name. Source maps may also be included using the `application/source-map` - content type. - """ - - metadata: WorkerMetadataParam + metadata: Required[WorkerMetadataParam] """JSON encoded metadata about the uploaded parts and Worker configuration.""" cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")] diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py index f7e8aedcdf9..4af5fd5079e 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py @@ -3,15 +3,22 @@ from __future__ import annotations from typing import List, Union, Iterable, Optional -from typing_extensions import Required, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict from .....workers.binding_param import BindingParam -from .....workers.stepped_migration_param import SteppedMigrationParam +from .....workers.migration_step_param import MigrationStepParam from .....workers.single_step_migration_param import SingleStepMigrationParam from .....workers.placement_configuration_param import PlacementConfigurationParam from .....workers.scripts.consumer_script_param import ConsumerScriptParam -__all__ = ["SettingEditParams", "Settings", "SettingsLimits", "SettingsMigrations", "SettingsObservability"] +__all__ = [ + "SettingEditParams", + "Settings", + "SettingsLimits", + "SettingsMigrations", + "SettingsMigrationsWorkersMultipleStepMigrations", + "SettingsObservability", +] class SettingEditParams(TypedDict, total=False): @@ -29,7 +36,21 @@ class SettingsLimits(TypedDict, total=False): """The amount of CPU time this Worker can use in milliseconds.""" -SettingsMigrations: TypeAlias = Union[SingleStepMigrationParam, SteppedMigrationParam] +class SettingsMigrationsWorkersMultipleStepMigrations(TypedDict, total=False): + new_tag: str + """Tag to set as the latest migration tag.""" + + old_tag: str + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Iterable[MigrationStepParam] + """Migrations to apply in order.""" + + +SettingsMigrations: TypeAlias = Union[SingleStepMigrationParam, SettingsMigrationsWorkersMultipleStepMigrations] class SettingsObservability(TypedDict, total=False): @@ -48,10 +69,18 @@ class Settings(TypedDict, total=False): """List of bindings attached to this Worker""" compatibility_date: str - """Opt your Worker into changes after this date""" + """Date indicating targeted support in the Workers runtime. + + Backwards incompatible fixes to the runtime following this date will not affect + this Worker. + """ compatibility_flags: List[str] - """Opt your Worker into specific changes""" + """Flags that enable or disable certain features in the Workers runtime. + + Used to enable upcoming features or opt in or out of specific changes not + included in a `compatibility_date`. + """ limits: SettingsLimits """Limits to apply for this Worker.""" @@ -73,5 +102,5 @@ class Settings(TypedDict, total=False): tail_consumers: Iterable[ConsumerScriptParam] """List of Workers that will consume logs from the attached Worker.""" - usage_model: str - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Literal["bundled", "unbound"] + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py index a5f8112d446..ef5b2a63cc6 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py @@ -1,16 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing_extensions import Literal, TypeAlias from ......_models import BaseModel from .....workers.binding import Binding -from .....workers.stepped_migration import SteppedMigration +from .....workers.migration_step import MigrationStep from .....workers.single_step_migration import SingleStepMigration from .....workers.placement_configuration import PlacementConfiguration from .....workers.scripts.consumer_script import ConsumerScript -__all__ = ["SettingEditResponse", "Limits", "Migrations", "Observability"] +__all__ = ["SettingEditResponse", "Limits", "Migrations", "MigrationsWorkersMultipleStepMigrations", "Observability"] class Limits(BaseModel): @@ -18,7 +18,21 @@ class Limits(BaseModel): """The amount of CPU time this Worker can use in milliseconds.""" -Migrations: TypeAlias = Union[SingleStepMigration, SteppedMigration] +class MigrationsWorkersMultipleStepMigrations(BaseModel): + new_tag: Optional[str] = None + """Tag to set as the latest migration tag.""" + + old_tag: Optional[str] = None + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Optional[List[MigrationStep]] = None + """Migrations to apply in order.""" + + +Migrations: TypeAlias = Union[SingleStepMigration, MigrationsWorkersMultipleStepMigrations] class Observability(BaseModel): @@ -37,10 +51,18 @@ class SettingEditResponse(BaseModel): """List of bindings attached to this Worker""" compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" + """Date indicating targeted support in the Workers runtime. + + Backwards incompatible fixes to the runtime following this date will not affect + this Worker. + """ compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" + """Flags that enable or disable certain features in the Workers runtime. + + Used to enable upcoming features or opt in or out of specific changes not + included in a `compatibility_date`. + """ limits: Optional[Limits] = None """Limits to apply for this Worker.""" @@ -62,5 +84,5 @@ class SettingEditResponse(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["bundled", "unbound"]] = None + """Usage model for the Worker invocations.""" diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py index 8e7516ccf3d..aed977e6486 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py @@ -1,16 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing_extensions import Literal, TypeAlias from ......_models import BaseModel from .....workers.binding import Binding -from .....workers.stepped_migration import SteppedMigration +from .....workers.migration_step import MigrationStep from .....workers.single_step_migration import SingleStepMigration from .....workers.placement_configuration import PlacementConfiguration from .....workers.scripts.consumer_script import ConsumerScript -__all__ = ["SettingGetResponse", "Limits", "Migrations", "Observability"] +__all__ = ["SettingGetResponse", "Limits", "Migrations", "MigrationsWorkersMultipleStepMigrations", "Observability"] class Limits(BaseModel): @@ -18,7 +18,21 @@ class Limits(BaseModel): """The amount of CPU time this Worker can use in milliseconds.""" -Migrations: TypeAlias = Union[SingleStepMigration, SteppedMigration] +class MigrationsWorkersMultipleStepMigrations(BaseModel): + new_tag: Optional[str] = None + """Tag to set as the latest migration tag.""" + + old_tag: Optional[str] = None + """Tag used to verify against the latest migration tag for this Worker. + + If they don't match, the upload is rejected. + """ + + steps: Optional[List[MigrationStep]] = None + """Migrations to apply in order.""" + + +Migrations: TypeAlias = Union[SingleStepMigration, MigrationsWorkersMultipleStepMigrations] class Observability(BaseModel): @@ -37,10 +51,18 @@ class SettingGetResponse(BaseModel): """List of bindings attached to this Worker""" compatibility_date: Optional[str] = None - """Opt your Worker into changes after this date""" + """Date indicating targeted support in the Workers runtime. + + Backwards incompatible fixes to the runtime following this date will not affect + this Worker. + """ compatibility_flags: Optional[List[str]] = None - """Opt your Worker into specific changes""" + """Flags that enable or disable certain features in the Workers runtime. + + Used to enable upcoming features or opt in or out of specific changes not + included in a `compatibility_date`. + """ limits: Optional[Limits] = None """Limits to apply for this Worker.""" @@ -62,5 +84,5 @@ class SettingGetResponse(BaseModel): tail_consumers: Optional[List[ConsumerScript]] = None """List of Workers that will consume logs from the attached Worker.""" - usage_model: Optional[str] = None - """Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').""" + usage_model: Optional[Literal["bundled", "unbound"]] = None + """Usage model for the Worker invocations.""" diff --git a/tests/api_resources/workers/scripts/test_content.py b/tests/api_resources/workers/scripts/test_content.py index 24a9e4d4cf5..9f7629d9227 100644 --- a/tests/api_resources/workers/scripts/test_content.py +++ b/tests/api_resources/workers/scripts/test_content.py @@ -31,6 +31,7 @@ def test_method_update(self, client: Cloudflare) -> None: content = client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -40,7 +41,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: content = client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -56,6 +56,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: response = client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -69,6 +70,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: with client.workers.scripts.content.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -85,12 +87,14 @@ def test_path_params_update(self, client: Cloudflare) -> None: client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.content.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize @@ -169,6 +173,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: content = await async_client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -178,7 +183,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare content = await async_client.workers.scripts.content.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -194,6 +198,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -207,6 +212,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.content.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -223,12 +229,14 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.content.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.content.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py index 1525f49c746..ad240184931 100644 --- a/tests/api_resources/workers/scripts/test_versions.py +++ b/tests/api_resources/workers/scripts/test_versions.py @@ -28,6 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: version = client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @@ -37,7 +38,6 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: version = client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ "annotations": { "workers_message": "Fixed worker code.", @@ -65,6 +65,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: response = client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -78,6 +79,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: with client.workers.scripts.versions.with_streaming_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -94,12 +96,14 @@ def test_path_params_create(self, client: Cloudflare) -> None: client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.versions.with_raw_response.create( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize @@ -231,6 +235,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: version = await async_client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[VersionCreateResponse], version, path=["response"]) @@ -240,7 +245,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare version = await async_client.workers.scripts.versions.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - any_part_name=[b"raw file contents"], metadata={ "annotations": { "workers_message": "Fixed worker code.", @@ -268,6 +272,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -281,6 +286,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> async with async_client.workers.scripts.versions.with_streaming_response.create( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -297,12 +303,14 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: await async_client.workers.scripts.versions.with_raw_response.create( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.versions.with_raw_response.create( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @parametrize diff --git a/tests/api_resources/workers/test_scripts.py b/tests/api_resources/workers/test_scripts.py index f031908950b..13972564c28 100644 --- a/tests/api_resources/workers/test_scripts.py +++ b/tests/api_resources/workers/test_scripts.py @@ -32,6 +32,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: script = client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -41,8 +42,6 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N script = client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -59,8 +58,8 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -101,6 +100,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N "usage_model": "bundled", "version_tags": {"foo": "string"}, }, + rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -110,6 +110,7 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: response = client.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -123,6 +124,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: with client.workers.scripts.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,12 +141,14 @@ def test_path_params_update_overload_1(self, client: Cloudflare) -> None: client.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): client.workers.scripts.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -163,7 +167,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - message="message", + message="Message about the rollback.", ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -381,6 +385,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> script = await async_client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -390,8 +395,6 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn script = await async_client.workers.scripts.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", - rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -408,8 +411,8 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -450,6 +453,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn "usage_model": "bundled", "version_tags": {"foo": "string"}, }, + rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -459,6 +463,7 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar response = await async_client.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) assert response.is_closed is True @@ -472,6 +477,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo async with async_client.workers.scripts.with_streaming_response.update( script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -488,12 +494,14 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare await async_client.workers.scripts.with_raw_response.update( script_name="this-is_my_script-01", account_id="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): await async_client.workers.scripts.with_raw_response.update( script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", + metadata={}, ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -512,7 +520,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - message="message", + message="Message about the rollback.", ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py index b869d42a76e..822e7f80d7a 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_content.py @@ -32,6 +32,7 @@ def test_method_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -42,7 +43,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -59,6 +59,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert response.is_closed is True @@ -73,6 +74,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -90,6 +92,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -97,6 +100,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -104,6 +108,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @parametrize @@ -195,6 +200,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[Script], content, path=["response"]) @@ -205,7 +211,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "body_part": "worker.js", "main_module": "worker.js", @@ -223,6 +228,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) ) @@ -238,6 +244,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -255,6 +262,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -262,6 +270,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -269,6 +278,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @parametrize diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py index 50a6f309b63..59bd18c7dac 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_settings.py @@ -39,8 +39,8 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: dispatch_namespace="my-dispatch-namespace", settings={ "bindings": [{"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": ["formdata_parser_supports_files"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "limits": {"cpu_ms": 50}, "logpush": False, "migrations": { @@ -76,7 +76,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: "namespace": "my-namespace", } ], - "usage_model": "unbound", + "usage_model": "bundled", }, ) assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) @@ -218,8 +218,8 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) dispatch_namespace="my-dispatch-namespace", settings={ "bindings": [{"type": "kv_namespace"}], - "compatibility_date": "2022-04-05", - "compatibility_flags": ["formdata_parser_supports_files"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "limits": {"cpu_ms": 50}, "logpush": False, "migrations": { @@ -255,7 +255,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) "namespace": "my-namespace", } ], - "usage_model": "unbound", + "usage_model": "bundled", }, ) assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py index c5c287cfdab..8dd234b018e 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py +++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/test_scripts.py @@ -27,6 +27,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -37,7 +38,6 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -54,8 +54,8 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -106,6 +106,7 @@ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert response.is_closed is True @@ -120,6 +121,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -137,6 +139,7 @@ def test_path_params_update_overload_1(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -144,6 +147,7 @@ def test_path_params_update_overload_1(self, client: Cloudflare) -> None: script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -151,6 +155,7 @@ def test_path_params_update_overload_1(self, client: Cloudflare) -> None: script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -170,7 +175,7 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - message="message", + message="Message about the rollback.", ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -369,6 +374,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"]) @@ -379,7 +385,6 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - any_part_name=[b"raw file contents"], metadata={ "assets": { "config": { @@ -396,8 +401,8 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn } ], "body_part": "worker.js", - "compatibility_date": "2023-07-25", - "compatibility_flags": ["string"], + "compatibility_date": "2021-01-01", + "compatibility_flags": ["nodejs_compat"], "keep_assets": False, "keep_bindings": ["string"], "logpush": False, @@ -448,6 +453,7 @@ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflar script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) assert response.is_closed is True @@ -462,6 +468,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -479,6 +486,7 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare script_name="this-is_my_script-01", account_id="", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"): @@ -486,6 +494,7 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="", + metadata={}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"): @@ -493,6 +502,7 @@ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare script_name="", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", + metadata={}, ) @pytest.mark.skip(reason="TODO: investigate broken test") @@ -512,7 +522,7 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn script_name="this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", dispatch_namespace="my-dispatch-namespace", - message="message", + message="Message about the rollback.", ) assert_matches_type(Optional[ScriptUpdateResponse], script, path=["response"])