diff --git a/.stats.yml b/.stats.yml
index de12921cd5a..8bd1d4afd6e 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 1292
+configured_endpoints: 1299
diff --git a/api.md b/api.md
index 25151f39684..de02ee85864 100644
--- a/api.md
+++ b/api.md
@@ -4,6 +4,7 @@
from cloudflare.types import (
ErrorData,
Logging,
+ ResponseInfo,
UnnamedSchemaRef10,
UnnamedSchemaRef100,
UnnamedSchemaRef101,
@@ -62,7 +63,6 @@ from cloudflare.types import (
UnnamedSchemaRef169,
UnnamedSchemaRef170,
UnnamedSchemaRef171,
- UnnamedSchemaRef172,
UnnamedSchemaRef173,
UnnamedSchemaRef2,
UnnamedSchemaRef22,
@@ -2836,8 +2836,52 @@ from cloudflare.types.workers.scripts import SettingEditResponse, SettingGetResp
Methods:
-- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> SettingEditResponse
-- client.workers.scripts.settings.get(script_name, \*, account_id) -> SettingGetResponse
+- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> SettingEditResponse
+- client.workers.scripts.settings.get(script_name, \*, account_id) -> SettingGetResponse
+
+### Deployments
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import DeploymentCreateResponse, DeploymentGetResponse
+```
+
+Methods:
+
+- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> DeploymentCreateResponse
+- client.workers.scripts.deployments.get(script_name, \*, account_id) -> DeploymentGetResponse
+
+### Versions
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts import (
+ VersionCreateResponse,
+ VersionListResponse,
+ VersionGetResponse,
+)
+```
+
+Methods:
+
+- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> VersionCreateResponse
+- client.workers.scripts.versions.list(script_name, \*, account_id) -> VersionListResponse
+- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> VersionGetResponse
+
+#### Settings
+
+Types:
+
+```python
+from cloudflare.types.workers.scripts.versions import SettingEditResponse, SettingGetResponse
+```
+
+Methods:
+
+- client.workers.scripts.versions.settings.edit(script_name, \*, account_id, \*\*params) -> SettingEditResponse
+- client.workers.scripts.versions.settings.get(script_name, \*, account_id) -> SettingGetResponse
## Filters
diff --git a/src/cloudflare/resources/workers/scripts/__init__.py b/src/cloudflare/resources/workers/scripts/__init__.py
index 5629fca6f7a..744428090ea 100644
--- a/src/cloudflare/resources/workers/scripts/__init__.py
+++ b/src/cloudflare/resources/workers/scripts/__init__.py
@@ -40,6 +40,14 @@
SettingsWithStreamingResponse,
AsyncSettingsWithStreamingResponse,
)
+from .versions import (
+ Versions,
+ AsyncVersions,
+ VersionsWithRawResponse,
+ AsyncVersionsWithRawResponse,
+ VersionsWithStreamingResponse,
+ AsyncVersionsWithStreamingResponse,
+)
from .schedules import (
Schedules,
AsyncSchedules,
@@ -56,6 +64,14 @@
ContentV2WithStreamingResponse,
AsyncContentV2WithStreamingResponse,
)
+from .deployments import (
+ Deployments,
+ AsyncDeployments,
+ DeploymentsWithRawResponse,
+ AsyncDeploymentsWithRawResponse,
+ DeploymentsWithStreamingResponse,
+ AsyncDeploymentsWithStreamingResponse,
+)
from .usage_model import (
UsageModel,
AsyncUsageModel,
@@ -108,6 +124,18 @@
"AsyncSettingsWithRawResponse",
"SettingsWithStreamingResponse",
"AsyncSettingsWithStreamingResponse",
+ "Deployments",
+ "AsyncDeployments",
+ "DeploymentsWithRawResponse",
+ "AsyncDeploymentsWithRawResponse",
+ "DeploymentsWithStreamingResponse",
+ "AsyncDeploymentsWithStreamingResponse",
+ "Versions",
+ "AsyncVersions",
+ "VersionsWithRawResponse",
+ "AsyncVersionsWithRawResponse",
+ "VersionsWithStreamingResponse",
+ "AsyncVersionsWithStreamingResponse",
"Scripts",
"AsyncScripts",
"ScriptsWithRawResponse",
diff --git a/src/cloudflare/resources/workers/scripts/deployments.py b/src/cloudflare/resources/workers/scripts/deployments.py
new file mode 100644
index 00000000000..abf691f4291
--- /dev/null
+++ b/src/cloudflare/resources/workers/scripts/deployments.py
@@ -0,0 +1,300 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import (
+ make_request_options,
+)
+from ....types.workers.scripts import DeploymentGetResponse, DeploymentCreateResponse, deployment_create_params
+
+__all__ = ["Deployments", "AsyncDeployments"]
+
+
+class Deployments(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> DeploymentsWithRawResponse:
+ return DeploymentsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> DeploymentsWithStreamingResponse:
+ return DeploymentsWithStreamingResponse(self)
+
+ def create(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ annotations: deployment_create_params.Annotations | NotGiven = NOT_GIVEN,
+ strategy: 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> DeploymentCreateResponse:
+ """
+ Deployments configure how
+ [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions)
+ are deployed to traffic. A deployment can consist of one or two versions of a
+ Worker.
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return self._post(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ body=maybe_transform(
+ {
+ "annotations": annotations,
+ "strategy": strategy,
+ },
+ deployment_create_params.DeploymentCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[DeploymentCreateResponse], ResultWrapper[DeploymentCreateResponse]),
+ )
+
+ def get(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> DeploymentGetResponse:
+ """List of Worker Deployments.
+
+ The first deployment in the list is the latest
+ deployment actively serving traffic.
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[DeploymentGetResponse], ResultWrapper[DeploymentGetResponse]),
+ )
+
+
+class AsyncDeployments(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncDeploymentsWithRawResponse:
+ return AsyncDeploymentsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncDeploymentsWithStreamingResponse:
+ return AsyncDeploymentsWithStreamingResponse(self)
+
+ async def create(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ annotations: deployment_create_params.Annotations | NotGiven = NOT_GIVEN,
+ strategy: 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> DeploymentCreateResponse:
+ """
+ Deployments configure how
+ [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions)
+ are deployed to traffic. A deployment can consist of one or two versions of a
+ Worker.
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return await self._post(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ body=await async_maybe_transform(
+ {
+ "annotations": annotations,
+ "strategy": strategy,
+ },
+ deployment_create_params.DeploymentCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[DeploymentCreateResponse], ResultWrapper[DeploymentCreateResponse]),
+ )
+
+ async def get(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> DeploymentGetResponse:
+ """List of Worker Deployments.
+
+ The first deployment in the list is the latest
+ deployment actively serving traffic.
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return await self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/deployments",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[DeploymentGetResponse], ResultWrapper[DeploymentGetResponse]),
+ )
+
+
+class DeploymentsWithRawResponse:
+ def __init__(self, deployments: Deployments) -> None:
+ self._deployments = deployments
+
+ self.create = to_raw_response_wrapper(
+ deployments.create,
+ )
+ self.get = to_raw_response_wrapper(
+ deployments.get,
+ )
+
+
+class AsyncDeploymentsWithRawResponse:
+ def __init__(self, deployments: AsyncDeployments) -> None:
+ self._deployments = deployments
+
+ self.create = async_to_raw_response_wrapper(
+ deployments.create,
+ )
+ self.get = async_to_raw_response_wrapper(
+ deployments.get,
+ )
+
+
+class DeploymentsWithStreamingResponse:
+ def __init__(self, deployments: Deployments) -> None:
+ self._deployments = deployments
+
+ self.create = to_streamed_response_wrapper(
+ deployments.create,
+ )
+ self.get = to_streamed_response_wrapper(
+ deployments.get,
+ )
+
+
+class AsyncDeploymentsWithStreamingResponse:
+ def __init__(self, deployments: AsyncDeployments) -> None:
+ self._deployments = deployments
+
+ self.create = async_to_streamed_response_wrapper(
+ deployments.create,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ deployments.get,
+ )
diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py
index 5b468328719..8541229f823 100644
--- a/src/cloudflare/resources/workers/scripts/scripts.py
+++ b/src/cloudflare/resources/workers/scripts/scripts.py
@@ -38,6 +38,14 @@
SettingsWithStreamingResponse,
AsyncSettingsWithStreamingResponse,
)
+from .versions import (
+ Versions,
+ AsyncVersions,
+ VersionsWithRawResponse,
+ AsyncVersionsWithRawResponse,
+ VersionsWithStreamingResponse,
+ AsyncVersionsWithStreamingResponse,
+)
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes
from ...._utils import (
required_args,
@@ -61,6 +69,14 @@
ContentV2WithStreamingResponse,
AsyncContentV2WithStreamingResponse,
)
+from .deployments import (
+ Deployments,
+ AsyncDeployments,
+ DeploymentsWithRawResponse,
+ AsyncDeploymentsWithRawResponse,
+ DeploymentsWithStreamingResponse,
+ AsyncDeploymentsWithStreamingResponse,
+)
from .usage_model import (
UsageModel,
AsyncUsageModel,
@@ -91,6 +107,7 @@
make_request_options,
)
from ....types.workers import WorkersScript, script_delete_params, script_update_params
+from .versions.versions import Versions, AsyncVersions
__all__ = ["Scripts", "AsyncScripts"]
@@ -124,6 +141,14 @@ def content_v2(self) -> ContentV2:
def settings(self) -> Settings:
return Settings(self._client)
+ @cached_property
+ def deployments(self) -> Deployments:
+ return Deployments(self._client)
+
+ @cached_property
+ def versions(self) -> Versions:
+ return Versions(self._client)
+
@cached_property
def with_raw_response(self) -> ScriptsWithRawResponse:
return ScriptsWithRawResponse(self)
@@ -420,6 +445,14 @@ def content_v2(self) -> AsyncContentV2:
def settings(self) -> AsyncSettings:
return AsyncSettings(self._client)
+ @cached_property
+ def deployments(self) -> AsyncDeployments:
+ return AsyncDeployments(self._client)
+
+ @cached_property
+ def versions(self) -> AsyncVersions:
+ return AsyncVersions(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncScriptsWithRawResponse:
return AsyncScriptsWithRawResponse(self)
@@ -735,6 +768,14 @@ def content_v2(self) -> ContentV2WithRawResponse:
def settings(self) -> SettingsWithRawResponse:
return SettingsWithRawResponse(self._scripts.settings)
+ @cached_property
+ def deployments(self) -> DeploymentsWithRawResponse:
+ return DeploymentsWithRawResponse(self._scripts.deployments)
+
+ @cached_property
+ def versions(self) -> VersionsWithRawResponse:
+ return VersionsWithRawResponse(self._scripts.versions)
+
class AsyncScriptsWithRawResponse:
def __init__(self, scripts: AsyncScripts) -> None:
@@ -782,6 +823,14 @@ def content_v2(self) -> AsyncContentV2WithRawResponse:
def settings(self) -> AsyncSettingsWithRawResponse:
return AsyncSettingsWithRawResponse(self._scripts.settings)
+ @cached_property
+ def deployments(self) -> AsyncDeploymentsWithRawResponse:
+ return AsyncDeploymentsWithRawResponse(self._scripts.deployments)
+
+ @cached_property
+ def versions(self) -> AsyncVersionsWithRawResponse:
+ return AsyncVersionsWithRawResponse(self._scripts.versions)
+
class ScriptsWithStreamingResponse:
def __init__(self, scripts: Scripts) -> None:
@@ -829,6 +878,14 @@ def content_v2(self) -> ContentV2WithStreamingResponse:
def settings(self) -> SettingsWithStreamingResponse:
return SettingsWithStreamingResponse(self._scripts.settings)
+ @cached_property
+ def deployments(self) -> DeploymentsWithStreamingResponse:
+ return DeploymentsWithStreamingResponse(self._scripts.deployments)
+
+ @cached_property
+ def versions(self) -> VersionsWithStreamingResponse:
+ return VersionsWithStreamingResponse(self._scripts.versions)
+
class AsyncScriptsWithStreamingResponse:
def __init__(self, scripts: AsyncScripts) -> None:
@@ -875,3 +932,11 @@ def content_v2(self) -> AsyncContentV2WithStreamingResponse:
@cached_property
def settings(self) -> AsyncSettingsWithStreamingResponse:
return AsyncSettingsWithStreamingResponse(self._scripts.settings)
+
+ @cached_property
+ def deployments(self) -> AsyncDeploymentsWithStreamingResponse:
+ return AsyncDeploymentsWithStreamingResponse(self._scripts.deployments)
+
+ @cached_property
+ def versions(self) -> AsyncVersionsWithStreamingResponse:
+ return AsyncVersionsWithStreamingResponse(self._scripts.versions)
diff --git a/src/cloudflare/resources/workers/scripts/settings.py b/src/cloudflare/resources/workers/scripts/settings.py
index bd34844a1ba..ab9ae6ddb17 100644
--- a/src/cloudflare/resources/workers/scripts/settings.py
+++ b/src/cloudflare/resources/workers/scripts/settings.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Type, cast
+from typing import Type, Iterable, cast
import httpx
@@ -42,7 +42,8 @@ def edit(
script_name: str,
*,
account_id: str,
- settings: setting_edit_params.Settings | NotGiven = NOT_GIVEN,
+ logpush: bool | NotGiven = NOT_GIVEN,
+ tail_consumers: Iterable[setting_edit_params.TailConsumer] | 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,
@@ -51,13 +52,19 @@ def edit(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SettingEditResponse:
"""
- Patch metadata or config, such as bindings or usage model
+ Patch script-level settings when using
+ [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
+ Includes Logpush and Tail Consumers.
Args:
account_id: Identifier
script_name: Name of the script, used in URLs and route configuration.
+ logpush: Whether Logpush is turned on for the Worker.
+
+ tail_consumers: List of Workers that will consume logs from the attached Worker.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -71,8 +78,14 @@ def edit(
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._patch(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
- body=maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams),
+ f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ body=maybe_transform(
+ {
+ "logpush": logpush,
+ "tail_consumers": tail_consumers,
+ },
+ setting_edit_params.SettingEditParams,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -96,7 +109,9 @@ def get(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SettingGetResponse:
"""
- Get metadata and config, such as bindings or usage model
+ Get script-level settings when using
+ [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
+ Includes Logpush and Tail Consumers.
Args:
account_id: Identifier
@@ -116,7 +131,7 @@ def get(
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -142,7 +157,8 @@ async def edit(
script_name: str,
*,
account_id: str,
- settings: setting_edit_params.Settings | NotGiven = NOT_GIVEN,
+ logpush: bool | NotGiven = NOT_GIVEN,
+ tail_consumers: Iterable[setting_edit_params.TailConsumer] | 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,
@@ -151,13 +167,19 @@ async def edit(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SettingEditResponse:
"""
- Patch metadata or config, such as bindings or usage model
+ Patch script-level settings when using
+ [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
+ Includes Logpush and Tail Consumers.
Args:
account_id: Identifier
script_name: Name of the script, used in URLs and route configuration.
+ logpush: Whether Logpush is turned on for the Worker.
+
+ tail_consumers: List of Workers that will consume logs from the attached Worker.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -171,8 +193,14 @@ async def edit(
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._patch(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
- body=await async_maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams),
+ f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
+ body=await async_maybe_transform(
+ {
+ "logpush": logpush,
+ "tail_consumers": tail_consumers,
+ },
+ setting_edit_params.SettingEditParams,
+ ),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -196,7 +224,9 @@ async def get(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SettingGetResponse:
"""
- Get metadata and config, such as bindings or usage model
+ Get script-level settings when using
+ [Worker Versions](https://developers.cloudflare.com/api/operations/worker-versions-list-versions).
+ Includes Logpush and Tail Consumers.
Args:
account_id: Identifier
@@ -216,7 +246,7 @@ async def get(
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return await self._get(
- f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ f"/accounts/{account_id}/workers/scripts/{script_name}/script-settings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
diff --git a/src/cloudflare/resources/workers/scripts/versions/__init__.py b/src/cloudflare/resources/workers/scripts/versions/__init__.py
new file mode 100644
index 00000000000..de0fccf6d92
--- /dev/null
+++ b/src/cloudflare/resources/workers/scripts/versions/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .settings import (
+ Settings,
+ AsyncSettings,
+ SettingsWithRawResponse,
+ AsyncSettingsWithRawResponse,
+ SettingsWithStreamingResponse,
+ AsyncSettingsWithStreamingResponse,
+)
+from .versions import (
+ Versions,
+ AsyncVersions,
+ VersionsWithRawResponse,
+ AsyncVersionsWithRawResponse,
+ VersionsWithStreamingResponse,
+ AsyncVersionsWithStreamingResponse,
+)
+
+__all__ = [
+ "Settings",
+ "AsyncSettings",
+ "SettingsWithRawResponse",
+ "AsyncSettingsWithRawResponse",
+ "SettingsWithStreamingResponse",
+ "AsyncSettingsWithStreamingResponse",
+ "Versions",
+ "AsyncVersions",
+ "VersionsWithRawResponse",
+ "AsyncVersionsWithRawResponse",
+ "VersionsWithStreamingResponse",
+ "AsyncVersionsWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/workers/scripts/versions/settings.py b/src/cloudflare/resources/workers/scripts/versions/settings.py
new file mode 100644
index 00000000000..91d1e01ae67
--- /dev/null
+++ b/src/cloudflare/resources/workers/scripts/versions/settings.py
@@ -0,0 +1,276 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ....._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ....._compat import cached_property
+from ....._resource import SyncAPIResource, AsyncAPIResource
+from ....._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ....._wrappers import ResultWrapper
+from ....._base_client import (
+ make_request_options,
+)
+from .....types.workers.scripts.versions import SettingGetResponse, SettingEditResponse, setting_edit_params
+
+__all__ = ["Settings", "AsyncSettings"]
+
+
+class Settings(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> SettingsWithRawResponse:
+ return SettingsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> SettingsWithStreamingResponse:
+ return SettingsWithStreamingResponse(self)
+
+ def edit(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ settings: setting_edit_params.Settings | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SettingEditResponse:
+ """
+ Patch metadata or config, such as bindings or usage model
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return self._patch(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ body=maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]),
+ )
+
+ def get(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SettingGetResponse:
+ """
+ Get metadata and config, such as bindings or usage model
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]),
+ )
+
+
+class AsyncSettings(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncSettingsWithRawResponse:
+ return AsyncSettingsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse:
+ return AsyncSettingsWithStreamingResponse(self)
+
+ async def edit(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ settings: setting_edit_params.Settings | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SettingEditResponse:
+ """
+ Patch metadata or config, such as bindings or usage model
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return await self._patch(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ body=await async_maybe_transform({"settings": settings}, setting_edit_params.SettingEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[SettingEditResponse], ResultWrapper[SettingEditResponse]),
+ )
+
+ async def get(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SettingGetResponse:
+ """
+ Get metadata and config, such as bindings or usage model
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return await self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/settings",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[SettingGetResponse], ResultWrapper[SettingGetResponse]),
+ )
+
+
+class SettingsWithRawResponse:
+ def __init__(self, settings: Settings) -> None:
+ self._settings = settings
+
+ self.edit = to_raw_response_wrapper(
+ settings.edit,
+ )
+ self.get = to_raw_response_wrapper(
+ settings.get,
+ )
+
+
+class AsyncSettingsWithRawResponse:
+ def __init__(self, settings: AsyncSettings) -> None:
+ self._settings = settings
+
+ self.edit = async_to_raw_response_wrapper(
+ settings.edit,
+ )
+ self.get = async_to_raw_response_wrapper(
+ settings.get,
+ )
+
+
+class SettingsWithStreamingResponse:
+ def __init__(self, settings: Settings) -> None:
+ self._settings = settings
+
+ self.edit = to_streamed_response_wrapper(
+ settings.edit,
+ )
+ self.get = to_streamed_response_wrapper(
+ settings.get,
+ )
+
+
+class AsyncSettingsWithStreamingResponse:
+ def __init__(self, settings: AsyncSettings) -> None:
+ self._settings = settings
+
+ self.edit = async_to_streamed_response_wrapper(
+ settings.edit,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ settings.get,
+ )
diff --git a/src/cloudflare/resources/workers/scripts/versions/versions.py b/src/cloudflare/resources/workers/scripts/versions/versions.py
new file mode 100644
index 00000000000..bee6f8ccdd3
--- /dev/null
+++ b/src/cloudflare/resources/workers/scripts/versions/versions.py
@@ -0,0 +1,463 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Type, Mapping, cast
+
+import httpx
+
+from .settings import (
+ Settings,
+ AsyncSettings,
+ SettingsWithRawResponse,
+ AsyncSettingsWithRawResponse,
+ SettingsWithStreamingResponse,
+ AsyncSettingsWithStreamingResponse,
+)
+from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
+from ....._utils import (
+ extract_files,
+ maybe_transform,
+ deepcopy_minimal,
+ async_maybe_transform,
+)
+from ....._compat import cached_property
+from ....._resource import SyncAPIResource, AsyncAPIResource
+from ....._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ....._wrappers import ResultWrapper
+from ....._base_client import (
+ make_request_options,
+)
+from .....types.workers.scripts import (
+ VersionGetResponse,
+ VersionListResponse,
+ VersionCreateResponse,
+ version_create_params,
+)
+
+__all__ = ["Versions", "AsyncVersions"]
+
+
+class Versions(SyncAPIResource):
+ @cached_property
+ def settings(self) -> Settings:
+ return Settings(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> VersionsWithRawResponse:
+ return VersionsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> VersionsWithStreamingResponse:
+ return VersionsWithStreamingResponse(self)
+
+ def create(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
+ metadata: version_create_params.Metadata | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VersionCreateResponse:
+ """
+ Upload a Worker Version without deploying to Cloudflare's network.
+
+ Args:
+ account_id: Identifier
+
+ 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
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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=[["", ""]])
+ if files:
+ # 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,
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[VersionCreateResponse], ResultWrapper[VersionCreateResponse]),
+ )
+
+ def list(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VersionListResponse:
+ """List of Worker Versions.
+
+ The first version in the list is the latest version.
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[VersionListResponse], ResultWrapper[VersionListResponse]),
+ )
+
+ def get(
+ self,
+ version_id: str,
+ *,
+ account_id: str,
+ script_name: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VersionGetResponse:
+ """
+ Get Version Detail
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ if not version_id:
+ raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
+ )
+
+
+class AsyncVersions(AsyncAPIResource):
+ @cached_property
+ def settings(self) -> AsyncSettings:
+ return AsyncSettings(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncVersionsWithRawResponse:
+ return AsyncVersionsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncVersionsWithStreamingResponse:
+ return AsyncVersionsWithStreamingResponse(self)
+
+ async def create(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
+ metadata: version_create_params.Metadata | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VersionCreateResponse:
+ """
+ Upload a Worker Version without deploying to Cloudflare's network.
+
+ Args:
+ account_id: Identifier
+
+ 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
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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=[["", ""]])
+ if files:
+ # 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,
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[VersionCreateResponse], ResultWrapper[VersionCreateResponse]),
+ )
+
+ async def list(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VersionListResponse:
+ """List of Worker Versions.
+
+ The first version in the list is the latest version.
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ return await self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/versions",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[VersionListResponse], ResultWrapper[VersionListResponse]),
+ )
+
+ async def get(
+ self,
+ version_id: str,
+ *,
+ account_id: str,
+ script_name: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> VersionGetResponse:
+ """
+ Get Version Detail
+
+ Args:
+ account_id: Identifier
+
+ script_name: Name of the script.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ 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}")
+ if not version_id:
+ raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
+ )
+
+
+class VersionsWithRawResponse:
+ def __init__(self, versions: Versions) -> None:
+ self._versions = versions
+
+ self.create = to_raw_response_wrapper(
+ versions.create,
+ )
+ self.list = to_raw_response_wrapper(
+ versions.list,
+ )
+ self.get = to_raw_response_wrapper(
+ versions.get,
+ )
+
+ @cached_property
+ def settings(self) -> SettingsWithRawResponse:
+ return SettingsWithRawResponse(self._versions.settings)
+
+
+class AsyncVersionsWithRawResponse:
+ def __init__(self, versions: AsyncVersions) -> None:
+ self._versions = versions
+
+ self.create = async_to_raw_response_wrapper(
+ versions.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ versions.list,
+ )
+ self.get = async_to_raw_response_wrapper(
+ versions.get,
+ )
+
+ @cached_property
+ def settings(self) -> AsyncSettingsWithRawResponse:
+ return AsyncSettingsWithRawResponse(self._versions.settings)
+
+
+class VersionsWithStreamingResponse:
+ def __init__(self, versions: Versions) -> None:
+ self._versions = versions
+
+ self.create = to_streamed_response_wrapper(
+ versions.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ versions.list,
+ )
+ self.get = to_streamed_response_wrapper(
+ versions.get,
+ )
+
+ @cached_property
+ def settings(self) -> SettingsWithStreamingResponse:
+ return SettingsWithStreamingResponse(self._versions.settings)
+
+
+class AsyncVersionsWithStreamingResponse:
+ def __init__(self, versions: AsyncVersions) -> None:
+ self._versions = versions
+
+ self.create = async_to_streamed_response_wrapper(
+ versions.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ versions.list,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ versions.get,
+ )
+
+ @cached_property
+ def settings(self) -> AsyncSettingsWithStreamingResponse:
+ return AsyncSettingsWithStreamingResponse(self._versions.settings)
diff --git a/src/cloudflare/resources/workers/services/environments/settings.py b/src/cloudflare/resources/workers/services/environments/settings.py
index 44ba38e0a1f..940b35d049a 100644
--- a/src/cloudflare/resources/workers/services/environments/settings.py
+++ b/src/cloudflare/resources/workers/services/environments/settings.py
@@ -45,8 +45,8 @@ def edit(
*,
account_id: str,
service_name: str,
- errors: Iterable[shared_params.UnnamedSchemaRef172],
- messages: Iterable[shared_params.UnnamedSchemaRef172],
+ errors: Iterable[shared_params.ResponseInfo],
+ messages: Iterable[shared_params.ResponseInfo],
result: setting_edit_params.Result,
success: Literal[True],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -168,8 +168,8 @@ async def edit(
*,
account_id: str,
service_name: str,
- errors: Iterable[shared_params.UnnamedSchemaRef172],
- messages: Iterable[shared_params.UnnamedSchemaRef172],
+ errors: Iterable[shared_params.ResponseInfo],
+ messages: Iterable[shared_params.ResponseInfo],
result: setting_edit_params.Result,
success: Literal[True],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py
index 2bea1bf19f4..36693b4da3e 100644
--- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py
+++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py
@@ -49,8 +49,8 @@ def edit(
*,
account_id: str,
dispatch_namespace: str,
- errors: Iterable[shared_params.UnnamedSchemaRef172],
- messages: Iterable[shared_params.UnnamedSchemaRef172],
+ errors: Iterable[shared_params.ResponseInfo],
+ messages: Iterable[shared_params.ResponseInfo],
result: setting_edit_params.Result,
success: Literal[True],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -172,8 +172,8 @@ async def edit(
*,
account_id: str,
dispatch_namespace: str,
- errors: Iterable[shared_params.UnnamedSchemaRef172],
- messages: Iterable[shared_params.UnnamedSchemaRef172],
+ errors: Iterable[shared_params.ResponseInfo],
+ messages: Iterable[shared_params.ResponseInfo],
result: setting_edit_params.Result,
success: Literal[True],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index 9be059fd52c..b257d75b751 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -8,6 +8,7 @@
from .shared import (
Logging as Logging,
ErrorData as ErrorData,
+ ResponseInfo as ResponseInfo,
UnnamedSchemaRef2 as UnnamedSchemaRef2,
UnnamedSchemaRef3 as UnnamedSchemaRef3,
UnnamedSchemaRef4 as UnnamedSchemaRef4,
@@ -125,7 +126,6 @@
UnnamedSchemaRef169 as UnnamedSchemaRef169,
UnnamedSchemaRef170 as UnnamedSchemaRef170,
UnnamedSchemaRef171 as UnnamedSchemaRef171,
- UnnamedSchemaRef172 as UnnamedSchemaRef172,
UnnamedSchemaRef173 as UnnamedSchemaRef173,
)
from .account import Account as Account
diff --git a/src/cloudflare/types/firewall/waf/package_get_response.py b/src/cloudflare/types/firewall/waf/package_get_response.py
index facfc2433a2..c6e6da9efbc 100644
--- a/src/cloudflare/types/firewall/waf/package_get_response.py
+++ b/src/cloudflare/types/firewall/waf/package_get_response.py
@@ -3,16 +3,16 @@
from typing import List, Union, Optional
from typing_extensions import Literal
-from ...shared import UnnamedSchemaRef172
+from ...shared import ResponseInfo
from ...._models import BaseModel
__all__ = ["PackageGetResponse", "LegacyJhsAPIResponseSingle", "Result"]
class LegacyJhsAPIResponseSingle(BaseModel):
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
result: Union[str, object, None] = None
diff --git a/src/cloudflare/types/firewall/waf/package_list_response.py b/src/cloudflare/types/firewall/waf/package_list_response.py
index 6cb67850c4b..607fc5de85e 100644
--- a/src/cloudflare/types/firewall/waf/package_list_response.py
+++ b/src/cloudflare/types/firewall/waf/package_list_response.py
@@ -3,7 +3,7 @@
from typing import List, Union, Optional
from typing_extensions import Literal
-from ...shared import UnnamedSchemaRef167, UnnamedSchemaRef172
+from ...shared import ResponseInfo, UnnamedSchemaRef167
from ...._models import BaseModel
__all__ = [
@@ -32,9 +32,9 @@ class LegacyJhsAPIResponseCollectionResultInfo(BaseModel):
class LegacyJhsAPIResponseCollection(BaseModel):
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
result: Optional[UnnamedSchemaRef167] = None
diff --git a/src/cloudflare/types/images/v1_list_response.py b/src/cloudflare/types/images/v1_list_response.py
index 7ef3c751b46..20552ea88e7 100644
--- a/src/cloudflare/types/images/v1_list_response.py
+++ b/src/cloudflare/types/images/v1_list_response.py
@@ -4,7 +4,7 @@
from typing_extensions import Literal
from .image import Image
-from ..shared import UnnamedSchemaRef172
+from ..shared import ResponseInfo
from ..._models import BaseModel
__all__ = ["V1ListResponse", "Result"]
@@ -15,9 +15,9 @@ class Result(BaseModel):
class V1ListResponse(BaseModel):
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
result: Result
diff --git a/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py b/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py
index 2489485ac7d..a61dae3081c 100644
--- a/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py
+++ b/src/cloudflare/types/intel/attack_surface_report/issue_list_response.py
@@ -4,7 +4,7 @@
from datetime import datetime
from typing_extensions import Literal
-from ...shared import UnnamedSchemaRef172
+from ...shared import ResponseInfo
from ...._models import BaseModel
__all__ = ["IssueListResponse", "Result", "ResultIssue"]
@@ -56,9 +56,9 @@ class Result(BaseModel):
class IssueListResponse(BaseModel):
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
result: Result
diff --git a/src/cloudflare/types/shared/__init__.py b/src/cloudflare/types/shared/__init__.py
index bf5cf523d43..44e2a7fa297 100644
--- a/src/cloudflare/types/shared/__init__.py
+++ b/src/cloudflare/types/shared/__init__.py
@@ -2,6 +2,7 @@
from .logging import Logging as Logging
from .error_data import ErrorData as ErrorData
+from .response_info import ResponseInfo as ResponseInfo
from .unnamed_schema_ref_2 import UnnamedSchemaRef2 as UnnamedSchemaRef2
from .unnamed_schema_ref_3 import UnnamedSchemaRef3 as UnnamedSchemaRef3
from .unnamed_schema_ref_4 import UnnamedSchemaRef4 as UnnamedSchemaRef4
@@ -119,5 +120,4 @@
from .unnamed_schema_ref_169 import UnnamedSchemaRef169 as UnnamedSchemaRef169
from .unnamed_schema_ref_170 import UnnamedSchemaRef170 as UnnamedSchemaRef170
from .unnamed_schema_ref_171 import UnnamedSchemaRef171 as UnnamedSchemaRef171
-from .unnamed_schema_ref_172 import UnnamedSchemaRef172 as UnnamedSchemaRef172
from .unnamed_schema_ref_173 import UnnamedSchemaRef173 as UnnamedSchemaRef173
diff --git a/src/cloudflare/types/shared/unnamed_schema_ref_172.py b/src/cloudflare/types/shared/response_info.py
similarity index 68%
rename from src/cloudflare/types/shared/unnamed_schema_ref_172.py
rename to src/cloudflare/types/shared/response_info.py
index aff53b9c518..3208261ab12 100644
--- a/src/cloudflare/types/shared/unnamed_schema_ref_172.py
+++ b/src/cloudflare/types/shared/response_info.py
@@ -4,10 +4,10 @@
from ..._models import BaseModel
-__all__ = ["UnnamedSchemaRef172"]
+__all__ = ["ResponseInfo"]
-class UnnamedSchemaRef172(BaseModel):
+class ResponseInfo(BaseModel):
code: int
message: str
diff --git a/src/cloudflare/types/shared/unnamed_schema_ref_9.py b/src/cloudflare/types/shared/unnamed_schema_ref_9.py
index 98faf4aedca..b6fab21d08f 100644
--- a/src/cloudflare/types/shared/unnamed_schema_ref_9.py
+++ b/src/cloudflare/types/shared/unnamed_schema_ref_9.py
@@ -7,8 +7,8 @@
from pydantic import Field as FieldInfo
from ..._models import BaseModel
+from .response_info import ResponseInfo
from .unnamed_schema_ref_171 import UnnamedSchemaRef171
-from .unnamed_schema_ref_172 import UnnamedSchemaRef172
__all__ = [
"UnnamedSchemaRef9",
@@ -102,9 +102,9 @@ class UnionMember0(BaseModel):
class AaaAPIResponseCommon(BaseModel):
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
result: UnnamedSchemaRef171
diff --git a/src/cloudflare/types/shared_params/__init__.py b/src/cloudflare/types/shared_params/__init__.py
index ad816ec1016..7cb043e279b 100644
--- a/src/cloudflare/types/shared_params/__init__.py
+++ b/src/cloudflare/types/shared_params/__init__.py
@@ -1,6 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from .logging import Logging as Logging
+from .response_info import ResponseInfo as ResponseInfo
from .unnamed_schema_ref_28 import UnnamedSchemaRef28 as UnnamedSchemaRef28
from .unnamed_schema_ref_51 import UnnamedSchemaRef51 as UnnamedSchemaRef51
from .unnamed_schema_ref_75 import UnnamedSchemaRef75 as UnnamedSchemaRef75
@@ -21,4 +22,3 @@
from .unnamed_schema_ref_131 import UnnamedSchemaRef131 as UnnamedSchemaRef131
from .unnamed_schema_ref_158 import UnnamedSchemaRef158 as UnnamedSchemaRef158
from .unnamed_schema_ref_163 import UnnamedSchemaRef163 as UnnamedSchemaRef163
-from .unnamed_schema_ref_172 import UnnamedSchemaRef172 as UnnamedSchemaRef172
diff --git a/src/cloudflare/types/shared_params/unnamed_schema_ref_172.py b/src/cloudflare/types/shared_params/response_info.py
similarity index 72%
rename from src/cloudflare/types/shared_params/unnamed_schema_ref_172.py
rename to src/cloudflare/types/shared_params/response_info.py
index 4205c0958c1..5e5530fa01e 100644
--- a/src/cloudflare/types/shared_params/unnamed_schema_ref_172.py
+++ b/src/cloudflare/types/shared_params/response_info.py
@@ -4,10 +4,10 @@
from typing_extensions import Required, TypedDict
-__all__ = ["UnnamedSchemaRef172"]
+__all__ = ["ResponseInfo"]
-class UnnamedSchemaRef172(TypedDict, total=False):
+class ResponseInfo(TypedDict, total=False):
code: Required[int]
message: Required[str]
diff --git a/src/cloudflare/types/speed/test_list_response.py b/src/cloudflare/types/speed/test_list_response.py
index 0c526e3cc20..e97b4874d95 100644
--- a/src/cloudflare/types/speed/test_list_response.py
+++ b/src/cloudflare/types/speed/test_list_response.py
@@ -2,7 +2,7 @@
from typing import List, Optional
-from ..shared import UnnamedSchemaRef172
+from ..shared import ResponseInfo
from ..._models import BaseModel
__all__ = ["TestListResponse", "ResultInfo"]
@@ -20,9 +20,9 @@ class ResultInfo(BaseModel):
class TestListResponse(BaseModel):
__test__ = False
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
success: bool
"""Whether the API call was successful."""
diff --git a/src/cloudflare/types/workers/scripts/__init__.py b/src/cloudflare/types/workers/scripts/__init__.py
index a0604d24a77..46d3c3aff8c 100644
--- a/src/cloudflare/types/workers/scripts/__init__.py
+++ b/src/cloudflare/types/workers/scripts/__init__.py
@@ -10,11 +10,18 @@
from .binding_get_response import BindingGetResponse as BindingGetResponse
from .setting_get_response import SettingGetResponse as SettingGetResponse
from .tail_create_response import TailCreateResponse as TailCreateResponse
+from .version_get_response import VersionGetResponse as VersionGetResponse
from .content_update_params import ContentUpdateParams as ContentUpdateParams
from .schedule_get_response import ScheduleGetResponse as ScheduleGetResponse
from .setting_edit_response import SettingEditResponse as SettingEditResponse
+from .version_create_params import VersionCreateParams as VersionCreateParams
+from .version_list_response import VersionListResponse as VersionListResponse
from .schedule_update_params import ScheduleUpdateParams as ScheduleUpdateParams
+from .deployment_get_response import DeploymentGetResponse as DeploymentGetResponse
+from .version_create_response import VersionCreateResponse as VersionCreateResponse
+from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams
from .schedule_update_response import ScheduleUpdateResponse as ScheduleUpdateResponse
from .usage_model_get_response import UsageModelGetResponse as UsageModelGetResponse
from .usage_model_update_params import UsageModelUpdateParams as UsageModelUpdateParams
+from .deployment_create_response import DeploymentCreateResponse as DeploymentCreateResponse
from .usage_model_update_response import UsageModelUpdateResponse as UsageModelUpdateResponse
diff --git a/src/cloudflare/types/workers/scripts/deployment_create_params.py b/src/cloudflare/types/workers/scripts/deployment_create_params.py
new file mode 100644
index 00000000000..481024a36ca
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/deployment_create_params.py
@@ -0,0 +1,23 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, Annotated, TypedDict
+
+from ...._utils import PropertyInfo
+
+__all__ = ["DeploymentCreateParams", "Annotations"]
+
+
+class DeploymentCreateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Identifier"""
+
+ annotations: Annotations
+
+ strategy: str
+
+
+class Annotations(TypedDict, total=False):
+ workers_message: Annotated[str, PropertyInfo(alias="workers/message")]
+ """Human-readable message about the deployment."""
diff --git a/src/cloudflare/types/workers/scripts/deployment_create_response.py b/src/cloudflare/types/workers/scripts/deployment_create_response.py
new file mode 100644
index 00000000000..7097c17dd62
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/deployment_create_response.py
@@ -0,0 +1,28 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from pydantic import Field as FieldInfo
+
+from ...._models import BaseModel
+
+__all__ = ["DeploymentCreateResponse", "Annotations"]
+
+
+class Annotations(BaseModel):
+ workers_message: Optional[str] = FieldInfo(alias="workers/message", default=None)
+ """Human-readable message about the deployment."""
+
+
+class DeploymentCreateResponse(BaseModel):
+ id: Optional[str] = None
+
+ annotations: Optional[Annotations] = None
+
+ author_email: Optional[str] = None
+
+ created_on: Optional[str] = None
+
+ source: Optional[str] = None
+
+ strategy: Optional[str] = None
diff --git a/src/cloudflare/types/workers/scripts/deployment_get_response.py b/src/cloudflare/types/workers/scripts/deployment_get_response.py
new file mode 100644
index 00000000000..49b5a84b276
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/deployment_get_response.py
@@ -0,0 +1,32 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+
+from pydantic import Field as FieldInfo
+
+from ...._models import BaseModel
+
+__all__ = ["DeploymentGetResponse", "Deployment", "DeploymentAnnotations"]
+
+
+class DeploymentAnnotations(BaseModel):
+ workers_message: Optional[str] = FieldInfo(alias="workers/message", default=None)
+ """Human-readable message about the deployment."""
+
+
+class Deployment(BaseModel):
+ id: Optional[str] = None
+
+ annotations: Optional[DeploymentAnnotations] = None
+
+ author_email: Optional[str] = None
+
+ created_on: Optional[str] = None
+
+ source: Optional[str] = None
+
+ strategy: Optional[str] = None
+
+
+class DeploymentGetResponse(BaseModel):
+ deployments: Optional[List[Deployment]] = None
diff --git a/src/cloudflare/types/workers/scripts/setting_edit_params.py b/src/cloudflare/types/workers/scripts/setting_edit_params.py
index 08e4ef027ee..58a8cb9b9f9 100644
--- a/src/cloudflare/types/workers/scripts/setting_edit_params.py
+++ b/src/cloudflare/types/workers/scripts/setting_edit_params.py
@@ -2,287 +2,24 @@
from __future__ import annotations
-from typing import List, Union, Iterable
-from typing_extensions import Literal, Required, TypedDict
+from typing import Iterable
+from typing_extensions import Required, TypedDict
-__all__ = [
- "SettingEditParams",
- "Settings",
- "SettingsBinding",
- "SettingsBindingWorkersKVNamespaceBinding",
- "SettingsBindingWorkersServiceBinding",
- "SettingsBindingWorkersDoBinding",
- "SettingsBindingWorkersR2Binding",
- "SettingsBindingWorkersQueueBinding",
- "SettingsBindingWorkersD1Binding",
- "SettingsBindingWorkersDispatchNamespaceBinding",
- "SettingsBindingWorkersDispatchNamespaceBindingOutbound",
- "SettingsBindingWorkersDispatchNamespaceBindingOutboundWorker",
- "SettingsBindingWorkersMTLSCERTBinding",
- "SettingsMigrations",
- "SettingsMigrationsWorkersSingleStepMigrations",
- "SettingsMigrationsWorkersSingleStepMigrationsRenamedClass",
- "SettingsMigrationsWorkersSingleStepMigrationsTransferredClass",
- "SettingsMigrationsWorkersSteppedMigrations",
- "SettingsMigrationsWorkersSteppedMigrationsStep",
- "SettingsMigrationsWorkersSteppedMigrationsStepRenamedClass",
- "SettingsMigrationsWorkersSteppedMigrationsStepTransferredClass",
- "SettingsPlacement",
- "SettingsTailConsumer",
-]
+__all__ = ["SettingEditParams", "TailConsumer"]
class SettingEditParams(TypedDict, total=False):
account_id: Required[str]
"""Identifier"""
- settings: Settings
-
-
-class SettingsBindingWorkersKVNamespaceBinding(TypedDict, total=False):
- type: Required[Literal["kv_namespace"]]
- """The class of resource that the binding provides."""
-
-
-class SettingsBindingWorkersServiceBinding(TypedDict, total=False):
- environment: Required[str]
- """Optional environment if the Worker utilizes one."""
-
- service: Required[str]
- """Name of Worker to bind to"""
-
- type: Required[Literal["service"]]
- """The class of resource that the binding provides."""
-
-
-class SettingsBindingWorkersDoBinding(TypedDict, total=False):
- class_name: Required[str]
- """The exported class name of the Durable Object"""
-
- type: Required[Literal["durable_object_namespace"]]
- """The class of resource that the binding provides."""
-
- environment: str
- """The environment of the script_name to bind to"""
-
- script_name: str
- """
- The script where the Durable Object is defined, if it is external to this Worker
- """
-
-
-class SettingsBindingWorkersR2Binding(TypedDict, total=False):
- bucket_name: Required[str]
- """R2 bucket to bind to"""
-
- type: Required[Literal["r2_bucket"]]
- """The class of resource that the binding provides."""
-
-
-class SettingsBindingWorkersQueueBinding(TypedDict, total=False):
- queue_name: Required[str]
- """Name of the Queue to bind to"""
-
- type: Required[Literal["queue"]]
- """The class of resource that the binding provides."""
-
-
-class SettingsBindingWorkersD1Binding(TypedDict, total=False):
- id: Required[str]
- """ID of the D1 database to bind to"""
-
- name: Required[str]
- """The name of the D1 database associated with the 'id' provided."""
-
- type: Required[Literal["d1"]]
- """The class of resource that the binding provides."""
-
-
-class SettingsBindingWorkersDispatchNamespaceBindingOutboundWorker(TypedDict, total=False):
- environment: str
- """Environment of the outbound worker"""
-
- service: str
- """Name of the outbound worker"""
-
-
-class SettingsBindingWorkersDispatchNamespaceBindingOutbound(TypedDict, total=False):
- params: List[str]
- """
- Pass information from the Dispatch Worker to the Outbound Worker through the
- parameters
- """
-
- worker: SettingsBindingWorkersDispatchNamespaceBindingOutboundWorker
- """Outbound worker"""
-
-
-class SettingsBindingWorkersDispatchNamespaceBinding(TypedDict, total=False):
- namespace: Required[str]
- """Namespace to bind to"""
-
- type: Required[Literal["dispatch_namespace"]]
- """The class of resource that the binding provides."""
-
- outbound: SettingsBindingWorkersDispatchNamespaceBindingOutbound
- """Outbound worker"""
-
-
-class SettingsBindingWorkersMTLSCERTBinding(TypedDict, total=False):
- certificate: Required[object]
-
- type: Required[Literal["mtls_certificate"]]
- """The class of resource that the binding provides."""
-
- certificate_id: str
- """ID of the certificate to bind to"""
-
-
-SettingsBinding = Union[
- SettingsBindingWorkersKVNamespaceBinding,
- SettingsBindingWorkersServiceBinding,
- SettingsBindingWorkersDoBinding,
- SettingsBindingWorkersR2Binding,
- SettingsBindingWorkersQueueBinding,
- SettingsBindingWorkersD1Binding,
- SettingsBindingWorkersDispatchNamespaceBinding,
- SettingsBindingWorkersMTLSCERTBinding,
-]
-
-_SettingsMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict(
- "_SettingsMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords",
- {
- "from": str,
- },
- total=False,
-)
-
-
-class SettingsMigrationsWorkersSingleStepMigrationsRenamedClass(
- _SettingsMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False
-):
- to: str
-
-
-_SettingsMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict(
- "_SettingsMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords",
- {
- "from": str,
- },
- total=False,
-)
-
-
-class SettingsMigrationsWorkersSingleStepMigrationsTransferredClass(
- _SettingsMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False
-):
- from_script: str
-
- to: str
-
-
-class SettingsMigrationsWorkersSingleStepMigrations(TypedDict, total=False):
- deleted_classes: List[str]
- """A list of classes to delete Durable Object namespaces from."""
-
- new_classes: List[str]
- """A list of classes to create Durable Object namespaces from."""
-
- 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.
- """
-
- renamed_classes: Iterable[SettingsMigrationsWorkersSingleStepMigrationsRenamedClass]
- """A list of classes with Durable Object namespaces that were renamed."""
-
- transferred_classes: Iterable[SettingsMigrationsWorkersSingleStepMigrationsTransferredClass]
- """
- A list of transfers for Durable Object namespaces from a different Worker and
- class to a class defined in this Worker.
- """
-
-
-_SettingsMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict(
- "_SettingsMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords",
- {
- "from": str,
- },
- total=False,
-)
-
-
-class SettingsMigrationsWorkersSteppedMigrationsStepRenamedClass(
- _SettingsMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False
-):
- to: str
-
-
-_SettingsMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict(
- "_SettingsMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords",
- {
- "from": str,
- },
- total=False,
-)
-
-
-class SettingsMigrationsWorkersSteppedMigrationsStepTransferredClass(
- _SettingsMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False
-):
- from_script: str
-
- to: str
-
-
-class SettingsMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False):
- deleted_classes: List[str]
- """A list of classes to delete Durable Object namespaces from."""
-
- new_classes: List[str]
- """A list of classes to create Durable Object namespaces from."""
-
- renamed_classes: Iterable[SettingsMigrationsWorkersSteppedMigrationsStepRenamedClass]
- """A list of classes with Durable Object namespaces that were renamed."""
-
- transferred_classes: Iterable[SettingsMigrationsWorkersSteppedMigrationsStepTransferredClass]
- """
- A list of transfers for Durable Object namespaces from a different Worker and
- class to a class defined in this Worker.
- """
-
-
-class SettingsMigrationsWorkersSteppedMigrations(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[SettingsMigrationsWorkersSteppedMigrationsStep]
- """Migrations to apply in order."""
-
-
-SettingsMigrations = Union[SettingsMigrationsWorkersSingleStepMigrations, SettingsMigrationsWorkersSteppedMigrations]
-
+ logpush: bool
+ """Whether Logpush is turned on for the Worker."""
-class SettingsPlacement(TypedDict, total=False):
- mode: Literal["smart"]
- """
- Enables
- [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- Only `"smart"` is currently supported
- """
+ tail_consumers: Iterable[TailConsumer]
+ """List of Workers that will consume logs from the attached Worker."""
-class SettingsTailConsumer(TypedDict, total=False):
+class TailConsumer(TypedDict, total=False):
service: Required[str]
"""Name of Worker that is to be the consumer."""
@@ -291,31 +28,3 @@ class SettingsTailConsumer(TypedDict, total=False):
namespace: str
"""Optional dispatch namespace the script belongs to."""
-
-
-class Settings(TypedDict, total=False):
- bindings: Iterable[SettingsBinding]
- """List of bindings attached to this Worker"""
-
- compatibility_date: str
- """Opt your Worker into changes after this date"""
-
- compatibility_flags: List[str]
- """Opt your Worker into specific changes"""
-
- logpush: bool
- """Whether Logpush is turned on for the Worker."""
-
- migrations: SettingsMigrations
- """Migrations to apply for Durable Objects associated with this Worker."""
-
- placement: SettingsPlacement
-
- tags: List[str]
- """Tags to help you manage your Workers"""
-
- tail_consumers: Iterable[SettingsTailConsumer]
- """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')."""
diff --git a/src/cloudflare/types/workers/scripts/setting_edit_response.py b/src/cloudflare/types/workers/scripts/setting_edit_response.py
index 03bca5bece7..c19e997f2ea 100644
--- a/src/cloudflare/types/workers/scripts/setting_edit_response.py
+++ b/src/cloudflare/types/workers/scripts/setting_edit_response.py
@@ -1,274 +1,10 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List, Union, Optional
-from typing_extensions import Literal
-
-from pydantic import Field as FieldInfo
+from typing import List, Optional
from ...._models import BaseModel
-__all__ = [
- "SettingEditResponse",
- "Binding",
- "BindingWorkersKVNamespaceBinding",
- "BindingWorkersServiceBinding",
- "BindingWorkersDoBinding",
- "BindingWorkersR2Binding",
- "BindingWorkersQueueBinding",
- "BindingWorkersD1Binding",
- "BindingWorkersDispatchNamespaceBinding",
- "BindingWorkersDispatchNamespaceBindingOutbound",
- "BindingWorkersDispatchNamespaceBindingOutboundWorker",
- "BindingWorkersMTLSCERTBinding",
- "Migrations",
- "MigrationsWorkersSingleStepMigrations",
- "MigrationsWorkersSingleStepMigrationsRenamedClass",
- "MigrationsWorkersSingleStepMigrationsTransferredClass",
- "MigrationsWorkersSteppedMigrations",
- "MigrationsWorkersSteppedMigrationsStep",
- "MigrationsWorkersSteppedMigrationsStepRenamedClass",
- "MigrationsWorkersSteppedMigrationsStepTransferredClass",
- "Placement",
- "TailConsumer",
-]
-
-
-class BindingWorkersKVNamespaceBinding(BaseModel):
- name: str
- """A JavaScript variable name for the binding."""
-
- namespace_id: str
- """Namespace identifier tag."""
-
- type: Literal["kv_namespace"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersServiceBinding(BaseModel):
- environment: str
- """Optional environment if the Worker utilizes one."""
-
- name: str
- """A JavaScript variable name for the binding."""
-
- service: str
- """Name of Worker to bind to"""
-
- type: Literal["service"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersDoBinding(BaseModel):
- class_name: str
- """The exported class name of the Durable Object"""
-
- name: str
- """A JavaScript variable name for the binding."""
-
- type: Literal["durable_object_namespace"]
- """The class of resource that the binding provides."""
-
- environment: Optional[str] = None
- """The environment of the script_name to bind to"""
-
- namespace_id: Optional[str] = None
- """Namespace identifier tag."""
-
- script_name: Optional[str] = None
- """
- The script where the Durable Object is defined, if it is external to this Worker
- """
-
-
-class BindingWorkersR2Binding(BaseModel):
- bucket_name: str
- """R2 bucket to bind to"""
-
- name: str
- """A JavaScript variable name for the binding."""
-
- type: Literal["r2_bucket"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersQueueBinding(BaseModel):
- name: str
- """A JavaScript variable name for the binding."""
-
- queue_name: str
- """Name of the Queue to bind to"""
-
- type: Literal["queue"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersD1Binding(BaseModel):
- id: str
- """ID of the D1 database to bind to"""
-
- binding: str
- """A JavaScript variable name for the binding."""
-
- name: str
- """The name of the D1 database associated with the 'id' provided."""
-
- type: Literal["d1"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel):
- environment: Optional[str] = None
- """Environment of the outbound worker"""
-
- service: Optional[str] = None
- """Name of the outbound worker"""
-
-
-class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel):
- params: Optional[List[str]] = None
- """
- Pass information from the Dispatch Worker to the Outbound Worker through the
- parameters
- """
-
- worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None
- """Outbound worker"""
-
-
-class BindingWorkersDispatchNamespaceBinding(BaseModel):
- name: str
- """A JavaScript variable name for the binding."""
-
- namespace: str
- """Namespace to bind to"""
-
- type: Literal["dispatch_namespace"]
- """The class of resource that the binding provides."""
-
- outbound: Optional[BindingWorkersDispatchNamespaceBindingOutbound] = None
- """Outbound worker"""
-
-
-class BindingWorkersMTLSCERTBinding(BaseModel):
- certificate: object
-
- name: str
- """A JavaScript variable name for the binding."""
-
- type: Literal["mtls_certificate"]
- """The class of resource that the binding provides."""
-
- certificate_id: Optional[str] = None
- """ID of the certificate to bind to"""
-
-
-Binding = Union[
- BindingWorkersKVNamespaceBinding,
- BindingWorkersServiceBinding,
- BindingWorkersDoBinding,
- BindingWorkersR2Binding,
- BindingWorkersQueueBinding,
- BindingWorkersD1Binding,
- BindingWorkersDispatchNamespaceBinding,
- BindingWorkersMTLSCERTBinding,
-]
-
-
-class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- from_script: Optional[str] = None
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSingleStepMigrations(BaseModel):
- deleted_classes: Optional[List[str]] = None
- """A list of classes to delete Durable Object namespaces from."""
-
- new_classes: Optional[List[str]] = None
- """A list of classes to create Durable Object namespaces from."""
-
- 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.
- """
-
- renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None
- """A list of classes with Durable Object namespaces that were renamed."""
-
- transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None
- """
- A list of transfers for Durable Object namespaces from a different Worker and
- class to a class defined in this Worker.
- """
-
-
-class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- from_script: Optional[str] = None
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSteppedMigrationsStep(BaseModel):
- deleted_classes: Optional[List[str]] = None
- """A list of classes to delete Durable Object namespaces from."""
-
- new_classes: Optional[List[str]] = None
- """A list of classes to create Durable Object namespaces from."""
-
- renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None
- """A list of classes with Durable Object namespaces that were renamed."""
-
- transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None
- """
- A list of transfers for Durable Object namespaces from a different Worker and
- class to a class defined in this Worker.
- """
-
-
-class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None
- """Migrations to apply in order."""
-
-
-Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations]
-
-
-class Placement(BaseModel):
- mode: Optional[Literal["smart"]] = None
- """
- Enables
- [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- Only `"smart"` is currently supported
- """
+__all__ = ["SettingEditResponse", "TailConsumer"]
class TailConsumer(BaseModel):
@@ -283,28 +19,8 @@ class TailConsumer(BaseModel):
class SettingEditResponse(BaseModel):
- bindings: Optional[List[Binding]] = None
- """List of bindings attached to this Worker"""
-
- compatibility_date: Optional[str] = None
- """Opt your Worker into changes after this date"""
-
- compatibility_flags: Optional[List[str]] = None
- """Opt your Worker into specific changes"""
-
logpush: Optional[bool] = None
"""Whether Logpush is turned on for the Worker."""
- migrations: Optional[Migrations] = None
- """Migrations to apply for Durable Objects associated with this Worker."""
-
- placement: Optional[Placement] = None
-
- tags: Optional[List[str]] = None
- """Tags to help you manage your Workers"""
-
tail_consumers: Optional[List[TailConsumer]] = 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')."""
diff --git a/src/cloudflare/types/workers/scripts/setting_get_response.py b/src/cloudflare/types/workers/scripts/setting_get_response.py
index 3a6b1c029c3..2228a7d6d91 100644
--- a/src/cloudflare/types/workers/scripts/setting_get_response.py
+++ b/src/cloudflare/types/workers/scripts/setting_get_response.py
@@ -1,274 +1,10 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List, Union, Optional
-from typing_extensions import Literal
-
-from pydantic import Field as FieldInfo
+from typing import List, Optional
from ...._models import BaseModel
-__all__ = [
- "SettingGetResponse",
- "Binding",
- "BindingWorkersKVNamespaceBinding",
- "BindingWorkersServiceBinding",
- "BindingWorkersDoBinding",
- "BindingWorkersR2Binding",
- "BindingWorkersQueueBinding",
- "BindingWorkersD1Binding",
- "BindingWorkersDispatchNamespaceBinding",
- "BindingWorkersDispatchNamespaceBindingOutbound",
- "BindingWorkersDispatchNamespaceBindingOutboundWorker",
- "BindingWorkersMTLSCERTBinding",
- "Migrations",
- "MigrationsWorkersSingleStepMigrations",
- "MigrationsWorkersSingleStepMigrationsRenamedClass",
- "MigrationsWorkersSingleStepMigrationsTransferredClass",
- "MigrationsWorkersSteppedMigrations",
- "MigrationsWorkersSteppedMigrationsStep",
- "MigrationsWorkersSteppedMigrationsStepRenamedClass",
- "MigrationsWorkersSteppedMigrationsStepTransferredClass",
- "Placement",
- "TailConsumer",
-]
-
-
-class BindingWorkersKVNamespaceBinding(BaseModel):
- name: str
- """A JavaScript variable name for the binding."""
-
- namespace_id: str
- """Namespace identifier tag."""
-
- type: Literal["kv_namespace"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersServiceBinding(BaseModel):
- environment: str
- """Optional environment if the Worker utilizes one."""
-
- name: str
- """A JavaScript variable name for the binding."""
-
- service: str
- """Name of Worker to bind to"""
-
- type: Literal["service"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersDoBinding(BaseModel):
- class_name: str
- """The exported class name of the Durable Object"""
-
- name: str
- """A JavaScript variable name for the binding."""
-
- type: Literal["durable_object_namespace"]
- """The class of resource that the binding provides."""
-
- environment: Optional[str] = None
- """The environment of the script_name to bind to"""
-
- namespace_id: Optional[str] = None
- """Namespace identifier tag."""
-
- script_name: Optional[str] = None
- """
- The script where the Durable Object is defined, if it is external to this Worker
- """
-
-
-class BindingWorkersR2Binding(BaseModel):
- bucket_name: str
- """R2 bucket to bind to"""
-
- name: str
- """A JavaScript variable name for the binding."""
-
- type: Literal["r2_bucket"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersQueueBinding(BaseModel):
- name: str
- """A JavaScript variable name for the binding."""
-
- queue_name: str
- """Name of the Queue to bind to"""
-
- type: Literal["queue"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersD1Binding(BaseModel):
- id: str
- """ID of the D1 database to bind to"""
-
- binding: str
- """A JavaScript variable name for the binding."""
-
- name: str
- """The name of the D1 database associated with the 'id' provided."""
-
- type: Literal["d1"]
- """The class of resource that the binding provides."""
-
-
-class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel):
- environment: Optional[str] = None
- """Environment of the outbound worker"""
-
- service: Optional[str] = None
- """Name of the outbound worker"""
-
-
-class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel):
- params: Optional[List[str]] = None
- """
- Pass information from the Dispatch Worker to the Outbound Worker through the
- parameters
- """
-
- worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None
- """Outbound worker"""
-
-
-class BindingWorkersDispatchNamespaceBinding(BaseModel):
- name: str
- """A JavaScript variable name for the binding."""
-
- namespace: str
- """Namespace to bind to"""
-
- type: Literal["dispatch_namespace"]
- """The class of resource that the binding provides."""
-
- outbound: Optional[BindingWorkersDispatchNamespaceBindingOutbound] = None
- """Outbound worker"""
-
-
-class BindingWorkersMTLSCERTBinding(BaseModel):
- certificate: object
-
- name: str
- """A JavaScript variable name for the binding."""
-
- type: Literal["mtls_certificate"]
- """The class of resource that the binding provides."""
-
- certificate_id: Optional[str] = None
- """ID of the certificate to bind to"""
-
-
-Binding = Union[
- BindingWorkersKVNamespaceBinding,
- BindingWorkersServiceBinding,
- BindingWorkersDoBinding,
- BindingWorkersR2Binding,
- BindingWorkersQueueBinding,
- BindingWorkersD1Binding,
- BindingWorkersDispatchNamespaceBinding,
- BindingWorkersMTLSCERTBinding,
-]
-
-
-class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- from_script: Optional[str] = None
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSingleStepMigrations(BaseModel):
- deleted_classes: Optional[List[str]] = None
- """A list of classes to delete Durable Object namespaces from."""
-
- new_classes: Optional[List[str]] = None
- """A list of classes to create Durable Object namespaces from."""
-
- 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.
- """
-
- renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None
- """A list of classes with Durable Object namespaces that were renamed."""
-
- transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None
- """
- A list of transfers for Durable Object namespaces from a different Worker and
- class to a class defined in this Worker.
- """
-
-
-class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel):
- from_: Optional[str] = FieldInfo(alias="from", default=None)
-
- from_script: Optional[str] = None
-
- to: Optional[str] = None
-
-
-class MigrationsWorkersSteppedMigrationsStep(BaseModel):
- deleted_classes: Optional[List[str]] = None
- """A list of classes to delete Durable Object namespaces from."""
-
- new_classes: Optional[List[str]] = None
- """A list of classes to create Durable Object namespaces from."""
-
- renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None
- """A list of classes with Durable Object namespaces that were renamed."""
-
- transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None
- """
- A list of transfers for Durable Object namespaces from a different Worker and
- class to a class defined in this Worker.
- """
-
-
-class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None
- """Migrations to apply in order."""
-
-
-Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations]
-
-
-class Placement(BaseModel):
- mode: Optional[Literal["smart"]] = None
- """
- Enables
- [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
- Only `"smart"` is currently supported
- """
+__all__ = ["SettingGetResponse", "TailConsumer"]
class TailConsumer(BaseModel):
@@ -283,28 +19,8 @@ class TailConsumer(BaseModel):
class SettingGetResponse(BaseModel):
- bindings: Optional[List[Binding]] = None
- """List of bindings attached to this Worker"""
-
- compatibility_date: Optional[str] = None
- """Opt your Worker into changes after this date"""
-
- compatibility_flags: Optional[List[str]] = None
- """Opt your Worker into specific changes"""
-
logpush: Optional[bool] = None
"""Whether Logpush is turned on for the Worker."""
- migrations: Optional[Migrations] = None
- """Migrations to apply for Durable Objects associated with this Worker."""
-
- placement: Optional[Placement] = None
-
- tags: Optional[List[str]] = None
- """Tags to help you manage your Workers"""
-
tail_consumers: Optional[List[TailConsumer]] = 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')."""
diff --git a/src/cloudflare/types/workers/scripts/version_create_params.py b/src/cloudflare/types/workers/scripts/version_create_params.py
new file mode 100644
index 00000000000..3a488701355
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/version_create_params.py
@@ -0,0 +1,67 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+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"]
+
+
+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
+ """JSON encoded metadata about the uploaded parts and Worker configuration."""
+
+
+class MetadataAnnotations(TypedDict, total=False):
+ workers_message: Annotated[str, PropertyInfo(alias="workers/message")]
+ """Human-readable message about the version."""
+
+ workers_tag: Annotated[str, PropertyInfo(alias="workers/tag")]
+ """User-provided identifier for the version."""
+
+
+class Metadata(TypedDict, total=False):
+ annotations: MetadataAnnotations
+
+ bindings: Iterable[object]
+ """List of bindings available to the worker."""
+
+ compatibility_date: str
+ """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]
+ """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`.
+ """
+
+ keep_bindings: List[str]
+ """List of binding types to keep from previous_upload."""
+
+ main_module: str
+ """Name of the part in the multipart request that contains the main module (e.g.
+
+ the file exporting a `fetch` handler). Indicates a `module syntax` Worker.
+ """
+
+ usage_model: Literal["standard"]
+ """Usage model to apply to invocations."""
diff --git a/src/cloudflare/types/workers/scripts/version_create_response.py b/src/cloudflare/types/workers/scripts/version_create_response.py
new file mode 100644
index 00000000000..75e17d7f44f
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/version_create_response.py
@@ -0,0 +1,17 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ...._models import BaseModel
+
+__all__ = ["VersionCreateResponse"]
+
+
+class VersionCreateResponse(BaseModel):
+ resources: object
+
+ id: Optional[str] = None
+
+ metadata: Optional[object] = None
+
+ number: Optional[float] = None
diff --git a/src/cloudflare/types/workers/scripts/version_get_response.py b/src/cloudflare/types/workers/scripts/version_get_response.py
new file mode 100644
index 00000000000..9a0dbd121eb
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/version_get_response.py
@@ -0,0 +1,17 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ...._models import BaseModel
+
+__all__ = ["VersionGetResponse"]
+
+
+class VersionGetResponse(BaseModel):
+ resources: object
+
+ id: Optional[str] = None
+
+ metadata: Optional[object] = None
+
+ number: Optional[float] = None
diff --git a/src/cloudflare/types/workers/scripts/version_list_response.py b/src/cloudflare/types/workers/scripts/version_list_response.py
new file mode 100644
index 00000000000..fd3de314931
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/version_list_response.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+
+from ...._models import BaseModel
+
+__all__ = ["VersionListResponse", "Item"]
+
+
+class Item(BaseModel):
+ id: Optional[str] = None
+
+ metadata: Optional[object] = None
+
+ number: Optional[float] = None
+
+
+class VersionListResponse(BaseModel):
+ items: Optional[List[Item]] = None
diff --git a/src/cloudflare/types/workers/scripts/versions/__init__.py b/src/cloudflare/types/workers/scripts/versions/__init__.py
new file mode 100644
index 00000000000..5f94854af3c
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/versions/__init__.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .setting_edit_params import SettingEditParams as SettingEditParams
+from .setting_get_response import SettingGetResponse as SettingGetResponse
+from .setting_edit_response import SettingEditResponse as SettingEditResponse
diff --git a/src/cloudflare/types/workers/scripts/versions/setting_edit_params.py b/src/cloudflare/types/workers/scripts/versions/setting_edit_params.py
new file mode 100644
index 00000000000..08e4ef027ee
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/versions/setting_edit_params.py
@@ -0,0 +1,321 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Union, Iterable
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = [
+ "SettingEditParams",
+ "Settings",
+ "SettingsBinding",
+ "SettingsBindingWorkersKVNamespaceBinding",
+ "SettingsBindingWorkersServiceBinding",
+ "SettingsBindingWorkersDoBinding",
+ "SettingsBindingWorkersR2Binding",
+ "SettingsBindingWorkersQueueBinding",
+ "SettingsBindingWorkersD1Binding",
+ "SettingsBindingWorkersDispatchNamespaceBinding",
+ "SettingsBindingWorkersDispatchNamespaceBindingOutbound",
+ "SettingsBindingWorkersDispatchNamespaceBindingOutboundWorker",
+ "SettingsBindingWorkersMTLSCERTBinding",
+ "SettingsMigrations",
+ "SettingsMigrationsWorkersSingleStepMigrations",
+ "SettingsMigrationsWorkersSingleStepMigrationsRenamedClass",
+ "SettingsMigrationsWorkersSingleStepMigrationsTransferredClass",
+ "SettingsMigrationsWorkersSteppedMigrations",
+ "SettingsMigrationsWorkersSteppedMigrationsStep",
+ "SettingsMigrationsWorkersSteppedMigrationsStepRenamedClass",
+ "SettingsMigrationsWorkersSteppedMigrationsStepTransferredClass",
+ "SettingsPlacement",
+ "SettingsTailConsumer",
+]
+
+
+class SettingEditParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Identifier"""
+
+ settings: Settings
+
+
+class SettingsBindingWorkersKVNamespaceBinding(TypedDict, total=False):
+ type: Required[Literal["kv_namespace"]]
+ """The class of resource that the binding provides."""
+
+
+class SettingsBindingWorkersServiceBinding(TypedDict, total=False):
+ environment: Required[str]
+ """Optional environment if the Worker utilizes one."""
+
+ service: Required[str]
+ """Name of Worker to bind to"""
+
+ type: Required[Literal["service"]]
+ """The class of resource that the binding provides."""
+
+
+class SettingsBindingWorkersDoBinding(TypedDict, total=False):
+ class_name: Required[str]
+ """The exported class name of the Durable Object"""
+
+ type: Required[Literal["durable_object_namespace"]]
+ """The class of resource that the binding provides."""
+
+ environment: str
+ """The environment of the script_name to bind to"""
+
+ script_name: str
+ """
+ The script where the Durable Object is defined, if it is external to this Worker
+ """
+
+
+class SettingsBindingWorkersR2Binding(TypedDict, total=False):
+ bucket_name: Required[str]
+ """R2 bucket to bind to"""
+
+ type: Required[Literal["r2_bucket"]]
+ """The class of resource that the binding provides."""
+
+
+class SettingsBindingWorkersQueueBinding(TypedDict, total=False):
+ queue_name: Required[str]
+ """Name of the Queue to bind to"""
+
+ type: Required[Literal["queue"]]
+ """The class of resource that the binding provides."""
+
+
+class SettingsBindingWorkersD1Binding(TypedDict, total=False):
+ id: Required[str]
+ """ID of the D1 database to bind to"""
+
+ name: Required[str]
+ """The name of the D1 database associated with the 'id' provided."""
+
+ type: Required[Literal["d1"]]
+ """The class of resource that the binding provides."""
+
+
+class SettingsBindingWorkersDispatchNamespaceBindingOutboundWorker(TypedDict, total=False):
+ environment: str
+ """Environment of the outbound worker"""
+
+ service: str
+ """Name of the outbound worker"""
+
+
+class SettingsBindingWorkersDispatchNamespaceBindingOutbound(TypedDict, total=False):
+ params: List[str]
+ """
+ Pass information from the Dispatch Worker to the Outbound Worker through the
+ parameters
+ """
+
+ worker: SettingsBindingWorkersDispatchNamespaceBindingOutboundWorker
+ """Outbound worker"""
+
+
+class SettingsBindingWorkersDispatchNamespaceBinding(TypedDict, total=False):
+ namespace: Required[str]
+ """Namespace to bind to"""
+
+ type: Required[Literal["dispatch_namespace"]]
+ """The class of resource that the binding provides."""
+
+ outbound: SettingsBindingWorkersDispatchNamespaceBindingOutbound
+ """Outbound worker"""
+
+
+class SettingsBindingWorkersMTLSCERTBinding(TypedDict, total=False):
+ certificate: Required[object]
+
+ type: Required[Literal["mtls_certificate"]]
+ """The class of resource that the binding provides."""
+
+ certificate_id: str
+ """ID of the certificate to bind to"""
+
+
+SettingsBinding = Union[
+ SettingsBindingWorkersKVNamespaceBinding,
+ SettingsBindingWorkersServiceBinding,
+ SettingsBindingWorkersDoBinding,
+ SettingsBindingWorkersR2Binding,
+ SettingsBindingWorkersQueueBinding,
+ SettingsBindingWorkersD1Binding,
+ SettingsBindingWorkersDispatchNamespaceBinding,
+ SettingsBindingWorkersMTLSCERTBinding,
+]
+
+_SettingsMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords = TypedDict(
+ "_SettingsMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords",
+ {
+ "from": str,
+ },
+ total=False,
+)
+
+
+class SettingsMigrationsWorkersSingleStepMigrationsRenamedClass(
+ _SettingsMigrationsWorkersSingleStepMigrationsRenamedClassReservedKeywords, total=False
+):
+ to: str
+
+
+_SettingsMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords = TypedDict(
+ "_SettingsMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords",
+ {
+ "from": str,
+ },
+ total=False,
+)
+
+
+class SettingsMigrationsWorkersSingleStepMigrationsTransferredClass(
+ _SettingsMigrationsWorkersSingleStepMigrationsTransferredClassReservedKeywords, total=False
+):
+ from_script: str
+
+ to: str
+
+
+class SettingsMigrationsWorkersSingleStepMigrations(TypedDict, total=False):
+ deleted_classes: List[str]
+ """A list of classes to delete Durable Object namespaces from."""
+
+ new_classes: List[str]
+ """A list of classes to create Durable Object namespaces from."""
+
+ 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.
+ """
+
+ renamed_classes: Iterable[SettingsMigrationsWorkersSingleStepMigrationsRenamedClass]
+ """A list of classes with Durable Object namespaces that were renamed."""
+
+ transferred_classes: Iterable[SettingsMigrationsWorkersSingleStepMigrationsTransferredClass]
+ """
+ A list of transfers for Durable Object namespaces from a different Worker and
+ class to a class defined in this Worker.
+ """
+
+
+_SettingsMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords = TypedDict(
+ "_SettingsMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords",
+ {
+ "from": str,
+ },
+ total=False,
+)
+
+
+class SettingsMigrationsWorkersSteppedMigrationsStepRenamedClass(
+ _SettingsMigrationsWorkersSteppedMigrationsStepRenamedClassReservedKeywords, total=False
+):
+ to: str
+
+
+_SettingsMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords = TypedDict(
+ "_SettingsMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords",
+ {
+ "from": str,
+ },
+ total=False,
+)
+
+
+class SettingsMigrationsWorkersSteppedMigrationsStepTransferredClass(
+ _SettingsMigrationsWorkersSteppedMigrationsStepTransferredClassReservedKeywords, total=False
+):
+ from_script: str
+
+ to: str
+
+
+class SettingsMigrationsWorkersSteppedMigrationsStep(TypedDict, total=False):
+ deleted_classes: List[str]
+ """A list of classes to delete Durable Object namespaces from."""
+
+ new_classes: List[str]
+ """A list of classes to create Durable Object namespaces from."""
+
+ renamed_classes: Iterable[SettingsMigrationsWorkersSteppedMigrationsStepRenamedClass]
+ """A list of classes with Durable Object namespaces that were renamed."""
+
+ transferred_classes: Iterable[SettingsMigrationsWorkersSteppedMigrationsStepTransferredClass]
+ """
+ A list of transfers for Durable Object namespaces from a different Worker and
+ class to a class defined in this Worker.
+ """
+
+
+class SettingsMigrationsWorkersSteppedMigrations(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[SettingsMigrationsWorkersSteppedMigrationsStep]
+ """Migrations to apply in order."""
+
+
+SettingsMigrations = Union[SettingsMigrationsWorkersSingleStepMigrations, SettingsMigrationsWorkersSteppedMigrations]
+
+
+class SettingsPlacement(TypedDict, total=False):
+ mode: Literal["smart"]
+ """
+ Enables
+ [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
+ Only `"smart"` is currently supported
+ """
+
+
+class SettingsTailConsumer(TypedDict, total=False):
+ service: Required[str]
+ """Name of Worker that is to be the consumer."""
+
+ environment: str
+ """Optional environment if the Worker utilizes one."""
+
+ namespace: str
+ """Optional dispatch namespace the script belongs to."""
+
+
+class Settings(TypedDict, total=False):
+ bindings: Iterable[SettingsBinding]
+ """List of bindings attached to this Worker"""
+
+ compatibility_date: str
+ """Opt your Worker into changes after this date"""
+
+ compatibility_flags: List[str]
+ """Opt your Worker into specific changes"""
+
+ logpush: bool
+ """Whether Logpush is turned on for the Worker."""
+
+ migrations: SettingsMigrations
+ """Migrations to apply for Durable Objects associated with this Worker."""
+
+ placement: SettingsPlacement
+
+ tags: List[str]
+ """Tags to help you manage your Workers"""
+
+ tail_consumers: Iterable[SettingsTailConsumer]
+ """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')."""
diff --git a/src/cloudflare/types/workers/scripts/versions/setting_edit_response.py b/src/cloudflare/types/workers/scripts/versions/setting_edit_response.py
new file mode 100644
index 00000000000..19bbf960f0e
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/versions/setting_edit_response.py
@@ -0,0 +1,310 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Union, Optional
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from ....._models import BaseModel
+
+__all__ = [
+ "SettingEditResponse",
+ "Binding",
+ "BindingWorkersKVNamespaceBinding",
+ "BindingWorkersServiceBinding",
+ "BindingWorkersDoBinding",
+ "BindingWorkersR2Binding",
+ "BindingWorkersQueueBinding",
+ "BindingWorkersD1Binding",
+ "BindingWorkersDispatchNamespaceBinding",
+ "BindingWorkersDispatchNamespaceBindingOutbound",
+ "BindingWorkersDispatchNamespaceBindingOutboundWorker",
+ "BindingWorkersMTLSCERTBinding",
+ "Migrations",
+ "MigrationsWorkersSingleStepMigrations",
+ "MigrationsWorkersSingleStepMigrationsRenamedClass",
+ "MigrationsWorkersSingleStepMigrationsTransferredClass",
+ "MigrationsWorkersSteppedMigrations",
+ "MigrationsWorkersSteppedMigrationsStep",
+ "MigrationsWorkersSteppedMigrationsStepRenamedClass",
+ "MigrationsWorkersSteppedMigrationsStepTransferredClass",
+ "Placement",
+ "TailConsumer",
+]
+
+
+class BindingWorkersKVNamespaceBinding(BaseModel):
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ namespace_id: str
+ """Namespace identifier tag."""
+
+ type: Literal["kv_namespace"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersServiceBinding(BaseModel):
+ environment: str
+ """Optional environment if the Worker utilizes one."""
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ service: str
+ """Name of Worker to bind to"""
+
+ type: Literal["service"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersDoBinding(BaseModel):
+ class_name: str
+ """The exported class name of the Durable Object"""
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ type: Literal["durable_object_namespace"]
+ """The class of resource that the binding provides."""
+
+ environment: Optional[str] = None
+ """The environment of the script_name to bind to"""
+
+ namespace_id: Optional[str] = None
+ """Namespace identifier tag."""
+
+ script_name: Optional[str] = None
+ """
+ The script where the Durable Object is defined, if it is external to this Worker
+ """
+
+
+class BindingWorkersR2Binding(BaseModel):
+ bucket_name: str
+ """R2 bucket to bind to"""
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ type: Literal["r2_bucket"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersQueueBinding(BaseModel):
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ queue_name: str
+ """Name of the Queue to bind to"""
+
+ type: Literal["queue"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersD1Binding(BaseModel):
+ id: str
+ """ID of the D1 database to bind to"""
+
+ binding: str
+ """A JavaScript variable name for the binding."""
+
+ name: str
+ """The name of the D1 database associated with the 'id' provided."""
+
+ type: Literal["d1"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel):
+ environment: Optional[str] = None
+ """Environment of the outbound worker"""
+
+ service: Optional[str] = None
+ """Name of the outbound worker"""
+
+
+class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel):
+ params: Optional[List[str]] = None
+ """
+ Pass information from the Dispatch Worker to the Outbound Worker through the
+ parameters
+ """
+
+ worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None
+ """Outbound worker"""
+
+
+class BindingWorkersDispatchNamespaceBinding(BaseModel):
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ namespace: str
+ """Namespace to bind to"""
+
+ type: Literal["dispatch_namespace"]
+ """The class of resource that the binding provides."""
+
+ outbound: Optional[BindingWorkersDispatchNamespaceBindingOutbound] = None
+ """Outbound worker"""
+
+
+class BindingWorkersMTLSCERTBinding(BaseModel):
+ certificate: object
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ type: Literal["mtls_certificate"]
+ """The class of resource that the binding provides."""
+
+ certificate_id: Optional[str] = None
+ """ID of the certificate to bind to"""
+
+
+Binding = Union[
+ BindingWorkersKVNamespaceBinding,
+ BindingWorkersServiceBinding,
+ BindingWorkersDoBinding,
+ BindingWorkersR2Binding,
+ BindingWorkersQueueBinding,
+ BindingWorkersD1Binding,
+ BindingWorkersDispatchNamespaceBinding,
+ BindingWorkersMTLSCERTBinding,
+]
+
+
+class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ from_script: Optional[str] = None
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSingleStepMigrations(BaseModel):
+ deleted_classes: Optional[List[str]] = None
+ """A list of classes to delete Durable Object namespaces from."""
+
+ new_classes: Optional[List[str]] = None
+ """A list of classes to create Durable Object namespaces from."""
+
+ 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.
+ """
+
+ renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None
+ """A list of classes with Durable Object namespaces that were renamed."""
+
+ transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None
+ """
+ A list of transfers for Durable Object namespaces from a different Worker and
+ class to a class defined in this Worker.
+ """
+
+
+class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ from_script: Optional[str] = None
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSteppedMigrationsStep(BaseModel):
+ deleted_classes: Optional[List[str]] = None
+ """A list of classes to delete Durable Object namespaces from."""
+
+ new_classes: Optional[List[str]] = None
+ """A list of classes to create Durable Object namespaces from."""
+
+ renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None
+ """A list of classes with Durable Object namespaces that were renamed."""
+
+ transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None
+ """
+ A list of transfers for Durable Object namespaces from a different Worker and
+ class to a class defined in this Worker.
+ """
+
+
+class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None
+ """Migrations to apply in order."""
+
+
+Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations]
+
+
+class Placement(BaseModel):
+ mode: Optional[Literal["smart"]] = None
+ """
+ Enables
+ [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
+ Only `"smart"` is currently supported
+ """
+
+
+class TailConsumer(BaseModel):
+ service: str
+ """Name of Worker that is to be the consumer."""
+
+ environment: Optional[str] = None
+ """Optional environment if the Worker utilizes one."""
+
+ namespace: Optional[str] = None
+ """Optional dispatch namespace the script belongs to."""
+
+
+class SettingEditResponse(BaseModel):
+ bindings: Optional[List[Binding]] = None
+ """List of bindings attached to this Worker"""
+
+ compatibility_date: Optional[str] = None
+ """Opt your Worker into changes after this date"""
+
+ compatibility_flags: Optional[List[str]] = None
+ """Opt your Worker into specific changes"""
+
+ logpush: Optional[bool] = None
+ """Whether Logpush is turned on for the Worker."""
+
+ migrations: Optional[Migrations] = None
+ """Migrations to apply for Durable Objects associated with this Worker."""
+
+ placement: Optional[Placement] = None
+
+ tags: Optional[List[str]] = None
+ """Tags to help you manage your Workers"""
+
+ tail_consumers: Optional[List[TailConsumer]] = 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')."""
diff --git a/src/cloudflare/types/workers/scripts/versions/setting_get_response.py b/src/cloudflare/types/workers/scripts/versions/setting_get_response.py
new file mode 100644
index 00000000000..fb1db345a37
--- /dev/null
+++ b/src/cloudflare/types/workers/scripts/versions/setting_get_response.py
@@ -0,0 +1,310 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Union, Optional
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from ....._models import BaseModel
+
+__all__ = [
+ "SettingGetResponse",
+ "Binding",
+ "BindingWorkersKVNamespaceBinding",
+ "BindingWorkersServiceBinding",
+ "BindingWorkersDoBinding",
+ "BindingWorkersR2Binding",
+ "BindingWorkersQueueBinding",
+ "BindingWorkersD1Binding",
+ "BindingWorkersDispatchNamespaceBinding",
+ "BindingWorkersDispatchNamespaceBindingOutbound",
+ "BindingWorkersDispatchNamespaceBindingOutboundWorker",
+ "BindingWorkersMTLSCERTBinding",
+ "Migrations",
+ "MigrationsWorkersSingleStepMigrations",
+ "MigrationsWorkersSingleStepMigrationsRenamedClass",
+ "MigrationsWorkersSingleStepMigrationsTransferredClass",
+ "MigrationsWorkersSteppedMigrations",
+ "MigrationsWorkersSteppedMigrationsStep",
+ "MigrationsWorkersSteppedMigrationsStepRenamedClass",
+ "MigrationsWorkersSteppedMigrationsStepTransferredClass",
+ "Placement",
+ "TailConsumer",
+]
+
+
+class BindingWorkersKVNamespaceBinding(BaseModel):
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ namespace_id: str
+ """Namespace identifier tag."""
+
+ type: Literal["kv_namespace"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersServiceBinding(BaseModel):
+ environment: str
+ """Optional environment if the Worker utilizes one."""
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ service: str
+ """Name of Worker to bind to"""
+
+ type: Literal["service"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersDoBinding(BaseModel):
+ class_name: str
+ """The exported class name of the Durable Object"""
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ type: Literal["durable_object_namespace"]
+ """The class of resource that the binding provides."""
+
+ environment: Optional[str] = None
+ """The environment of the script_name to bind to"""
+
+ namespace_id: Optional[str] = None
+ """Namespace identifier tag."""
+
+ script_name: Optional[str] = None
+ """
+ The script where the Durable Object is defined, if it is external to this Worker
+ """
+
+
+class BindingWorkersR2Binding(BaseModel):
+ bucket_name: str
+ """R2 bucket to bind to"""
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ type: Literal["r2_bucket"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersQueueBinding(BaseModel):
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ queue_name: str
+ """Name of the Queue to bind to"""
+
+ type: Literal["queue"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersD1Binding(BaseModel):
+ id: str
+ """ID of the D1 database to bind to"""
+
+ binding: str
+ """A JavaScript variable name for the binding."""
+
+ name: str
+ """The name of the D1 database associated with the 'id' provided."""
+
+ type: Literal["d1"]
+ """The class of resource that the binding provides."""
+
+
+class BindingWorkersDispatchNamespaceBindingOutboundWorker(BaseModel):
+ environment: Optional[str] = None
+ """Environment of the outbound worker"""
+
+ service: Optional[str] = None
+ """Name of the outbound worker"""
+
+
+class BindingWorkersDispatchNamespaceBindingOutbound(BaseModel):
+ params: Optional[List[str]] = None
+ """
+ Pass information from the Dispatch Worker to the Outbound Worker through the
+ parameters
+ """
+
+ worker: Optional[BindingWorkersDispatchNamespaceBindingOutboundWorker] = None
+ """Outbound worker"""
+
+
+class BindingWorkersDispatchNamespaceBinding(BaseModel):
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ namespace: str
+ """Namespace to bind to"""
+
+ type: Literal["dispatch_namespace"]
+ """The class of resource that the binding provides."""
+
+ outbound: Optional[BindingWorkersDispatchNamespaceBindingOutbound] = None
+ """Outbound worker"""
+
+
+class BindingWorkersMTLSCERTBinding(BaseModel):
+ certificate: object
+
+ name: str
+ """A JavaScript variable name for the binding."""
+
+ type: Literal["mtls_certificate"]
+ """The class of resource that the binding provides."""
+
+ certificate_id: Optional[str] = None
+ """ID of the certificate to bind to"""
+
+
+Binding = Union[
+ BindingWorkersKVNamespaceBinding,
+ BindingWorkersServiceBinding,
+ BindingWorkersDoBinding,
+ BindingWorkersR2Binding,
+ BindingWorkersQueueBinding,
+ BindingWorkersD1Binding,
+ BindingWorkersDispatchNamespaceBinding,
+ BindingWorkersMTLSCERTBinding,
+]
+
+
+class MigrationsWorkersSingleStepMigrationsRenamedClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSingleStepMigrationsTransferredClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ from_script: Optional[str] = None
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSingleStepMigrations(BaseModel):
+ deleted_classes: Optional[List[str]] = None
+ """A list of classes to delete Durable Object namespaces from."""
+
+ new_classes: Optional[List[str]] = None
+ """A list of classes to create Durable Object namespaces from."""
+
+ 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.
+ """
+
+ renamed_classes: Optional[List[MigrationsWorkersSingleStepMigrationsRenamedClass]] = None
+ """A list of classes with Durable Object namespaces that were renamed."""
+
+ transferred_classes: Optional[List[MigrationsWorkersSingleStepMigrationsTransferredClass]] = None
+ """
+ A list of transfers for Durable Object namespaces from a different Worker and
+ class to a class defined in this Worker.
+ """
+
+
+class MigrationsWorkersSteppedMigrationsStepRenamedClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSteppedMigrationsStepTransferredClass(BaseModel):
+ from_: Optional[str] = FieldInfo(alias="from", default=None)
+
+ from_script: Optional[str] = None
+
+ to: Optional[str] = None
+
+
+class MigrationsWorkersSteppedMigrationsStep(BaseModel):
+ deleted_classes: Optional[List[str]] = None
+ """A list of classes to delete Durable Object namespaces from."""
+
+ new_classes: Optional[List[str]] = None
+ """A list of classes to create Durable Object namespaces from."""
+
+ renamed_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepRenamedClass]] = None
+ """A list of classes with Durable Object namespaces that were renamed."""
+
+ transferred_classes: Optional[List[MigrationsWorkersSteppedMigrationsStepTransferredClass]] = None
+ """
+ A list of transfers for Durable Object namespaces from a different Worker and
+ class to a class defined in this Worker.
+ """
+
+
+class MigrationsWorkersSteppedMigrations(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[MigrationsWorkersSteppedMigrationsStep]] = None
+ """Migrations to apply in order."""
+
+
+Migrations = Union[MigrationsWorkersSingleStepMigrations, MigrationsWorkersSteppedMigrations]
+
+
+class Placement(BaseModel):
+ mode: Optional[Literal["smart"]] = None
+ """
+ Enables
+ [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
+ Only `"smart"` is currently supported
+ """
+
+
+class TailConsumer(BaseModel):
+ service: str
+ """Name of Worker that is to be the consumer."""
+
+ environment: Optional[str] = None
+ """Optional environment if the Worker utilizes one."""
+
+ namespace: Optional[str] = None
+ """Optional dispatch namespace the script belongs to."""
+
+
+class SettingGetResponse(BaseModel):
+ bindings: Optional[List[Binding]] = None
+ """List of bindings attached to this Worker"""
+
+ compatibility_date: Optional[str] = None
+ """Opt your Worker into changes after this date"""
+
+ compatibility_flags: Optional[List[str]] = None
+ """Opt your Worker into specific changes"""
+
+ logpush: Optional[bool] = None
+ """Whether Logpush is turned on for the Worker."""
+
+ migrations: Optional[Migrations] = None
+ """Migrations to apply for Durable Objects associated with this Worker."""
+
+ placement: Optional[Placement] = None
+
+ tags: Optional[List[str]] = None
+ """Tags to help you manage your Workers"""
+
+ tail_consumers: Optional[List[TailConsumer]] = 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')."""
diff --git a/src/cloudflare/types/workers/services/environments/setting_edit_params.py b/src/cloudflare/types/workers/services/environments/setting_edit_params.py
index febb4a55ba9..7f6a4673848 100644
--- a/src/cloudflare/types/workers/services/environments/setting_edit_params.py
+++ b/src/cloudflare/types/workers/services/environments/setting_edit_params.py
@@ -17,9 +17,9 @@ class SettingEditParams(TypedDict, total=False):
service_name: Required[str]
"""Name of Worker to bind to"""
- errors: Required[Iterable[shared_params.UnnamedSchemaRef172]]
+ errors: Required[Iterable[shared_params.ResponseInfo]]
- messages: Required[Iterable[shared_params.UnnamedSchemaRef172]]
+ messages: Required[Iterable[shared_params.ResponseInfo]]
result: Required[Result]
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 874af0a660d..d428ad8fe55 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
@@ -17,9 +17,9 @@ class SettingEditParams(TypedDict, total=False):
dispatch_namespace: Required[str]
"""Name of the Workers for Platforms dispatch namespace."""
- errors: Required[Iterable[shared_params.UnnamedSchemaRef172]]
+ errors: Required[Iterable[shared_params.ResponseInfo]]
- messages: Required[Iterable[shared_params.UnnamedSchemaRef172]]
+ messages: Required[Iterable[shared_params.ResponseInfo]]
result: Required[Result]
diff --git a/src/cloudflare/types/zero_trust/dex/test_list_response.py b/src/cloudflare/types/zero_trust/dex/test_list_response.py
index 49f74a9b329..77875117aaf 100644
--- a/src/cloudflare/types/zero_trust/dex/test_list_response.py
+++ b/src/cloudflare/types/zero_trust/dex/test_list_response.py
@@ -3,7 +3,7 @@
from typing import List, Optional
from typing_extensions import Literal
-from ...shared import UnnamedSchemaRef172
+from ...shared import ResponseInfo
from ...._models import BaseModel
from .digital_experience_monitoring_tests import DigitalExperienceMonitoringTests
@@ -26,9 +26,9 @@ class ResultInfo(BaseModel):
class TestListResponse(BaseModel):
__test__ = False
- errors: List[UnnamedSchemaRef172]
+ errors: List[ResponseInfo]
- messages: List[UnnamedSchemaRef172]
+ messages: List[ResponseInfo]
result: DigitalExperienceMonitoringTests
diff --git a/tests/api_resources/workers/scripts/test_deployments.py b/tests/api_resources/workers/scripts/test_deployments.py
new file mode 100644
index 00000000000..5ff04d519c5
--- /dev/null
+++ b/tests/api_resources/workers/scripts/test_deployments.py
@@ -0,0 +1,252 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.workers.scripts import DeploymentGetResponse, DeploymentCreateResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestDeployments:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ deployment = client.workers.scripts.deployments.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ deployment = client.workers.scripts.deployments.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ annotations={"workers_message": "Deploy bug fix."},
+ strategy="string",
+ )
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.deployments.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ deployment = response.parse()
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.workers.scripts.deployments.with_streaming_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ deployment = response.parse()
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_create(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.deployments.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.deployments.with_raw_response.create(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ deployment = client.workers.scripts.deployments.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DeploymentGetResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.deployments.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ deployment = response.parse()
+ assert_matches_type(DeploymentGetResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.workers.scripts.deployments.with_streaming_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ deployment = response.parse()
+ assert_matches_type(DeploymentGetResponse, deployment, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_get(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.deployments.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.deployments.with_raw_response.get(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncDeployments:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ deployment = await async_client.workers.scripts.deployments.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ deployment = await async_client.workers.scripts.deployments.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ annotations={"workers_message": "Deploy bug fix."},
+ strategy="string",
+ )
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.deployments.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ deployment = await response.parse()
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.deployments.with_streaming_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ deployment = await response.parse()
+ assert_matches_type(DeploymentCreateResponse, deployment, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.deployments.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers.scripts.deployments.with_raw_response.create(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ deployment = await async_client.workers.scripts.deployments.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DeploymentGetResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.deployments.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ deployment = await response.parse()
+ assert_matches_type(DeploymentGetResponse, deployment, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.deployments.with_streaming_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ deployment = await response.parse()
+ assert_matches_type(DeploymentGetResponse, deployment, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.deployments.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers.scripts.deployments.with_raw_response.get(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
diff --git a/tests/api_resources/workers/scripts/test_settings.py b/tests/api_resources/workers/scripts/test_settings.py
index ed4edcf67c4..930984b7949 100644
--- a/tests/api_resources/workers/scripts/test_settings.py
+++ b/tests/api_resources/workers/scripts/test_settings.py
@@ -32,73 +32,24 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
setting = client.workers.scripts.settings.edit(
"this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
- settings={
- "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}],
- "compatibility_date": "2022-04-05",
- "compatibility_flags": [
- "formdata_parser_supports_files",
- "formdata_parser_supports_files",
- "formdata_parser_supports_files",
- ],
- "logpush": False,
- "migrations": {
- "new_tag": "v2",
- "old_tag": "v1",
- "deleted_classes": ["string", "string", "string"],
- "new_classes": ["string", "string", "string"],
- "renamed_classes": [
- {
- "from": "string",
- "to": "string",
- },
- {
- "from": "string",
- "to": "string",
- },
- {
- "from": "string",
- "to": "string",
- },
- ],
- "transferred_classes": [
- {
- "from": "string",
- "from_script": "string",
- "to": "string",
- },
- {
- "from": "string",
- "from_script": "string",
- "to": "string",
- },
- {
- "from": "string",
- "from_script": "string",
- "to": "string",
- },
- ],
+ logpush=False,
+ tail_consumers=[
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
},
- "placement": {"mode": "smart"},
- "tags": ["my-tag", "my-tag", "my-tag"],
- "tail_consumers": [
- {
- "environment": "production",
- "namespace": "my-namespace",
- "service": "my-log-consumer",
- },
- {
- "environment": "production",
- "namespace": "my-namespace",
- "service": "my-log-consumer",
- },
- {
- "environment": "production",
- "namespace": "my-namespace",
- "service": "my-log-consumer",
- },
- ],
- "usage_model": "unbound",
- },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ ],
)
assert_matches_type(SettingEditResponse, setting, path=["response"])
@@ -216,73 +167,24 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare)
setting = await async_client.workers.scripts.settings.edit(
"this-is_my_script-01",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
- settings={
- "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}],
- "compatibility_date": "2022-04-05",
- "compatibility_flags": [
- "formdata_parser_supports_files",
- "formdata_parser_supports_files",
- "formdata_parser_supports_files",
- ],
- "logpush": False,
- "migrations": {
- "new_tag": "v2",
- "old_tag": "v1",
- "deleted_classes": ["string", "string", "string"],
- "new_classes": ["string", "string", "string"],
- "renamed_classes": [
- {
- "from": "string",
- "to": "string",
- },
- {
- "from": "string",
- "to": "string",
- },
- {
- "from": "string",
- "to": "string",
- },
- ],
- "transferred_classes": [
- {
- "from": "string",
- "from_script": "string",
- "to": "string",
- },
- {
- "from": "string",
- "from_script": "string",
- "to": "string",
- },
- {
- "from": "string",
- "from_script": "string",
- "to": "string",
- },
- ],
+ logpush=False,
+ tail_consumers=[
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
},
- "placement": {"mode": "smart"},
- "tags": ["my-tag", "my-tag", "my-tag"],
- "tail_consumers": [
- {
- "environment": "production",
- "namespace": "my-namespace",
- "service": "my-log-consumer",
- },
- {
- "environment": "production",
- "namespace": "my-namespace",
- "service": "my-log-consumer",
- },
- {
- "environment": "production",
- "namespace": "my-namespace",
- "service": "my-log-consumer",
- },
- ],
- "usage_model": "unbound",
- },
+ ],
)
assert_matches_type(SettingEditResponse, setting, path=["response"])
diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py
new file mode 100644
index 00000000000..701befc6da1
--- /dev/null
+++ b/tests/api_resources/workers/scripts/test_versions.py
@@ -0,0 +1,418 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.workers.scripts import (
+ VersionGetResponse,
+ VersionListResponse,
+ VersionCreateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestVersions:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ version = client.workers.scripts.versions.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ version = client.workers.scripts.versions.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"],
+ metadata={
+ "annotations": {
+ "workers_message": "Fixed worker code.",
+ "workers_tag": "string",
+ },
+ "bindings": [
+ {
+ "name": "MY_ENV_VAR",
+ "text": "my_data",
+ "type": "plain_text",
+ }
+ ],
+ "compatibility_date": "2023-07-25",
+ "compatibility_flags": ["string", "string", "string"],
+ "keep_bindings": ["string", "string", "string"],
+ "main_module": "worker.js",
+ "usage_model": "standard",
+ },
+ )
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.versions.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ version = response.parse()
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.workers.scripts.versions.with_streaming_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ version = response.parse()
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_create(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.versions.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.versions.with_raw_response.create(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ version = client.workers.scripts.versions.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(VersionListResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.versions.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ version = response.parse()
+ assert_matches_type(VersionListResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.workers.scripts.versions.with_streaming_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ version = response.parse()
+ assert_matches_type(VersionListResponse, version, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.versions.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.versions.with_raw_response.list(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ version = client.workers.scripts.versions.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ )
+ assert_matches_type(VersionGetResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.versions.with_raw_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ version = response.parse()
+ assert_matches_type(VersionGetResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.workers.scripts.versions.with_streaming_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ version = response.parse()
+ assert_matches_type(VersionGetResponse, version, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_get(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.versions.with_raw_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="",
+ script_name="this-is_my_script-01",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.versions.with_raw_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"):
+ client.workers.scripts.versions.with_raw_response.get(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ )
+
+
+class TestAsyncVersions:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ version = await async_client.workers.scripts.versions.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ version = await async_client.workers.scripts.versions.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"],
+ metadata={
+ "annotations": {
+ "workers_message": "Fixed worker code.",
+ "workers_tag": "string",
+ },
+ "bindings": [
+ {
+ "name": "MY_ENV_VAR",
+ "text": "my_data",
+ "type": "plain_text",
+ }
+ ],
+ "compatibility_date": "2023-07-25",
+ "compatibility_flags": ["string", "string", "string"],
+ "keep_bindings": ["string", "string", "string"],
+ "main_module": "worker.js",
+ "usage_model": "standard",
+ },
+ )
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.versions.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ version = await response.parse()
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.versions.with_streaming_response.create(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ version = await response.parse()
+ assert_matches_type(VersionCreateResponse, version, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.versions.with_raw_response.create(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ 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(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ version = await async_client.workers.scripts.versions.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(VersionListResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.versions.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ version = await response.parse()
+ assert_matches_type(VersionListResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.versions.with_streaming_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ version = await response.parse()
+ assert_matches_type(VersionListResponse, version, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.versions.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ 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.list(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ version = await async_client.workers.scripts.versions.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ )
+ assert_matches_type(VersionGetResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.versions.with_raw_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ version = await response.parse()
+ assert_matches_type(VersionGetResponse, version, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.versions.with_streaming_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ version = await response.parse()
+ assert_matches_type(VersionGetResponse, version, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.versions.with_raw_response.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="",
+ script_name="this-is_my_script-01",
+ )
+
+ 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.get(
+ "bcf48806-b317-4351-9ee7-36e7d557d4de",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"):
+ await async_client.workers.scripts.versions.with_raw_response.get(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ script_name="this-is_my_script-01",
+ )
diff --git a/tests/api_resources/workers/scripts/versions/__init__.py b/tests/api_resources/workers/scripts/versions/__init__.py
new file mode 100644
index 00000000000..fd8019a9a1a
--- /dev/null
+++ b/tests/api_resources/workers/scripts/versions/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/workers/scripts/versions/test_settings.py b/tests/api_resources/workers/scripts/versions/test_settings.py
new file mode 100644
index 00000000000..c1a9b8107ce
--- /dev/null
+++ b/tests/api_resources/workers/scripts/versions/test_settings.py
@@ -0,0 +1,382 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.workers.scripts.versions import SettingGetResponse, SettingEditResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestSettings:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_edit(self, client: Cloudflare) -> None:
+ setting = client.workers.scripts.versions.settings.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
+ setting = client.workers.scripts.versions.settings.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ settings={
+ "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}],
+ "compatibility_date": "2022-04-05",
+ "compatibility_flags": [
+ "formdata_parser_supports_files",
+ "formdata_parser_supports_files",
+ "formdata_parser_supports_files",
+ ],
+ "logpush": False,
+ "migrations": {
+ "new_tag": "v2",
+ "old_tag": "v1",
+ "deleted_classes": ["string", "string", "string"],
+ "new_classes": ["string", "string", "string"],
+ "renamed_classes": [
+ {
+ "from": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "to": "string",
+ },
+ ],
+ "transferred_classes": [
+ {
+ "from": "string",
+ "from_script": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "from_script": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "from_script": "string",
+ "to": "string",
+ },
+ ],
+ },
+ "placement": {"mode": "smart"},
+ "tags": ["my-tag", "my-tag", "my-tag"],
+ "tail_consumers": [
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ ],
+ "usage_model": "unbound",
+ },
+ )
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_edit(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.versions.settings.with_raw_response.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ setting = response.parse()
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_edit(self, client: Cloudflare) -> None:
+ with client.workers.scripts.versions.settings.with_streaming_response.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ setting = response.parse()
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_edit(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.versions.settings.with_raw_response.edit(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.versions.settings.with_raw_response.edit(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ setting = client.workers.scripts.versions.settings.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SettingGetResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.workers.scripts.versions.settings.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ setting = response.parse()
+ assert_matches_type(SettingGetResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.workers.scripts.versions.settings.with_streaming_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ setting = response.parse()
+ assert_matches_type(SettingGetResponse, setting, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_get(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.scripts.versions.settings.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers.scripts.versions.settings.with_raw_response.get(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncSettings:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
+ setting = await async_client.workers.scripts.versions.settings.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ setting = await async_client.workers.scripts.versions.settings.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ settings={
+ "bindings": [{"type": "kv_namespace"}, {"type": "kv_namespace"}, {"type": "kv_namespace"}],
+ "compatibility_date": "2022-04-05",
+ "compatibility_flags": [
+ "formdata_parser_supports_files",
+ "formdata_parser_supports_files",
+ "formdata_parser_supports_files",
+ ],
+ "logpush": False,
+ "migrations": {
+ "new_tag": "v2",
+ "old_tag": "v1",
+ "deleted_classes": ["string", "string", "string"],
+ "new_classes": ["string", "string", "string"],
+ "renamed_classes": [
+ {
+ "from": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "to": "string",
+ },
+ ],
+ "transferred_classes": [
+ {
+ "from": "string",
+ "from_script": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "from_script": "string",
+ "to": "string",
+ },
+ {
+ "from": "string",
+ "from_script": "string",
+ "to": "string",
+ },
+ ],
+ },
+ "placement": {"mode": "smart"},
+ "tags": ["my-tag", "my-tag", "my-tag"],
+ "tail_consumers": [
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ {
+ "environment": "production",
+ "namespace": "my-namespace",
+ "service": "my-log-consumer",
+ },
+ ],
+ "usage_model": "unbound",
+ },
+ )
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.versions.settings.with_raw_response.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ setting = await response.parse()
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.versions.settings.with_streaming_response.edit(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ setting = await response.parse()
+ assert_matches_type(SettingEditResponse, setting, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.versions.settings.with_raw_response.edit(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers.scripts.versions.settings.with_raw_response.edit(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ setting = await async_client.workers.scripts.versions.settings.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SettingGetResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.scripts.versions.settings.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ setting = await response.parse()
+ assert_matches_type(SettingGetResponse, setting, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.scripts.versions.settings.with_streaming_response.get(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ setting = await response.parse()
+ assert_matches_type(SettingGetResponse, setting, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.scripts.versions.settings.with_raw_response.get(
+ "this-is_my_script-01",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers.scripts.versions.settings.with_raw_response.get(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )