@zyphr-dev/node-sdk 0.1.22 → 0.1.24
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.
- package/README.md +47 -35
- package/dist/index.cjs +139 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +275 -129
- package/dist/index.d.ts +275 -129
- package/dist/index.js +132 -70
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/src/.openapi-generator/FILES +1 -0
- package/src/errors.ts +20 -0
- package/src/src/apis/EmailsApi.ts +4 -4
- package/src/src/models/BatchRecipient.ts +83 -0
- package/src/src/models/CreateTemplateRequest.ts +18 -11
- package/src/src/models/SendBatchEmailRequest.ts +95 -11
- package/src/src/models/Template.ts +5 -4
- package/src/src/models/TemplateResponse.ts +13 -0
- package/src/src/models/UpdateTemplateRequest.ts +9 -8
- package/src/src/models/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyphr-dev/node-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Official Zyphr SDK for Node.js, React, and React Native",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"build": "tsup",
|
|
29
29
|
"lint": "tsc --noEmit",
|
|
30
30
|
"test": "echo 'No tests yet for generated SDK'",
|
|
31
|
+
"examples:typecheck": "tsc --noEmit -p examples/tsconfig.json",
|
|
32
|
+
"readme:check": "node ../scripts/verify-readme-methods.mjs",
|
|
33
|
+
"verify": "yarn lint && yarn examples:typecheck && yarn readme:check",
|
|
31
34
|
"clean": "rm -rf dist"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
@@ -66,6 +66,7 @@ src/models/AuthUser.ts
|
|
|
66
66
|
src/models/AuthUserResponse.ts
|
|
67
67
|
src/models/AuthUserResponseData.ts
|
|
68
68
|
src/models/BatchPublishWaaSEvents201Response.ts
|
|
69
|
+
src/models/BatchRecipient.ts
|
|
69
70
|
src/models/BulkRetryWebhookDeliveriesRequest.ts
|
|
70
71
|
src/models/BulkUpsertAuthEmailTemplatesRequest.ts
|
|
71
72
|
src/models/BulkUpsertAuthEmailTemplatesResponse.ts
|
package/src/errors.ts
CHANGED
|
@@ -82,6 +82,26 @@ export class ZyphrNotFoundError extends ZyphrError {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Thrown when a Zyphr webhook signature fails verification.
|
|
87
|
+
*
|
|
88
|
+
* Use the verification helper shown in `examples/14-webhook-handler.ts`
|
|
89
|
+
* (or write your own) to detect tampered or replayed webhook deliveries.
|
|
90
|
+
*/
|
|
91
|
+
export class ZyphrWebhookVerificationError extends ZyphrError {
|
|
92
|
+
constructor(message: string) {
|
|
93
|
+
super({ message, status: 401, code: 'webhook_verification_failed' });
|
|
94
|
+
this.name = 'ZyphrWebhookVerificationError';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Alias for {@link ZyphrWebhookVerificationError}. Provided for symmetry with
|
|
100
|
+
* `Zyphr*Error` naming and shorter import statements in webhook handlers.
|
|
101
|
+
*/
|
|
102
|
+
export const WebhookVerificationError = ZyphrWebhookVerificationError;
|
|
103
|
+
export type WebhookVerificationError = ZyphrWebhookVerificationError;
|
|
104
|
+
|
|
85
105
|
/**
|
|
86
106
|
* Parse an API error response and throw the appropriate ZyphrError subclass.
|
|
87
107
|
*/
|
|
@@ -148,7 +148,7 @@ export interface EmailsApiInterface {
|
|
|
148
148
|
listEmails(status?: ListEmailsStatusEnum, tag?: string, limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmailListResponse>;
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
* Send up to 100
|
|
151
|
+
* Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`. Per-recipient `variables` are merged on top of the batch-level `template_data`.
|
|
152
152
|
* @summary Send batch emails
|
|
153
153
|
* @param {SendBatchEmailRequest} sendBatchEmailRequest
|
|
154
154
|
* @param {*} [options] Override http request option.
|
|
@@ -158,7 +158,7 @@ export interface EmailsApiInterface {
|
|
|
158
158
|
sendBatchEmailRaw(requestParameters: EmailsApiSendBatchEmailOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SendBatchEmailResponse>>;
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* Send up to 100
|
|
161
|
+
* Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`. Per-recipient `variables` are merged on top of the batch-level `template_data`.
|
|
162
162
|
* Send batch emails
|
|
163
163
|
*/
|
|
164
164
|
sendBatchEmail(sendBatchEmailRequest: SendBatchEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SendBatchEmailResponse>;
|
|
@@ -352,7 +352,7 @@ export class EmailsApi extends runtime.BaseAPI implements EmailsApiInterface {
|
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
/**
|
|
355
|
-
* Send up to 100
|
|
355
|
+
* Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`. Per-recipient `variables` are merged on top of the batch-level `template_data`.
|
|
356
356
|
* Send batch emails
|
|
357
357
|
*/
|
|
358
358
|
async sendBatchEmailRaw(requestParameters: EmailsApiSendBatchEmailOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SendBatchEmailResponse>> {
|
|
@@ -385,7 +385,7 @@ export class EmailsApi extends runtime.BaseAPI implements EmailsApiInterface {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
/**
|
|
388
|
-
* Send up to 100
|
|
388
|
+
* Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`. Per-recipient `variables` are merged on top of the batch-level `template_data`.
|
|
389
389
|
* Send batch emails
|
|
390
390
|
*/
|
|
391
391
|
async sendBatchEmail(sendBatchEmailRequest: SendBatchEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SendBatchEmailResponse> {
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface BatchRecipient
|
|
20
|
+
*/
|
|
21
|
+
export interface BatchRecipient {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof BatchRecipient
|
|
26
|
+
*/
|
|
27
|
+
email: string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof BatchRecipient
|
|
32
|
+
*/
|
|
33
|
+
name?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Per-recipient template variables. Merged on top of the batch-level `template_data`, so per-recipient values win on key collisions.
|
|
36
|
+
*
|
|
37
|
+
* @type {{ [key: string]: any; }}
|
|
38
|
+
* @memberof BatchRecipient
|
|
39
|
+
*/
|
|
40
|
+
variables?: { [key: string]: any; };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if a given object implements the BatchRecipient interface.
|
|
45
|
+
*/
|
|
46
|
+
export function instanceOfBatchRecipient(value: object): value is BatchRecipient {
|
|
47
|
+
if (!('email' in value) || value['email'] === undefined) return false;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function BatchRecipientFromJSON(json: any): BatchRecipient {
|
|
52
|
+
return BatchRecipientFromJSONTyped(json, false);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function BatchRecipientFromJSONTyped(json: any, ignoreDiscriminator: boolean): BatchRecipient {
|
|
56
|
+
if (json == null) {
|
|
57
|
+
return json;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
|
|
61
|
+
'email': json['email'],
|
|
62
|
+
'name': json['name'] == null ? undefined : json['name'],
|
|
63
|
+
'variables': json['variables'] == null ? undefined : json['variables'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function BatchRecipientToJSON(json: any): BatchRecipient {
|
|
68
|
+
return BatchRecipientToJSONTyped(json, false);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function BatchRecipientToJSONTyped(value?: BatchRecipient | null, ignoreDiscriminator: boolean = false): any {
|
|
72
|
+
if (value == null) {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
|
|
78
|
+
'email': value['email'],
|
|
79
|
+
'name': value['name'],
|
|
80
|
+
'variables': value['variables'],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
@@ -32,29 +32,38 @@ export interface CreateTemplateRequest {
|
|
|
32
32
|
*/
|
|
33
33
|
description?: string;
|
|
34
34
|
/**
|
|
35
|
-
* Email subject line
|
|
35
|
+
* Email subject line. Supports Handlebars `{{var}}` interpolation;
|
|
36
|
+
* values are HTML-escaped on render (see `html` field for the full
|
|
37
|
+
* escape policy).
|
|
38
|
+
*
|
|
36
39
|
* @type {string}
|
|
37
40
|
* @memberof CreateTemplateRequest
|
|
38
41
|
*/
|
|
39
42
|
subject?: string;
|
|
40
43
|
/**
|
|
41
|
-
* HTML body
|
|
44
|
+
* HTML body. Supports Handlebars `{{var}}` interpolation; values are
|
|
45
|
+
* always HTML-escaped on render.
|
|
46
|
+
*
|
|
47
|
+
* **Triple-brace `{{{var}}}` (raw HTML output) is not supported** for
|
|
48
|
+
* XSS-prevention reasons — input containing `{{{var}}}` is rewritten
|
|
49
|
+
* to `{{var}}` on save and the response includes a top-level
|
|
50
|
+
* `warnings` array describing what changed. To inject pre-rendered
|
|
51
|
+
* HTML, render the entire `html` field outside Zyphr and POST it to
|
|
52
|
+
* `/v1/email/send` directly without `template_id`.
|
|
53
|
+
*
|
|
42
54
|
* @type {string}
|
|
43
55
|
* @memberof CreateTemplateRequest
|
|
44
56
|
*/
|
|
45
57
|
html?: string;
|
|
46
58
|
/**
|
|
47
|
-
* Plain text body
|
|
59
|
+
* Plain text body. Supports Handlebars `{{var}}` interpolation;
|
|
60
|
+
* triple-brace syntax is rewritten to double-brace on save (same
|
|
61
|
+
* policy as the `html` field).
|
|
62
|
+
*
|
|
48
63
|
* @type {string}
|
|
49
64
|
* @memberof CreateTemplateRequest
|
|
50
65
|
*/
|
|
51
66
|
text?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Default variable values
|
|
54
|
-
* @type {{ [key: string]: any; }}
|
|
55
|
-
* @memberof CreateTemplateRequest
|
|
56
|
-
*/
|
|
57
|
-
variables?: { [key: string]: any; };
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
/**
|
|
@@ -80,7 +89,6 @@ export function CreateTemplateRequestFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
80
89
|
'subject': json['subject'] == null ? undefined : json['subject'],
|
|
81
90
|
'html': json['html'] == null ? undefined : json['html'],
|
|
82
91
|
'text': json['text'] == null ? undefined : json['text'],
|
|
83
|
-
'variables': json['variables'] == null ? undefined : json['variables'],
|
|
84
92
|
};
|
|
85
93
|
}
|
|
86
94
|
|
|
@@ -100,7 +108,6 @@ export function CreateTemplateRequestToJSONTyped(value?: CreateTemplateRequest |
|
|
|
100
108
|
'subject': value['subject'],
|
|
101
109
|
'html': value['html'],
|
|
102
110
|
'text': value['text'],
|
|
103
|
-
'variables': value['variables'],
|
|
104
111
|
};
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -13,33 +13,99 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
-
import type {
|
|
16
|
+
import type { BatchRecipient } from './BatchRecipient';
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from './
|
|
18
|
+
BatchRecipientFromJSON,
|
|
19
|
+
BatchRecipientFromJSONTyped,
|
|
20
|
+
BatchRecipientToJSON,
|
|
21
|
+
BatchRecipientToJSONTyped,
|
|
22
|
+
} from './BatchRecipient';
|
|
23
|
+
import type { EmailAddress } from './EmailAddress';
|
|
24
|
+
import {
|
|
25
|
+
EmailAddressFromJSON,
|
|
26
|
+
EmailAddressFromJSONTyped,
|
|
27
|
+
EmailAddressToJSON,
|
|
28
|
+
EmailAddressToJSONTyped,
|
|
29
|
+
} from './EmailAddress';
|
|
23
30
|
|
|
24
31
|
/**
|
|
32
|
+
* Send a single email to up to 100 recipients in one request. Each recipient gets their own message record. Provide either raw content (`subject` plus `html` and/or `text`) or a `template_id` with `template_data`.
|
|
25
33
|
*
|
|
26
34
|
* @export
|
|
27
35
|
* @interface SendBatchEmailRequest
|
|
28
36
|
*/
|
|
29
37
|
export interface SendBatchEmailRequest {
|
|
38
|
+
/**
|
|
39
|
+
* Sender address. The API also accepts a plain email string for convenience.
|
|
40
|
+
*
|
|
41
|
+
* @type {EmailAddress}
|
|
42
|
+
* @memberof SendBatchEmailRequest
|
|
43
|
+
*/
|
|
44
|
+
from: EmailAddress;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @type {Array<BatchRecipient>}
|
|
48
|
+
* @memberof SendBatchEmailRequest
|
|
49
|
+
*/
|
|
50
|
+
to: Array<BatchRecipient>;
|
|
51
|
+
/**
|
|
52
|
+
* Reply-to address. The API also accepts a plain email string for convenience.
|
|
53
|
+
*
|
|
54
|
+
* @type {EmailAddress}
|
|
55
|
+
* @memberof SendBatchEmailRequest
|
|
56
|
+
*/
|
|
57
|
+
replyTo?: EmailAddress;
|
|
58
|
+
/**
|
|
59
|
+
* Required when sending raw content (no `template_id`).
|
|
60
|
+
* @type {string}
|
|
61
|
+
* @memberof SendBatchEmailRequest
|
|
62
|
+
*/
|
|
63
|
+
subject?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Provide either `html` or `text` (or both) when sending raw content.
|
|
66
|
+
* @type {string}
|
|
67
|
+
* @memberof SendBatchEmailRequest
|
|
68
|
+
*/
|
|
69
|
+
html?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Provide either `html` or `text` (or both) when sending raw content.
|
|
72
|
+
* @type {string}
|
|
73
|
+
* @memberof SendBatchEmailRequest
|
|
74
|
+
*/
|
|
75
|
+
text?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Template ID to use instead of raw `subject`/`html`/`text`.
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @memberof SendBatchEmailRequest
|
|
80
|
+
*/
|
|
81
|
+
templateId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Default variables to pass to the template. Merged with each recipient's per-recipient `variables` (per-recipient values win on key collisions).
|
|
84
|
+
*
|
|
85
|
+
* @type {{ [key: string]: any; }}
|
|
86
|
+
* @memberof SendBatchEmailRequest
|
|
87
|
+
*/
|
|
88
|
+
templateData?: { [key: string]: any; };
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @type {Array<string>}
|
|
92
|
+
* @memberof SendBatchEmailRequest
|
|
93
|
+
*/
|
|
94
|
+
tags?: Array<string>;
|
|
30
95
|
/**
|
|
31
96
|
*
|
|
32
|
-
* @type {
|
|
97
|
+
* @type {{ [key: string]: any; }}
|
|
33
98
|
* @memberof SendBatchEmailRequest
|
|
34
99
|
*/
|
|
35
|
-
|
|
100
|
+
metadata?: { [key: string]: any; };
|
|
36
101
|
}
|
|
37
102
|
|
|
38
103
|
/**
|
|
39
104
|
* Check if a given object implements the SendBatchEmailRequest interface.
|
|
40
105
|
*/
|
|
41
106
|
export function instanceOfSendBatchEmailRequest(value: object): value is SendBatchEmailRequest {
|
|
42
|
-
if (!('
|
|
107
|
+
if (!('from' in value) || value['from'] === undefined) return false;
|
|
108
|
+
if (!('to' in value) || value['to'] === undefined) return false;
|
|
43
109
|
return true;
|
|
44
110
|
}
|
|
45
111
|
|
|
@@ -53,7 +119,16 @@ export function SendBatchEmailRequestFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
53
119
|
}
|
|
54
120
|
return {
|
|
55
121
|
|
|
56
|
-
'
|
|
122
|
+
'from': EmailAddressFromJSON(json['from']),
|
|
123
|
+
'to': ((json['to'] as Array<any>).map(BatchRecipientFromJSON)),
|
|
124
|
+
'replyTo': json['reply_to'] == null ? undefined : EmailAddressFromJSON(json['reply_to']),
|
|
125
|
+
'subject': json['subject'] == null ? undefined : json['subject'],
|
|
126
|
+
'html': json['html'] == null ? undefined : json['html'],
|
|
127
|
+
'text': json['text'] == null ? undefined : json['text'],
|
|
128
|
+
'templateId': json['template_id'] == null ? undefined : json['template_id'],
|
|
129
|
+
'templateData': json['template_data'] == null ? undefined : json['template_data'],
|
|
130
|
+
'tags': json['tags'] == null ? undefined : json['tags'],
|
|
131
|
+
'metadata': json['metadata'] == null ? undefined : json['metadata'],
|
|
57
132
|
};
|
|
58
133
|
}
|
|
59
134
|
|
|
@@ -68,7 +143,16 @@ export function SendBatchEmailRequestToJSONTyped(value?: SendBatchEmailRequest |
|
|
|
68
143
|
|
|
69
144
|
return {
|
|
70
145
|
|
|
71
|
-
'
|
|
146
|
+
'from': EmailAddressToJSON(value['from']),
|
|
147
|
+
'to': ((value['to'] as Array<any>).map(BatchRecipientToJSON)),
|
|
148
|
+
'reply_to': EmailAddressToJSON(value['replyTo']),
|
|
149
|
+
'subject': value['subject'],
|
|
150
|
+
'html': value['html'],
|
|
151
|
+
'text': value['text'],
|
|
152
|
+
'template_id': value['templateId'],
|
|
153
|
+
'template_data': value['templateData'],
|
|
154
|
+
'tags': value['tags'],
|
|
155
|
+
'metadata': value['metadata'],
|
|
72
156
|
};
|
|
73
157
|
}
|
|
74
158
|
|
|
@@ -56,11 +56,13 @@ export interface Template {
|
|
|
56
56
|
*/
|
|
57
57
|
text?: string | null;
|
|
58
58
|
/**
|
|
59
|
+
* Variable names auto-detected from `{{var}}` placeholders in subject,
|
|
60
|
+
* html, and text. Server-derived; ignored if supplied on create/update.
|
|
59
61
|
*
|
|
60
|
-
* @type {
|
|
62
|
+
* @type {Array<string>}
|
|
61
63
|
* @memberof Template
|
|
62
64
|
*/
|
|
63
|
-
variables?:
|
|
65
|
+
readonly variables?: Array<string> | null;
|
|
64
66
|
/**
|
|
65
67
|
*
|
|
66
68
|
* @type {number}
|
|
@@ -115,7 +117,7 @@ export function TemplateToJSON(json: any): Template {
|
|
|
115
117
|
return TemplateToJSONTyped(json, false);
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
export function TemplateToJSONTyped(value?: Template | null, ignoreDiscriminator: boolean = false): any {
|
|
120
|
+
export function TemplateToJSONTyped(value?: Omit<Template, 'variables'> | null, ignoreDiscriminator: boolean = false): any {
|
|
119
121
|
if (value == null) {
|
|
120
122
|
return value;
|
|
121
123
|
}
|
|
@@ -128,7 +130,6 @@ export function TemplateToJSONTyped(value?: Template | null, ignoreDiscriminator
|
|
|
128
130
|
'subject': value['subject'],
|
|
129
131
|
'html': value['html'],
|
|
130
132
|
'text': value['text'],
|
|
131
|
-
'variables': value['variables'],
|
|
132
133
|
'version': value['version'],
|
|
133
134
|
'created_at': value['createdAt'] == null ? undefined : ((value['createdAt']).toISOString()),
|
|
134
135
|
'updated_at': value['updatedAt'] == null ? undefined : ((value['updatedAt']).toISOString()),
|
|
@@ -46,6 +46,17 @@ export interface TemplateResponse {
|
|
|
46
46
|
* @memberof TemplateResponse
|
|
47
47
|
*/
|
|
48
48
|
meta?: RequestMeta;
|
|
49
|
+
/**
|
|
50
|
+
* Non-fatal advisories about the request. Currently emitted only when
|
|
51
|
+
* the server rewrites template content for security (see the `html`
|
|
52
|
+
* field on `CreateTemplateRequest` for the triple-brace policy).
|
|
53
|
+
* Omitted entirely when no warnings apply — clients should treat its
|
|
54
|
+
* absence as equivalent to an empty array.
|
|
55
|
+
*
|
|
56
|
+
* @type {Array<string>}
|
|
57
|
+
* @memberof TemplateResponse
|
|
58
|
+
*/
|
|
59
|
+
warnings?: Array<string>;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
/**
|
|
@@ -67,6 +78,7 @@ export function TemplateResponseFromJSONTyped(json: any, ignoreDiscriminator: bo
|
|
|
67
78
|
|
|
68
79
|
'data': json['data'] == null ? undefined : TemplateFromJSON(json['data']),
|
|
69
80
|
'meta': json['meta'] == null ? undefined : RequestMetaFromJSON(json['meta']),
|
|
81
|
+
'warnings': json['warnings'] == null ? undefined : json['warnings'],
|
|
70
82
|
};
|
|
71
83
|
}
|
|
72
84
|
|
|
@@ -83,6 +95,7 @@ export function TemplateResponseToJSONTyped(value?: TemplateResponse | null, ign
|
|
|
83
95
|
|
|
84
96
|
'data': TemplateToJSON(value['data']),
|
|
85
97
|
'meta': RequestMetaToJSON(value['meta']),
|
|
98
|
+
'warnings': value['warnings'],
|
|
86
99
|
};
|
|
87
100
|
}
|
|
88
101
|
|
|
@@ -32,29 +32,32 @@ export interface UpdateTemplateRequest {
|
|
|
32
32
|
*/
|
|
33
33
|
description?: string;
|
|
34
34
|
/**
|
|
35
|
+
* Email subject line. Supports Handlebars `{{var}}` interpolation
|
|
36
|
+
* (HTML-escaped on render).
|
|
35
37
|
*
|
|
36
38
|
* @type {string}
|
|
37
39
|
* @memberof UpdateTemplateRequest
|
|
38
40
|
*/
|
|
39
41
|
subject?: string;
|
|
40
42
|
/**
|
|
43
|
+
* HTML body. Supports Handlebars `{{var}}` interpolation; values are
|
|
44
|
+
* always HTML-escaped on render. Triple-brace `{{{var}}}` is not
|
|
45
|
+
* supported — input is rewritten to `{{var}}` on save and the
|
|
46
|
+
* response includes a top-level `warnings` array describing the
|
|
47
|
+
* rewrite. See `CreateTemplateRequest.html` for full rationale.
|
|
41
48
|
*
|
|
42
49
|
* @type {string}
|
|
43
50
|
* @memberof UpdateTemplateRequest
|
|
44
51
|
*/
|
|
45
52
|
html?: string;
|
|
46
53
|
/**
|
|
54
|
+
* Plain text body. Supports Handlebars `{{var}}` interpolation; same
|
|
55
|
+
* triple-brace rewrite policy as `html`.
|
|
47
56
|
*
|
|
48
57
|
* @type {string}
|
|
49
58
|
* @memberof UpdateTemplateRequest
|
|
50
59
|
*/
|
|
51
60
|
text?: string;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @type {{ [key: string]: any; }}
|
|
55
|
-
* @memberof UpdateTemplateRequest
|
|
56
|
-
*/
|
|
57
|
-
variables?: { [key: string]: any; };
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
/**
|
|
@@ -79,7 +82,6 @@ export function UpdateTemplateRequestFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
79
82
|
'subject': json['subject'] == null ? undefined : json['subject'],
|
|
80
83
|
'html': json['html'] == null ? undefined : json['html'],
|
|
81
84
|
'text': json['text'] == null ? undefined : json['text'],
|
|
82
|
-
'variables': json['variables'] == null ? undefined : json['variables'],
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -99,7 +101,6 @@ export function UpdateTemplateRequestToJSONTyped(value?: UpdateTemplateRequest |
|
|
|
99
101
|
'subject': value['subject'],
|
|
100
102
|
'html': value['html'],
|
|
101
103
|
'text': value['text'],
|
|
102
|
-
'variables': value['variables'],
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
|
package/src/src/models/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from './AuthUser';
|
|
|
32
32
|
export * from './AuthUserResponse';
|
|
33
33
|
export * from './AuthUserResponseData';
|
|
34
34
|
export * from './BatchPublishWaaSEvents201Response';
|
|
35
|
+
export * from './BatchRecipient';
|
|
35
36
|
export * from './BulkRetryWebhookDeliveriesRequest';
|
|
36
37
|
export * from './BulkUpsertAuthEmailTemplatesRequest';
|
|
37
38
|
export * from './BulkUpsertAuthEmailTemplatesResponse';
|