Skip to content

Commit f0898d4

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): api update (#2132)
1 parent e077e34 commit f0898d4

File tree

14 files changed

+131
-21
lines changed

14 files changed

+131
-21
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1397
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cedc346a76dfdf50768c01a48e573dfaeddfe35be8910188d42fe3c5afaaa5bb.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1504fe697d2d7335627a605468544df46a79e9a8b355f91527556e6d25cf0f7a.yml

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def edit(
7575
7676
logpush: Whether Logpush is turned on for the Worker.
7777
78-
observability: Observability settings for the Worker
78+
observability: Observability settings for the Worker.
7979
8080
tail_consumers: List of Workers that will consume logs from the attached Worker.
8181
@@ -205,7 +205,7 @@ async def edit(
205205
206206
logpush: Whether Logpush is turned on for the Worker.
207207
208-
observability: Observability settings for the Worker
208+
observability: Observability settings for the Worker.
209209
210210
tail_consumers: List of Workers that will consume logs from the attached Worker.
211211

src/cloudflare/types/workers/script.py

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class Script(BaseModel):
1919
etag: Optional[str] = None
2020
"""Hashed script content, can be used in a If-None-Match header when updating."""
2121

22+
has_assets: Optional[bool] = None
23+
"""Whether a Worker contains assets."""
24+
25+
has_modules: Optional[bool] = None
26+
"""Whether a Worker contains modules."""
27+
2228
logpush: Optional[bool] = None
2329
"""Whether Logpush is turned on for the Worker."""
2430

src/cloudflare/types/workers/script_setting.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class Observability(BaseModel):
1212
enabled: bool
13-
"""Whether observability is enabled for the Worker"""
13+
"""Whether observability is enabled for the Worker."""
1414

1515
head_sampling_rate: Optional[float] = None
1616
"""The sampling rate for incoming requests.
@@ -24,7 +24,7 @@ class ScriptSetting(BaseModel):
2424
"""Whether Logpush is turned on for the Worker."""
2525

2626
observability: Optional[Observability] = None
27-
"""Observability settings for the Worker"""
27+
"""Observability settings for the Worker."""
2828

2929
tail_consumers: Optional[List[ConsumerScript]] = None
3030
"""List of Workers that will consume logs from the attached Worker."""

src/cloudflare/types/workers/script_update_params.py

+34-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"ScriptUpdateParams",
1717
"Variant0",
1818
"Variant0Metadata",
19+
"Variant0MetadataAssets",
20+
"Variant0MetadataAssetsConfig",
1921
"Variant0MetadataBinding",
2022
"Variant0MetadataMigrations",
2123
"Variant0MetadataObservability",
@@ -48,6 +50,25 @@ class Variant0(TypedDict, total=False):
4850
"""JSON encoded metadata about the uploaded parts and Worker configuration."""
4951

5052

53+
class Variant0MetadataAssetsConfig(TypedDict, total=False):
54+
html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]
55+
"""Determines the redirects and rewrites of requests for HTML content."""
56+
57+
not_found_handling: Literal["none", "404-page", "single-page-application"]
58+
"""
59+
Determines the response when a request does not match a static asset, and there
60+
is no Worker script.
61+
"""
62+
63+
64+
class Variant0MetadataAssets(TypedDict, total=False):
65+
config: Variant0MetadataAssetsConfig
66+
"""Configuration for assets within a Worker."""
67+
68+
jwt: str
69+
"""Token provided upon successful upload of all files from a registered manifest."""
70+
71+
5172
class Variant0MetadataBindingTyped(TypedDict, total=False):
5273
name: str
5374
"""Name of the binding variable."""
@@ -67,7 +88,7 @@ class Variant0MetadataBindingTyped(TypedDict, total=False):
6788

6889
class Variant0MetadataObservability(TypedDict, total=False):
6990
enabled: Required[bool]
70-
"""Whether observability is enabled for the Worker"""
91+
"""Whether observability is enabled for the Worker."""
7192

7293
head_sampling_rate: Optional[float]
7394
"""The sampling rate for incoming requests.
@@ -77,6 +98,9 @@ class Variant0MetadataObservability(TypedDict, total=False):
7798

7899

79100
class Variant0Metadata(TypedDict, total=False):
101+
assets: Variant0MetadataAssets
102+
"""Configuration for assets within a Worker"""
103+
80104
bindings: Iterable[Variant0MetadataBinding]
81105
"""List of bindings available to the worker."""
82106

@@ -101,6 +125,12 @@ class Variant0Metadata(TypedDict, total=False):
101125
included in a `compatibility_date`.
102126
"""
103127

128+
keep_assets: bool
129+
"""
130+
Retain assets which exist for a previously uploaded Worker version; used in lieu
131+
of providing a completion token.
132+
"""
133+
104134
keep_bindings: List[str]
105135
"""List of binding types to keep from previous_upload."""
106136

@@ -117,12 +147,12 @@ class Variant0Metadata(TypedDict, total=False):
117147
"""Migrations to apply for Durable Objects associated with this Worker."""
118148

119149
observability: Variant0MetadataObservability
120-
"""Observability settings for the Worker"""
150+
"""Observability settings for the Worker."""
121151

122152
placement: PlacementConfigurationParam
123153

124154
tags: List[str]
125-
"""List of strings to use as tags for this Worker"""
155+
"""List of strings to use as tags for this Worker."""
126156

127157
tail_consumers: Iterable[ConsumerScriptParam]
128158
"""List of Workers that will consume logs from the attached Worker."""
@@ -131,7 +161,7 @@ class Variant0Metadata(TypedDict, total=False):
131161
"""Usage model to apply to invocations."""
132162

133163
version_tags: Dict[str, str]
134-
"""Key-value pairs to use as tags for this version of this Worker"""
164+
"""Key-value pairs to use as tags for this version of this Worker."""
135165

136166

137167
class Variant1(TypedDict, total=False):

src/cloudflare/types/workers/script_update_response.py

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class ScriptUpdateResponse(BaseModel):
1919
etag: Optional[str] = None
2020
"""Hashed script content, can be used in a If-None-Match header when updating."""
2121

22+
has_assets: Optional[bool] = None
23+
"""Whether a Worker contains assets."""
24+
25+
has_modules: Optional[bool] = None
26+
"""Whether a Worker contains modules."""
27+
2228
logpush: Optional[bool] = None
2329
"""Whether Logpush is turned on for the Worker."""
2430

src/cloudflare/types/workers/scripts/setting_edit_params.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class SettingEditParams(TypedDict, total=False):
1818
"""Whether Logpush is turned on for the Worker."""
1919

2020
observability: Observability
21-
"""Observability settings for the Worker"""
21+
"""Observability settings for the Worker."""
2222

2323
tail_consumers: Iterable[ConsumerScriptParam]
2424
"""List of Workers that will consume logs from the attached Worker."""
2525

2626

2727
class Observability(TypedDict, total=False):
2828
enabled: Required[bool]
29-
"""Whether observability is enabled for the Worker"""
29+
"""Whether observability is enabled for the Worker."""
3030

3131
head_sampling_rate: Optional[float]
3232
"""The sampling rate for incoming requests.

src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_params.py

+34-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"ScriptUpdateParams",
1717
"Variant0",
1818
"Variant0Metadata",
19+
"Variant0MetadataAssets",
20+
"Variant0MetadataAssetsConfig",
1921
"Variant0MetadataBinding",
2022
"Variant0MetadataMigrations",
2123
"Variant0MetadataObservability",
@@ -43,6 +45,25 @@ class Variant0(TypedDict, total=False):
4345
"""JSON encoded metadata about the uploaded parts and Worker configuration."""
4446

4547

48+
class Variant0MetadataAssetsConfig(TypedDict, total=False):
49+
html_handling: Literal["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]
50+
"""Determines the redirects and rewrites of requests for HTML content."""
51+
52+
not_found_handling: Literal["none", "404-page", "single-page-application"]
53+
"""
54+
Determines the response when a request does not match a static asset, and there
55+
is no Worker script.
56+
"""
57+
58+
59+
class Variant0MetadataAssets(TypedDict, total=False):
60+
config: Variant0MetadataAssetsConfig
61+
"""Configuration for assets within a Worker."""
62+
63+
jwt: str
64+
"""Token provided upon successful upload of all files from a registered manifest."""
65+
66+
4667
class Variant0MetadataBindingTyped(TypedDict, total=False):
4768
name: str
4869
"""Name of the binding variable."""
@@ -62,7 +83,7 @@ class Variant0MetadataBindingTyped(TypedDict, total=False):
6283

6384
class Variant0MetadataObservability(TypedDict, total=False):
6485
enabled: Required[bool]
65-
"""Whether observability is enabled for the Worker"""
86+
"""Whether observability is enabled for the Worker."""
6687

6788
head_sampling_rate: Optional[float]
6889
"""The sampling rate for incoming requests.
@@ -72,6 +93,9 @@ class Variant0MetadataObservability(TypedDict, total=False):
7293

7394

7495
class Variant0Metadata(TypedDict, total=False):
96+
assets: Variant0MetadataAssets
97+
"""Configuration for assets within a Worker"""
98+
7599
bindings: Iterable[Variant0MetadataBinding]
76100
"""List of bindings available to the worker."""
77101

@@ -96,6 +120,12 @@ class Variant0Metadata(TypedDict, total=False):
96120
included in a `compatibility_date`.
97121
"""
98122

123+
keep_assets: bool
124+
"""
125+
Retain assets which exist for a previously uploaded Worker version; used in lieu
126+
of providing a completion token.
127+
"""
128+
99129
keep_bindings: List[str]
100130
"""List of binding types to keep from previous_upload."""
101131

@@ -112,12 +142,12 @@ class Variant0Metadata(TypedDict, total=False):
112142
"""Migrations to apply for Durable Objects associated with this Worker."""
113143

114144
observability: Variant0MetadataObservability
115-
"""Observability settings for the Worker"""
145+
"""Observability settings for the Worker."""
116146

117147
placement: PlacementConfigurationParam
118148

119149
tags: List[str]
120-
"""List of strings to use as tags for this Worker"""
150+
"""List of strings to use as tags for this Worker."""
121151

122152
tail_consumers: Iterable[ConsumerScriptParam]
123153
"""List of Workers that will consume logs from the attached Worker."""
@@ -126,7 +156,7 @@ class Variant0Metadata(TypedDict, total=False):
126156
"""Usage model to apply to invocations."""
127157

128158
version_tags: Dict[str, str]
129-
"""Key-value pairs to use as tags for this version of this Worker"""
159+
"""Key-value pairs to use as tags for this version of this Worker."""
130160

131161

132162
class Variant1(TypedDict, total=False):

src/cloudflare/types/workers_for_platforms/dispatch/namespaces/script_update_response.py

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class ScriptUpdateResponse(BaseModel):
1919
etag: Optional[str] = None
2020
"""Hashed script content, can be used in a If-None-Match header when updating."""
2121

22+
has_assets: Optional[bool] = None
23+
"""Whether a Worker contains assets."""
24+
25+
has_modules: Optional[bool] = None
26+
"""Whether a Worker contains modules."""
27+
2228
logpush: Optional[bool] = None
2329
"""Whether Logpush is turned on for the Worker."""
2430

src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SettingsLimits(TypedDict, total=False):
3434

3535
class SettingsObservability(TypedDict, total=False):
3636
enabled: Required[bool]
37-
"""Whether observability is enabled for the Worker"""
37+
"""Whether observability is enabled for the Worker."""
3838

3939
head_sampling_rate: Optional[float]
4040
"""The sampling rate for incoming requests.
@@ -63,7 +63,7 @@ class Settings(TypedDict, total=False):
6363
"""Migrations to apply for Durable Objects associated with this Worker."""
6464

6565
observability: SettingsObservability
66-
"""Observability settings for the Worker"""
66+
"""Observability settings for the Worker."""
6767

6868
placement: PlacementConfigurationParam
6969

src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Limits(BaseModel):
2323

2424
class Observability(BaseModel):
2525
enabled: bool
26-
"""Whether observability is enabled for the Worker"""
26+
"""Whether observability is enabled for the Worker."""
2727

2828
head_sampling_rate: Optional[float] = None
2929
"""The sampling rate for incoming requests.
@@ -52,7 +52,7 @@ class SettingEditResponse(BaseModel):
5252
"""Migrations to apply for Durable Objects associated with this Worker."""
5353

5454
observability: Optional[Observability] = None
55-
"""Observability settings for the Worker"""
55+
"""Observability settings for the Worker."""
5656

5757
placement: Optional[PlacementConfiguration] = None
5858

src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Limits(BaseModel):
2323

2424
class Observability(BaseModel):
2525
enabled: bool
26-
"""Whether observability is enabled for the Worker"""
26+
"""Whether observability is enabled for the Worker."""
2727

2828
head_sampling_rate: Optional[float] = None
2929
"""The sampling rate for incoming requests.
@@ -52,7 +52,7 @@ class SettingGetResponse(BaseModel):
5252
"""Migrations to apply for Durable Objects associated with this Worker."""
5353

5454
observability: Optional[Observability] = None
55-
"""Observability settings for the Worker"""
55+
"""Observability settings for the Worker."""
5656

5757
placement: Optional[PlacementConfiguration] = None
5858

tests/api_resources/workers/test_scripts.py

+16
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N
4444
rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
4545
any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"],
4646
metadata={
47+
"assets": {
48+
"config": {
49+
"html_handling": "auto-trailing-slash",
50+
"not_found_handling": "none",
51+
},
52+
"jwt": "jwt",
53+
},
4754
"bindings": [
4855
{
4956
"name": "MY_ENV_VAR",
@@ -53,6 +60,7 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N
5360
"body_part": "worker.js",
5461
"compatibility_date": "2023-07-25",
5562
"compatibility_flags": ["string", "string", "string"],
63+
"keep_assets": False,
5664
"keep_bindings": ["string", "string", "string"],
5765
"logpush": False,
5866
"main_module": "worker.js",
@@ -412,6 +420,13 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn
412420
rollback_to="f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
413421
any_part_name=[b"raw file contents", b"raw file contents", b"raw file contents"],
414422
metadata={
423+
"assets": {
424+
"config": {
425+
"html_handling": "auto-trailing-slash",
426+
"not_found_handling": "none",
427+
},
428+
"jwt": "jwt",
429+
},
415430
"bindings": [
416431
{
417432
"name": "MY_ENV_VAR",
@@ -421,6 +436,7 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn
421436
"body_part": "worker.js",
422437
"compatibility_date": "2023-07-25",
423438
"compatibility_flags": ["string", "string", "string"],
439+
"keep_assets": False,
424440
"keep_bindings": ["string", "string", "string"],
425441
"logpush": False,
426442
"main_module": "worker.js",

0 commit comments

Comments
 (0)