22
33from __future__ import annotations
44
5- from typing import Type , Union , cast
5+ from typing import Type , Union , Iterable , cast
66from datetime import datetime
77from typing_extensions import Literal
88
3030 async_to_streamed_response_wrapper ,
3131)
3232from ...._wrappers import ResultWrapper
33- from ....pagination import SyncV4PagePaginationArray , AsyncV4PagePaginationArray
33+ from ....pagination import SyncSinglePage , AsyncSinglePage , SyncV4PagePaginationArray , AsyncV4PagePaginationArray
3434from ...._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
3636from ....types .workflows .instance_get_response import InstanceGetResponse
37+ from ....types .workflows .instance_bulk_response import InstanceBulkResponse
3738from ....types .workflows .instance_list_response import InstanceListResponse
3839from ....types .workflows .instance_create_response import InstanceCreateResponse
3940
@@ -175,6 +176,46 @@ def list(
175176 model = InstanceListResponse ,
176177 )
177178
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+
178219 def get (
179220 self ,
180221 instance_id : str ,
@@ -354,6 +395,46 @@ def list(
354395 model = InstanceListResponse ,
355396 )
356397
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+
357438 async def get (
358439 self ,
359440 instance_id : str ,
@@ -408,6 +489,9 @@ def __init__(self, instances: InstancesResource) -> None:
408489 self .list = to_raw_response_wrapper (
409490 instances .list ,
410491 )
492+ self .bulk = to_raw_response_wrapper (
493+ instances .bulk ,
494+ )
411495 self .get = to_raw_response_wrapper (
412496 instances .get ,
413497 )
@@ -427,6 +511,9 @@ def __init__(self, instances: AsyncInstancesResource) -> None:
427511 self .list = async_to_raw_response_wrapper (
428512 instances .list ,
429513 )
514+ self .bulk = async_to_raw_response_wrapper (
515+ instances .bulk ,
516+ )
430517 self .get = async_to_raw_response_wrapper (
431518 instances .get ,
432519 )
@@ -446,6 +533,9 @@ def __init__(self, instances: InstancesResource) -> None:
446533 self .list = to_streamed_response_wrapper (
447534 instances .list ,
448535 )
536+ self .bulk = to_streamed_response_wrapper (
537+ instances .bulk ,
538+ )
449539 self .get = to_streamed_response_wrapper (
450540 instances .get ,
451541 )
@@ -465,6 +555,9 @@ def __init__(self, instances: AsyncInstancesResource) -> None:
465555 self .list = async_to_streamed_response_wrapper (
466556 instances .list ,
467557 )
558+ self .bulk = async_to_streamed_response_wrapper (
559+ instances .bulk ,
560+ )
468561 self .get = async_to_streamed_response_wrapper (
469562 instances .get ,
470563 )
0 commit comments