Skip to content

Commit 7b0082c

Browse files
committed
feat(workflows): update generated types and methods
1 parent 83a81dd commit 7b0082c

16 files changed

Lines changed: 279 additions & 75 deletions
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Workflows
2+
3+
Types:
4+
5+
```python
6+
from cloudflare.types.workflows import (
7+
WorkflowUpdateResponse,
8+
WorkflowListResponse,
9+
WorkflowDeleteResponse,
10+
WorkflowGetResponse,
11+
)
12+
```
13+
14+
Methods:
15+
16+
- <code title="put /accounts/{account_id}/workflows/{workflow_name}">client.workflows.<a href="./src/cloudflare/resources/workflows/workflows.py">update</a>(workflow_name, \*, account_id, \*\*<a href="src/cloudflare/types/workflows/workflow_update_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/workflow_update_response.py">WorkflowUpdateResponse</a></code>
17+
- <code title="get /accounts/{account_id}/workflows">client.workflows.<a href="./src/cloudflare/resources/workflows/workflows.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/workflows/workflow_list_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/workflow_list_response.py">SyncV4PagePaginationArray[WorkflowListResponse]</a></code>
18+
- <code title="delete /accounts/{account_id}/workflows/{workflow_name}">client.workflows.<a href="./src/cloudflare/resources/workflows/workflows.py">delete</a>(workflow_name, \*, account_id) -> <a href="./src/cloudflare/types/workflows/workflow_delete_response.py">WorkflowDeleteResponse</a></code>
19+
- <code title="get /accounts/{account_id}/workflows/{workflow_name}">client.workflows.<a href="./src/cloudflare/resources/workflows/workflows.py">get</a>(workflow_name, \*, account_id) -> <a href="./src/cloudflare/types/workflows/workflow_get_response.py">WorkflowGetResponse</a></code>
20+
21+
## Instances
22+
23+
Types:
24+
25+
```python
26+
from cloudflare.types.workflows import (
27+
InstanceCreateResponse,
28+
InstanceListResponse,
29+
InstanceBulkResponse,
30+
InstanceGetResponse,
31+
)
32+
```
33+
34+
Methods:
35+
36+
- <code title="post /accounts/{account_id}/workflows/{workflow_name}/instances">client.workflows.instances.<a href="./src/cloudflare/resources/workflows/instances/instances.py">create</a>(workflow_name, \*, account_id, \*\*<a href="src/cloudflare/types/workflows/instance_create_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/instance_create_response.py">InstanceCreateResponse</a></code>
37+
- <code title="get /accounts/{account_id}/workflows/{workflow_name}/instances">client.workflows.instances.<a href="./src/cloudflare/resources/workflows/instances/instances.py">list</a>(workflow_name, \*, account_id, \*\*<a href="src/cloudflare/types/workflows/instance_list_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/instance_list_response.py">SyncV4PagePaginationArray[InstanceListResponse]</a></code>
38+
- <code title="post /accounts/{account_id}/workflows/{workflow_name}/instances/batch">client.workflows.instances.<a href="./src/cloudflare/resources/workflows/instances/instances.py">bulk</a>(workflow_name, \*, account_id, \*\*<a href="src/cloudflare/types/workflows/instance_bulk_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/instance_bulk_response.py">SyncSinglePage[InstanceBulkResponse]</a></code>
39+
- <code title="get /accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}">client.workflows.instances.<a href="./src/cloudflare/resources/workflows/instances/instances.py">get</a>(instance_id, \*, account_id, workflow_name, \*\*<a href="src/cloudflare/types/workflows/instance_get_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/instance_get_response.py">InstanceGetResponse</a></code>
40+
41+
### Status
42+
43+
Types:
44+
45+
```python
46+
from cloudflare.types.workflows.instances import StatusEditResponse
47+
```
48+
49+
Methods:
50+
51+
- <code title="patch /accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/status">client.workflows.instances.status.<a href="./src/cloudflare/resources/workflows/instances/status.py">edit</a>(instance_id, \*, account_id, workflow_name, \*\*<a href="src/cloudflare/types/workflows/instances/status_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/instances/status_edit_response.py">StatusEditResponse</a></code>
52+
53+
### Events
54+
55+
Methods:
56+
57+
- <code title="post /accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{event_type}">client.workflows.instances.events.<a href="./src/cloudflare/resources/workflows/instances/events.py">create</a>(event_type, \*, account_id, workflow_name, instance_id, \*\*<a href="src/cloudflare/types/workflows/instances/event_create_params.py">params</a>) -> object</code>
58+
59+
## Versions
60+
61+
Types:
62+
63+
```python
64+
from cloudflare.types.workflows import VersionListResponse, VersionGetResponse
65+
```
66+
67+
Methods:
68+
69+
- <code title="get /accounts/{account_id}/workflows/{workflow_name}/versions">client.workflows.versions.<a href="./src/cloudflare/resources/workflows/versions.py">list</a>(workflow_name, \*, account_id, \*\*<a href="src/cloudflare/types/workflows/version_list_params.py">params</a>) -> <a href="./src/cloudflare/types/workflows/version_list_response.py">SyncV4PagePaginationArray[VersionListResponse]</a></code>
70+
- <code title="get /accounts/{account_id}/workflows/{workflow_name}/versions/{version_id}">client.workflows.versions.<a href="./src/cloudflare/resources/workflows/versions.py">get</a>(version_id, \*, account_id, workflow_name) -> <a href="./src/cloudflare/types/workflows/version_get_response.py">VersionGetResponse</a></code>

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import httpx
88

99
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10-
from ...._utils import maybe_transform, async_maybe_transform
10+
from ...._utils import path_template, maybe_transform, async_maybe_transform
1111
from ...._compat import cached_property
1212
from ...._resource import SyncAPIResource, AsyncAPIResource
1313
from ...._response import (
@@ -47,7 +47,7 @@ def create(
4747
self,
4848
event_type: str,
4949
*,
50-
account_id: str,
50+
account_id: str | None = None,
5151
workflow_name: str,
5252
instance_id: str,
5353
body: object | Omit = omit,
@@ -70,6 +70,8 @@ def create(
7070
7171
timeout: Override the client-level default timeout for this request, in seconds
7272
"""
73+
if account_id is None:
74+
account_id = self._client._get_account_id_path_param()
7375
if not account_id:
7476
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
7577
if not workflow_name:
@@ -79,7 +81,13 @@ def create(
7981
if not event_type:
8082
raise ValueError(f"Expected a non-empty value for `event_type` but received {event_type!r}")
8183
return self._post(
82-
f"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{event_type}",
84+
path_template(
85+
"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{event_type}",
86+
account_id=account_id,
87+
workflow_name=workflow_name,
88+
instance_id=instance_id,
89+
event_type=event_type,
90+
),
8391
body=maybe_transform(body, event_create_params.EventCreateParams),
8492
options=make_request_options(
8593
extra_headers=extra_headers,
@@ -116,7 +124,7 @@ async def create(
116124
self,
117125
event_type: str,
118126
*,
119-
account_id: str,
127+
account_id: str | None = None,
120128
workflow_name: str,
121129
instance_id: str,
122130
body: object | Omit = omit,
@@ -139,6 +147,8 @@ async def create(
139147
140148
timeout: Override the client-level default timeout for this request, in seconds
141149
"""
150+
if account_id is None:
151+
account_id = self._client._get_account_id_path_param()
142152
if not account_id:
143153
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
144154
if not workflow_name:
@@ -148,7 +158,13 @@ async def create(
148158
if not event_type:
149159
raise ValueError(f"Expected a non-empty value for `event_type` but received {event_type!r}")
150160
return await self._post(
151-
f"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{event_type}",
161+
path_template(
162+
"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}/events/{event_type}",
163+
account_id=account_id,
164+
workflow_name=workflow_name,
165+
instance_id=instance_id,
166+
event_type=event_type,
167+
),
152168
body=await async_maybe_transform(body, event_create_params.EventCreateParams),
153169
options=make_request_options(
154170
extra_headers=extra_headers,

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

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
AsyncStatusResourceWithStreamingResponse,
2626
)
2727
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
28-
from ...._utils import maybe_transform, async_maybe_transform
28+
from ...._utils import path_template, maybe_transform, async_maybe_transform
2929
from ...._compat import cached_property
3030
from ...._resource import SyncAPIResource, AsyncAPIResource
3131
from ...._response import (
@@ -78,7 +78,7 @@ def create(
7878
self,
7979
workflow_name: str,
8080
*,
81-
account_id: str,
81+
account_id: str | None = None,
8282
instance_id: str | Omit = omit,
8383
instance_retention: instance_create_params.InstanceRetention | Omit = omit,
8484
params: object | Omit = omit,
@@ -101,12 +101,18 @@ def create(
101101
102102
timeout: Override the client-level default timeout for this request, in seconds
103103
"""
104+
if account_id is None:
105+
account_id = self._client._get_account_id_path_param()
104106
if not account_id:
105107
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
106108
if not workflow_name:
107109
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
108110
return self._post(
109-
f"/accounts/{account_id}/workflows/{workflow_name}/instances",
111+
path_template(
112+
"/accounts/{account_id}/workflows/{workflow_name}/instances",
113+
account_id=account_id,
114+
workflow_name=workflow_name,
115+
),
110116
body=maybe_transform(
111117
{
112118
"instance_id": instance_id,
@@ -129,7 +135,7 @@ def list(
129135
self,
130136
workflow_name: str,
131137
*,
132-
account_id: str,
138+
account_id: str | None = None,
133139
cursor: str | Omit = omit,
134140
date_end: Union[str, datetime] | Omit = omit,
135141
date_start: Union[str, datetime] | Omit = omit,
@@ -169,12 +175,18 @@ def list(
169175
170176
timeout: Override the client-level default timeout for this request, in seconds
171177
"""
178+
if account_id is None:
179+
account_id = self._client._get_account_id_path_param()
172180
if not account_id:
173181
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
174182
if not workflow_name:
175183
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
176184
return self._get_api_list(
177-
f"/accounts/{account_id}/workflows/{workflow_name}/instances",
185+
path_template(
186+
"/accounts/{account_id}/workflows/{workflow_name}/instances",
187+
account_id=account_id,
188+
workflow_name=workflow_name,
189+
),
178190
page=SyncV4PagePaginationArray[InstanceListResponse],
179191
options=make_request_options(
180192
extra_headers=extra_headers,
@@ -201,7 +213,7 @@ def bulk(
201213
self,
202214
workflow_name: str,
203215
*,
204-
account_id: str,
216+
account_id: str | None = None,
205217
body: Iterable[instance_bulk_params.Body] | Omit = omit,
206218
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
207219
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -222,12 +234,18 @@ def bulk(
222234
223235
timeout: Override the client-level default timeout for this request, in seconds
224236
"""
237+
if account_id is None:
238+
account_id = self._client._get_account_id_path_param()
225239
if not account_id:
226240
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
227241
if not workflow_name:
228242
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
229243
return self._get_api_list(
230-
f"/accounts/{account_id}/workflows/{workflow_name}/instances/batch",
244+
path_template(
245+
"/accounts/{account_id}/workflows/{workflow_name}/instances/batch",
246+
account_id=account_id,
247+
workflow_name=workflow_name,
248+
),
231249
page=SyncSinglePage[InstanceBulkResponse],
232250
body=maybe_transform(body, Iterable[instance_bulk_params.Body]),
233251
options=make_request_options(
@@ -241,7 +259,7 @@ def get(
241259
self,
242260
instance_id: str,
243261
*,
244-
account_id: str,
262+
account_id: str | None = None,
245263
workflow_name: str,
246264
order: Literal["asc", "desc"] | Omit = omit,
247265
simple: Literal["true", "false"] | Omit = omit,
@@ -268,14 +286,21 @@ def get(
268286
269287
timeout: Override the client-level default timeout for this request, in seconds
270288
"""
289+
if account_id is None:
290+
account_id = self._client._get_account_id_path_param()
271291
if not account_id:
272292
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
273293
if not workflow_name:
274294
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
275295
if not instance_id:
276296
raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
277297
return self._get(
278-
f"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}",
298+
path_template(
299+
"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}",
300+
account_id=account_id,
301+
workflow_name=workflow_name,
302+
instance_id=instance_id,
303+
),
279304
options=make_request_options(
280305
extra_headers=extra_headers,
281306
extra_query=extra_query,
@@ -326,7 +351,7 @@ async def create(
326351
self,
327352
workflow_name: str,
328353
*,
329-
account_id: str,
354+
account_id: str | None = None,
330355
instance_id: str | Omit = omit,
331356
instance_retention: instance_create_params.InstanceRetention | Omit = omit,
332357
params: object | Omit = omit,
@@ -349,12 +374,18 @@ async def create(
349374
350375
timeout: Override the client-level default timeout for this request, in seconds
351376
"""
377+
if account_id is None:
378+
account_id = self._client._get_account_id_path_param()
352379
if not account_id:
353380
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
354381
if not workflow_name:
355382
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
356383
return await self._post(
357-
f"/accounts/{account_id}/workflows/{workflow_name}/instances",
384+
path_template(
385+
"/accounts/{account_id}/workflows/{workflow_name}/instances",
386+
account_id=account_id,
387+
workflow_name=workflow_name,
388+
),
358389
body=await async_maybe_transform(
359390
{
360391
"instance_id": instance_id,
@@ -377,7 +408,7 @@ def list(
377408
self,
378409
workflow_name: str,
379410
*,
380-
account_id: str,
411+
account_id: str | None = None,
381412
cursor: str | Omit = omit,
382413
date_end: Union[str, datetime] | Omit = omit,
383414
date_start: Union[str, datetime] | Omit = omit,
@@ -417,12 +448,18 @@ def list(
417448
418449
timeout: Override the client-level default timeout for this request, in seconds
419450
"""
451+
if account_id is None:
452+
account_id = self._client._get_account_id_path_param()
420453
if not account_id:
421454
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
422455
if not workflow_name:
423456
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
424457
return self._get_api_list(
425-
f"/accounts/{account_id}/workflows/{workflow_name}/instances",
458+
path_template(
459+
"/accounts/{account_id}/workflows/{workflow_name}/instances",
460+
account_id=account_id,
461+
workflow_name=workflow_name,
462+
),
426463
page=AsyncV4PagePaginationArray[InstanceListResponse],
427464
options=make_request_options(
428465
extra_headers=extra_headers,
@@ -449,7 +486,7 @@ def bulk(
449486
self,
450487
workflow_name: str,
451488
*,
452-
account_id: str,
489+
account_id: str | None = None,
453490
body: Iterable[instance_bulk_params.Body] | Omit = omit,
454491
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
455492
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -470,12 +507,18 @@ def bulk(
470507
471508
timeout: Override the client-level default timeout for this request, in seconds
472509
"""
510+
if account_id is None:
511+
account_id = self._client._get_account_id_path_param()
473512
if not account_id:
474513
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
475514
if not workflow_name:
476515
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
477516
return self._get_api_list(
478-
f"/accounts/{account_id}/workflows/{workflow_name}/instances/batch",
517+
path_template(
518+
"/accounts/{account_id}/workflows/{workflow_name}/instances/batch",
519+
account_id=account_id,
520+
workflow_name=workflow_name,
521+
),
479522
page=AsyncSinglePage[InstanceBulkResponse],
480523
body=maybe_transform(body, Iterable[instance_bulk_params.Body]),
481524
options=make_request_options(
@@ -489,7 +532,7 @@ async def get(
489532
self,
490533
instance_id: str,
491534
*,
492-
account_id: str,
535+
account_id: str | None = None,
493536
workflow_name: str,
494537
order: Literal["asc", "desc"] | Omit = omit,
495538
simple: Literal["true", "false"] | Omit = omit,
@@ -516,14 +559,21 @@ async def get(
516559
517560
timeout: Override the client-level default timeout for this request, in seconds
518561
"""
562+
if account_id is None:
563+
account_id = self._client._get_account_id_path_param()
519564
if not account_id:
520565
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
521566
if not workflow_name:
522567
raise ValueError(f"Expected a non-empty value for `workflow_name` but received {workflow_name!r}")
523568
if not instance_id:
524569
raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
525570
return await self._get(
526-
f"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}",
571+
path_template(
572+
"/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}",
573+
account_id=account_id,
574+
workflow_name=workflow_name,
575+
instance_id=instance_id,
576+
),
527577
options=make_request_options(
528578
extra_headers=extra_headers,
529579
extra_query=extra_query,

0 commit comments

Comments
 (0)