2
2
3
3
from __future__ import annotations
4
4
5
- from typing import Type , Union , cast
5
+ from typing import Type , Union , Iterable , cast
6
6
from datetime import datetime
7
7
from typing_extensions import Literal
8
8
30
30
async_to_streamed_response_wrapper ,
31
31
)
32
32
from ...._wrappers import ResultWrapper
33
- from ....pagination import SyncV4PagePaginationArray , AsyncV4PagePaginationArray
33
+ from ....pagination import SyncSinglePage , AsyncSinglePage , SyncV4PagePaginationArray , AsyncV4PagePaginationArray
34
34
from ...._base_client import AsyncPaginator , make_request_options
35
- from ....types .workflows import instance_list_params , instance_create_params
35
+ from ....types .workflows import instance_bulk_params , instance_list_params , instance_create_params
36
36
from ....types .workflows .instance_get_response import InstanceGetResponse
37
+ from ....types .workflows .instance_bulk_response import InstanceBulkResponse
37
38
from ....types .workflows .instance_list_response import InstanceListResponse
38
39
from ....types .workflows .instance_create_response import InstanceCreateResponse
39
40
@@ -175,6 +176,46 @@ def list(
175
176
model = InstanceListResponse ,
176
177
)
177
178
179
+ def bulk (
180
+ self ,
181
+ workflow_name : str ,
182
+ * ,
183
+ account_id : str ,
184
+ body : Iterable [instance_bulk_params .Body ] | NotGiven = NOT_GIVEN ,
185
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
186
+ # The extra values given here take precedence over values defined on the client or passed to this method.
187
+ extra_headers : Headers | None = None ,
188
+ extra_query : Query | None = None ,
189
+ extra_body : Body | None = None ,
190
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
191
+ ) -> SyncSinglePage [InstanceBulkResponse ]:
192
+ """
193
+ Batch create new Workflow instances
194
+
195
+ Args:
196
+ extra_headers: Send extra headers
197
+
198
+ extra_query: Add additional query parameters to the request
199
+
200
+ extra_body: Add additional JSON properties to the request
201
+
202
+ timeout: Override the client-level default timeout for this request, in seconds
203
+ """
204
+ if not account_id :
205
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
206
+ if not workflow_name :
207
+ raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
208
+ return self ._get_api_list (
209
+ f"/accounts/{ account_id } /workflows/{ workflow_name } /instances/batch" ,
210
+ page = SyncSinglePage [InstanceBulkResponse ],
211
+ body = maybe_transform (body , Iterable [instance_bulk_params .Body ]),
212
+ options = make_request_options (
213
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
214
+ ),
215
+ model = InstanceBulkResponse ,
216
+ method = "post" ,
217
+ )
218
+
178
219
def get (
179
220
self ,
180
221
instance_id : str ,
@@ -354,6 +395,46 @@ def list(
354
395
model = InstanceListResponse ,
355
396
)
356
397
398
+ def bulk (
399
+ self ,
400
+ workflow_name : str ,
401
+ * ,
402
+ account_id : str ,
403
+ body : Iterable [instance_bulk_params .Body ] | NotGiven = NOT_GIVEN ,
404
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
405
+ # The extra values given here take precedence over values defined on the client or passed to this method.
406
+ extra_headers : Headers | None = None ,
407
+ extra_query : Query | None = None ,
408
+ extra_body : Body | None = None ,
409
+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
410
+ ) -> AsyncPaginator [InstanceBulkResponse , AsyncSinglePage [InstanceBulkResponse ]]:
411
+ """
412
+ Batch create new Workflow instances
413
+
414
+ Args:
415
+ extra_headers: Send extra headers
416
+
417
+ extra_query: Add additional query parameters to the request
418
+
419
+ extra_body: Add additional JSON properties to the request
420
+
421
+ timeout: Override the client-level default timeout for this request, in seconds
422
+ """
423
+ if not account_id :
424
+ raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
425
+ if not workflow_name :
426
+ raise ValueError (f"Expected a non-empty value for `workflow_name` but received { workflow_name !r} " )
427
+ return self ._get_api_list (
428
+ f"/accounts/{ account_id } /workflows/{ workflow_name } /instances/batch" ,
429
+ page = AsyncSinglePage [InstanceBulkResponse ],
430
+ body = maybe_transform (body , Iterable [instance_bulk_params .Body ]),
431
+ options = make_request_options (
432
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
433
+ ),
434
+ model = InstanceBulkResponse ,
435
+ method = "post" ,
436
+ )
437
+
357
438
async def get (
358
439
self ,
359
440
instance_id : str ,
@@ -408,6 +489,9 @@ def __init__(self, instances: InstancesResource) -> None:
408
489
self .list = to_raw_response_wrapper (
409
490
instances .list ,
410
491
)
492
+ self .bulk = to_raw_response_wrapper (
493
+ instances .bulk ,
494
+ )
411
495
self .get = to_raw_response_wrapper (
412
496
instances .get ,
413
497
)
@@ -427,6 +511,9 @@ def __init__(self, instances: AsyncInstancesResource) -> None:
427
511
self .list = async_to_raw_response_wrapper (
428
512
instances .list ,
429
513
)
514
+ self .bulk = async_to_raw_response_wrapper (
515
+ instances .bulk ,
516
+ )
430
517
self .get = async_to_raw_response_wrapper (
431
518
instances .get ,
432
519
)
@@ -446,6 +533,9 @@ def __init__(self, instances: InstancesResource) -> None:
446
533
self .list = to_streamed_response_wrapper (
447
534
instances .list ,
448
535
)
536
+ self .bulk = to_streamed_response_wrapper (
537
+ instances .bulk ,
538
+ )
449
539
self .get = to_streamed_response_wrapper (
450
540
instances .get ,
451
541
)
@@ -465,6 +555,9 @@ def __init__(self, instances: AsyncInstancesResource) -> None:
465
555
self .list = async_to_streamed_response_wrapper (
466
556
instances .list ,
467
557
)
558
+ self .bulk = async_to_streamed_response_wrapper (
559
+ instances .bulk ,
560
+ )
468
561
self .get = async_to_streamed_response_wrapper (
469
562
instances .get ,
470
563
)
0 commit comments