@zyphr-dev/node-sdk 0.1.39 → 0.1.41

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.
Files changed (40) hide show
  1. package/dist/index.cjs +2315 -1220
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1724 -622
  4. package/dist/index.d.ts +1724 -622
  5. package/dist/index.js +2195 -1203
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/.openapi-generator/FILES +24 -4
  9. package/src/src/apis/AuthRegistrationApi.ts +4 -4
  10. package/src/src/apis/WorkflowsApi.ts +912 -0
  11. package/src/src/apis/index.ts +1 -1
  12. package/src/src/models/AddWorkflowStep201Response.ts +88 -0
  13. package/src/src/models/AddWorkflowStepRequest.ts +136 -0
  14. package/src/src/models/CreateWorkflow201Response.ts +88 -0
  15. package/src/src/models/CreateWorkflowRequest.ts +98 -0
  16. package/src/src/models/DeleteWorkflow200Response.ts +88 -0
  17. package/src/src/models/{TopicDeleteResponseData.ts → DeleteWorkflow200ResponseData.ts} +12 -12
  18. package/src/src/models/DeleteWorkflowStep200Response.ts +88 -0
  19. package/src/src/models/DeleteWorkflowStep200ResponseData.ts +81 -0
  20. package/src/src/models/ListWorkflowExecutions200Response.ts +88 -0
  21. package/src/src/models/{SmsListResponseMeta.ts → ListWorkflowExecutions200ResponseMeta.ts} +15 -15
  22. package/src/src/models/ListWorkflows200Response.ts +88 -0
  23. package/src/src/models/ListWorkflows200ResponseMeta.ts +121 -0
  24. package/src/src/models/ReorderWorkflowStepsRequest.ts +66 -0
  25. package/src/src/models/SignInWithGameCenterRequest.ts +1 -1
  26. package/src/src/models/SmsListResponse.ts +10 -10
  27. package/src/src/models/TopicDeleteResponse.ts +10 -10
  28. package/src/src/models/TriggerWorkflow202Response.ts +88 -0
  29. package/src/src/models/TriggerWorkflow202ResponseData.ts +81 -0
  30. package/src/src/models/TriggerWorkflowRequest.ts +90 -0
  31. package/src/src/models/UpdateWorkflowRequest.ts +89 -0
  32. package/src/src/models/UpdateWorkflowStatusRequest.ts +76 -0
  33. package/src/src/models/UpdateWorkflowStepRequest.ts +73 -0
  34. package/src/src/models/Workflow.ts +187 -0
  35. package/src/src/models/WorkflowStatus.ts +55 -0
  36. package/src/src/models/WorkflowStep.ts +176 -0
  37. package/src/src/models/WorkflowStepType.ts +60 -0
  38. package/src/src/models/index.ts +23 -3
  39. package/src/src/apis/MuseApi.ts +0 -531
  40. package/src/src/models/V1MuseSubjectsSuggestPostRequest.ts +0 -105
