@zyphr-dev/node-sdk 0.1.18 → 0.1.20

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 (53) hide show
  1. package/dist/index.cjs +2473 -200
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +4376 -1787
  4. package/dist/index.d.ts +4376 -1787
  5. package/dist/index.js +2274 -195
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/.openapi-generator/FILES +40 -1
  9. package/src/client.ts +3 -0
  10. package/src/src/apis/AuthEmailTemplatesApi.ts +734 -0
  11. package/src/src/apis/ExecutionsApi.ts +225 -0
  12. package/src/src/apis/SlackApi.ts +264 -0
  13. package/src/src/apis/index.ts +3 -0
  14. package/src/src/models/AuthEmailTemplate.ts +181 -0
  15. package/src/src/models/AuthEmailTemplateDefault.ts +107 -0
  16. package/src/src/models/AuthEmailTemplateDefaultResponse.ts +88 -0
  17. package/src/src/models/AuthEmailTemplateDeleteResponse.ts +88 -0
  18. package/src/src/models/{SuccessResultData.ts → AuthEmailTemplateDeleteResponseData.ts} +11 -11
  19. package/src/src/models/AuthEmailTemplateListResponse.ts +88 -0
  20. package/src/src/models/AuthEmailTemplatePreviewRequest.ts +65 -0
  21. package/src/src/models/AuthEmailTemplatePreviewResponse.ts +88 -0
  22. package/src/src/models/AuthEmailTemplatePreviewResult.ts +97 -0
  23. package/src/src/models/AuthEmailTemplateResponse.ts +88 -0
  24. package/src/src/models/AuthEmailTemplateTestRequest.ts +74 -0
  25. package/src/src/models/AuthEmailTemplateTestResponse.ts +88 -0
  26. package/src/src/models/AuthEmailTemplateTestResult.ts +73 -0
  27. package/src/src/models/AuthEmailTemplateVersion.ts +157 -0
  28. package/src/src/models/AuthEmailTemplateVersionsResponse.ts +88 -0
  29. package/src/src/models/AuthEmailType.ts +54 -0
  30. package/src/src/models/BulkUpsertAuthEmailTemplatesRequest.ts +91 -0
  31. package/src/src/models/BulkUpsertAuthEmailTemplatesResponse.ts +88 -0
  32. package/src/src/models/ExecutionCancelResponse.ts +88 -0
  33. package/src/src/models/ExecutionCancelResponseData.ts +83 -0
  34. package/src/src/models/ExecutionResponse.ts +88 -0
  35. package/src/src/models/ExecutionRetryResponse.ts +88 -0
  36. package/src/src/models/ExecutionRetryResponseData.ts +94 -0
  37. package/src/src/models/ResubscribeResponse.ts +10 -10
  38. package/src/src/models/SendSlackMessageRequest.ts +156 -0
  39. package/src/src/models/SendSlackMessageResponse.ts +88 -0
  40. package/src/src/models/SendSlackMessageResult.ts +115 -0
  41. package/src/src/models/SlackMessage.ts +203 -0
  42. package/src/src/models/SlackMessageListResponse.ts +88 -0
  43. package/src/src/models/SlackMessageListResponseMeta.ts +89 -0
  44. package/src/src/models/SlackMessageResponse.ts +88 -0
  45. package/src/src/models/SlackMessageStatus.ts +56 -0
  46. package/src/src/models/SlackMessageSummary.ts +155 -0
  47. package/src/src/models/SuccessResult.ts +10 -10
  48. package/src/src/models/UpsertAuthEmailTemplateRequest.ts +143 -0
  49. package/src/src/models/WorkflowExecution.ts +201 -0
  50. package/src/src/models/WorkflowExecutionStatus.ts +56 -0
  51. package/src/src/models/WorkflowStepExecution.ts +184 -0
  52. package/src/src/models/WorkflowStepExecutionStatus.ts +57 -0
  53. package/src/src/models/index.ts +37 -1
