@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/README.md
CHANGED
|
@@ -234,9 +234,9 @@ const subs = await zyphr.subscribers.listSubscribers('subscribed', undefined, 50
|
|
|
234
234
|
// Preferences
|
|
235
235
|
const prefs = await zyphr.subscribers.getSubscriberPreferences('sub_id');
|
|
236
236
|
await zyphr.subscribers.setSubscriberPreferences('sub_id', {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
preferences: [
|
|
238
|
+
{ categoryId: 'marketing', channel: 'email', enabled: false },
|
|
239
|
+
],
|
|
240
240
|
});
|
|
241
241
|
|
|
242
242
|
// Unsubscribe/resubscribe
|
|
@@ -342,7 +342,9 @@ await zyphr.topics.createTopic({
|
|
|
342
342
|
await zyphr.topics.addTopicSubscribers('product-updates', {
|
|
343
343
|
subscriberIds: ['sub_123', 'sub_456'],
|
|
344
344
|
});
|
|
345
|
-
await zyphr.topics.removeTopicSubscribers('product-updates',
|
|
345
|
+
await zyphr.topics.removeTopicSubscribers('product-updates', {
|
|
346
|
+
subscriberIds: ['sub_789'],
|
|
347
|
+
});
|
|
346
348
|
|
|
347
349
|
// CRUD
|
|
348
350
|
const topic = await zyphr.topics.getTopic('product-updates');
|
|
@@ -360,8 +362,8 @@ Register and manage push notification devices.
|
|
|
360
362
|
const device = await zyphr.devices.registerDevice({
|
|
361
363
|
userId: 'user_123',
|
|
362
364
|
platform: 'ios',
|
|
363
|
-
|
|
364
|
-
deviceName: 'iPhone 16 Pro',
|
|
365
|
+
token: 'apns_token_xxx',
|
|
366
|
+
metadata: { deviceName: 'iPhone 16 Pro' },
|
|
365
367
|
});
|
|
366
368
|
|
|
367
369
|
// List devices
|
|
@@ -394,48 +396,52 @@ const zyphr = new Zyphr({
|
|
|
394
396
|
```ts
|
|
395
397
|
// Register an end user
|
|
396
398
|
const result = await zyphr.auth.registration.registerEndUser({
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
name: 'New User',
|
|
401
|
-
},
|
|
399
|
+
email: 'new@example.com',
|
|
400
|
+
password: 'SecureP@ss123',
|
|
401
|
+
name: 'New User',
|
|
402
402
|
});
|
|
403
|
-
// result.data
|
|
404
|
-
// result.data
|
|
403
|
+
// result.data?.user — the new user
|
|
404
|
+
// result.data?.tokens — { accessToken, refreshToken, expiresIn }
|
|
405
405
|
|
|
406
406
|
// Login
|
|
407
407
|
const session = await zyphr.auth.login.loginEndUser({
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
password: 'SecureP@ss123',
|
|
411
|
-
},
|
|
408
|
+
email: 'user@example.com',
|
|
409
|
+
password: 'SecureP@ss123',
|
|
412
410
|
});
|
|
413
411
|
|
|
414
412
|
// User profile (requires end-user access token)
|
|
415
413
|
// Use zyphr.asEndUser(token) to authenticate as the end user
|
|
416
414
|
const login = await zyphr.auth.login.loginEndUser({
|
|
417
|
-
|
|
415
|
+
email: 'user@example.com',
|
|
416
|
+
password: 'SecureP@ss123',
|
|
418
417
|
});
|
|
419
|
-
const token = login.data
|
|
418
|
+
const token = login.data?.tokens?.accessToken;
|
|
419
|
+
if (!token) throw new Error('No access token returned');
|
|
420
420
|
|
|
421
421
|
const profile = await zyphr.auth.profile.getEndUser(zyphr.asEndUser(token));
|
|
422
422
|
await zyphr.auth.profile.updateEndUser(
|
|
423
|
-
{
|
|
423
|
+
{ name: 'Updated Name' },
|
|
424
424
|
zyphr.asEndUser(token),
|
|
425
425
|
);
|
|
426
426
|
|
|
427
|
-
// Email verification
|
|
428
|
-
await zyphr.auth.emailVerification.
|
|
427
|
+
// Email verification (acts on the authenticated end user)
|
|
428
|
+
await zyphr.auth.emailVerification.sendEmailVerification(
|
|
429
|
+
{ redirectUrl: 'https://myapp.com/verified' },
|
|
430
|
+
zyphr.asEndUser(token),
|
|
431
|
+
);
|
|
429
432
|
|
|
430
433
|
// Password reset
|
|
431
|
-
await zyphr.auth.passwordReset.
|
|
434
|
+
await zyphr.auth.passwordReset.forgotPassword({ email: 'user@example.com' });
|
|
432
435
|
|
|
433
436
|
// Magic links
|
|
434
|
-
await zyphr.auth.magicLinks.sendMagicLink(
|
|
437
|
+
await zyphr.auth.magicLinks.sendMagicLink({
|
|
438
|
+
email: 'user@example.com',
|
|
439
|
+
redirectUrl: 'https://myapp.com/auth/callback',
|
|
440
|
+
});
|
|
435
441
|
|
|
436
442
|
// MFA
|
|
437
|
-
const mfaStatus = await zyphr.auth.mfa.getMfaStatus();
|
|
438
|
-
await zyphr.auth.mfa.
|
|
443
|
+
const mfaStatus = await zyphr.auth.mfa.getMfaStatus('user_123');
|
|
444
|
+
await zyphr.auth.mfa.startMfaEnrollment({ userId: 'user_123' });
|
|
439
445
|
```
|
|
440
446
|
|
|
441
447
|
**Available auth modules:** `login`, `registration`, `sessions`, `emailVerification`, `passwordReset`, `magicLinks`, `mfa`, `oauth`, `phone`, `webauthn`, `profile`.
|
|
@@ -448,28 +454,34 @@ Webhooks-as-a-Service: multi-tenant webhook delivery infrastructure for your cus
|
|
|
448
454
|
|
|
449
455
|
```ts
|
|
450
456
|
// Create a WaaS application
|
|
451
|
-
const
|
|
457
|
+
const created = await zyphr.waas.applications.createWaaSApplication({
|
|
452
458
|
name: 'My SaaS',
|
|
459
|
+
slug: 'my-saas',
|
|
453
460
|
description: 'Webhook delivery for My SaaS customers',
|
|
454
461
|
});
|
|
462
|
+
const appId = created.data?.id;
|
|
463
|
+
if (!appId) throw new Error('App id missing from response');
|
|
455
464
|
|
|
456
465
|
// Define event types
|
|
457
|
-
await zyphr.waas.eventTypes.
|
|
466
|
+
await zyphr.waas.eventTypes.createWaaSEventType(appId, {
|
|
458
467
|
eventType: 'order.created',
|
|
459
468
|
name: 'Order Created',
|
|
460
469
|
description: 'Fired when a new order is placed',
|
|
461
|
-
examplePayload: {
|
|
470
|
+
examplePayload: { orderId: '123', total: 99.99 },
|
|
462
471
|
});
|
|
463
472
|
|
|
464
|
-
//
|
|
465
|
-
await zyphr.waas.events.
|
|
473
|
+
// Publish events — fans out to all matching tenant endpoints
|
|
474
|
+
await zyphr.waas.events.publishWaaSEvent(appId, {
|
|
466
475
|
eventType: 'order.created',
|
|
467
|
-
|
|
476
|
+
tenantId: 'cust_abc123',
|
|
477
|
+
data: { orderId: '456', total: 149.99 },
|
|
468
478
|
});
|
|
469
479
|
|
|
470
|
-
// Generate portal token for embedded UI
|
|
471
|
-
const portalToken = await zyphr.waas.portal.
|
|
472
|
-
|
|
480
|
+
// Generate a tenant-scoped portal token for embedded UI
|
|
481
|
+
const portalToken = await zyphr.waas.portal.generateWaaSPortalToken(appId, {
|
|
482
|
+
tenantId: 'cust_abc123',
|
|
483
|
+
});
|
|
484
|
+
// Pass portalToken.data?.token to @zyphr-dev/webhook-portal
|
|
473
485
|
```
|
|
474
486
|
|
|
475
487
|
**Available WaaS modules:** `applications`, `eventTypes`, `endpoints`, `events`, `deliveries`, `portal`.
|
package/dist/index.cjs
CHANGED
|
@@ -166,6 +166,10 @@ __export(index_exports, {
|
|
|
166
166
|
BatchPublishWaaSEvents201ResponseFromJSONTyped: () => BatchPublishWaaSEvents201ResponseFromJSONTyped,
|
|
167
167
|
BatchPublishWaaSEvents201ResponseToJSON: () => BatchPublishWaaSEvents201ResponseToJSON,
|
|
168
168
|
BatchPublishWaaSEvents201ResponseToJSONTyped: () => BatchPublishWaaSEvents201ResponseToJSONTyped,
|
|
169
|
+
BatchRecipientFromJSON: () => BatchRecipientFromJSON,
|
|
170
|
+
BatchRecipientFromJSONTyped: () => BatchRecipientFromJSONTyped,
|
|
171
|
+
BatchRecipientToJSON: () => BatchRecipientToJSON,
|
|
172
|
+
BatchRecipientToJSONTyped: () => BatchRecipientToJSONTyped,
|
|
169
173
|
BlobApiResponse: () => BlobApiResponse,
|
|
170
174
|
BulkRetryWebhookDeliveriesRequestFromJSON: () => BulkRetryWebhookDeliveriesRequestFromJSON,
|
|
171
175
|
BulkRetryWebhookDeliveriesRequestFromJSONTyped: () => BulkRetryWebhookDeliveriesRequestFromJSONTyped,
|
|
@@ -1573,6 +1577,7 @@ __export(index_exports, {
|
|
|
1573
1577
|
WebhookUsageResponseFromJSONTyped: () => WebhookUsageResponseFromJSONTyped,
|
|
1574
1578
|
WebhookUsageResponseToJSON: () => WebhookUsageResponseToJSON,
|
|
1575
1579
|
WebhookUsageResponseToJSONTyped: () => WebhookUsageResponseToJSONTyped,
|
|
1580
|
+
WebhookVerificationError: () => WebhookVerificationError,
|
|
1576
1581
|
WebhookVersionFromJSON: () => WebhookVersionFromJSON,
|
|
1577
1582
|
WebhookVersionFromJSONTyped: () => WebhookVersionFromJSONTyped,
|
|
1578
1583
|
WebhookVersionToJSON: () => WebhookVersionToJSON,
|
|
@@ -1615,6 +1620,7 @@ __export(index_exports, {
|
|
|
1615
1620
|
ZyphrNotFoundError: () => ZyphrNotFoundError,
|
|
1616
1621
|
ZyphrRateLimitError: () => ZyphrRateLimitError,
|
|
1617
1622
|
ZyphrValidationError: () => ZyphrValidationError,
|
|
1623
|
+
ZyphrWebhookVerificationError: () => ZyphrWebhookVerificationError,
|
|
1618
1624
|
canConsumeForm: () => canConsumeForm,
|
|
1619
1625
|
exists: () => exists,
|
|
1620
1626
|
instanceOfAddTopicSubscribersRequest: () => instanceOfAddTopicSubscribersRequest,
|
|
@@ -1649,6 +1655,7 @@ __export(index_exports, {
|
|
|
1649
1655
|
instanceOfAuthUserResponse: () => instanceOfAuthUserResponse,
|
|
1650
1656
|
instanceOfAuthUserResponseData: () => instanceOfAuthUserResponseData,
|
|
1651
1657
|
instanceOfBatchPublishWaaSEvents201Response: () => instanceOfBatchPublishWaaSEvents201Response,
|
|
1658
|
+
instanceOfBatchRecipient: () => instanceOfBatchRecipient,
|
|
1652
1659
|
instanceOfBulkRetryWebhookDeliveriesRequest: () => instanceOfBulkRetryWebhookDeliveriesRequest,
|
|
1653
1660
|
instanceOfBulkUpsertAuthEmailTemplatesRequest: () => instanceOfBulkUpsertAuthEmailTemplatesRequest,
|
|
1654
1661
|
instanceOfBulkUpsertAuthEmailTemplatesResponse: () => instanceOfBulkUpsertAuthEmailTemplatesResponse,
|
|
@@ -3383,6 +3390,38 @@ function BatchPublishWaaSEvents201ResponseToJSONTyped(value, ignoreDiscriminator
|
|
|
3383
3390
|
};
|
|
3384
3391
|
}
|
|
3385
3392
|
|
|
3393
|
+
// src/src/models/BatchRecipient.ts
|
|
3394
|
+
function instanceOfBatchRecipient(value) {
|
|
3395
|
+
if (!("email" in value) || value["email"] === void 0) return false;
|
|
3396
|
+
return true;
|
|
3397
|
+
}
|
|
3398
|
+
function BatchRecipientFromJSON(json) {
|
|
3399
|
+
return BatchRecipientFromJSONTyped(json, false);
|
|
3400
|
+
}
|
|
3401
|
+
function BatchRecipientFromJSONTyped(json, ignoreDiscriminator) {
|
|
3402
|
+
if (json == null) {
|
|
3403
|
+
return json;
|
|
3404
|
+
}
|
|
3405
|
+
return {
|
|
3406
|
+
"email": json["email"],
|
|
3407
|
+
"name": json["name"] == null ? void 0 : json["name"],
|
|
3408
|
+
"variables": json["variables"] == null ? void 0 : json["variables"]
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
function BatchRecipientToJSON(json) {
|
|
3412
|
+
return BatchRecipientToJSONTyped(json, false);
|
|
3413
|
+
}
|
|
3414
|
+
function BatchRecipientToJSONTyped(value, ignoreDiscriminator = false) {
|
|
3415
|
+
if (value == null) {
|
|
3416
|
+
return value;
|
|
3417
|
+
}
|
|
3418
|
+
return {
|
|
3419
|
+
"email": value["email"],
|
|
3420
|
+
"name": value["name"],
|
|
3421
|
+
"variables": value["variables"]
|
|
3422
|
+
};
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3386
3425
|
// src/src/models/BulkRetryWebhookDeliveriesRequest.ts
|
|
3387
3426
|
var BulkRetryWebhookDeliveriesRequestStatusEnum = {
|
|
3388
3427
|
FAILED: "failed",
|
|
@@ -4122,8 +4161,7 @@ function CreateTemplateRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
4122
4161
|
"description": json["description"] == null ? void 0 : json["description"],
|
|
4123
4162
|
"subject": json["subject"] == null ? void 0 : json["subject"],
|
|
4124
4163
|
"html": json["html"] == null ? void 0 : json["html"],
|
|
4125
|
-
"text": json["text"] == null ? void 0 : json["text"]
|
|
4126
|
-
"variables": json["variables"] == null ? void 0 : json["variables"]
|
|
4164
|
+
"text": json["text"] == null ? void 0 : json["text"]
|
|
4127
4165
|
};
|
|
4128
4166
|
}
|
|
4129
4167
|
function CreateTemplateRequestToJSON(json) {
|
|
@@ -4138,8 +4176,7 @@ function CreateTemplateRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
4138
4176
|
"description": value["description"],
|
|
4139
4177
|
"subject": value["subject"],
|
|
4140
4178
|
"html": value["html"],
|
|
4141
|
-
"text": value["text"]
|
|
4142
|
-
"variables": value["variables"]
|
|
4179
|
+
"text": value["text"]
|
|
4143
4180
|
};
|
|
4144
4181
|
}
|
|
4145
4182
|
|
|
@@ -9192,92 +9229,50 @@ function RevokeSessionRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
9192
9229
|
};
|
|
9193
9230
|
}
|
|
9194
9231
|
|
|
9195
|
-
// src/src/models/
|
|
9196
|
-
function
|
|
9232
|
+
// src/src/models/SendBatchEmailRequest.ts
|
|
9233
|
+
function instanceOfSendBatchEmailRequest(value) {
|
|
9234
|
+
if (!("from" in value) || value["from"] === void 0) return false;
|
|
9197
9235
|
if (!("to" in value) || value["to"] === void 0) return false;
|
|
9198
|
-
if (!("subject" in value) || value["subject"] === void 0) return false;
|
|
9199
9236
|
return true;
|
|
9200
9237
|
}
|
|
9201
|
-
function
|
|
9202
|
-
return
|
|
9238
|
+
function SendBatchEmailRequestFromJSON(json) {
|
|
9239
|
+
return SendBatchEmailRequestFromJSONTyped(json, false);
|
|
9203
9240
|
}
|
|
9204
|
-
function
|
|
9241
|
+
function SendBatchEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
9205
9242
|
if (json == null) {
|
|
9206
9243
|
return json;
|
|
9207
9244
|
}
|
|
9208
9245
|
return {
|
|
9209
|
-
"
|
|
9210
|
-
"
|
|
9246
|
+
"from": EmailAddressFromJSON(json["from"]),
|
|
9247
|
+
"to": json["to"].map(BatchRecipientFromJSON),
|
|
9211
9248
|
"replyTo": json["reply_to"] == null ? void 0 : EmailAddressFromJSON(json["reply_to"]),
|
|
9212
|
-
"
|
|
9213
|
-
"bcc": json["bcc"] == null ? void 0 : json["bcc"],
|
|
9214
|
-
"subject": json["subject"],
|
|
9249
|
+
"subject": json["subject"] == null ? void 0 : json["subject"],
|
|
9215
9250
|
"html": json["html"] == null ? void 0 : json["html"],
|
|
9216
9251
|
"text": json["text"] == null ? void 0 : json["text"],
|
|
9217
9252
|
"templateId": json["template_id"] == null ? void 0 : json["template_id"],
|
|
9218
9253
|
"templateData": json["template_data"] == null ? void 0 : json["template_data"],
|
|
9219
|
-
"attachments": json["attachments"] == null ? void 0 : json["attachments"].map(EmailAttachmentFromJSON),
|
|
9220
|
-
"headers": json["headers"] == null ? void 0 : json["headers"],
|
|
9221
9254
|
"tags": json["tags"] == null ? void 0 : json["tags"],
|
|
9222
|
-
"metadata": json["metadata"] == null ? void 0 : json["metadata"]
|
|
9223
|
-
"scheduledAt": json["scheduled_at"] == null ? void 0 : new Date(json["scheduled_at"]),
|
|
9224
|
-
"subscriberId": json["subscriber_id"] == null ? void 0 : json["subscriber_id"],
|
|
9225
|
-
"category": json["category"] == null ? void 0 : json["category"]
|
|
9255
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"]
|
|
9226
9256
|
};
|
|
9227
9257
|
}
|
|
9228
|
-
function
|
|
9229
|
-
return
|
|
9258
|
+
function SendBatchEmailRequestToJSON(json) {
|
|
9259
|
+
return SendBatchEmailRequestToJSONTyped(json, false);
|
|
9230
9260
|
}
|
|
9231
|
-
function
|
|
9261
|
+
function SendBatchEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
9232
9262
|
if (value == null) {
|
|
9233
9263
|
return value;
|
|
9234
9264
|
}
|
|
9235
9265
|
return {
|
|
9236
|
-
"to": value["to"].map(EmailAddressToJSON),
|
|
9237
9266
|
"from": EmailAddressToJSON(value["from"]),
|
|
9267
|
+
"to": value["to"].map(BatchRecipientToJSON),
|
|
9238
9268
|
"reply_to": EmailAddressToJSON(value["replyTo"]),
|
|
9239
|
-
"cc": value["cc"],
|
|
9240
|
-
"bcc": value["bcc"],
|
|
9241
9269
|
"subject": value["subject"],
|
|
9242
9270
|
"html": value["html"],
|
|
9243
9271
|
"text": value["text"],
|
|
9244
9272
|
"template_id": value["templateId"],
|
|
9245
9273
|
"template_data": value["templateData"],
|
|
9246
|
-
"attachments": value["attachments"] == null ? void 0 : value["attachments"].map(EmailAttachmentToJSON),
|
|
9247
|
-
"headers": value["headers"],
|
|
9248
9274
|
"tags": value["tags"],
|
|
9249
|
-
"metadata": value["metadata"]
|
|
9250
|
-
"scheduled_at": value["scheduledAt"] == null ? void 0 : value["scheduledAt"].toISOString(),
|
|
9251
|
-
"subscriber_id": value["subscriberId"],
|
|
9252
|
-
"category": value["category"]
|
|
9253
|
-
};
|
|
9254
|
-
}
|
|
9255
|
-
|
|
9256
|
-
// src/src/models/SendBatchEmailRequest.ts
|
|
9257
|
-
function instanceOfSendBatchEmailRequest(value) {
|
|
9258
|
-
if (!("messages" in value) || value["messages"] === void 0) return false;
|
|
9259
|
-
return true;
|
|
9260
|
-
}
|
|
9261
|
-
function SendBatchEmailRequestFromJSON(json) {
|
|
9262
|
-
return SendBatchEmailRequestFromJSONTyped(json, false);
|
|
9263
|
-
}
|
|
9264
|
-
function SendBatchEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
9265
|
-
if (json == null) {
|
|
9266
|
-
return json;
|
|
9267
|
-
}
|
|
9268
|
-
return {
|
|
9269
|
-
"messages": json["messages"].map(SendEmailRequestFromJSON)
|
|
9270
|
-
};
|
|
9271
|
-
}
|
|
9272
|
-
function SendBatchEmailRequestToJSON(json) {
|
|
9273
|
-
return SendBatchEmailRequestToJSONTyped(json, false);
|
|
9274
|
-
}
|
|
9275
|
-
function SendBatchEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
9276
|
-
if (value == null) {
|
|
9277
|
-
return value;
|
|
9278
|
-
}
|
|
9279
|
-
return {
|
|
9280
|
-
"messages": value["messages"].map(SendEmailRequestToJSON)
|
|
9275
|
+
"metadata": value["metadata"]
|
|
9281
9276
|
};
|
|
9282
9277
|
}
|
|
9283
9278
|
|
|
@@ -9684,6 +9679,67 @@ function SendBatchSmsResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
9684
9679
|
};
|
|
9685
9680
|
}
|
|
9686
9681
|
|
|
9682
|
+
// src/src/models/SendEmailRequest.ts
|
|
9683
|
+
function instanceOfSendEmailRequest(value) {
|
|
9684
|
+
if (!("to" in value) || value["to"] === void 0) return false;
|
|
9685
|
+
if (!("subject" in value) || value["subject"] === void 0) return false;
|
|
9686
|
+
return true;
|
|
9687
|
+
}
|
|
9688
|
+
function SendEmailRequestFromJSON(json) {
|
|
9689
|
+
return SendEmailRequestFromJSONTyped(json, false);
|
|
9690
|
+
}
|
|
9691
|
+
function SendEmailRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
9692
|
+
if (json == null) {
|
|
9693
|
+
return json;
|
|
9694
|
+
}
|
|
9695
|
+
return {
|
|
9696
|
+
"to": json["to"].map(EmailAddressFromJSON),
|
|
9697
|
+
"from": json["from"] == null ? void 0 : EmailAddressFromJSON(json["from"]),
|
|
9698
|
+
"replyTo": json["reply_to"] == null ? void 0 : EmailAddressFromJSON(json["reply_to"]),
|
|
9699
|
+
"cc": json["cc"] == null ? void 0 : json["cc"],
|
|
9700
|
+
"bcc": json["bcc"] == null ? void 0 : json["bcc"],
|
|
9701
|
+
"subject": json["subject"],
|
|
9702
|
+
"html": json["html"] == null ? void 0 : json["html"],
|
|
9703
|
+
"text": json["text"] == null ? void 0 : json["text"],
|
|
9704
|
+
"templateId": json["template_id"] == null ? void 0 : json["template_id"],
|
|
9705
|
+
"templateData": json["template_data"] == null ? void 0 : json["template_data"],
|
|
9706
|
+
"attachments": json["attachments"] == null ? void 0 : json["attachments"].map(EmailAttachmentFromJSON),
|
|
9707
|
+
"headers": json["headers"] == null ? void 0 : json["headers"],
|
|
9708
|
+
"tags": json["tags"] == null ? void 0 : json["tags"],
|
|
9709
|
+
"metadata": json["metadata"] == null ? void 0 : json["metadata"],
|
|
9710
|
+
"scheduledAt": json["scheduled_at"] == null ? void 0 : new Date(json["scheduled_at"]),
|
|
9711
|
+
"subscriberId": json["subscriber_id"] == null ? void 0 : json["subscriber_id"],
|
|
9712
|
+
"category": json["category"] == null ? void 0 : json["category"]
|
|
9713
|
+
};
|
|
9714
|
+
}
|
|
9715
|
+
function SendEmailRequestToJSON(json) {
|
|
9716
|
+
return SendEmailRequestToJSONTyped(json, false);
|
|
9717
|
+
}
|
|
9718
|
+
function SendEmailRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
9719
|
+
if (value == null) {
|
|
9720
|
+
return value;
|
|
9721
|
+
}
|
|
9722
|
+
return {
|
|
9723
|
+
"to": value["to"].map(EmailAddressToJSON),
|
|
9724
|
+
"from": EmailAddressToJSON(value["from"]),
|
|
9725
|
+
"reply_to": EmailAddressToJSON(value["replyTo"]),
|
|
9726
|
+
"cc": value["cc"],
|
|
9727
|
+
"bcc": value["bcc"],
|
|
9728
|
+
"subject": value["subject"],
|
|
9729
|
+
"html": value["html"],
|
|
9730
|
+
"text": value["text"],
|
|
9731
|
+
"template_id": value["templateId"],
|
|
9732
|
+
"template_data": value["templateData"],
|
|
9733
|
+
"attachments": value["attachments"] == null ? void 0 : value["attachments"].map(EmailAttachmentToJSON),
|
|
9734
|
+
"headers": value["headers"],
|
|
9735
|
+
"tags": value["tags"],
|
|
9736
|
+
"metadata": value["metadata"],
|
|
9737
|
+
"scheduled_at": value["scheduledAt"] == null ? void 0 : value["scheduledAt"].toISOString(),
|
|
9738
|
+
"subscriber_id": value["subscriberId"],
|
|
9739
|
+
"category": value["category"]
|
|
9740
|
+
};
|
|
9741
|
+
}
|
|
9742
|
+
|
|
9687
9743
|
// src/src/models/SendEmailResponseMeta.ts
|
|
9688
9744
|
function instanceOfSendEmailResponseMeta(value) {
|
|
9689
9745
|
return true;
|
|
@@ -11337,7 +11393,6 @@ function TemplateToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
11337
11393
|
"subject": value["subject"],
|
|
11338
11394
|
"html": value["html"],
|
|
11339
11395
|
"text": value["text"],
|
|
11340
|
-
"variables": value["variables"],
|
|
11341
11396
|
"version": value["version"],
|
|
11342
11397
|
"created_at": value["createdAt"] == null ? void 0 : value["createdAt"].toISOString(),
|
|
11343
11398
|
"updated_at": value["updatedAt"] == null ? void 0 : value["updatedAt"].toISOString()
|
|
@@ -11446,7 +11501,8 @@ function TemplateResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11446
11501
|
}
|
|
11447
11502
|
return {
|
|
11448
11503
|
"data": json["data"] == null ? void 0 : TemplateFromJSON(json["data"]),
|
|
11449
|
-
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
|
|
11504
|
+
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"]),
|
|
11505
|
+
"warnings": json["warnings"] == null ? void 0 : json["warnings"]
|
|
11450
11506
|
};
|
|
11451
11507
|
}
|
|
11452
11508
|
function TemplateResponseToJSON(json) {
|
|
@@ -11458,7 +11514,8 @@ function TemplateResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
11458
11514
|
}
|
|
11459
11515
|
return {
|
|
11460
11516
|
"data": TemplateToJSON(value["data"]),
|
|
11461
|
-
"meta": RequestMetaToJSON(value["meta"])
|
|
11517
|
+
"meta": RequestMetaToJSON(value["meta"]),
|
|
11518
|
+
"warnings": value["warnings"]
|
|
11462
11519
|
};
|
|
11463
11520
|
}
|
|
11464
11521
|
|
|
@@ -12300,8 +12357,7 @@ function UpdateTemplateRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
12300
12357
|
"description": json["description"] == null ? void 0 : json["description"],
|
|
12301
12358
|
"subject": json["subject"] == null ? void 0 : json["subject"],
|
|
12302
12359
|
"html": json["html"] == null ? void 0 : json["html"],
|
|
12303
|
-
"text": json["text"] == null ? void 0 : json["text"]
|
|
12304
|
-
"variables": json["variables"] == null ? void 0 : json["variables"]
|
|
12360
|
+
"text": json["text"] == null ? void 0 : json["text"]
|
|
12305
12361
|
};
|
|
12306
12362
|
}
|
|
12307
12363
|
function UpdateTemplateRequestToJSON(json) {
|
|
@@ -12316,8 +12372,7 @@ function UpdateTemplateRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
12316
12372
|
"description": value["description"],
|
|
12317
12373
|
"subject": value["subject"],
|
|
12318
12374
|
"html": value["html"],
|
|
12319
|
-
"text": value["text"]
|
|
12320
|
-
"variables": value["variables"]
|
|
12375
|
+
"text": value["text"]
|
|
12321
12376
|
};
|
|
12322
12377
|
}
|
|
12323
12378
|
|
|
@@ -16977,7 +17032,7 @@ var EmailsApi = class extends BaseAPI {
|
|
|
16977
17032
|
return await response.value();
|
|
16978
17033
|
}
|
|
16979
17034
|
/**
|
|
16980
|
-
* Send up to 100
|
|
17035
|
+
* 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`.
|
|
16981
17036
|
* Send batch emails
|
|
16982
17037
|
*/
|
|
16983
17038
|
async sendBatchEmailRaw(requestParameters, initOverrides) {
|
|
@@ -17003,7 +17058,7 @@ var EmailsApi = class extends BaseAPI {
|
|
|
17003
17058
|
return new JSONApiResponse(response, (jsonValue) => SendBatchEmailResponseFromJSON(jsonValue));
|
|
17004
17059
|
}
|
|
17005
17060
|
/**
|
|
17006
|
-
* Send up to 100
|
|
17061
|
+
* 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`.
|
|
17007
17062
|
* Send batch emails
|
|
17008
17063
|
*/
|
|
17009
17064
|
async sendBatchEmail(sendBatchEmailRequest, initOverrides) {
|
|
@@ -21793,6 +21848,13 @@ var ZyphrNotFoundError = class extends ZyphrError {
|
|
|
21793
21848
|
this.name = "ZyphrNotFoundError";
|
|
21794
21849
|
}
|
|
21795
21850
|
};
|
|
21851
|
+
var ZyphrWebhookVerificationError = class extends ZyphrError {
|
|
21852
|
+
constructor(message) {
|
|
21853
|
+
super({ message, status: 401, code: "webhook_verification_failed" });
|
|
21854
|
+
this.name = "ZyphrWebhookVerificationError";
|
|
21855
|
+
}
|
|
21856
|
+
};
|
|
21857
|
+
var WebhookVerificationError = ZyphrWebhookVerificationError;
|
|
21796
21858
|
async function parseErrorResponse(response) {
|
|
21797
21859
|
let body = {};
|
|
21798
21860
|
try {
|
|
@@ -22069,6 +22131,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
22069
22131
|
BatchPublishWaaSEvents201ResponseFromJSONTyped,
|
|
22070
22132
|
BatchPublishWaaSEvents201ResponseToJSON,
|
|
22071
22133
|
BatchPublishWaaSEvents201ResponseToJSONTyped,
|
|
22134
|
+
BatchRecipientFromJSON,
|
|
22135
|
+
BatchRecipientFromJSONTyped,
|
|
22136
|
+
BatchRecipientToJSON,
|
|
22137
|
+
BatchRecipientToJSONTyped,
|
|
22072
22138
|
BlobApiResponse,
|
|
22073
22139
|
BulkRetryWebhookDeliveriesRequestFromJSON,
|
|
22074
22140
|
BulkRetryWebhookDeliveriesRequestFromJSONTyped,
|
|
@@ -23476,6 +23542,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
23476
23542
|
WebhookUsageResponseFromJSONTyped,
|
|
23477
23543
|
WebhookUsageResponseToJSON,
|
|
23478
23544
|
WebhookUsageResponseToJSONTyped,
|
|
23545
|
+
WebhookVerificationError,
|
|
23479
23546
|
WebhookVersionFromJSON,
|
|
23480
23547
|
WebhookVersionFromJSONTyped,
|
|
23481
23548
|
WebhookVersionToJSON,
|
|
@@ -23518,6 +23585,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
23518
23585
|
ZyphrNotFoundError,
|
|
23519
23586
|
ZyphrRateLimitError,
|
|
23520
23587
|
ZyphrValidationError,
|
|
23588
|
+
ZyphrWebhookVerificationError,
|
|
23521
23589
|
canConsumeForm,
|
|
23522
23590
|
exists,
|
|
23523
23591
|
instanceOfAddTopicSubscribersRequest,
|
|
@@ -23552,6 +23620,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
23552
23620
|
instanceOfAuthUserResponse,
|
|
23553
23621
|
instanceOfAuthUserResponseData,
|
|
23554
23622
|
instanceOfBatchPublishWaaSEvents201Response,
|
|
23623
|
+
instanceOfBatchRecipient,
|
|
23555
23624
|
instanceOfBulkRetryWebhookDeliveriesRequest,
|
|
23556
23625
|
instanceOfBulkUpsertAuthEmailTemplatesRequest,
|
|
23557
23626
|
instanceOfBulkUpsertAuthEmailTemplatesResponse,
|