@@ -4,7 +4,7 @@ import { APIResource } from '../../../resource';
44import * as Core from '../../../core' ;
55import * as StatusAPI from './status' ;
66import { Status , StatusEditParams , StatusEditResponse } from './status' ;
7- import { V4PagePaginationArray , type V4PagePaginationArrayParams } from '../../../pagination' ;
7+ import { SinglePage , V4PagePaginationArray , type V4PagePaginationArrayParams } from '../../../pagination' ;
88
99export class Instances extends APIResource {
1010 status : StatusAPI . Status = new StatusAPI . Status ( this . _client ) ;
@@ -42,6 +42,22 @@ export class Instances extends APIResource {
4242 ) ;
4343 }
4444
45+ /**
46+ * Batch create new Workflow instances
47+ */
48+ bulk (
49+ workflowName : string ,
50+ params : InstanceBulkParams ,
51+ options ?: Core . RequestOptions ,
52+ ) : Core . PagePromise < InstanceBulkResponsesSinglePage , InstanceBulkResponse > {
53+ const { account_id, body } = params ?? { } ;
54+ return this . _client . getAPIList (
55+ `/accounts/${ account_id } /workflows/${ workflowName } /instances/batch` ,
56+ InstanceBulkResponsesSinglePage ,
57+ { body : body , method : 'post' , ...options } ,
58+ ) ;
59+ }
60+
4561 /**
4662 * Get logs and status from instance
4763 */
@@ -63,6 +79,8 @@ export class Instances extends APIResource {
6379
6480export class InstanceListResponsesV4PagePaginationArray extends V4PagePaginationArray < InstanceListResponse > { }
6581
82+ export class InstanceBulkResponsesSinglePage extends SinglePage < InstanceBulkResponse > { }
83+
6684export interface InstanceCreateResponse {
6785 id : string ;
6886
@@ -109,6 +127,25 @@ export interface InstanceListResponse {
109127 workflow_id : string ;
110128}
111129
130+ export interface InstanceBulkResponse {
131+ id : string ;
132+
133+ status :
134+ | 'queued'
135+ | 'running'
136+ | 'paused'
137+ | 'errored'
138+ | 'terminated'
139+ | 'complete'
140+ | 'waitingForPause'
141+ | 'waiting'
142+ | 'unknown' ;
143+
144+ version_id : string ;
145+
146+ workflow_id : string ;
147+ }
148+
112149export interface InstanceGetResponse {
113150 end : string | null ;
114151
@@ -292,21 +329,45 @@ export interface InstanceListParams extends V4PagePaginationArrayParams {
292329 | 'unknown' ;
293330}
294331
332+ export interface InstanceBulkParams {
333+ /**
334+ * Path param:
335+ */
336+ account_id : string ;
337+
338+ /**
339+ * Body param:
340+ */
341+ body ?: Array < InstanceBulkParams . Body > ;
342+ }
343+
344+ export namespace InstanceBulkParams {
345+ export interface Body {
346+ instance_id ?: string ;
347+
348+ params ?: unknown ;
349+ }
350+ }
351+
295352export interface InstanceGetParams {
296353 account_id : string ;
297354}
298355
299356Instances . InstanceListResponsesV4PagePaginationArray = InstanceListResponsesV4PagePaginationArray ;
357+ Instances . InstanceBulkResponsesSinglePage = InstanceBulkResponsesSinglePage ;
300358Instances . Status = Status ;
301359
302360export declare namespace Instances {
303361 export {
304362 type InstanceCreateResponse as InstanceCreateResponse ,
305363 type InstanceListResponse as InstanceListResponse ,
364+ type InstanceBulkResponse as InstanceBulkResponse ,
306365 type InstanceGetResponse as InstanceGetResponse ,
307366 InstanceListResponsesV4PagePaginationArray as InstanceListResponsesV4PagePaginationArray ,
367+ InstanceBulkResponsesSinglePage as InstanceBulkResponsesSinglePage ,
308368 type InstanceCreateParams as InstanceCreateParams ,
309369 type InstanceListParams as InstanceListParams ,
370+ type InstanceBulkParams as InstanceBulkParams ,
310371 type InstanceGetParams as InstanceGetParams ,
311372 } ;
312373
0 commit comments