@epilot/automation-client 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,608 @@
1
+ /* eslint-disable */
2
+ import {
3
+ OpenAPIClient,
4
+ Parameters,
5
+ UnknownParamsObject,
6
+ OperationResponse,
7
+ AxiosRequestConfig,
8
+ } from 'openapi-client-axios';
9
+
10
+ declare namespace Components {
11
+ namespace Schemas {
12
+ export type AnyAction = MapEntityAction | TriggerWorkflowAction | TriggerWebhookAction | AutomationAction;
13
+ export interface AutomationAction {
14
+ id?: AutomationActionId;
15
+ name?: string;
16
+ type?: string;
17
+ config?: {
18
+ [name: string]: any;
19
+ };
20
+ }
21
+ /**
22
+ * example:
23
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
24
+ */
25
+ export type AutomationActionId = string;
26
+ export interface AutomationExecution {
27
+ id?: AutomationExecutionId;
28
+ /**
29
+ * example:
30
+ * success
31
+ */
32
+ status?: "pending" | "in_progress" | "success" | "failed" | "cancelled";
33
+ entity_id?: EntityId;
34
+ org_id?: OrganizationId;
35
+ flow_id?: AutomationFlowId;
36
+ /**
37
+ * example:
38
+ * Handle contact form
39
+ */
40
+ flow_name?: string;
41
+ created_at?: string; // date-time
42
+ updated_at?: string; // date-time
43
+ current_action_id?: AutomationActionId;
44
+ actions?: {
45
+ status?: "pending" | "in_progress" | "success" | "failed";
46
+ started_at?: string; // date-time
47
+ updated_at?: string; // date-time
48
+ /**
49
+ * example:
50
+ * {
51
+ * "affected_entities": "cbbf0e83-0f37-4a0c-9801-93877ec0b2c2"
52
+ * }
53
+ */
54
+ outputs?: {
55
+ [name: string]: any;
56
+ };
57
+ /**
58
+ * example:
59
+ * {
60
+ * "email": "$.contact.email",
61
+ * "name": "$.contact.name",
62
+ * "template_id": "6a5b1249-4093-4724-b25a-ae985f7877d6"
63
+ * }
64
+ */
65
+ inputs?: {
66
+ [name: string]: any;
67
+ };
68
+ id?: AutomationActionId;
69
+ name?: string;
70
+ type?: string;
71
+ config?: {
72
+ [name: string]: any;
73
+ };
74
+ }[];
75
+ }
76
+ /**
77
+ * example:
78
+ * 9baf184f-bc81-4128-bca3-d974c90a12c4
79
+ */
80
+ export type AutomationExecutionId = string;
81
+ export interface AutomationFlow {
82
+ id?: AutomationFlowId;
83
+ /**
84
+ * example:
85
+ * Handle contact form
86
+ */
87
+ flow_name?: string;
88
+ trigger?: EntityOperationTrigger;
89
+ /**
90
+ * The entity schema
91
+ * example:
92
+ * submission
93
+ */
94
+ entity?: string;
95
+ actions?: AnyAction[];
96
+ created_at?: string; // date-time
97
+ updated_at?: string; // date-time
98
+ }
99
+ /**
100
+ * example:
101
+ * 7791b04a-16d2-44a2-9af9-2d59c25c512f
102
+ */
103
+ export type AutomationFlowId = string;
104
+ /**
105
+ * example:
106
+ * e3d3ebac-baab-4395-abf4-50b5bf1f8b74
107
+ */
108
+ export type EntityId = string;
109
+ export interface EntityOperationTrigger {
110
+ type?: "entity_operation";
111
+ configuration?: {
112
+ /**
113
+ * example:
114
+ * submission
115
+ */
116
+ schema?: string;
117
+ operations?: ("createEntity" | "updateEntity" | "deleteEntity")[];
118
+ /**
119
+ * example:
120
+ * [
121
+ * {
122
+ * "source": "source_type",
123
+ * "comparison": "equals",
124
+ * "value": "journey"
125
+ * },
126
+ * {
127
+ * "source": "source_id",
128
+ * "comparison": "array_in",
129
+ * "value": [
130
+ * "c69b3f50-0c9b-11ec-b2e4-8724b261c6ab",
131
+ * "6053c022-d50a-4b8d-9dcd-3b31213af36b"
132
+ * ]
133
+ * }
134
+ * ]
135
+ */
136
+ conditions?: {
137
+ source?: string;
138
+ comparison?: "not_empty" | "is_empty" | "equals" | "contains" | "array_in";
139
+ value?: string | number | [string?, ...any[]];
140
+ }[];
141
+ };
142
+ }
143
+ export interface FrontendSubmitTrigger {
144
+ type?: "frontend_submit";
145
+ configuration?: {
146
+ /**
147
+ * example:
148
+ * 99
149
+ */
150
+ frontend_id?: string;
151
+ };
152
+ }
153
+ export interface JourneySubmitTrigger {
154
+ type?: "journey_submit";
155
+ configuration?: {
156
+ journey_id?: string; // uuid
157
+ };
158
+ }
159
+ /**
160
+ * example:
161
+ * {
162
+ * "id": "2520gja-2sgmsaga-0asg-822jgal",
163
+ * "name": "Map Entity",
164
+ * "type": "map-entity",
165
+ * "config": {
166
+ * "target_schema": "contact",
167
+ * "target_unique": [
168
+ * "email.email"
169
+ * ],
170
+ * "mapping_attributes": [
171
+ * {
172
+ * "target": "email",
173
+ * "mode": "copy_if_exists",
174
+ * "source": "billing_contact.email"
175
+ * },
176
+ * {
177
+ * "target": "first_name",
178
+ * "mode": "copy_if_exists",
179
+ * "source": "billing_contact.first_name"
180
+ * },
181
+ * {
182
+ * "target": "last_name",
183
+ * "mode": "copy_if_exists",
184
+ * "source": "billing_contact.last_name"
185
+ * },
186
+ * {
187
+ * "target": "addresses",
188
+ * "mode": "append_if_exists",
189
+ * "source": "billing_contact",
190
+ * "value_json": "{\n \"street_name\": \"{{billing_contact.street_name}}\",\n \"street_number\": \"{{billing_contact.street_number}}\",\n \"city\": \"{{billing_contact.city}}\",\n \"postal_code\": \"{{billing_contact.postal_code}}\",\n \"country\": \"{{billing_contact.country}}\",\n}"
191
+ * },
192
+ * {
193
+ * "target": "addresses",
194
+ * "mode": "append_if_exists",
195
+ * "source": "delivery_contact",
196
+ * "value_json": "{\n \"street_name\": \"{{delivery_contact.street_name}}\",\n \"street_number\": \"{{delivery_contact.street_number}}\",\n \"city\": \"{{delivery_contact.city}}\",\n \"postal_code\": \"{{delivery_contact.postal_code}}\",\n \"country\": \"{{delivery_contact.country}}\",\n}"
197
+ * }
198
+ * ]
199
+ * }
200
+ * }
201
+ */
202
+ export interface MapEntityAction {
203
+ id?: AutomationActionId;
204
+ name?: string;
205
+ type?: string;
206
+ config?: MapEntityActionConfig;
207
+ outputs?: {
208
+ [name: string]: any;
209
+ };
210
+ }
211
+ export interface MapEntityActionConfig {
212
+ target_schema?: string;
213
+ target_unique?: string[];
214
+ mapping_attributes?: MappingAttribute[];
215
+ }
216
+ export interface MappingAttribute {
217
+ target?: string;
218
+ mode?: "copy_if_exists" | "append_if_exists";
219
+ source?: string;
220
+ value_json?: string;
221
+ }
222
+ /**
223
+ * example:
224
+ * e3d3ebac-baab-4395-abf4-50b5bf1f8b74
225
+ */
226
+ export type OrganizationId = string;
227
+ export interface StartExecutionRequest {
228
+ entity_id?: EntityId;
229
+ flow_id?: AutomationFlowId;
230
+ }
231
+ /**
232
+ * example:
233
+ * {
234
+ * "id": "2520gja-2sgmsaga-0asg-822jgal",
235
+ * "name": "Trigger Webhook",
236
+ * "type": "trigger-webhook",
237
+ * "config": {
238
+ * "entity_sources": [
239
+ * "contact",
240
+ * "account"
241
+ * ],
242
+ * "target_webhook_id": "25jg9ag2ga"
243
+ * }
244
+ * }
245
+ */
246
+ export interface TriggerWebhookAction {
247
+ id?: AutomationActionId;
248
+ name?: string;
249
+ type?: string;
250
+ config?: TriggerWebhookActionConfig;
251
+ outputs?: {
252
+ [name: string]: any;
253
+ };
254
+ }
255
+ export interface TriggerWebhookActionConfig {
256
+ entity_sources?: string[];
257
+ target_webhook_id?: string;
258
+ }
259
+ /**
260
+ * example:
261
+ * {
262
+ * "id": "08g988-ojt2jtaga-292h-8978gsaga",
263
+ * "name": "Trigger Workflow",
264
+ * "type": "trigger-workflow",
265
+ * "config": {
266
+ * "target_workflow": "mfptvUMH",
267
+ * "add_context": [
268
+ * "contact"
269
+ * ],
270
+ * "assign_steps": {
271
+ * "First Step Daniel": [
272
+ * 10010729
273
+ * ],
274
+ * "call me": [
275
+ * 10010728,
276
+ * 10010729
277
+ * ]
278
+ * }
279
+ * }
280
+ * }
281
+ */
282
+ export interface TriggerWorkflowAction {
283
+ id?: AutomationActionId;
284
+ name?: string;
285
+ type?: string;
286
+ config?: TriggerWorkflowConfig;
287
+ outputs?: {
288
+ workflow?: {
289
+ [name: string]: any;
290
+ };
291
+ };
292
+ }
293
+ export interface TriggerWorkflowConfig {
294
+ target_workflow?: string;
295
+ add_context?: string[];
296
+ assign_steps?: {
297
+ [name: string]: any;
298
+ };
299
+ }
300
+ }
301
+ }
302
+ declare namespace Paths {
303
+ namespace CancelExecution {
304
+ namespace Parameters {
305
+ export type ExecutionId = Components.Schemas.AutomationExecutionId;
306
+ }
307
+ export interface PathParameters {
308
+ execution_id: Parameters.ExecutionId;
309
+ }
310
+ namespace Responses {
311
+ export type $200 = Components.Schemas.AutomationExecution;
312
+ }
313
+ }
314
+ namespace CreateFlow {
315
+ export type RequestBody = Components.Schemas.AutomationFlow;
316
+ namespace Responses {
317
+ export type $201 = Components.Schemas.AutomationFlow;
318
+ }
319
+ }
320
+ namespace DeleteFlow {
321
+ namespace Parameters {
322
+ export type FlowId = Components.Schemas.AutomationFlowId;
323
+ }
324
+ export interface PathParameters {
325
+ flow_id: Parameters.FlowId;
326
+ }
327
+ namespace Responses {
328
+ export type $200 = Components.Schemas.AutomationFlow;
329
+ }
330
+ }
331
+ namespace GetExecution {
332
+ namespace Parameters {
333
+ export type ExecutionId = Components.Schemas.AutomationExecutionId;
334
+ }
335
+ export interface PathParameters {
336
+ execution_id: Parameters.ExecutionId;
337
+ }
338
+ namespace Responses {
339
+ export type $200 = Components.Schemas.AutomationExecution;
340
+ }
341
+ }
342
+ namespace GetExecutions {
343
+ namespace Parameters {
344
+ export type EntityId = Components.Schemas.EntityId;
345
+ export type From = number;
346
+ export type Size = number;
347
+ }
348
+ export interface QueryParameters {
349
+ entity_id?: Parameters.EntityId;
350
+ size?: Parameters.Size;
351
+ from?: Parameters.From;
352
+ }
353
+ namespace Responses {
354
+ export type $200 = Components.Schemas.AutomationExecution[];
355
+ }
356
+ }
357
+ namespace GetFlow {
358
+ namespace Parameters {
359
+ export type FlowId = Components.Schemas.AutomationFlowId;
360
+ }
361
+ export interface PathParameters {
362
+ flow_id: Parameters.FlowId;
363
+ }
364
+ namespace Responses {
365
+ export type $200 = Components.Schemas.AutomationFlow;
366
+ }
367
+ }
368
+ namespace PutFlow {
369
+ namespace Parameters {
370
+ export type FlowId = Components.Schemas.AutomationFlowId;
371
+ }
372
+ export interface PathParameters {
373
+ flow_id: Parameters.FlowId;
374
+ }
375
+ export type RequestBody = Components.Schemas.AutomationFlow;
376
+ namespace Responses {
377
+ export type $200 = Components.Schemas.AutomationFlow;
378
+ }
379
+ }
380
+ namespace SearchFlows {
381
+ namespace Parameters {
382
+ export type From = number;
383
+ /**
384
+ * example:
385
+ * submission
386
+ */
387
+ export type Schema = string;
388
+ export type Size = number;
389
+ }
390
+ export interface QueryParameters {
391
+ schema?: Parameters.Schema;
392
+ size?: Parameters.Size;
393
+ from?: Parameters.From;
394
+ }
395
+ namespace Responses {
396
+ export interface $200 {
397
+ /**
398
+ * example:
399
+ * 1
400
+ */
401
+ total?: number;
402
+ results?: Components.Schemas.AutomationFlow[];
403
+ }
404
+ }
405
+ }
406
+ namespace StartExecution {
407
+ export type RequestBody = Components.Schemas.StartExecutionRequest;
408
+ namespace Responses {
409
+ export type $201 = Components.Schemas.AutomationExecution;
410
+ }
411
+ }
412
+ }
413
+
414
+ export interface OperationMethods {
415
+ /**
416
+ * searchFlows - searchFlows
417
+ *
418
+ * Search available automation flows
419
+ */
420
+ 'searchFlows'(
421
+ parameters?: Parameters<Paths.SearchFlows.QueryParameters> | null,
422
+ data?: any,
423
+ config?: AxiosRequestConfig
424
+ ): OperationResponse<Paths.SearchFlows.Responses.$200>
425
+ /**
426
+ * createFlow - createFlow
427
+ *
428
+ * Create new automation flow
429
+ */
430
+ 'createFlow'(
431
+ parameters?: Parameters<UnknownParamsObject> | null,
432
+ data?: Paths.CreateFlow.RequestBody,
433
+ config?: AxiosRequestConfig
434
+ ): OperationResponse<Paths.CreateFlow.Responses.$201>
435
+ /**
436
+ * getFlow - getFlow
437
+ *
438
+ * List available automation flows
439
+ */
440
+ 'getFlow'(
441
+ parameters?: Parameters<Paths.GetFlow.PathParameters> | null,
442
+ data?: any,
443
+ config?: AxiosRequestConfig
444
+ ): OperationResponse<Paths.GetFlow.Responses.$200>
445
+ /**
446
+ * putFlow - putFlow
447
+ *
448
+ * Update automation flow by id
449
+ */
450
+ 'putFlow'(
451
+ parameters?: Parameters<Paths.PutFlow.PathParameters> | null,
452
+ data?: Paths.PutFlow.RequestBody,
453
+ config?: AxiosRequestConfig
454
+ ): OperationResponse<Paths.PutFlow.Responses.$200>
455
+ /**
456
+ * deleteFlow - deleteFlow
457
+ *
458
+ * Update automation flow by id
459
+ */
460
+ 'deleteFlow'(
461
+ parameters?: Parameters<Paths.DeleteFlow.PathParameters> | null,
462
+ data?: any,
463
+ config?: AxiosRequestConfig
464
+ ): OperationResponse<Paths.DeleteFlow.Responses.$200>
465
+ /**
466
+ * getExecutions - getExecutions
467
+ *
468
+ * List automation executions
469
+ */
470
+ 'getExecutions'(
471
+ parameters?: Parameters<Paths.GetExecutions.QueryParameters> | null,
472
+ data?: any,
473
+ config?: AxiosRequestConfig
474
+ ): OperationResponse<Paths.GetExecutions.Responses.$200>
475
+ /**
476
+ * startExecution - startExecution
477
+ *
478
+ * Start new automation execution
479
+ */
480
+ 'startExecution'(
481
+ parameters?: Parameters<UnknownParamsObject> | null,
482
+ data?: Paths.StartExecution.RequestBody,
483
+ config?: AxiosRequestConfig
484
+ ): OperationResponse<Paths.StartExecution.Responses.$201>
485
+ /**
486
+ * getExecution - getExecution
487
+ *
488
+ * Get automation execution
489
+ */
490
+ 'getExecution'(
491
+ parameters?: Parameters<Paths.GetExecution.PathParameters> | null,
492
+ data?: any,
493
+ config?: AxiosRequestConfig
494
+ ): OperationResponse<Paths.GetExecution.Responses.$200>
495
+ /**
496
+ * cancelExecution - cancelExecution
497
+ *
498
+ * Cancel automation execution
499
+ */
500
+ 'cancelExecution'(
501
+ parameters?: Parameters<Paths.CancelExecution.PathParameters> | null,
502
+ data?: any,
503
+ config?: AxiosRequestConfig
504
+ ): OperationResponse<Paths.CancelExecution.Responses.$200>
505
+ }
506
+
507
+ export interface PathsDictionary {
508
+ ['/v1/automation/flows']: {
509
+ /**
510
+ * searchFlows - searchFlows
511
+ *
512
+ * Search available automation flows
513
+ */
514
+ 'get'(
515
+ parameters?: Parameters<Paths.SearchFlows.QueryParameters> | null,
516
+ data?: any,
517
+ config?: AxiosRequestConfig
518
+ ): OperationResponse<Paths.SearchFlows.Responses.$200>
519
+ /**
520
+ * createFlow - createFlow
521
+ *
522
+ * Create new automation flow
523
+ */
524
+ 'post'(
525
+ parameters?: Parameters<UnknownParamsObject> | null,
526
+ data?: Paths.CreateFlow.RequestBody,
527
+ config?: AxiosRequestConfig
528
+ ): OperationResponse<Paths.CreateFlow.Responses.$201>
529
+ }
530
+ ['/v1/automation/flows/{flow_id}']: {
531
+ /**
532
+ * getFlow - getFlow
533
+ *
534
+ * List available automation flows
535
+ */
536
+ 'get'(
537
+ parameters?: Parameters<Paths.GetFlow.PathParameters> | null,
538
+ data?: any,
539
+ config?: AxiosRequestConfig
540
+ ): OperationResponse<Paths.GetFlow.Responses.$200>
541
+ /**
542
+ * putFlow - putFlow
543
+ *
544
+ * Update automation flow by id
545
+ */
546
+ 'put'(
547
+ parameters?: Parameters<Paths.PutFlow.PathParameters> | null,
548
+ data?: Paths.PutFlow.RequestBody,
549
+ config?: AxiosRequestConfig
550
+ ): OperationResponse<Paths.PutFlow.Responses.$200>
551
+ /**
552
+ * deleteFlow - deleteFlow
553
+ *
554
+ * Update automation flow by id
555
+ */
556
+ 'delete'(
557
+ parameters?: Parameters<Paths.DeleteFlow.PathParameters> | null,
558
+ data?: any,
559
+ config?: AxiosRequestConfig
560
+ ): OperationResponse<Paths.DeleteFlow.Responses.$200>
561
+ }
562
+ ['/v1/automation/executions']: {
563
+ /**
564
+ * getExecutions - getExecutions
565
+ *
566
+ * List automation executions
567
+ */
568
+ 'get'(
569
+ parameters?: Parameters<Paths.GetExecutions.QueryParameters> | null,
570
+ data?: any,
571
+ config?: AxiosRequestConfig
572
+ ): OperationResponse<Paths.GetExecutions.Responses.$200>
573
+ /**
574
+ * startExecution - startExecution
575
+ *
576
+ * Start new automation execution
577
+ */
578
+ 'post'(
579
+ parameters?: Parameters<UnknownParamsObject> | null,
580
+ data?: Paths.StartExecution.RequestBody,
581
+ config?: AxiosRequestConfig
582
+ ): OperationResponse<Paths.StartExecution.Responses.$201>
583
+ }
584
+ ['/v1/automation/executions/{execution_id}']: {
585
+ /**
586
+ * getExecution - getExecution
587
+ *
588
+ * Get automation execution
589
+ */
590
+ 'get'(
591
+ parameters?: Parameters<Paths.GetExecution.PathParameters> | null,
592
+ data?: any,
593
+ config?: AxiosRequestConfig
594
+ ): OperationResponse<Paths.GetExecution.Responses.$200>
595
+ /**
596
+ * cancelExecution - cancelExecution
597
+ *
598
+ * Cancel automation execution
599
+ */
600
+ 'delete'(
601
+ parameters?: Parameters<Paths.CancelExecution.PathParameters> | null,
602
+ data?: any,
603
+ config?: AxiosRequestConfig
604
+ ): OperationResponse<Paths.CancelExecution.Responses.$200>
605
+ }
606
+ }
607
+
608
+ export type Client = OpenAPIClient<OperationMethods, PathsDictionary>