@@ -0,0 +1,912 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Zyphr API
5
+ * Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@zyphr.dev
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ AddWorkflowStep201Response,
19
+ AddWorkflowStepRequest,
20
+ ApiError,
21
+ CreateWorkflow201Response,
22
+ CreateWorkflowRequest,
23
+ DeleteWorkflow200Response,
24
+ DeleteWorkflowStep200Response,
25
+ ListWorkflowExecutions200Response,
26
+ ListWorkflows200Response,
27
+ ReorderWorkflowStepsRequest,
28
+ TriggerWorkflow202Response,
29
+ TriggerWorkflowRequest,
30
+ UpdateWorkflowRequest,
31
+ UpdateWorkflowStatusRequest,
32
+ UpdateWorkflowStepRequest,
33
+ WorkflowStatus,
34
+ } from '../models/index';
35
+ import {
36
+ AddWorkflowStep201ResponseFromJSON,
37
+ AddWorkflowStep201ResponseToJSON,
38
+ AddWorkflowStepRequestFromJSON,
39
+ AddWorkflowStepRequestToJSON,
40
+ ApiErrorFromJSON,
41
+ ApiErrorToJSON,
42
+ CreateWorkflow201ResponseFromJSON,
43
+ CreateWorkflow201ResponseToJSON,
44
+ CreateWorkflowRequestFromJSON,
45
+ CreateWorkflowRequestToJSON,
46
+ DeleteWorkflow200ResponseFromJSON,
47
+ DeleteWorkflow200ResponseToJSON,
48
+ DeleteWorkflowStep200ResponseFromJSON,
49
+ DeleteWorkflowStep200ResponseToJSON,
50
+ ListWorkflowExecutions200ResponseFromJSON,
51
+ ListWorkflowExecutions200ResponseToJSON,
52
+ ListWorkflows200ResponseFromJSON,
53
+ ListWorkflows200ResponseToJSON,
54
+ ReorderWorkflowStepsRequestFromJSON,
55
+ ReorderWorkflowStepsRequestToJSON,
56
+ TriggerWorkflow202ResponseFromJSON,
57
+ TriggerWorkflow202ResponseToJSON,
58
+ TriggerWorkflowRequestFromJSON,
59
+ TriggerWorkflowRequestToJSON,
60
+ UpdateWorkflowRequestFromJSON,
61
+ UpdateWorkflowRequestToJSON,
62
+ UpdateWorkflowStatusRequestFromJSON,
63
+ UpdateWorkflowStatusRequestToJSON,
64
+ UpdateWorkflowStepRequestFromJSON,
65
+ UpdateWorkflowStepRequestToJSON,
66
+ WorkflowStatusFromJSON,
67
+ WorkflowStatusToJSON,
68
+ } from '../models/index';
69
+
70
+ export interface WorkflowsApiAddWorkflowStepOperationRequest {
71
+ key: string;
72
+ addWorkflowStepRequest: AddWorkflowStepRequest;
73
+ }
74
+
75
+ export interface WorkflowsApiCreateWorkflowOperationRequest {
76
+ createWorkflowRequest: CreateWorkflowRequest;
77
+ }
78
+
79
+ export interface WorkflowsApiDeleteWorkflowRequest {
80
+ key: string;
81
+ }
82
+
83
+ export interface WorkflowsApiDeleteWorkflowStepRequest {
84
+ key: string;
85
+ stepKey: string;
86
+ }
87
+
88
+ export interface WorkflowsApiGetWorkflowRequest {
89
+ key: string;
90
+ }
91
+
92
+ export interface WorkflowsApiListWorkflowExecutionsRequest {
93
+ key: string;
94
+ page?: number;
95
+ perPage?: number;
96
+ }
97
+
98
+ export interface WorkflowsApiListWorkflowsRequest {
99
+ page?: number;
100
+ perPage?: number;
101
+ search?: string;
102
+ status?: WorkflowStatus;
103
+ }
104
+
105
+ export interface WorkflowsApiReorderWorkflowStepsOperationRequest {
106
+ key: string;
107
+ reorderWorkflowStepsRequest: ReorderWorkflowStepsRequest;
108
+ }
109
+
110
+ export interface WorkflowsApiTriggerWorkflowOperationRequest {
111
+ key: string;
112
+ triggerWorkflowRequest: TriggerWorkflowRequest;
113
+ }
114
+
115
+ export interface WorkflowsApiUpdateWorkflowOperationRequest {
116
+ key: string;
117
+ updateWorkflowRequest: UpdateWorkflowRequest;
118
+ }
119
+
120
+ export interface WorkflowsApiUpdateWorkflowStatusOperationRequest {
121
+ key: string;
122
+ updateWorkflowStatusRequest: UpdateWorkflowStatusRequest;
123
+ }
124
+
125
+ export interface WorkflowsApiUpdateWorkflowStepOperationRequest {
126
+ key: string;
127
+ stepKey: string;
128
+ updateWorkflowStepRequest: UpdateWorkflowStepRequest;
129
+ }
130
+
131
+ /**
132
+ * WorkflowsApi - interface
133
+ *
134
+ * @export
135
+ * @interface WorkflowsApiInterface
136
+ */
137
+ export interface WorkflowsApiInterface {
138
+ /**
139
+ * Append a step to a workflow. Channel steps (`email`, `push`, `sms`, `in_app`, `slack`, `discord`, `teams`) carry message content in `config`; `delay` steps carry `{ amount, unit }`; `branch` steps carry `{ conditions }`.
140
+ * @summary Add a workflow step
141
+ * @param {string} key The workflow key.
142
+ * @param {AddWorkflowStepRequest} addWorkflowStepRequest
143
+ * @param {*} [options] Override http request option.
144
+ * @throws {RequiredError}
145
+ * @memberof WorkflowsApiInterface
146
+ */
147
+ addWorkflowStepRaw(requestParameters: WorkflowsApiAddWorkflowStepOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AddWorkflowStep201Response>>;
148
+
149
+ /**
150
+ * Append a step to a workflow. Channel steps (`email`, `push`, `sms`, `in_app`, `slack`, `discord`, `teams`) carry message content in `config`; `delay` steps carry `{ amount, unit }`; `branch` steps carry `{ conditions }`.
151
+ * Add a workflow step
152
+ */
153
+ addWorkflowStep(key: string, addWorkflowStepRequest: AddWorkflowStepRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AddWorkflowStep201Response>;
154
+
155
+ /**
156
+ * Create a new notification workflow. A workflow is a named, multi-step notification sequence identified by a unique `key` within the project. If `key` is omitted, one is derived from the `name`.
157
+ * @summary Create a workflow
158
+ * @param {CreateWorkflowRequest} createWorkflowRequest
159
+ * @param {*} [options] Override http request option.
160
+ * @throws {RequiredError}
161
+ * @memberof WorkflowsApiInterface
162
+ */
163
+ createWorkflowRaw(requestParameters: WorkflowsApiCreateWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>>;
164
+
165
+ /**
166
+ * Create a new notification workflow. A workflow is a named, multi-step notification sequence identified by a unique `key` within the project. If `key` is omitted, one is derived from the `name`.
167
+ * Create a workflow
168
+ */
169
+ createWorkflow(createWorkflowRequest: CreateWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response>;
170
+
171
+ /**
172
+ * Permanently delete a workflow and all of its steps.
173
+ * @summary Delete a workflow
174
+ * @param {string} key The workflow key.
175
+ * @param {*} [options] Override http request option.
176
+ * @throws {RequiredError}
177
+ * @memberof WorkflowsApiInterface
178
+ */
179
+ deleteWorkflowRaw(requestParameters: WorkflowsApiDeleteWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DeleteWorkflow200Response>>;
180
+
181
+ /**
182
+ * Permanently delete a workflow and all of its steps.
183
+ * Delete a workflow
184
+ */
185
+ deleteWorkflow(key: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DeleteWorkflow200Response>;
186
+
187
+ /**
188
+ * Remove a step from a workflow.
189
+ * @summary Delete a workflow step
190
+ * @param {string} key The workflow key.
191
+ * @param {string} stepKey The step key.
192
+ * @param {*} [options] Override http request option.
193
+ * @throws {RequiredError}
194
+ * @memberof WorkflowsApiInterface
195
+ */
196
+ deleteWorkflowStepRaw(requestParameters: WorkflowsApiDeleteWorkflowStepRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DeleteWorkflowStep200Response>>;
197
+
198
+ /**
199
+ * Remove a step from a workflow.
200
+ * Delete a workflow step
201
+ */
202
+ deleteWorkflowStep(key: string, stepKey: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DeleteWorkflowStep200Response>;
203
+
204
+ /**
205
+ * Retrieve a single workflow by its key, including its ordered steps.
206
+ * @summary Get a workflow
207
+ * @param {string} key The workflow key.
208
+ * @param {*} [options] Override http request option.
209
+ * @throws {RequiredError}
210
+ * @memberof WorkflowsApiInterface
211
+ */
212
+ getWorkflowRaw(requestParameters: WorkflowsApiGetWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>>;
213
+
214
+ /**
215
+ * Retrieve a single workflow by its key, including its ordered steps.
216
+ * Get a workflow
217
+ */
218
+ getWorkflow(key: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response>;
219
+
220
+ /**
221
+ * List the executions of a workflow, most recent first. Supports pagination.
222
+ * @summary List workflow executions
223
+ * @param {string} key The workflow key.
224
+ * @param {number} [page] Page number (1-based).
225
+ * @param {number} [perPage] Number of executions per page (max 100).
226
+ * @param {*} [options] Override http request option.
227
+ * @throws {RequiredError}
228
+ * @memberof WorkflowsApiInterface
229
+ */
230
+ listWorkflowExecutionsRaw(requestParameters: WorkflowsApiListWorkflowExecutionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListWorkflowExecutions200Response>>;
231
+
232
+ /**
233
+ * List the executions of a workflow, most recent first. Supports pagination.
234
+ * List workflow executions
235
+ */
236
+ listWorkflowExecutions(key: string, page?: number, perPage?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListWorkflowExecutions200Response>;
237
+
238
+ /**
239
+ * List workflows in the project. Supports pagination, free-text search, and status filtering.
240
+ * @summary List workflows
241
+ * @param {number} [page] Page number (1-based).
242
+ * @param {number} [perPage] Number of workflows per page (max 100).
243
+ * @param {string} [search] Free-text search over workflow name and key.
244
+ * @param {WorkflowStatus} [status] Filter by workflow status.
245
+ * @param {*} [options] Override http request option.
246
+ * @throws {RequiredError}
247
+ * @memberof WorkflowsApiInterface
248
+ */
249
+ listWorkflowsRaw(requestParameters: WorkflowsApiListWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListWorkflows200Response>>;
250
+
251
+ /**
252
+ * List workflows in the project. Supports pagination, free-text search, and status filtering.
253
+ * List workflows
254
+ */
255
+ listWorkflows(page?: number, perPage?: number, search?: string, status?: WorkflowStatus, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListWorkflows200Response>;
256
+
257
+ /**
258
+ * Reorder a workflow\'s steps. Provide the full set of step keys in the desired order — the array must contain exactly the workflow\'s existing step keys.
259
+ * @summary Reorder workflow steps
260
+ * @param {string} key The workflow key.
261
+ * @param {ReorderWorkflowStepsRequest} reorderWorkflowStepsRequest
262
+ * @param {*} [options] Override http request option.
263
+ * @throws {RequiredError}
264
+ * @memberof WorkflowsApiInterface
265
+ */
266
+ reorderWorkflowStepsRaw(requestParameters: WorkflowsApiReorderWorkflowStepsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>>;
267
+
268
+ /**
269
+ * Reorder a workflow\'s steps. Provide the full set of step keys in the desired order — the array must contain exactly the workflow\'s existing step keys.
270
+ * Reorder workflow steps
271
+ */
272
+ reorderWorkflowSteps(key: string, reorderWorkflowStepsRequest: ReorderWorkflowStepsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response>;
273
+
274
+ /**
275
+ * Trigger an execution of an active workflow for one or more recipients. The `to` field accepts a single recipient, an array of recipients, or a topic object (`{ \"topic\": \"topic-key\" }`) to trigger for all subscribers of a topic. One execution is created per resolved subscriber.
276
+ * @summary Trigger a workflow
277
+ * @param {string} key The workflow key.
278
+ * @param {TriggerWorkflowRequest} triggerWorkflowRequest
279
+ * @param {*} [options] Override http request option.
280
+ * @throws {RequiredError}
281
+ * @memberof WorkflowsApiInterface
282
+ */
283
+ triggerWorkflowRaw(requestParameters: WorkflowsApiTriggerWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerWorkflow202Response>>;
284
+
285
+ /**
286
+ * Trigger an execution of an active workflow for one or more recipients. The `to` field accepts a single recipient, an array of recipients, or a topic object (`{ \"topic\": \"topic-key\" }`) to trigger for all subscribers of a topic. One execution is created per resolved subscriber.
287
+ * Trigger a workflow
288
+ */
289
+ triggerWorkflow(key: string, triggerWorkflowRequest: TriggerWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerWorkflow202Response>;
290
+
291
+ /**
292
+ * Update a workflow\'s metadata. Only the provided fields are changed. To change the status, use the dedicated status endpoint.
293
+ * @summary Update a workflow
294
+ * @param {string} key The workflow key.
295
+ * @param {UpdateWorkflowRequest} updateWorkflowRequest
296
+ * @param {*} [options] Override http request option.
297
+ * @throws {RequiredError}
298
+ * @memberof WorkflowsApiInterface
299
+ */
300
+ updateWorkflowRaw(requestParameters: WorkflowsApiUpdateWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>>;
301
+
302
+ /**
303
+ * Update a workflow\'s metadata. Only the provided fields are changed. To change the status, use the dedicated status endpoint.
304
+ * Update a workflow
305
+ */
306
+ updateWorkflow(key: string, updateWorkflowRequest: UpdateWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response>;
307
+
308
+ /**
309
+ * Change a workflow\'s lifecycle status. This is the single endpoint for activating, pausing, archiving, or returning a workflow to draft — there are no separate `/activate` or `/pause` endpoints. Set `status` to `active` to activate and `paused` to pause.
310
+ * @summary Update workflow status
311
+ * @param {string} key The workflow key.
312
+ * @param {UpdateWorkflowStatusRequest} updateWorkflowStatusRequest
313
+ * @param {*} [options] Override http request option.
314
+ * @throws {RequiredError}
315
+ * @memberof WorkflowsApiInterface
316
+ */
317
+ updateWorkflowStatusRaw(requestParameters: WorkflowsApiUpdateWorkflowStatusOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>>;
318
+
319
+ /**
320
+ * Change a workflow\'s lifecycle status. This is the single endpoint for activating, pausing, archiving, or returning a workflow to draft — there are no separate `/activate` or `/pause` endpoints. Set `status` to `active` to activate and `paused` to pause.
321
+ * Update workflow status
322
+ */
323
+ updateWorkflowStatus(key: string, updateWorkflowStatusRequest: UpdateWorkflowStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response>;
324
+
325
+ /**
326
+ * Update a step\'s name and/or config. Only the provided fields are changed.
327
+ * @summary Update a workflow step
328
+ * @param {string} key The workflow key.
329
+ * @param {string} stepKey The step key.
330
+ * @param {UpdateWorkflowStepRequest} updateWorkflowStepRequest
331
+ * @param {*} [options] Override http request option.
332
+ * @throws {RequiredError}
333
+ * @memberof WorkflowsApiInterface
334
+ */
335
+ updateWorkflowStepRaw(requestParameters: WorkflowsApiUpdateWorkflowStepOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AddWorkflowStep201Response>>;
336
+
337
+ /**
338
+ * Update a step\'s name and/or config. Only the provided fields are changed.
339
+ * Update a workflow step
340
+ */
341
+ updateWorkflowStep(key: string, stepKey: string, updateWorkflowStepRequest: UpdateWorkflowStepRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AddWorkflowStep201Response>;
342
+
343
+ }
344
+
345
+ /**
346
+ *
347
+ */
348
+ export class WorkflowsApi extends runtime.BaseAPI implements WorkflowsApiInterface {
349
+
350
+ /**
351
+ * Append a step to a workflow. Channel steps (`email`, `push`, `sms`, `in_app`, `slack`, `discord`, `teams`) carry message content in `config`; `delay` steps carry `{ amount, unit }`; `branch` steps carry `{ conditions }`.
352
+ * Add a workflow step
353
+ */
354
+ async addWorkflowStepRaw(requestParameters: WorkflowsApiAddWorkflowStepOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AddWorkflowStep201Response>> {
355
+ if (requestParameters['key'] == null) {
356
+ throw new runtime.RequiredError(
357
+ 'key',
358
+ 'Required parameter "key" was null or undefined when calling addWorkflowStep().'
359
+ );
360
+ }
361
+
362
+ if (requestParameters['addWorkflowStepRequest'] == null) {
363
+ throw new runtime.RequiredError(
364
+ 'addWorkflowStepRequest',
365
+ 'Required parameter "addWorkflowStepRequest" was null or undefined when calling addWorkflowStep().'
366
+ );
367
+ }
368
+
369
+ const queryParameters: any = {};
370
+
371
+ const headerParameters: runtime.HTTPHeaders = {};
372
+
373
+ headerParameters['Content-Type'] = 'application/json';
374
+
375
+ if (this.configuration && this.configuration.apiKey) {
376
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
377
+ }
378
+
379
+ const response = await this.request({
380
+ path: `/workflows/{key}/steps`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
381
+ method: 'POST',
382
+ headers: headerParameters,
383
+ query: queryParameters,
384
+ body: AddWorkflowStepRequestToJSON(requestParameters['addWorkflowStepRequest']),
385
+ }, initOverrides);
386
+
387
+ return new runtime.JSONApiResponse(response, (jsonValue) => AddWorkflowStep201ResponseFromJSON(jsonValue));
388
+ }
389
+
390
+ /**
391
+ * Append a step to a workflow. Channel steps (`email`, `push`, `sms`, `in_app`, `slack`, `discord`, `teams`) carry message content in `config`; `delay` steps carry `{ amount, unit }`; `branch` steps carry `{ conditions }`.
392
+ * Add a workflow step
393
+ */
394
+ async addWorkflowStep(key: string, addWorkflowStepRequest: AddWorkflowStepRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AddWorkflowStep201Response> {
395
+ const response = await this.addWorkflowStepRaw({ key: key, addWorkflowStepRequest: addWorkflowStepRequest }, initOverrides);
396
+ return await response.value();
397
+ }
398
+
399
+ /**
400
+ * Create a new notification workflow. A workflow is a named, multi-step notification sequence identified by a unique `key` within the project. If `key` is omitted, one is derived from the `name`.
401
+ * Create a workflow
402
+ */
403
+ async createWorkflowRaw(requestParameters: WorkflowsApiCreateWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>> {
404
+ if (requestParameters['createWorkflowRequest'] == null) {
405
+ throw new runtime.RequiredError(
406
+ 'createWorkflowRequest',
407
+ 'Required parameter "createWorkflowRequest" was null or undefined when calling createWorkflow().'
408
+ );
409
+ }
410
+
411
+ const queryParameters: any = {};
412
+
413
+ const headerParameters: runtime.HTTPHeaders = {};
414
+
415
+ headerParameters['Content-Type'] = 'application/json';
416
+
417
+ if (this.configuration && this.configuration.apiKey) {
418
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
419
+ }
420
+
421
+ const response = await this.request({
422
+ path: `/workflows`,
423
+ method: 'POST',
424
+ headers: headerParameters,
425
+ query: queryParameters,
426
+ body: CreateWorkflowRequestToJSON(requestParameters['createWorkflowRequest']),
427
+ }, initOverrides);
428
+
429
+ return new runtime.JSONApiResponse(response, (jsonValue) => CreateWorkflow201ResponseFromJSON(jsonValue));
430
+ }
431
+
432
+ /**
433
+ * Create a new notification workflow. A workflow is a named, multi-step notification sequence identified by a unique `key` within the project. If `key` is omitted, one is derived from the `name`.
434
+ * Create a workflow
435
+ */
436
+ async createWorkflow(createWorkflowRequest: CreateWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response> {
437
+ const response = await this.createWorkflowRaw({ createWorkflowRequest: createWorkflowRequest }, initOverrides);
438
+ return await response.value();
439
+ }
440
+
441
+ /**
442
+ * Permanently delete a workflow and all of its steps.
443
+ * Delete a workflow
444
+ */
445
+ async deleteWorkflowRaw(requestParameters: WorkflowsApiDeleteWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DeleteWorkflow200Response>> {
446
+ if (requestParameters['key'] == null) {
447
+ throw new runtime.RequiredError(
448
+ 'key',
449
+ 'Required parameter "key" was null or undefined when calling deleteWorkflow().'
450
+ );
451
+ }
452
+
453
+ const queryParameters: any = {};
454
+
455
+ const headerParameters: runtime.HTTPHeaders = {};
456
+
457
+ if (this.configuration && this.configuration.apiKey) {
458
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
459
+ }
460
+
461
+ const response = await this.request({
462
+ path: `/workflows/{key}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
463
+ method: 'DELETE',
464
+ headers: headerParameters,
465
+ query: queryParameters,
466
+ }, initOverrides);
467
+
468
+ return new runtime.JSONApiResponse(response, (jsonValue) => DeleteWorkflow200ResponseFromJSON(jsonValue));
469
+ }
470
+
471
+ /**
472
+ * Permanently delete a workflow and all of its steps.
473
+ * Delete a workflow
474
+ */
475
+ async deleteWorkflow(key: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DeleteWorkflow200Response> {
476
+ const response = await this.deleteWorkflowRaw({ key: key }, initOverrides);
477
+ return await response.value();
478
+ }
479
+
480
+ /**
481
+ * Remove a step from a workflow.
482
+ * Delete a workflow step
483
+ */
484
+ async deleteWorkflowStepRaw(requestParameters: WorkflowsApiDeleteWorkflowStepRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DeleteWorkflowStep200Response>> {
485
+ if (requestParameters['key'] == null) {
486
+ throw new runtime.RequiredError(
487
+ 'key',
488
+ 'Required parameter "key" was null or undefined when calling deleteWorkflowStep().'
489
+ );
490
+ }
491
+
492
+ if (requestParameters['stepKey'] == null) {
493
+ throw new runtime.RequiredError(
494
+ 'stepKey',
495
+ 'Required parameter "stepKey" was null or undefined when calling deleteWorkflowStep().'
496
+ );
497
+ }
498
+
499
+ const queryParameters: any = {};
500
+
501
+ const headerParameters: runtime.HTTPHeaders = {};
502
+
503
+ if (this.configuration && this.configuration.apiKey) {
504
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
505
+ }
506
+
507
+ const response = await this.request({
508
+ path: `/workflows/{key}/steps/{stepKey}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))).replace(`{${"stepKey"}}`, encodeURIComponent(String(requestParameters['stepKey']))),
509
+ method: 'DELETE',
510
+ headers: headerParameters,
511
+ query: queryParameters,
512
+ }, initOverrides);
513
+
514
+ return new runtime.JSONApiResponse(response, (jsonValue) => DeleteWorkflowStep200ResponseFromJSON(jsonValue));
515
+ }
516
+
517
+ /**
518
+ * Remove a step from a workflow.
519
+ * Delete a workflow step
520
+ */
521
+ async deleteWorkflowStep(key: string, stepKey: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DeleteWorkflowStep200Response> {
522
+ const response = await this.deleteWorkflowStepRaw({ key: key, stepKey: stepKey }, initOverrides);
523
+ return await response.value();
524
+ }
525
+
526
+ /**
527
+ * Retrieve a single workflow by its key, including its ordered steps.
528
+ * Get a workflow
529
+ */
530
+ async getWorkflowRaw(requestParameters: WorkflowsApiGetWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>> {
531
+ if (requestParameters['key'] == null) {
532
+ throw new runtime.RequiredError(
533
+ 'key',
534
+ 'Required parameter "key" was null or undefined when calling getWorkflow().'
535
+ );
536
+ }
537
+
538
+ const queryParameters: any = {};
539
+
540
+ const headerParameters: runtime.HTTPHeaders = {};
541
+
542
+ if (this.configuration && this.configuration.apiKey) {
543
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
544
+ }
545
+
546
+ const response = await this.request({
547
+ path: `/workflows/{key}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
548
+ method: 'GET',
549
+ headers: headerParameters,
550
+ query: queryParameters,
551
+ }, initOverrides);
552
+
553
+ return new runtime.JSONApiResponse(response, (jsonValue) => CreateWorkflow201ResponseFromJSON(jsonValue));
554
+ }
555
+
556
+ /**
557
+ * Retrieve a single workflow by its key, including its ordered steps.
558
+ * Get a workflow
559
+ */
560
+ async getWorkflow(key: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response> {
561
+ const response = await this.getWorkflowRaw({ key: key }, initOverrides);
562
+ return await response.value();
563
+ }
564
+
565
+ /**
566
+ * List the executions of a workflow, most recent first. Supports pagination.
567
+ * List workflow executions
568
+ */
569
+ async listWorkflowExecutionsRaw(requestParameters: WorkflowsApiListWorkflowExecutionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListWorkflowExecutions200Response>> {
570
+ if (requestParameters['key'] == null) {
571
+ throw new runtime.RequiredError(
572
+ 'key',
573
+ 'Required parameter "key" was null or undefined when calling listWorkflowExecutions().'
574
+ );
575
+ }
576
+
577
+ const queryParameters: any = {};
578
+
579
+ if (requestParameters['page'] != null) {
580
+ queryParameters['page'] = requestParameters['page'];
581
+ }
582
+
583
+ if (requestParameters['perPage'] != null) {
584
+ queryParameters['per_page'] = requestParameters['perPage'];
585
+ }
586
+
587
+ const headerParameters: runtime.HTTPHeaders = {};
588
+
589
+ if (this.configuration && this.configuration.apiKey) {
590
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
591
+ }
592
+
593
+ const response = await this.request({
594
+ path: `/workflows/{key}/executions`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
595
+ method: 'GET',
596
+ headers: headerParameters,
597
+ query: queryParameters,
598
+ }, initOverrides);
599
+
600
+ return new runtime.JSONApiResponse(response, (jsonValue) => ListWorkflowExecutions200ResponseFromJSON(jsonValue));
601
+ }
602
+
603
+ /**
604
+ * List the executions of a workflow, most recent first. Supports pagination.
605
+ * List workflow executions
606
+ */
607
+ async listWorkflowExecutions(key: string, page?: number, perPage?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListWorkflowExecutions200Response> {
608
+ const response = await this.listWorkflowExecutionsRaw({ key: key, page: page, perPage: perPage }, initOverrides);
609
+ return await response.value();
610
+ }
611
+
612
+ /**
613
+ * List workflows in the project. Supports pagination, free-text search, and status filtering.
614
+ * List workflows
615
+ */
616
+ async listWorkflowsRaw(requestParameters: WorkflowsApiListWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListWorkflows200Response>> {
617
+ const queryParameters: any = {};
618
+
619
+ if (requestParameters['page'] != null) {
620
+ queryParameters['page'] = requestParameters['page'];
621
+ }
622
+
623
+ if (requestParameters['perPage'] != null) {
624
+ queryParameters['per_page'] = requestParameters['perPage'];
625
+ }
626
+
627
+ if (requestParameters['search'] != null) {
628
+ queryParameters['search'] = requestParameters['search'];
629
+ }
630
+
631
+ if (requestParameters['status'] != null) {
632
+ queryParameters['status'] = requestParameters['status'];
633
+ }
634
+
635
+ const headerParameters: runtime.HTTPHeaders = {};
636
+
637
+ if (this.configuration && this.configuration.apiKey) {
638
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
639
+ }
640
+
641
+ const response = await this.request({
642
+ path: `/workflows`,
643
+ method: 'GET',
644
+ headers: headerParameters,
645
+ query: queryParameters,
646
+ }, initOverrides);
647
+
648
+ return new runtime.JSONApiResponse(response, (jsonValue) => ListWorkflows200ResponseFromJSON(jsonValue));
649
+ }
650
+
651
+ /**
652
+ * List workflows in the project. Supports pagination, free-text search, and status filtering.
653
+ * List workflows
654
+ */
655
+ async listWorkflows(page?: number, perPage?: number, search?: string, status?: WorkflowStatus, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListWorkflows200Response> {
656
+ const response = await this.listWorkflowsRaw({ page: page, perPage: perPage, search: search, status: status }, initOverrides);
657
+ return await response.value();
658
+ }
659
+
660
+ /**
661
+ * Reorder a workflow\'s steps. Provide the full set of step keys in the desired order — the array must contain exactly the workflow\'s existing step keys.
662
+ * Reorder workflow steps
663
+ */
664
+ async reorderWorkflowStepsRaw(requestParameters: WorkflowsApiReorderWorkflowStepsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>> {
665
+ if (requestParameters['key'] == null) {
666
+ throw new runtime.RequiredError(
667
+ 'key',
668
+ 'Required parameter "key" was null or undefined when calling reorderWorkflowSteps().'
669
+ );
670
+ }
671
+
672
+ if (requestParameters['reorderWorkflowStepsRequest'] == null) {
673
+ throw new runtime.RequiredError(
674
+ 'reorderWorkflowStepsRequest',
675
+ 'Required parameter "reorderWorkflowStepsRequest" was null or undefined when calling reorderWorkflowSteps().'
676
+ );
677
+ }
678
+
679
+ const queryParameters: any = {};
680
+
681
+ const headerParameters: runtime.HTTPHeaders = {};
682
+
683
+ headerParameters['Content-Type'] = 'application/json';
684
+
685
+ if (this.configuration && this.configuration.apiKey) {
686
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
687
+ }
688
+
689
+ const response = await this.request({
690
+ path: `/workflows/{key}/steps/reorder`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
691
+ method: 'PUT',
692
+ headers: headerParameters,
693
+ query: queryParameters,
694
+ body: ReorderWorkflowStepsRequestToJSON(requestParameters['reorderWorkflowStepsRequest']),
695
+ }, initOverrides);
696
+
697
+ return new runtime.JSONApiResponse(response, (jsonValue) => CreateWorkflow201ResponseFromJSON(jsonValue));
698
+ }
699
+
700
+ /**
701
+ * Reorder a workflow\'s steps. Provide the full set of step keys in the desired order — the array must contain exactly the workflow\'s existing step keys.
702
+ * Reorder workflow steps
703
+ */
704
+ async reorderWorkflowSteps(key: string, reorderWorkflowStepsRequest: ReorderWorkflowStepsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response> {
705
+ const response = await this.reorderWorkflowStepsRaw({ key: key, reorderWorkflowStepsRequest: reorderWorkflowStepsRequest }, initOverrides);
706
+ return await response.value();
707
+ }
708
+
709
+ /**
710
+ * Trigger an execution of an active workflow for one or more recipients. The `to` field accepts a single recipient, an array of recipients, or a topic object (`{ \"topic\": \"topic-key\" }`) to trigger for all subscribers of a topic. One execution is created per resolved subscriber.
711
+ * Trigger a workflow
712
+ */
713
+ async triggerWorkflowRaw(requestParameters: WorkflowsApiTriggerWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerWorkflow202Response>> {
714
+ if (requestParameters['key'] == null) {
715
+ throw new runtime.RequiredError(
716
+ 'key',
717
+ 'Required parameter "key" was null or undefined when calling triggerWorkflow().'
718
+ );
719
+ }
720
+
721
+ if (requestParameters['triggerWorkflowRequest'] == null) {
722
+ throw new runtime.RequiredError(
723
+ 'triggerWorkflowRequest',
724
+ 'Required parameter "triggerWorkflowRequest" was null or undefined when calling triggerWorkflow().'
725
+ );
726
+ }
727
+
728
+ const queryParameters: any = {};
729
+
730
+ const headerParameters: runtime.HTTPHeaders = {};
731
+
732
+ headerParameters['Content-Type'] = 'application/json';
733
+
734
+ if (this.configuration && this.configuration.apiKey) {
735
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
736
+ }
737
+
738
+ const response = await this.request({
739
+ path: `/workflows/{key}/trigger`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
740
+ method: 'POST',
741
+ headers: headerParameters,
742
+ query: queryParameters,
743
+ body: TriggerWorkflowRequestToJSON(requestParameters['triggerWorkflowRequest']),
744
+ }, initOverrides);
745
+
746
+ return new runtime.JSONApiResponse(response, (jsonValue) => TriggerWorkflow202ResponseFromJSON(jsonValue));
747
+ }
748
+
749
+ /**
750
+ * Trigger an execution of an active workflow for one or more recipients. The `to` field accepts a single recipient, an array of recipients, or a topic object (`{ \"topic\": \"topic-key\" }`) to trigger for all subscribers of a topic. One execution is created per resolved subscriber.
751
+ * Trigger a workflow
752
+ */
753
+ async triggerWorkflow(key: string, triggerWorkflowRequest: TriggerWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerWorkflow202Response> {
754
+ const response = await this.triggerWorkflowRaw({ key: key, triggerWorkflowRequest: triggerWorkflowRequest }, initOverrides);
755
+ return await response.value();
756
+ }
757
+
758
+ /**
759
+ * Update a workflow\'s metadata. Only the provided fields are changed. To change the status, use the dedicated status endpoint.
760
+ * Update a workflow
761
+ */
762
+ async updateWorkflowRaw(requestParameters: WorkflowsApiUpdateWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>> {
763
+ if (requestParameters['key'] == null) {
764
+ throw new runtime.RequiredError(
765
+ 'key',
766
+ 'Required parameter "key" was null or undefined when calling updateWorkflow().'
767
+ );
768
+ }
769
+
770
+ if (requestParameters['updateWorkflowRequest'] == null) {
771
+ throw new runtime.RequiredError(
772
+ 'updateWorkflowRequest',
773
+ 'Required parameter "updateWorkflowRequest" was null or undefined when calling updateWorkflow().'
774
+ );
775
+ }
776
+
777
+ const queryParameters: any = {};
778
+
779
+ const headerParameters: runtime.HTTPHeaders = {};
780
+
781
+ headerParameters['Content-Type'] = 'application/json';
782
+
783
+ if (this.configuration && this.configuration.apiKey) {
784
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
785
+ }
786
+
787
+ const response = await this.request({
788
+ path: `/workflows/{key}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
789
+ method: 'PATCH',
790
+ headers: headerParameters,
791
+ query: queryParameters,
792
+ body: UpdateWorkflowRequestToJSON(requestParameters['updateWorkflowRequest']),
793
+ }, initOverrides);
794
+
795
+ return new runtime.JSONApiResponse(response, (jsonValue) => CreateWorkflow201ResponseFromJSON(jsonValue));
796
+ }
797
+
798
+ /**
799
+ * Update a workflow\'s metadata. Only the provided fields are changed. To change the status, use the dedicated status endpoint.
800
+ * Update a workflow
801
+ */
802
+ async updateWorkflow(key: string, updateWorkflowRequest: UpdateWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response> {
803
+ const response = await this.updateWorkflowRaw({ key: key, updateWorkflowRequest: updateWorkflowRequest }, initOverrides);
804
+ return await response.value();
805
+ }
806
+
807
+ /**
808
+ * Change a workflow\'s lifecycle status. This is the single endpoint for activating, pausing, archiving, or returning a workflow to draft — there are no separate `/activate` or `/pause` endpoints. Set `status` to `active` to activate and `paused` to pause.
809
+ * Update workflow status
810
+ */
811
+ async updateWorkflowStatusRaw(requestParameters: WorkflowsApiUpdateWorkflowStatusOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CreateWorkflow201Response>> {
812
+ if (requestParameters['key'] == null) {
813
+ throw new runtime.RequiredError(
814
+ 'key',
815
+ 'Required parameter "key" was null or undefined when calling updateWorkflowStatus().'
816
+ );
817
+ }
818
+
819
+ if (requestParameters['updateWorkflowStatusRequest'] == null) {
820
+ throw new runtime.RequiredError(
821
+ 'updateWorkflowStatusRequest',
822
+ 'Required parameter "updateWorkflowStatusRequest" was null or undefined when calling updateWorkflowStatus().'
823
+ );
824
+ }
825
+
826
+ const queryParameters: any = {};
827
+
828
+ const headerParameters: runtime.HTTPHeaders = {};
829
+
830
+ headerParameters['Content-Type'] = 'application/json';
831
+
832
+ if (this.configuration && this.configuration.apiKey) {
833
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
834
+ }
835
+
836
+ const response = await this.request({
837
+ path: `/workflows/{key}/status`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
838
+ method: 'PATCH',
839
+ headers: headerParameters,
840
+ query: queryParameters,
841
+ body: UpdateWorkflowStatusRequestToJSON(requestParameters['updateWorkflowStatusRequest']),
842
+ }, initOverrides);
843
+
844
+ return new runtime.JSONApiResponse(response, (jsonValue) => CreateWorkflow201ResponseFromJSON(jsonValue));
845
+ }
846
+
847
+ /**
848
+ * Change a workflow\'s lifecycle status. This is the single endpoint for activating, pausing, archiving, or returning a workflow to draft — there are no separate `/activate` or `/pause` endpoints. Set `status` to `active` to activate and `paused` to pause.
849
+ * Update workflow status
850
+ */
851
+ async updateWorkflowStatus(key: string, updateWorkflowStatusRequest: UpdateWorkflowStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CreateWorkflow201Response> {
852
+ const response = await this.updateWorkflowStatusRaw({ key: key, updateWorkflowStatusRequest: updateWorkflowStatusRequest }, initOverrides);
853
+ return await response.value();
854
+ }
855
+
856
+ /**
857
+ * Update a step\'s name and/or config. Only the provided fields are changed.
858
+ * Update a workflow step
859
+ */
860
+ async updateWorkflowStepRaw(requestParameters: WorkflowsApiUpdateWorkflowStepOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AddWorkflowStep201Response>> {
861
+ if (requestParameters['key'] == null) {
862
+ throw new runtime.RequiredError(
863
+ 'key',
864
+ 'Required parameter "key" was null or undefined when calling updateWorkflowStep().'
865
+ );
866
+ }
867
+
868
+ if (requestParameters['stepKey'] == null) {
869
+ throw new runtime.RequiredError(
870
+ 'stepKey',
871
+ 'Required parameter "stepKey" was null or undefined when calling updateWorkflowStep().'
872
+ );
873
+ }
874
+
875
+ if (requestParameters['updateWorkflowStepRequest'] == null) {
876
+ throw new runtime.RequiredError(
877
+ 'updateWorkflowStepRequest',
878
+ 'Required parameter "updateWorkflowStepRequest" was null or undefined when calling updateWorkflowStep().'
879
+ );
880
+ }
881
+
882
+ const queryParameters: any = {};
883
+
884
+ const headerParameters: runtime.HTTPHeaders = {};
885
+
886
+ headerParameters['Content-Type'] = 'application/json';
887
+
888
+ if (this.configuration && this.configuration.apiKey) {
889
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
890
+ }
891
+
892
+ const response = await this.request({
893
+ path: `/workflows/{key}/steps/{stepKey}`.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))).replace(`{${"stepKey"}}`, encodeURIComponent(String(requestParameters['stepKey']))),
894
+ method: 'PATCH',
895
+ headers: headerParameters,
896
+ query: queryParameters,
897
+ body: UpdateWorkflowStepRequestToJSON(requestParameters['updateWorkflowStepRequest']),
898
+ }, initOverrides);
899
+
900
+ return new runtime.JSONApiResponse(response, (jsonValue) => AddWorkflowStep201ResponseFromJSON(jsonValue));
901
+ }
902
+
903
+ /**
904
+ * Update a step\'s name and/or config. Only the provided fields are changed.
905
+ * Update a workflow step
906
+ */
907
+ async updateWorkflowStep(key: string, stepKey: string, updateWorkflowStepRequest: UpdateWorkflowStepRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AddWorkflowStep201Response> {
908
+ const response = await this.updateWorkflowStepRaw({ key: key, stepKey: stepKey, updateWorkflowStepRequest: updateWorkflowStepRequest }, initOverrides);
909
+ return await response.value();
910
+ }
911
+
912
+ }