@@ -0,0 +1,734 @@
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 ## 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
+ ApiError,
19
+ AuthEmailTemplateDefaultResponse,
20
+ AuthEmailTemplateDeleteResponse,
21
+ AuthEmailTemplateListResponse,
22
+ AuthEmailTemplatePreviewRequest,
23
+ AuthEmailTemplatePreviewResponse,
24
+ AuthEmailTemplateResponse,
25
+ AuthEmailTemplateTestRequest,
26
+ AuthEmailTemplateTestResponse,
27
+ AuthEmailTemplateVersionsResponse,
28
+ AuthEmailType,
29
+ BulkUpsertAuthEmailTemplatesRequest,
30
+ BulkUpsertAuthEmailTemplatesResponse,
31
+ UpsertAuthEmailTemplateRequest,
32
+ } from '../models/index';
33
+ import {
34
+ ApiErrorFromJSON,
35
+ ApiErrorToJSON,
36
+ AuthEmailTemplateDefaultResponseFromJSON,
37
+ AuthEmailTemplateDefaultResponseToJSON,
38
+ AuthEmailTemplateDeleteResponseFromJSON,
39
+ AuthEmailTemplateDeleteResponseToJSON,
40
+ AuthEmailTemplateListResponseFromJSON,
41
+ AuthEmailTemplateListResponseToJSON,
42
+ AuthEmailTemplatePreviewRequestFromJSON,
43
+ AuthEmailTemplatePreviewRequestToJSON,
44
+ AuthEmailTemplatePreviewResponseFromJSON,
45
+ AuthEmailTemplatePreviewResponseToJSON,
46
+ AuthEmailTemplateResponseFromJSON,
47
+ AuthEmailTemplateResponseToJSON,
48
+ AuthEmailTemplateTestRequestFromJSON,
49
+ AuthEmailTemplateTestRequestToJSON,
50
+ AuthEmailTemplateTestResponseFromJSON,
51
+ AuthEmailTemplateTestResponseToJSON,
52
+ AuthEmailTemplateVersionsResponseFromJSON,
53
+ AuthEmailTemplateVersionsResponseToJSON,
54
+ AuthEmailTypeFromJSON,
55
+ AuthEmailTypeToJSON,
56
+ BulkUpsertAuthEmailTemplatesRequestFromJSON,
57
+ BulkUpsertAuthEmailTemplatesRequestToJSON,
58
+ BulkUpsertAuthEmailTemplatesResponseFromJSON,
59
+ BulkUpsertAuthEmailTemplatesResponseToJSON,
60
+ UpsertAuthEmailTemplateRequestFromJSON,
61
+ UpsertAuthEmailTemplateRequestToJSON,
62
+ } from '../models/index';
63
+
64
+ export interface AuthEmailTemplatesApiBulkUpsertAuthEmailTemplatesOperationRequest {
65
+ bulkUpsertAuthEmailTemplatesRequest: BulkUpsertAuthEmailTemplatesRequest;
66
+ }
67
+
68
+ export interface AuthEmailTemplatesApiDeleteAuthEmailTemplateRequest {
69
+ type: AuthEmailType;
70
+ }
71
+
72
+ export interface AuthEmailTemplatesApiGetAuthEmailTemplateRequest {
73
+ type: AuthEmailType;
74
+ }
75
+
76
+ export interface AuthEmailTemplatesApiGetAuthEmailTemplateDefaultRequest {
77
+ type: AuthEmailType;
78
+ }
79
+
80
+ export interface AuthEmailTemplatesApiListAuthEmailTemplateVersionsRequest {
81
+ type: AuthEmailType;
82
+ }
83
+
84
+ export interface AuthEmailTemplatesApiPreviewAuthEmailTemplateRequest {
85
+ type: AuthEmailType;
86
+ authEmailTemplatePreviewRequest?: AuthEmailTemplatePreviewRequest;
87
+ }
88
+
89
+ export interface AuthEmailTemplatesApiRestoreAuthEmailTemplateVersionRequest {
90
+ type: AuthEmailType;
91
+ version: number;
92
+ }
93
+
94
+ export interface AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest {
95
+ type: AuthEmailType;
96
+ authEmailTemplateTestRequest: AuthEmailTemplateTestRequest;
97
+ }
98
+
99
+ export interface AuthEmailTemplatesApiUpsertAuthEmailTemplateOperationRequest {
100
+ type: AuthEmailType;
101
+ upsertAuthEmailTemplateRequest: UpsertAuthEmailTemplateRequest;
102
+ }
103
+
104
+ /**
105
+ * AuthEmailTemplatesApi - interface
106
+ *
107
+ * @export
108
+ * @interface AuthEmailTemplatesApiInterface
109
+ */
110
+ export interface AuthEmailTemplatesApiInterface {
111
+ /**
112
+ * Atomic upsert of any subset of magic_link, password_reset, email_verification. Validates all inputs before any write; if any one fails validation or MJML compile, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
113
+ * @summary Bulk-upsert auth email templates
114
+ * @param {BulkUpsertAuthEmailTemplatesRequest} bulkUpsertAuthEmailTemplatesRequest
115
+ * @param {*} [options] Override http request option.
116
+ * @throws {RequiredError}
117
+ * @memberof AuthEmailTemplatesApiInterface
118
+ */
119
+ bulkUpsertAuthEmailTemplatesRaw(requestParameters: AuthEmailTemplatesApiBulkUpsertAuthEmailTemplatesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkUpsertAuthEmailTemplatesResponse>>;
120
+
121
+ /**
122
+ * Atomic upsert of any subset of magic_link, password_reset, email_verification. Validates all inputs before any write; if any one fails validation or MJML compile, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
123
+ * Bulk-upsert auth email templates
124
+ */
125
+ bulkUpsertAuthEmailTemplates(bulkUpsertAuthEmailTemplatesRequest: BulkUpsertAuthEmailTemplatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkUpsertAuthEmailTemplatesResponse>;
126
+
127
+ /**
128
+ * Reverts the application to the system default for this type
129
+ * @summary Remove a tenant override
130
+ * @param {AuthEmailType} type
131
+ * @param {*} [options] Override http request option.
132
+ * @throws {RequiredError}
133
+ * @memberof AuthEmailTemplatesApiInterface
134
+ */
135
+ deleteAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiDeleteAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateDeleteResponse>>;
136
+
137
+ /**
138
+ * Reverts the application to the system default for this type
139
+ * Remove a tenant override
140
+ */
141
+ deleteAuthEmailTemplate(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateDeleteResponse>;
142
+
143
+ /**
144
+ * Returns the override row for the given `type` if one exists, otherwise the system default. Use `is_default` to distinguish.
145
+ * @summary Get an auth email template
146
+ * @param {AuthEmailType} type
147
+ * @param {*} [options] Override http request option.
148
+ * @throws {RequiredError}
149
+ * @memberof AuthEmailTemplatesApiInterface
150
+ */
151
+ getAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiGetAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateResponse>>;
152
+
153
+ /**
154
+ * Returns the override row for the given `type` if one exists, otherwise the system default. Use `is_default` to distinguish.
155
+ * Get an auth email template
156
+ */
157
+ getAuthEmailTemplate(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse>;
158
+
159
+ /**
160
+ * Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.
161
+ * @summary Get the system default template
162
+ * @param {AuthEmailType} type
163
+ * @param {*} [options] Override http request option.
164
+ * @throws {RequiredError}
165
+ * @memberof AuthEmailTemplatesApiInterface
166
+ */
167
+ getAuthEmailTemplateDefaultRaw(requestParameters: AuthEmailTemplatesApiGetAuthEmailTemplateDefaultRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateDefaultResponse>>;
168
+
169
+ /**
170
+ * Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.
171
+ * Get the system default template
172
+ */
173
+ getAuthEmailTemplateDefault(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateDefaultResponse>;
174
+
175
+ /**
176
+ *
177
+ * @summary List version history for a template
178
+ * @param {AuthEmailType} type
179
+ * @param {*} [options] Override http request option.
180
+ * @throws {RequiredError}
181
+ * @memberof AuthEmailTemplatesApiInterface
182
+ */
183
+ listAuthEmailTemplateVersionsRaw(requestParameters: AuthEmailTemplatesApiListAuthEmailTemplateVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateVersionsResponse>>;
184
+
185
+ /**
186
+ * List version history for a template
187
+ */
188
+ listAuthEmailTemplateVersions(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateVersionsResponse>;
189
+
190
+ /**
191
+ * List the application\'s auth email templates. Returns one entry per email type; when no override exists for a type, the system default is returned with `is_default: true`.
192
+ * @summary List auth email templates
193
+ * @param {*} [options] Override http request option.
194
+ * @throws {RequiredError}
195
+ * @memberof AuthEmailTemplatesApiInterface
196
+ */
197
+ listAuthEmailTemplatesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateListResponse>>;
198
+
199
+ /**
200
+ * List the application\'s auth email templates. Returns one entry per email type; when no override exists for a type, the system default is returned with `is_default: true`.
201
+ * List auth email templates
202
+ */
203
+ listAuthEmailTemplates(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateListResponse>;
204
+
205
+ /**
206
+ * Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.
207
+ * @summary Render a template with sample variables
208
+ * @param {AuthEmailType} type
209
+ * @param {AuthEmailTemplatePreviewRequest} [authEmailTemplatePreviewRequest]
210
+ * @param {*} [options] Override http request option.
211
+ * @throws {RequiredError}
212
+ * @memberof AuthEmailTemplatesApiInterface
213
+ */
214
+ previewAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiPreviewAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplatePreviewResponse>>;
215
+
216
+ /**
217
+ * Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.
218
+ * Render a template with sample variables
219
+ */
220
+ previewAuthEmailTemplate(type: AuthEmailType, authEmailTemplatePreviewRequest?: AuthEmailTemplatePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplatePreviewResponse>;
221
+
222
+ /**
223
+ * Snapshots current state, then overwrites with the contents of the specified historical version.
224
+ * @summary Restore a previous version
225
+ * @param {AuthEmailType} type
226
+ * @param {number} version
227
+ * @param {*} [options] Override http request option.
228
+ * @throws {RequiredError}
229
+ * @memberof AuthEmailTemplatesApiInterface
230
+ */
231
+ restoreAuthEmailTemplateVersionRaw(requestParameters: AuthEmailTemplatesApiRestoreAuthEmailTemplateVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateResponse>>;
232
+
233
+ /**
234
+ * Snapshots current state, then overwrites with the contents of the specified historical version.
235
+ * Restore a previous version
236
+ */
237
+ restoreAuthEmailTemplateVersion(type: AuthEmailType, version: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse>;
238
+
239
+ /**
240
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
241
+ * @summary Send a test render of a template
242
+ * @param {AuthEmailType} type
243
+ * @param {AuthEmailTemplateTestRequest} authEmailTemplateTestRequest
244
+ * @param {*} [options] Override http request option.
245
+ * @throws {RequiredError}
246
+ * @memberof AuthEmailTemplatesApiInterface
247
+ */
248
+ sendAuthEmailTemplateTestRaw(requestParameters: AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateTestResponse>>;
249
+
250
+ /**
251
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
252
+ * Send a test render of a template
253
+ */
254
+ sendAuthEmailTemplateTest(type: AuthEmailType, authEmailTemplateTestRequest: AuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateTestResponse>;
255
+
256
+ /**
257
+ * Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with `details`.
258
+ * @summary Create or update an auth email template
259
+ * @param {AuthEmailType} type
260
+ * @param {UpsertAuthEmailTemplateRequest} upsertAuthEmailTemplateRequest
261
+ * @param {*} [options] Override http request option.
262
+ * @throws {RequiredError}
263
+ * @memberof AuthEmailTemplatesApiInterface
264
+ */
265
+ upsertAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiUpsertAuthEmailTemplateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateResponse>>;
266
+
267
+ /**
268
+ * Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with `details`.
269
+ * Create or update an auth email template
270
+ */
271
+ upsertAuthEmailTemplate(type: AuthEmailType, upsertAuthEmailTemplateRequest: UpsertAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse>;
272
+
273
+ }
274
+
275
+ /**
276
+ *
277
+ */
278
+ export class AuthEmailTemplatesApi extends runtime.BaseAPI implements AuthEmailTemplatesApiInterface {
279
+
280
+ /**
281
+ * Atomic upsert of any subset of magic_link, password_reset, email_verification. Validates all inputs before any write; if any one fails validation or MJML compile, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
282
+ * Bulk-upsert auth email templates
283
+ */
284
+ async bulkUpsertAuthEmailTemplatesRaw(requestParameters: AuthEmailTemplatesApiBulkUpsertAuthEmailTemplatesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkUpsertAuthEmailTemplatesResponse>> {
285
+ if (requestParameters['bulkUpsertAuthEmailTemplatesRequest'] == null) {
286
+ throw new runtime.RequiredError(
287
+ 'bulkUpsertAuthEmailTemplatesRequest',
288
+ 'Required parameter "bulkUpsertAuthEmailTemplatesRequest" was null or undefined when calling bulkUpsertAuthEmailTemplates().'
289
+ );
290
+ }
291
+
292
+ const queryParameters: any = {};
293
+
294
+ const headerParameters: runtime.HTTPHeaders = {};
295
+
296
+ headerParameters['Content-Type'] = 'application/json';
297
+
298
+ if (this.configuration && this.configuration.apiKey) {
299
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
300
+ }
301
+
302
+ if (this.configuration && this.configuration.apiKey) {
303
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
304
+ }
305
+
306
+ const response = await this.request({
307
+ path: `/auth/email-templates`,
308
+ method: 'PUT',
309
+ headers: headerParameters,
310
+ query: queryParameters,
311
+ body: BulkUpsertAuthEmailTemplatesRequestToJSON(requestParameters['bulkUpsertAuthEmailTemplatesRequest']),
312
+ }, initOverrides);
313
+
314
+ return new runtime.JSONApiResponse(response, (jsonValue) => BulkUpsertAuthEmailTemplatesResponseFromJSON(jsonValue));
315
+ }
316
+
317
+ /**
318
+ * Atomic upsert of any subset of magic_link, password_reset, email_verification. Validates all inputs before any write; if any one fails validation or MJML compile, none are saved. Designed for one-shot migration imports from Auth0/Firebase/Clerk/Cognito.
319
+ * Bulk-upsert auth email templates
320
+ */
321
+ async bulkUpsertAuthEmailTemplates(bulkUpsertAuthEmailTemplatesRequest: BulkUpsertAuthEmailTemplatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkUpsertAuthEmailTemplatesResponse> {
322
+ const response = await this.bulkUpsertAuthEmailTemplatesRaw({ bulkUpsertAuthEmailTemplatesRequest: bulkUpsertAuthEmailTemplatesRequest }, initOverrides);
323
+ return await response.value();
324
+ }
325
+
326
+ /**
327
+ * Reverts the application to the system default for this type
328
+ * Remove a tenant override
329
+ */
330
+ async deleteAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiDeleteAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateDeleteResponse>> {
331
+ if (requestParameters['type'] == null) {
332
+ throw new runtime.RequiredError(
333
+ 'type',
334
+ 'Required parameter "type" was null or undefined when calling deleteAuthEmailTemplate().'
335
+ );
336
+ }
337
+
338
+ const queryParameters: any = {};
339
+
340
+ const headerParameters: runtime.HTTPHeaders = {};
341
+
342
+ if (this.configuration && this.configuration.apiKey) {
343
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
344
+ }
345
+
346
+ if (this.configuration && this.configuration.apiKey) {
347
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
348
+ }
349
+
350
+ const response = await this.request({
351
+ path: `/auth/email-templates/{type}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
352
+ method: 'DELETE',
353
+ headers: headerParameters,
354
+ query: queryParameters,
355
+ }, initOverrides);
356
+
357
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateDeleteResponseFromJSON(jsonValue));
358
+ }
359
+
360
+ /**
361
+ * Reverts the application to the system default for this type
362
+ * Remove a tenant override
363
+ */
364
+ async deleteAuthEmailTemplate(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateDeleteResponse> {
365
+ const response = await this.deleteAuthEmailTemplateRaw({ type: type }, initOverrides);
366
+ return await response.value();
367
+ }
368
+
369
+ /**
370
+ * Returns the override row for the given `type` if one exists, otherwise the system default. Use `is_default` to distinguish.
371
+ * Get an auth email template
372
+ */
373
+ async getAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiGetAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateResponse>> {
374
+ if (requestParameters['type'] == null) {
375
+ throw new runtime.RequiredError(
376
+ 'type',
377
+ 'Required parameter "type" was null or undefined when calling getAuthEmailTemplate().'
378
+ );
379
+ }
380
+
381
+ const queryParameters: any = {};
382
+
383
+ const headerParameters: runtime.HTTPHeaders = {};
384
+
385
+ if (this.configuration && this.configuration.apiKey) {
386
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
387
+ }
388
+
389
+ if (this.configuration && this.configuration.apiKey) {
390
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
391
+ }
392
+
393
+ const response = await this.request({
394
+ path: `/auth/email-templates/{type}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
395
+ method: 'GET',
396
+ headers: headerParameters,
397
+ query: queryParameters,
398
+ }, initOverrides);
399
+
400
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateResponseFromJSON(jsonValue));
401
+ }
402
+
403
+ /**
404
+ * Returns the override row for the given `type` if one exists, otherwise the system default. Use `is_default` to distinguish.
405
+ * Get an auth email template
406
+ */
407
+ async getAuthEmailTemplate(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse> {
408
+ const response = await this.getAuthEmailTemplateRaw({ type: type }, initOverrides);
409
+ return await response.value();
410
+ }
411
+
412
+ /**
413
+ * Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.
414
+ * Get the system default template
415
+ */
416
+ async getAuthEmailTemplateDefaultRaw(requestParameters: AuthEmailTemplatesApiGetAuthEmailTemplateDefaultRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateDefaultResponse>> {
417
+ if (requestParameters['type'] == null) {
418
+ throw new runtime.RequiredError(
419
+ 'type',
420
+ 'Required parameter "type" was null or undefined when calling getAuthEmailTemplateDefault().'
421
+ );
422
+ }
423
+
424
+ const queryParameters: any = {};
425
+
426
+ const headerParameters: runtime.HTTPHeaders = {};
427
+
428
+ if (this.configuration && this.configuration.apiKey) {
429
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
430
+ }
431
+
432
+ if (this.configuration && this.configuration.apiKey) {
433
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
434
+ }
435
+
436
+ const response = await this.request({
437
+ path: `/auth/email-templates/{type}/default`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
438
+ method: 'GET',
439
+ headers: headerParameters,
440
+ query: queryParameters,
441
+ }, initOverrides);
442
+
443
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateDefaultResponseFromJSON(jsonValue));
444
+ }
445
+
446
+ /**
447
+ * Returns the system default for the given type with Handlebars variables un-rendered. Useful for migration tooling fetch, modify, then PUT.
448
+ * Get the system default template
449
+ */
450
+ async getAuthEmailTemplateDefault(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateDefaultResponse> {
451
+ const response = await this.getAuthEmailTemplateDefaultRaw({ type: type }, initOverrides);
452
+ return await response.value();
453
+ }
454
+
455
+ /**
456
+ * List version history for a template
457
+ */
458
+ async listAuthEmailTemplateVersionsRaw(requestParameters: AuthEmailTemplatesApiListAuthEmailTemplateVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateVersionsResponse>> {
459
+ if (requestParameters['type'] == null) {
460
+ throw new runtime.RequiredError(
461
+ 'type',
462
+ 'Required parameter "type" was null or undefined when calling listAuthEmailTemplateVersions().'
463
+ );
464
+ }
465
+
466
+ const queryParameters: any = {};
467
+
468
+ const headerParameters: runtime.HTTPHeaders = {};
469
+
470
+ if (this.configuration && this.configuration.apiKey) {
471
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
472
+ }
473
+
474
+ if (this.configuration && this.configuration.apiKey) {
475
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
476
+ }
477
+
478
+ const response = await this.request({
479
+ path: `/auth/email-templates/{type}/versions`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
480
+ method: 'GET',
481
+ headers: headerParameters,
482
+ query: queryParameters,
483
+ }, initOverrides);
484
+
485
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateVersionsResponseFromJSON(jsonValue));
486
+ }
487
+
488
+ /**
489
+ * List version history for a template
490
+ */
491
+ async listAuthEmailTemplateVersions(type: AuthEmailType, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateVersionsResponse> {
492
+ const response = await this.listAuthEmailTemplateVersionsRaw({ type: type }, initOverrides);
493
+ return await response.value();
494
+ }
495
+
496
+ /**
497
+ * List the application\'s auth email templates. Returns one entry per email type; when no override exists for a type, the system default is returned with `is_default: true`.
498
+ * List auth email templates
499
+ */
500
+ async listAuthEmailTemplatesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateListResponse>> {
501
+ const queryParameters: any = {};
502
+
503
+ const headerParameters: runtime.HTTPHeaders = {};
504
+
505
+ if (this.configuration && this.configuration.apiKey) {
506
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
507
+ }
508
+
509
+ if (this.configuration && this.configuration.apiKey) {
510
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
511
+ }
512
+
513
+ const response = await this.request({
514
+ path: `/auth/email-templates`,
515
+ method: 'GET',
516
+ headers: headerParameters,
517
+ query: queryParameters,
518
+ }, initOverrides);
519
+
520
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateListResponseFromJSON(jsonValue));
521
+ }
522
+
523
+ /**
524
+ * List the application\'s auth email templates. Returns one entry per email type; when no override exists for a type, the system default is returned with `is_default: true`.
525
+ * List auth email templates
526
+ */
527
+ async listAuthEmailTemplates(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateListResponse> {
528
+ const response = await this.listAuthEmailTemplatesRaw(initOverrides);
529
+ return await response.value();
530
+ }
531
+
532
+ /**
533
+ * Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.
534
+ * Render a template with sample variables
535
+ */
536
+ async previewAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiPreviewAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplatePreviewResponse>> {
537
+ if (requestParameters['type'] == null) {
538
+ throw new runtime.RequiredError(
539
+ 'type',
540
+ 'Required parameter "type" was null or undefined when calling previewAuthEmailTemplate().'
541
+ );
542
+ }
543
+
544
+ const queryParameters: any = {};
545
+
546
+ const headerParameters: runtime.HTTPHeaders = {};
547
+
548
+ headerParameters['Content-Type'] = 'application/json';
549
+
550
+ if (this.configuration && this.configuration.apiKey) {
551
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
552
+ }
553
+
554
+ if (this.configuration && this.configuration.apiKey) {
555
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
556
+ }
557
+
558
+ const response = await this.request({
559
+ path: `/auth/email-templates/{type}/preview`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
560
+ method: 'POST',
561
+ headers: headerParameters,
562
+ query: queryParameters,
563
+ body: AuthEmailTemplatePreviewRequestToJSON(requestParameters['authEmailTemplatePreviewRequest']),
564
+ }, initOverrides);
565
+
566
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplatePreviewResponseFromJSON(jsonValue));
567
+ }
568
+
569
+ /**
570
+ * Returns subject/html/text rendered using sample variables (or caller-provided variables). No email is sent. Useful for dashboard previews and migration import validation.
571
+ * Render a template with sample variables
572
+ */
573
+ async previewAuthEmailTemplate(type: AuthEmailType, authEmailTemplatePreviewRequest?: AuthEmailTemplatePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplatePreviewResponse> {
574
+ const response = await this.previewAuthEmailTemplateRaw({ type: type, authEmailTemplatePreviewRequest: authEmailTemplatePreviewRequest }, initOverrides);
575
+ return await response.value();
576
+ }
577
+
578
+ /**
579
+ * Snapshots current state, then overwrites with the contents of the specified historical version.
580
+ * Restore a previous version
581
+ */
582
+ async restoreAuthEmailTemplateVersionRaw(requestParameters: AuthEmailTemplatesApiRestoreAuthEmailTemplateVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateResponse>> {
583
+ if (requestParameters['type'] == null) {
584
+ throw new runtime.RequiredError(
585
+ 'type',
586
+ 'Required parameter "type" was null or undefined when calling restoreAuthEmailTemplateVersion().'
587
+ );
588
+ }
589
+
590
+ if (requestParameters['version'] == null) {
591
+ throw new runtime.RequiredError(
592
+ 'version',
593
+ 'Required parameter "version" was null or undefined when calling restoreAuthEmailTemplateVersion().'
594
+ );
595
+ }
596
+
597
+ const queryParameters: any = {};
598
+
599
+ const headerParameters: runtime.HTTPHeaders = {};
600
+
601
+ if (this.configuration && this.configuration.apiKey) {
602
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
603
+ }
604
+
605
+ if (this.configuration && this.configuration.apiKey) {
606
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
607
+ }
608
+
609
+ const response = await this.request({
610
+ path: `/auth/email-templates/{type}/versions/{version}/restore`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))).replace(`{${"version"}}`, encodeURIComponent(String(requestParameters['version']))),
611
+ method: 'POST',
612
+ headers: headerParameters,
613
+ query: queryParameters,
614
+ }, initOverrides);
615
+
616
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateResponseFromJSON(jsonValue));
617
+ }
618
+
619
+ /**
620
+ * Snapshots current state, then overwrites with the contents of the specified historical version.
621
+ * Restore a previous version
622
+ */
623
+ async restoreAuthEmailTemplateVersion(type: AuthEmailType, version: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse> {
624
+ const response = await this.restoreAuthEmailTemplateVersionRaw({ type: type, version: version }, initOverrides);
625
+ return await response.value();
626
+ }
627
+
628
+ /**
629
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
630
+ * Send a test render of a template
631
+ */
632
+ async sendAuthEmailTemplateTestRaw(requestParameters: AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateTestResponse>> {
633
+ if (requestParameters['type'] == null) {
634
+ throw new runtime.RequiredError(
635
+ 'type',
636
+ 'Required parameter "type" was null or undefined when calling sendAuthEmailTemplateTest().'
637
+ );
638
+ }
639
+
640
+ if (requestParameters['authEmailTemplateTestRequest'] == null) {
641
+ throw new runtime.RequiredError(
642
+ 'authEmailTemplateTestRequest',
643
+ 'Required parameter "authEmailTemplateTestRequest" was null or undefined when calling sendAuthEmailTemplateTest().'
644
+ );
645
+ }
646
+
647
+ const queryParameters: any = {};
648
+
649
+ const headerParameters: runtime.HTTPHeaders = {};
650
+
651
+ headerParameters['Content-Type'] = 'application/json';
652
+
653
+ if (this.configuration && this.configuration.apiKey) {
654
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
655
+ }
656
+
657
+ if (this.configuration && this.configuration.apiKey) {
658
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
659
+ }
660
+
661
+ const response = await this.request({
662
+ path: `/auth/email-templates/{type}/test`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
663
+ method: 'POST',
664
+ headers: headerParameters,
665
+ query: queryParameters,
666
+ body: AuthEmailTemplateTestRequestToJSON(requestParameters['authEmailTemplateTestRequest']),
667
+ }, initOverrides);
668
+
669
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateTestResponseFromJSON(jsonValue));
670
+ }
671
+
672
+ /**
673
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
674
+ * Send a test render of a template
675
+ */
676
+ async sendAuthEmailTemplateTest(type: AuthEmailType, authEmailTemplateTestRequest: AuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateTestResponse> {
677
+ const response = await this.sendAuthEmailTemplateTestRaw({ type: type, authEmailTemplateTestRequest: authEmailTemplateTestRequest }, initOverrides);
678
+ return await response.value();
679
+ }
680
+
681
+ /**
682
+ * Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with `details`.
683
+ * Create or update an auth email template
684
+ */
685
+ async upsertAuthEmailTemplateRaw(requestParameters: AuthEmailTemplatesApiUpsertAuthEmailTemplateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateResponse>> {
686
+ if (requestParameters['type'] == null) {
687
+ throw new runtime.RequiredError(
688
+ 'type',
689
+ 'Required parameter "type" was null or undefined when calling upsertAuthEmailTemplate().'
690
+ );
691
+ }
692
+
693
+ if (requestParameters['upsertAuthEmailTemplateRequest'] == null) {
694
+ throw new runtime.RequiredError(
695
+ 'upsertAuthEmailTemplateRequest',
696
+ 'Required parameter "upsertAuthEmailTemplateRequest" was null or undefined when calling upsertAuthEmailTemplate().'
697
+ );
698
+ }
699
+
700
+ const queryParameters: any = {};
701
+
702
+ const headerParameters: runtime.HTTPHeaders = {};
703
+
704
+ headerParameters['Content-Type'] = 'application/json';
705
+
706
+ if (this.configuration && this.configuration.apiKey) {
707
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
708
+ }
709
+
710
+ if (this.configuration && this.configuration.apiKey) {
711
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
712
+ }
713
+
714
+ const response = await this.request({
715
+ path: `/auth/email-templates/{type}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters['type']))),
716
+ method: 'PUT',
717
+ headers: headerParameters,
718
+ query: queryParameters,
719
+ body: UpsertAuthEmailTemplateRequestToJSON(requestParameters['upsertAuthEmailTemplateRequest']),
720
+ }, initOverrides);
721
+
722
+ return new runtime.JSONApiResponse(response, (jsonValue) => AuthEmailTemplateResponseFromJSON(jsonValue));
723
+ }
724
+
725
+ /**
726
+ * Idempotent upsert keyed by application + type. MJML sources are compiled to HTML on save; compile errors return 400 with `details`.
727
+ * Create or update an auth email template
728
+ */
729
+ async upsertAuthEmailTemplate(type: AuthEmailType, upsertAuthEmailTemplateRequest: UpsertAuthEmailTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse> {
730
+ const response = await this.upsertAuthEmailTemplateRaw({ type: type, upsertAuthEmailTemplateRequest: upsertAuthEmailTemplateRequest }, initOverrides);
731
+ return await response.value();
732
+ }
733
+
734
+ }