Skip to content

Commit f408b80

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#297)
1 parent bef513f commit f408b80

39 files changed

+734
-574
lines changed

api.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -4658,16 +4658,31 @@ Methods:
46584658

46594659
##### Settings
46604660

4661+
Types:
4662+
4663+
```python
4664+
from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
4665+
SettingEditResponse,
4666+
SettingGetResponse,
4667+
)
4668+
```
4669+
46614670
Methods:
46624671

4663-
- <code title="patch /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">edit</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_setting.py">ScriptSetting</a></code>
4664-
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers/script_setting.py">ScriptSetting</a></code>
4672+
- <code title="patch /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">edit</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py">SettingEditResponse</a></code>
4673+
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py">SettingGetResponse</a></code>
46654674

46664675
##### Bindings
46674676

4677+
Types:
4678+
4679+
```python
4680+
from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse
4681+
```
4682+
46684683
Methods:
46694684

4670-
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings">client.workers_for_platforms.dispatch.namespaces.scripts.bindings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/binding.py">Binding</a></code>
4685+
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings">client.workers_for_platforms.dispatch.namespaces.scripts.bindings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py">BindingGetResponse</a></code>
46714686

46724687
# ZeroTrust
46734688

src/cloudflare/resources/workers/scripts/content.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def update(
7575
may be provided as separate named parts, but at least one module must be
7676
present. This should be referenced either in the metadata as `main_module`
7777
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
78-
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
78+
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
79+
be included using the `application/source-map` content type.
7980
8081
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
8182
@@ -194,7 +195,8 @@ async def update(
194195
may be provided as separate named parts, but at least one module must be
195196
present. This should be referenced either in the metadata as `main_module`
196197
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
197-
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
198+
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
199+
be included using the `application/source-map` content type.
198200
199201
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
200202

src/cloudflare/resources/workers/scripts/scripts.py

+4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def update(
151151
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
152152
may be provided as separate named parts, but at least one module must be present
153153
and referenced in the metadata as `main_module` or `body_part` by part name.
154+
Source maps may also be included using the `application/source-map` content
155+
type.
154156
155157
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
156158
@@ -443,6 +445,8 @@ async def update(
443445
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
444446
may be provided as separate named parts, but at least one module must be present
445447
and referenced in the metadata as `main_module` or `body_part` by part name.
448+
Source maps may also be included using the `application/source-map` content
449+
type.
446450
447451
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
448452

src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def get(
193193
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
194194
) -> NamespaceGetResponse:
195195
"""
196-
Fetch a Workers for Platforms namespace.
196+
Get a Workers for Platforms namespace.
197197
198198
Args:
199199
account_id: Identifier
@@ -374,7 +374,7 @@ async def get(
374374
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
375375
) -> NamespaceGetResponse:
376376
"""
377-
Fetch a Workers for Platforms namespace.
377+
Get a Workers for Platforms namespace.
378378
379379
Args:
380380
account_id: Identifier

src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py

+23-20
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, cast
5+
from typing import Type, cast
66

77
import httpx
88

9-
from ......types import Binding
109
from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
1110
from ......_compat import cached_property
1211
from ......_resource import SyncAPIResource, AsyncAPIResource
@@ -16,9 +15,11 @@
1615
async_to_raw_response_wrapper,
1716
async_to_streamed_response_wrapper,
1817
)
18+
from ......_wrappers import ResultWrapper
1919
from ......_base_client import (
2020
make_request_options,
2121
)
22+
from ......types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse
2223

2324
__all__ = ["Bindings", "AsyncBindings"]
2425

@@ -44,7 +45,7 @@ def get(
4445
extra_query: Query | None = None,
4546
extra_body: Body | None = None,
4647
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
47-
) -> Binding:
48+
) -> BindingGetResponse:
4849
"""
4950
Fetch script bindings from a script uploaded to a Workers for Platforms
5051
namespace.
@@ -70,15 +71,16 @@ def get(
7071
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
7172
if not script_name:
7273
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
73-
return cast(
74-
Binding,
75-
self._get(
76-
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
77-
options=make_request_options(
78-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
79-
),
80-
cast_to=cast(Any, Binding), # Union types cannot be passed in as arguments in the type system
74+
return self._get(
75+
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
76+
options=make_request_options(
77+
extra_headers=extra_headers,
78+
extra_query=extra_query,
79+
extra_body=extra_body,
80+
timeout=timeout,
81+
post_parser=ResultWrapper._unwrapper,
8182
),
83+
cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]),
8284
)
8385

8486

@@ -103,7 +105,7 @@ async def get(
103105
extra_query: Query | None = None,
104106
extra_body: Body | None = None,
105107
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
106-
) -> Binding:
108+
) -> BindingGetResponse:
107109
"""
108110
Fetch script bindings from a script uploaded to a Workers for Platforms
109111
namespace.
@@ -129,15 +131,16 @@ async def get(
129131
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
130132
if not script_name:
131133
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
132-
return cast(
133-
Binding,
134-
await self._get(
135-
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
136-
options=make_request_options(
137-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
138-
),
139-
cast_to=cast(Any, Binding), # Union types cannot be passed in as arguments in the type system
134+
return await self._get(
135+
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
136+
options=make_request_options(
137+
extra_headers=extra_headers,
138+
extra_query=extra_query,
139+
extra_body=extra_body,
140+
timeout=timeout,
141+
post_parser=ResultWrapper._unwrapper,
140142
),
143+
cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]),
141144
)
142145

143146

src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def update(
7878
may be provided as separate named parts, but at least one module must be
7979
present. This should be referenced either in the metadata as `main_module`
8080
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
81-
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
81+
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
82+
be included using the `application/source-map` content type.
8283
8384
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
8485
@@ -208,7 +209,8 @@ async def update(
208209
may be provided as separate named parts, but at least one module must be
209210
present. This should be referenced either in the metadata as `main_module`
210211
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
211-
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
212+
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
213+
be included using the `application/source-map` content type.
212214
213215
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
214216

src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py

+24-8
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ def update(
9191
extra_body: Body | None = None,
9292
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
9393
) -> Script:
94-
"""
95-
Upload a worker module to a Workers for Platforms namespace.
94+
"""Upload a worker module to a Workers for Platforms namespace.
95+
96+
You can find an
97+
example of the metadata on our docs:
98+
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
9699
97100
Args:
98101
account_id: Identifier
@@ -104,6 +107,8 @@ def update(
104107
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
105108
may be provided as separate named parts, but at least one module must be present
106109
and referenced in the metadata as `main_module` or `body_part` by part name.
110+
Source maps may also be included using the `application/source-map` content
111+
type.
107112
108113
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
109114
@@ -132,8 +137,11 @@ def update(
132137
extra_body: Body | None = None,
133138
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
134139
) -> Script:
135-
"""
136-
Upload a worker module to a Workers for Platforms namespace.
140+
"""Upload a worker module to a Workers for Platforms namespace.
141+
142+
You can find an
143+
example of the metadata on our docs:
144+
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
137145
138146
Args:
139147
account_id: Identifier
@@ -344,8 +352,11 @@ async def update(
344352
extra_body: Body | None = None,
345353
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
346354
) -> Script:
347-
"""
348-
Upload a worker module to a Workers for Platforms namespace.
355+
"""Upload a worker module to a Workers for Platforms namespace.
356+
357+
You can find an
358+
example of the metadata on our docs:
359+
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
349360
350361
Args:
351362
account_id: Identifier
@@ -357,6 +368,8 @@ async def update(
357368
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
358369
may be provided as separate named parts, but at least one module must be present
359370
and referenced in the metadata as `main_module` or `body_part` by part name.
371+
Source maps may also be included using the `application/source-map` content
372+
type.
360373
361374
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
362375
@@ -385,8 +398,11 @@ async def update(
385398
extra_body: Body | None = None,
386399
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
387400
) -> Script:
388-
"""
389-
Upload a worker module to a Workers for Platforms namespace.
401+
"""Upload a worker module to a Workers for Platforms namespace.
402+
403+
You can find an
404+
example of the metadata on our docs:
405+
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
390406
391407
Args:
392408
account_id: Identifier

0 commit comments

Comments
 (0)