Skip to content

Commit e0e13d1

Browse files
feat(api): api update
1 parent 053f18f commit e0e13d1

7 files changed

Lines changed: 45 additions & 27 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: 1782
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-eb90b7fb6b9b4fdf8aa58c6f60980875a8dc855114fb2f84a4998024d7087f69.yml
3-
openapi_spec_hash: 7eabd8352835bf80892dbb494fdf3ef4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d2a66f62f007704db30b02dc6072a9c9a3363f229521fd5c8d1db94cdaddf682.yml
3+
openapi_spec_hash: 5439122fed13eb566c770576999e67fb
44
config_hash: eda5b3d9487ce675d1fadf88153b457d

src/cloudflare/resources/snippets/rules.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def update(
5050
self,
5151
*,
5252
zone_id: str,
53-
body: Iterable[rule_update_params.Body],
53+
rules: Iterable[rule_update_params.Rule],
5454
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5555
# The extra values given here take precedence over values defined on the client or passed to this method.
5656
extra_headers: Headers | None = None,
@@ -64,7 +64,7 @@ def update(
6464
Args:
6565
zone_id: The unique ID of the zone.
6666
67-
body: A list of snippet rules.
67+
rules: A list of snippet rules.
6868
6969
extra_headers: Send extra headers
7070
@@ -79,7 +79,7 @@ def update(
7979
return self._get_api_list(
8080
f"/zones/{zone_id}/snippets/snippet_rules",
8181
page=SyncSinglePage[RuleUpdateResponse],
82-
body=maybe_transform(body, Iterable[rule_update_params.Body]),
82+
body=maybe_transform({"rules": rules}, rule_update_params.RuleUpdateParams),
8383
options=make_request_options(
8484
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
8585
),
@@ -185,7 +185,7 @@ def update(
185185
self,
186186
*,
187187
zone_id: str,
188-
body: Iterable[rule_update_params.Body],
188+
rules: Iterable[rule_update_params.Rule],
189189
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
190190
# The extra values given here take precedence over values defined on the client or passed to this method.
191191
extra_headers: Headers | None = None,
@@ -199,7 +199,7 @@ def update(
199199
Args:
200200
zone_id: The unique ID of the zone.
201201
202-
body: A list of snippet rules.
202+
rules: A list of snippet rules.
203203
204204
extra_headers: Send extra headers
205205
@@ -214,7 +214,7 @@ def update(
214214
return self._get_api_list(
215215
f"/zones/{zone_id}/snippets/snippet_rules",
216216
page=AsyncSinglePage[RuleUpdateResponse],
217-
body=maybe_transform(body, Iterable[rule_update_params.Body]),
217+
body=maybe_transform({"rules": rules}, rule_update_params.RuleUpdateParams),
218218
options=make_request_options(
219219
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
220220
),

src/cloudflare/resources/workflows/instances/instances.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def list(
130130
workflow_name: str,
131131
*,
132132
account_id: str,
133+
cursor: str | NotGiven = NOT_GIVEN,
133134
date_end: Union[str, datetime] | NotGiven = NOT_GIVEN,
134135
date_start: Union[str, datetime] | NotGiven = NOT_GIVEN,
135136
page: float | NotGiven = NOT_GIVEN,
@@ -149,10 +150,14 @@ def list(
149150
List of workflow instances
150151
151152
Args:
153+
cursor: `page` and `cursor` are mutually exclusive, use one or the other.
154+
152155
date_end: Accepts ISO 8601 with no timezone offsets and in UTC.
153156
154157
date_start: Accepts ISO 8601 with no timezone offsets and in UTC.
155158
159+
page: `page` and `cursor` are mutually exclusive, use one or the other.
160+
156161
extra_headers: Send extra headers
157162
158163
extra_query: Add additional query parameters to the request
@@ -175,6 +180,7 @@ def list(
175180
timeout=timeout,
176181
query=maybe_transform(
177182
{
183+
"cursor": cursor,
178184
"date_end": date_end,
179185
"date_start": date_start,
180186
"page": page,
@@ -355,6 +361,7 @@ def list(
355361
workflow_name: str,
356362
*,
357363
account_id: str,
364+
cursor: str | NotGiven = NOT_GIVEN,
358365
date_end: Union[str, datetime] | NotGiven = NOT_GIVEN,
359366
date_start: Union[str, datetime] | NotGiven = NOT_GIVEN,
360367
page: float | NotGiven = NOT_GIVEN,
@@ -374,10 +381,14 @@ def list(
374381
List of workflow instances
375382
376383
Args:
384+
cursor: `page` and `cursor` are mutually exclusive, use one or the other.
385+
377386
date_end: Accepts ISO 8601 with no timezone offsets and in UTC.
378387
379388
date_start: Accepts ISO 8601 with no timezone offsets and in UTC.
380389
390+
page: `page` and `cursor` are mutually exclusive, use one or the other.
391+
381392
extra_headers: Send extra headers
382393
383394
extra_query: Add additional query parameters to the request
@@ -400,6 +411,7 @@ def list(
400411
timeout=timeout,
401412
query=maybe_transform(
402413
{
414+
"cursor": cursor,
403415
"date_end": date_end,
404416
"date_start": date_start,
405417
"page": page,

src/cloudflare/types/snippets/rule_update_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
from typing import Iterable
66
from typing_extensions import Required, TypedDict
77

8-
__all__ = ["RuleUpdateParams", "Body"]
8+
__all__ = ["RuleUpdateParams", "Rule"]
99

1010

1111
class RuleUpdateParams(TypedDict, total=False):
1212
zone_id: Required[str]
1313
"""The unique ID of the zone."""
1414

15-
body: Required[Iterable[Body]]
15+
rules: Required[Iterable[Rule]]
1616
"""A list of snippet rules."""
1717

1818

19-
class Body(TypedDict, total=False):
19+
class Rule(TypedDict, total=False):
2020
expression: Required[str]
2121
"""The expression defining which traffic will match the rule."""
2222

src/cloudflare/types/workflows/instance_list_params.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
class InstanceListParams(TypedDict, total=False):
1515
account_id: Required[str]
1616

17+
cursor: str
18+
"""`page` and `cursor` are mutually exclusive, use one or the other."""
19+
1720
date_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
1821
"""Accepts ISO 8601 with no timezone offsets and in UTC."""
1922

2023
date_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
2124
"""Accepts ISO 8601 with no timezone offsets and in UTC."""
2225

2326
page: float
27+
"""`page` and `cursor` are mutually exclusive, use one or the other."""
2428

2529
per_page: float
2630

tests/api_resources/snippets/test_rules.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class TestRules:
2222
def test_method_update(self, client: Cloudflare) -> None:
2323
rule = client.snippets.rules.update(
2424
zone_id="9f1839b6152d298aca64c4e906b6d074",
25-
body=[
25+
rules=[
2626
{
27-
"expression": "ip.src ne 1.1.1.1",
27+
"expression": "ip.src eq 1.1.1.1",
2828
"snippet_name": "my_snippet",
2929
}
3030
],
@@ -35,9 +35,9 @@ def test_method_update(self, client: Cloudflare) -> None:
3535
def test_raw_response_update(self, client: Cloudflare) -> None:
3636
response = client.snippets.rules.with_raw_response.update(
3737
zone_id="9f1839b6152d298aca64c4e906b6d074",
38-
body=[
38+
rules=[
3939
{
40-
"expression": "ip.src ne 1.1.1.1",
40+
"expression": "ip.src eq 1.1.1.1",
4141
"snippet_name": "my_snippet",
4242
}
4343
],
@@ -52,9 +52,9 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
5252
def test_streaming_response_update(self, client: Cloudflare) -> None:
5353
with client.snippets.rules.with_streaming_response.update(
5454
zone_id="9f1839b6152d298aca64c4e906b6d074",
55-
body=[
55+
rules=[
5656
{
57-
"expression": "ip.src ne 1.1.1.1",
57+
"expression": "ip.src eq 1.1.1.1",
5858
"snippet_name": "my_snippet",
5959
}
6060
],
@@ -72,9 +72,9 @@ def test_path_params_update(self, client: Cloudflare) -> None:
7272
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
7373
client.snippets.rules.with_raw_response.update(
7474
zone_id="",
75-
body=[
75+
rules=[
7676
{
77-
"expression": "ip.src ne 1.1.1.1",
77+
"expression": "ip.src eq 1.1.1.1",
7878
"snippet_name": "my_snippet",
7979
}
8080
],
@@ -166,9 +166,9 @@ class TestAsyncRules:
166166
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
167167
rule = await async_client.snippets.rules.update(
168168
zone_id="9f1839b6152d298aca64c4e906b6d074",
169-
body=[
169+
rules=[
170170
{
171-
"expression": "ip.src ne 1.1.1.1",
171+
"expression": "ip.src eq 1.1.1.1",
172172
"snippet_name": "my_snippet",
173173
}
174174
],
@@ -179,9 +179,9 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
179179
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
180180
response = await async_client.snippets.rules.with_raw_response.update(
181181
zone_id="9f1839b6152d298aca64c4e906b6d074",
182-
body=[
182+
rules=[
183183
{
184-
"expression": "ip.src ne 1.1.1.1",
184+
"expression": "ip.src eq 1.1.1.1",
185185
"snippet_name": "my_snippet",
186186
}
187187
],
@@ -196,9 +196,9 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
196196
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
197197
async with async_client.snippets.rules.with_streaming_response.update(
198198
zone_id="9f1839b6152d298aca64c4e906b6d074",
199-
body=[
199+
rules=[
200200
{
201-
"expression": "ip.src ne 1.1.1.1",
201+
"expression": "ip.src eq 1.1.1.1",
202202
"snippet_name": "my_snippet",
203203
}
204204
],
@@ -216,9 +216,9 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
216216
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
217217
await async_client.snippets.rules.with_raw_response.update(
218218
zone_id="",
219-
body=[
219+
rules=[
220220
{
221-
"expression": "ip.src ne 1.1.1.1",
221+
"expression": "ip.src eq 1.1.1.1",
222222
"snippet_name": "my_snippet",
223223
}
224224
],

tests/api_resources/workflows/test_instances.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
9696
instance = client.workflows.instances.list(
9797
workflow_name="x",
9898
account_id="account_id",
99+
cursor="cursor",
99100
date_end=parse_datetime("2019-12-27T18:11:19.117Z"),
100101
date_start=parse_datetime("2019-12-27T18:11:19.117Z"),
101102
page=1,
@@ -345,6 +346,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
345346
instance = await async_client.workflows.instances.list(
346347
workflow_name="x",
347348
account_id="account_id",
349+
cursor="cursor",
348350
date_end=parse_datetime("2019-12-27T18:11:19.117Z"),
349351
date_start=parse_datetime("2019-12-27T18:11:19.117Z"),
350352
page=1,

0 commit comments

Comments
 (0)