Skip to content

Commit d22a2de

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): api update (#2175)
1 parent dbebda3 commit d22a2de

File tree

6 files changed

+6
-56
lines changed

6 files changed

+6
-56
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1411
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d6dd7ea434d79d52578f28ebdc5ddd1fbf9e68526bf0e32285f1c3725ccacb4d.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-829ade7062fed63a30accc2a5e1a14c6c26fd4dc003d300d1b25a5416b8b8727.yml

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

+4-24
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ def create(
5050
script_name: str,
5151
*,
5252
account_id: str,
53-
enabled: bool,
54-
previews_enabled: bool | NotGiven = NOT_GIVEN,
53+
enabled: bool | NotGiven = NOT_GIVEN,
5554
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5655
# The extra values given here take precedence over values defined on the client or passed to this method.
5756
extra_headers: Headers | None = None,
@@ -69,9 +68,6 @@ def create(
6968
7069
enabled: Whether the Worker should be available on the workers.dev subdomain.
7170
72-
previews_enabled: Whether the Worker's Preview URLs should be available on the workers.dev
73-
subdomain.
74-
7571
extra_headers: Send extra headers
7672
7773
extra_query: Add additional query parameters to the request
@@ -86,13 +82,7 @@ def create(
8682
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
8783
return self._post(
8884
f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
89-
body=maybe_transform(
90-
{
91-
"enabled": enabled,
92-
"previews_enabled": previews_enabled,
93-
},
94-
subdomain_create_params.SubdomainCreateParams,
95-
),
85+
body=maybe_transform({"enabled": enabled}, subdomain_create_params.SubdomainCreateParams),
9686
options=make_request_options(
9787
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
9888
),
@@ -165,8 +155,7 @@ async def create(
165155
script_name: str,
166156
*,
167157
account_id: str,
168-
enabled: bool,
169-
previews_enabled: bool | NotGiven = NOT_GIVEN,
158+
enabled: bool | NotGiven = NOT_GIVEN,
170159
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
171160
# The extra values given here take precedence over values defined on the client or passed to this method.
172161
extra_headers: Headers | None = None,
@@ -184,9 +173,6 @@ async def create(
184173
185174
enabled: Whether the Worker should be available on the workers.dev subdomain.
186175
187-
previews_enabled: Whether the Worker's Preview URLs should be available on the workers.dev
188-
subdomain.
189-
190176
extra_headers: Send extra headers
191177
192178
extra_query: Add additional query parameters to the request
@@ -201,13 +187,7 @@ async def create(
201187
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
202188
return await self._post(
203189
f"/accounts/{account_id}/workers/scripts/{script_name}/subdomain",
204-
body=await async_maybe_transform(
205-
{
206-
"enabled": enabled,
207-
"previews_enabled": previews_enabled,
208-
},
209-
subdomain_create_params.SubdomainCreateParams,
210-
),
190+
body=await async_maybe_transform({"enabled": enabled}, subdomain_create_params.SubdomainCreateParams),
211191
options=make_request_options(
212192
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
213193
),

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

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,5 @@ class SubdomainCreateParams(TypedDict, total=False):
1111
account_id: Required[str]
1212
"""Identifier"""
1313

14-
enabled: Required[bool]
14+
enabled: bool
1515
"""Whether the Worker should be available on the workers.dev subdomain."""
16-
17-
previews_enabled: bool
18-
"""
19-
Whether the Worker's Preview URLs should be available on the workers.dev
20-
subdomain.
21-
"""

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

-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,3 @@
1010
class SubdomainCreateResponse(BaseModel):
1111
enabled: Optional[bool] = None
1212
"""Whether the Worker is available on the workers.dev subdomain."""
13-
14-
previews_enabled: Optional[bool] = None
15-
"""
16-
Whether the Worker's Preview URLs should be available on the workers.dev
17-
subdomain.
18-
"""

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

-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,3 @@
1010
class SubdomainGetResponse(BaseModel):
1111
enabled: Optional[bool] = None
1212
"""Whether the Worker is available on the workers.dev subdomain."""
13-
14-
previews_enabled: Optional[bool] = None
15-
"""
16-
Whether the Worker's Preview URLs should be available on the workers.dev
17-
subdomain.
18-
"""

tests/api_resources/workers/scripts/test_subdomain.py

-12
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def test_method_create(self, client: Cloudflare) -> None:
2222
subdomain = client.workers.scripts.subdomain.create(
2323
script_name="this-is_my_script-01",
2424
account_id="023e105f4ecef8ad9ca31a8372d0c353",
25-
enabled=True,
2625
)
2726
assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"])
2827

@@ -32,7 +31,6 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
3231
script_name="this-is_my_script-01",
3332
account_id="023e105f4ecef8ad9ca31a8372d0c353",
3433
enabled=True,
35-
previews_enabled=True,
3634
)
3735
assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"])
3836

@@ -41,7 +39,6 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
4139
response = client.workers.scripts.subdomain.with_raw_response.create(
4240
script_name="this-is_my_script-01",
4341
account_id="023e105f4ecef8ad9ca31a8372d0c353",
44-
enabled=True,
4542
)
4643

4744
assert response.is_closed is True
@@ -54,7 +51,6 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
5451
with client.workers.scripts.subdomain.with_streaming_response.create(
5552
script_name="this-is_my_script-01",
5653
account_id="023e105f4ecef8ad9ca31a8372d0c353",
57-
enabled=True,
5854
) as response:
5955
assert not response.is_closed
6056
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -70,14 +66,12 @@ def test_path_params_create(self, client: Cloudflare) -> None:
7066
client.workers.scripts.subdomain.with_raw_response.create(
7167
script_name="this-is_my_script-01",
7268
account_id="",
73-
enabled=True,
7469
)
7570

7671
with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
7772
client.workers.scripts.subdomain.with_raw_response.create(
7873
script_name="",
7974
account_id="023e105f4ecef8ad9ca31a8372d0c353",
80-
enabled=True,
8175
)
8276

8377
@parametrize
@@ -137,7 +131,6 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
137131
subdomain = await async_client.workers.scripts.subdomain.create(
138132
script_name="this-is_my_script-01",
139133
account_id="023e105f4ecef8ad9ca31a8372d0c353",
140-
enabled=True,
141134
)
142135
assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"])
143136

@@ -147,7 +140,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
147140
script_name="this-is_my_script-01",
148141
account_id="023e105f4ecef8ad9ca31a8372d0c353",
149142
enabled=True,
150-
previews_enabled=True,
151143
)
152144
assert_matches_type(SubdomainCreateResponse, subdomain, path=["response"])
153145

@@ -156,7 +148,6 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
156148
response = await async_client.workers.scripts.subdomain.with_raw_response.create(
157149
script_name="this-is_my_script-01",
158150
account_id="023e105f4ecef8ad9ca31a8372d0c353",
159-
enabled=True,
160151
)
161152

162153
assert response.is_closed is True
@@ -169,7 +160,6 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
169160
async with async_client.workers.scripts.subdomain.with_streaming_response.create(
170161
script_name="this-is_my_script-01",
171162
account_id="023e105f4ecef8ad9ca31a8372d0c353",
172-
enabled=True,
173163
) as response:
174164
assert not response.is_closed
175165
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -185,14 +175,12 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
185175
await async_client.workers.scripts.subdomain.with_raw_response.create(
186176
script_name="this-is_my_script-01",
187177
account_id="",
188-
enabled=True,
189178
)
190179

191180
with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
192181
await async_client.workers.scripts.subdomain.with_raw_response.create(
193182
script_name="",
194183
account_id="023e105f4ecef8ad9ca31a8372d0c353",
195-
enabled=True,
196184
)
197185

198186
@parametrize

0 commit comments

Comments
 (0)