Skip to content

Commit dd641c8

Browse files
feat(api): api update
1 parent 5724345 commit dd641c8

6 files changed

Lines changed: 58 additions & 6 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1781
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f552d9d66684cd309a04567e09c14c86cf824a1776da6b25b27de302bc0686dc.yml
3-
openapi_spec_hash: 97f316cb6055691278d565061afcd9cd
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-45f3d528a7290d80336539cc59fdf9074526ae8c5b5b012a9d8c597db4f151d7.yml
3+
openapi_spec_hash: 8cf560393053b3a83f0ad48b20515589
44
config_hash: 31525fc9404677e20330cc748dfaf55d

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,7 @@ from cloudflare.types.workers import Script, ScriptSetting, ScriptUpdateResponse
23082308
Methods:
23092309

23102310
- <code title="put /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">update</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/script_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_update_response.py">ScriptUpdateResponse</a></code>
2311-
- <code title="get /accounts/{account_id}/workers/scripts">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/workers/script.py">SyncSinglePage[Script]</a></code>
2311+
- <code title="get /accounts/{account_id}/workers/scripts">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workers/script_list_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script.py">SyncSinglePage[Script]</a></code>
23122312
- <code title="delete /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">delete</a>(script_name, \*, account_id, \*\*<a href="src/cloudflare/types/workers/script_delete_params.py">params</a>) -> object</code>
23132313
- <code title="get /accounts/{account_id}/workers/scripts/{script_name}">client.workers.scripts.<a href="./src/cloudflare/resources/workers/scripts/scripts.py">get</a>(script_name, \*, account_id) -> str</code>
23142314

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
AsyncAssetsResourceWithStreamingResponse,
9292
)
9393
from ...._base_client import AsyncPaginator, make_request_options
94-
from ....types.workers import script_delete_params, script_update_params
94+
from ....types.workers import script_list_params, script_delete_params, script_update_params
9595
from ....types.workers.script import Script
9696
from .script_and_version_settings import (
9797
ScriptAndVersionSettingsResource,
@@ -244,6 +244,7 @@ def list(
244244
self,
245245
*,
246246
account_id: str,
247+
tags: str | NotGiven = NOT_GIVEN,
247248
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
248249
# The extra values given here take precedence over values defined on the client or passed to this method.
249250
extra_headers: Headers | None = None,
@@ -257,6 +258,9 @@ def list(
257258
Args:
258259
account_id: Identifier.
259260
261+
tags: Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where
262+
allowed is 'yes' or 'no'.
263+
260264
extra_headers: Send extra headers
261265
262266
extra_query: Add additional query parameters to the request
@@ -271,7 +275,11 @@ def list(
271275
f"/accounts/{account_id}/workers/scripts",
272276
page=SyncSinglePage[Script],
273277
options=make_request_options(
274-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
278+
extra_headers=extra_headers,
279+
extra_query=extra_query,
280+
extra_body=extra_body,
281+
timeout=timeout,
282+
query=maybe_transform({"tags": tags}, script_list_params.ScriptListParams),
275283
),
276284
model=Script,
277285
)
@@ -509,6 +517,7 @@ def list(
509517
self,
510518
*,
511519
account_id: str,
520+
tags: str | NotGiven = NOT_GIVEN,
512521
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
513522
# The extra values given here take precedence over values defined on the client or passed to this method.
514523
extra_headers: Headers | None = None,
@@ -522,6 +531,9 @@ def list(
522531
Args:
523532
account_id: Identifier.
524533
534+
tags: Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where
535+
allowed is 'yes' or 'no'.
536+
525537
extra_headers: Send extra headers
526538
527539
extra_query: Add additional query parameters to the request
@@ -536,7 +548,11 @@ def list(
536548
f"/accounts/{account_id}/workers/scripts",
537549
page=AsyncSinglePage[Script],
538550
options=make_request_options(
539-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
551+
extra_headers=extra_headers,
552+
extra_query=extra_query,
553+
extra_body=extra_body,
554+
timeout=timeout,
555+
query=maybe_transform({"tags": tags}, script_list_params.ScriptListParams),
540556
),
541557
model=Script,
542558
)

src/cloudflare/types/workers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .script_setting import ScriptSetting as ScriptSetting
99
from .domain_list_params import DomainListParams as DomainListParams
1010
from .route_get_response import RouteGetResponse as RouteGetResponse
11+
from .script_list_params import ScriptListParams as ScriptListParams
1112
from .route_create_params import RouteCreateParams as RouteCreateParams
1213
from .route_list_response import RouteListResponse as RouteListResponse
1314
from .route_update_params import RouteUpdateParams as RouteUpdateParams
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, TypedDict
6+
7+
__all__ = ["ScriptListParams"]
8+
9+
10+
class ScriptListParams(TypedDict, total=False):
11+
account_id: Required[str]
12+
"""Identifier."""
13+
14+
tags: str
15+
"""Filter scripts by tags.
16+
17+
Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or
18+
'no'.
19+
"""

tests/api_resources/workers/test_scripts.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ def test_method_list(self, client: Cloudflare) -> None:
161161
)
162162
assert_matches_type(SyncSinglePage[Script], script, path=["response"])
163163

164+
@parametrize
165+
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
166+
script = client.workers.scripts.list(
167+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
168+
tags="production:yes,staging:no",
169+
)
170+
assert_matches_type(SyncSinglePage[Script], script, path=["response"])
171+
164172
@parametrize
165173
def test_raw_response_list(self, client: Cloudflare) -> None:
166174
response = client.workers.scripts.with_raw_response.list(
@@ -443,6 +451,14 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
443451
)
444452
assert_matches_type(AsyncSinglePage[Script], script, path=["response"])
445453

454+
@parametrize
455+
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
456+
script = await async_client.workers.scripts.list(
457+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
458+
tags="production:yes,staging:no",
459+
)
460+
assert_matches_type(AsyncSinglePage[Script], script, path=["response"])
461+
446462
@parametrize
447463
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
448464
response = await async_client.workers.scripts.with_raw_response.list(

0 commit comments

Comments
 (0)