@zyphr-dev/node-sdk 0.1.9 → 0.1.12
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 +34 -12
- package/dist/index.cjs +433 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +358 -1
- package/dist/index.d.ts +358 -1
- package/dist/index.js +417 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +3 -0
- package/src/client.ts +10 -1
- package/src/src/apis/InboxApi.ts +548 -0
- package/src/src/models/MarkAllSubscriberNotificationsReadRequest.ts +65 -0
- package/src/src/models/UpdateSubscriberPreferencesRequest.ts +74 -0
- package/src/src/models/UpdateSubscriberPreferencesRequestPreferencesInner.ts +96 -0
- package/src/src/models/index.ts +3 -0
package/README.md
CHANGED
|
@@ -377,20 +377,44 @@ await zyphr.devices.deleteUserDevices('user_123');
|
|
|
377
377
|
|
|
378
378
|
### Authentication — `zyphr.auth.*`
|
|
379
379
|
|
|
380
|
-
Full
|
|
380
|
+
Full Auth-as-a-Service API for end-user authentication: registration, login, MFA, magic links, OAuth, and more.
|
|
381
|
+
|
|
382
|
+
> **Important:** Auth endpoints require application credentials, not just an API key. Create an application in the Zyphr dashboard first, then pass the credentials when constructing the client:
|
|
383
|
+
|
|
384
|
+
```ts
|
|
385
|
+
const zyphr = new Zyphr({
|
|
386
|
+
apiKey: process.env.ZYPHR_API_KEY!,
|
|
387
|
+
applicationKey: process.env.ZYPHR_APP_PUBLIC_KEY!, // za_pub_*
|
|
388
|
+
applicationSecret: process.env.ZYPHR_APP_SECRET_KEY!, // za_sec_*
|
|
389
|
+
});
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
> **Common mistake:** `POST /v1/auth/register` creates a **platform account** (for the Zyphr dashboard). To register **end users** in your application, use `POST /v1/auth/users/register` via `zyphr.auth.registration.registerEndUser()`.
|
|
381
393
|
|
|
382
394
|
```ts
|
|
395
|
+
// Register an end user
|
|
396
|
+
const result = await zyphr.auth.registration.registerEndUser({
|
|
397
|
+
registerRequest: {
|
|
398
|
+
email: 'new@example.com',
|
|
399
|
+
password: 'SecureP@ss123',
|
|
400
|
+
name: 'New User',
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
// result.data.user — the new user
|
|
404
|
+
// result.data.tokens — { access_token, refresh_token, expires_in }
|
|
405
|
+
|
|
383
406
|
// Login
|
|
384
407
|
const session = await zyphr.auth.login.loginEndUser({
|
|
385
|
-
|
|
386
|
-
|
|
408
|
+
loginRequest: {
|
|
409
|
+
email: 'user@example.com',
|
|
410
|
+
password: 'SecureP@ss123',
|
|
411
|
+
},
|
|
387
412
|
});
|
|
388
413
|
|
|
389
|
-
//
|
|
390
|
-
await zyphr.auth.
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
name: 'New User',
|
|
414
|
+
// User profile (requires end-user access token)
|
|
415
|
+
const profile = await zyphr.auth.profile.getEndUser();
|
|
416
|
+
await zyphr.auth.profile.updateEndUser({
|
|
417
|
+
updateEndUserRequest: { name: 'Updated Name' },
|
|
394
418
|
});
|
|
395
419
|
|
|
396
420
|
// Email verification
|
|
@@ -405,14 +429,12 @@ await zyphr.auth.magicLinks.sendMagicLink('user@example.com');
|
|
|
405
429
|
// MFA
|
|
406
430
|
const mfaStatus = await zyphr.auth.mfa.getMfaStatus();
|
|
407
431
|
await zyphr.auth.mfa.enrollMfa({ method: 'totp' });
|
|
408
|
-
|
|
409
|
-
// User profile
|
|
410
|
-
const profile = await zyphr.auth.profile.getProfile();
|
|
411
|
-
await zyphr.auth.profile.updateProfile({ name: 'Updated Name' });
|
|
412
432
|
```
|
|
413
433
|
|
|
414
434
|
**Available auth modules:** `login`, `registration`, `sessions`, `emailVerification`, `passwordReset`, `magicLinks`, `mfa`, `oauth`, `phone`, `webauthn`, `profile`.
|
|
415
435
|
|
|
436
|
+
See the [Auth-as-a-Service guide](https://zyphr.dev/docs/guides/auth-as-a-service) for the full setup walkthrough.
|
|
437
|
+
|
|
416
438
|
### WaaS — `zyphr.waas.*`
|
|
417
439
|
|
|
418
440
|
Webhooks-as-a-Service: multi-tenant webhook delivery infrastructure for your customers.
|
package/dist/index.cjs
CHANGED
|
@@ -410,6 +410,10 @@ __export(index_exports, {
|
|
|
410
410
|
MarkAllReadResponseFromJSONTyped: () => MarkAllReadResponseFromJSONTyped,
|
|
411
411
|
MarkAllReadResponseToJSON: () => MarkAllReadResponseToJSON,
|
|
412
412
|
MarkAllReadResponseToJSONTyped: () => MarkAllReadResponseToJSONTyped,
|
|
413
|
+
MarkAllSubscriberNotificationsReadRequestFromJSON: () => MarkAllSubscriberNotificationsReadRequestFromJSON,
|
|
414
|
+
MarkAllSubscriberNotificationsReadRequestFromJSONTyped: () => MarkAllSubscriberNotificationsReadRequestFromJSONTyped,
|
|
415
|
+
MarkAllSubscriberNotificationsReadRequestToJSON: () => MarkAllSubscriberNotificationsReadRequestToJSON,
|
|
416
|
+
MarkAllSubscriberNotificationsReadRequestToJSONTyped: () => MarkAllSubscriberNotificationsReadRequestToJSONTyped,
|
|
413
417
|
MarkInboxReadRequestFromJSON: () => MarkInboxReadRequestFromJSON,
|
|
414
418
|
MarkInboxReadRequestFromJSONTyped: () => MarkInboxReadRequestFromJSONTyped,
|
|
415
419
|
MarkInboxReadRequestToJSON: () => MarkInboxReadRequestToJSON,
|
|
@@ -1095,6 +1099,15 @@ __export(index_exports, {
|
|
|
1095
1099
|
UpdateEndUserRequestFromJSONTyped: () => UpdateEndUserRequestFromJSONTyped,
|
|
1096
1100
|
UpdateEndUserRequestToJSON: () => UpdateEndUserRequestToJSON,
|
|
1097
1101
|
UpdateEndUserRequestToJSONTyped: () => UpdateEndUserRequestToJSONTyped,
|
|
1102
|
+
UpdateSubscriberPreferencesRequestFromJSON: () => UpdateSubscriberPreferencesRequestFromJSON,
|
|
1103
|
+
UpdateSubscriberPreferencesRequestFromJSONTyped: () => UpdateSubscriberPreferencesRequestFromJSONTyped,
|
|
1104
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerChannelEnum: () => UpdateSubscriberPreferencesRequestPreferencesInnerChannelEnum,
|
|
1105
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerFromJSON: () => UpdateSubscriberPreferencesRequestPreferencesInnerFromJSON,
|
|
1106
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerFromJSONTyped: () => UpdateSubscriberPreferencesRequestPreferencesInnerFromJSONTyped,
|
|
1107
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerToJSON: () => UpdateSubscriberPreferencesRequestPreferencesInnerToJSON,
|
|
1108
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerToJSONTyped: () => UpdateSubscriberPreferencesRequestPreferencesInnerToJSONTyped,
|
|
1109
|
+
UpdateSubscriberPreferencesRequestToJSON: () => UpdateSubscriberPreferencesRequestToJSON,
|
|
1110
|
+
UpdateSubscriberPreferencesRequestToJSONTyped: () => UpdateSubscriberPreferencesRequestToJSONTyped,
|
|
1098
1111
|
UpdateSubscriberRequestFromJSON: () => UpdateSubscriberRequestFromJSON,
|
|
1099
1112
|
UpdateSubscriberRequestFromJSONTyped: () => UpdateSubscriberRequestFromJSONTyped,
|
|
1100
1113
|
UpdateSubscriberRequestStatusEnum: () => UpdateSubscriberRequestStatusEnum,
|
|
@@ -1529,6 +1542,7 @@ __export(index_exports, {
|
|
|
1529
1542
|
instanceOfMarkAllInboxReadRequest: () => instanceOfMarkAllInboxReadRequest,
|
|
1530
1543
|
instanceOfMarkAllReadData: () => instanceOfMarkAllReadData,
|
|
1531
1544
|
instanceOfMarkAllReadResponse: () => instanceOfMarkAllReadResponse,
|
|
1545
|
+
instanceOfMarkAllSubscriberNotificationsReadRequest: () => instanceOfMarkAllSubscriberNotificationsReadRequest,
|
|
1532
1546
|
instanceOfMarkInboxReadRequest: () => instanceOfMarkInboxReadRequest,
|
|
1533
1547
|
instanceOfMfaBackupCodesResponse: () => instanceOfMfaBackupCodesResponse,
|
|
1534
1548
|
instanceOfMfaBackupCodesResponseData: () => instanceOfMfaBackupCodesResponseData,
|
|
@@ -1694,6 +1708,8 @@ __export(index_exports, {
|
|
|
1694
1708
|
instanceOfUnsubscribeResponse: () => instanceOfUnsubscribeResponse,
|
|
1695
1709
|
instanceOfUpdateCategoryRequest: () => instanceOfUpdateCategoryRequest,
|
|
1696
1710
|
instanceOfUpdateEndUserRequest: () => instanceOfUpdateEndUserRequest,
|
|
1711
|
+
instanceOfUpdateSubscriberPreferencesRequest: () => instanceOfUpdateSubscriberPreferencesRequest,
|
|
1712
|
+
instanceOfUpdateSubscriberPreferencesRequestPreferencesInner: () => instanceOfUpdateSubscriberPreferencesRequestPreferencesInner,
|
|
1697
1713
|
instanceOfUpdateSubscriberRequest: () => instanceOfUpdateSubscriberRequest,
|
|
1698
1714
|
instanceOfUpdateTemplateRequest: () => instanceOfUpdateTemplateRequest,
|
|
1699
1715
|
instanceOfUpdateTopicRequest: () => instanceOfUpdateTopicRequest,
|
|
@@ -5303,6 +5319,33 @@ function MarkAllReadResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
5303
5319
|
};
|
|
5304
5320
|
}
|
|
5305
5321
|
|
|
5322
|
+
// src/src/models/MarkAllSubscriberNotificationsReadRequest.ts
|
|
5323
|
+
function instanceOfMarkAllSubscriberNotificationsReadRequest(value) {
|
|
5324
|
+
return true;
|
|
5325
|
+
}
|
|
5326
|
+
function MarkAllSubscriberNotificationsReadRequestFromJSON(json) {
|
|
5327
|
+
return MarkAllSubscriberNotificationsReadRequestFromJSONTyped(json, false);
|
|
5328
|
+
}
|
|
5329
|
+
function MarkAllSubscriberNotificationsReadRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
5330
|
+
if (json == null) {
|
|
5331
|
+
return json;
|
|
5332
|
+
}
|
|
5333
|
+
return {
|
|
5334
|
+
"category": json["category"] == null ? void 0 : json["category"]
|
|
5335
|
+
};
|
|
5336
|
+
}
|
|
5337
|
+
function MarkAllSubscriberNotificationsReadRequestToJSON(json) {
|
|
5338
|
+
return MarkAllSubscriberNotificationsReadRequestToJSONTyped(json, false);
|
|
5339
|
+
}
|
|
5340
|
+
function MarkAllSubscriberNotificationsReadRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5341
|
+
if (value == null) {
|
|
5342
|
+
return value;
|
|
5343
|
+
}
|
|
5344
|
+
return {
|
|
5345
|
+
"category": value["category"]
|
|
5346
|
+
};
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5306
5349
|
// src/src/models/MarkInboxReadRequest.ts
|
|
5307
5350
|
function instanceOfMarkInboxReadRequest(value) {
|
|
5308
5351
|
return true;
|
|
@@ -10597,6 +10640,73 @@ function UpdateEndUserRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
10597
10640
|
};
|
|
10598
10641
|
}
|
|
10599
10642
|
|
|
10643
|
+
// src/src/models/UpdateSubscriberPreferencesRequestPreferencesInner.ts
|
|
10644
|
+
var UpdateSubscriberPreferencesRequestPreferencesInnerChannelEnum = {
|
|
10645
|
+
EMAIL: "email",
|
|
10646
|
+
PUSH: "push",
|
|
10647
|
+
SMS: "sms",
|
|
10648
|
+
IN_APP: "in_app"
|
|
10649
|
+
};
|
|
10650
|
+
function instanceOfUpdateSubscriberPreferencesRequestPreferencesInner(value) {
|
|
10651
|
+
if (!("channel" in value) || value["channel"] === void 0) return false;
|
|
10652
|
+
if (!("enabled" in value) || value["enabled"] === void 0) return false;
|
|
10653
|
+
return true;
|
|
10654
|
+
}
|
|
10655
|
+
function UpdateSubscriberPreferencesRequestPreferencesInnerFromJSON(json) {
|
|
10656
|
+
return UpdateSubscriberPreferencesRequestPreferencesInnerFromJSONTyped(json, false);
|
|
10657
|
+
}
|
|
10658
|
+
function UpdateSubscriberPreferencesRequestPreferencesInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
10659
|
+
if (json == null) {
|
|
10660
|
+
return json;
|
|
10661
|
+
}
|
|
10662
|
+
return {
|
|
10663
|
+
"categoryId": json["category_id"] == null ? void 0 : json["category_id"],
|
|
10664
|
+
"channel": json["channel"],
|
|
10665
|
+
"enabled": json["enabled"]
|
|
10666
|
+
};
|
|
10667
|
+
}
|
|
10668
|
+
function UpdateSubscriberPreferencesRequestPreferencesInnerToJSON(json) {
|
|
10669
|
+
return UpdateSubscriberPreferencesRequestPreferencesInnerToJSONTyped(json, false);
|
|
10670
|
+
}
|
|
10671
|
+
function UpdateSubscriberPreferencesRequestPreferencesInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
10672
|
+
if (value == null) {
|
|
10673
|
+
return value;
|
|
10674
|
+
}
|
|
10675
|
+
return {
|
|
10676
|
+
"category_id": value["categoryId"],
|
|
10677
|
+
"channel": value["channel"],
|
|
10678
|
+
"enabled": value["enabled"]
|
|
10679
|
+
};
|
|
10680
|
+
}
|
|
10681
|
+
|
|
10682
|
+
// src/src/models/UpdateSubscriberPreferencesRequest.ts
|
|
10683
|
+
function instanceOfUpdateSubscriberPreferencesRequest(value) {
|
|
10684
|
+
if (!("preferences" in value) || value["preferences"] === void 0) return false;
|
|
10685
|
+
return true;
|
|
10686
|
+
}
|
|
10687
|
+
function UpdateSubscriberPreferencesRequestFromJSON(json) {
|
|
10688
|
+
return UpdateSubscriberPreferencesRequestFromJSONTyped(json, false);
|
|
10689
|
+
}
|
|
10690
|
+
function UpdateSubscriberPreferencesRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
10691
|
+
if (json == null) {
|
|
10692
|
+
return json;
|
|
10693
|
+
}
|
|
10694
|
+
return {
|
|
10695
|
+
"preferences": json["preferences"].map(UpdateSubscriberPreferencesRequestPreferencesInnerFromJSON)
|
|
10696
|
+
};
|
|
10697
|
+
}
|
|
10698
|
+
function UpdateSubscriberPreferencesRequestToJSON(json) {
|
|
10699
|
+
return UpdateSubscriberPreferencesRequestToJSONTyped(json, false);
|
|
10700
|
+
}
|
|
10701
|
+
function UpdateSubscriberPreferencesRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
10702
|
+
if (value == null) {
|
|
10703
|
+
return value;
|
|
10704
|
+
}
|
|
10705
|
+
return {
|
|
10706
|
+
"preferences": value["preferences"].map(UpdateSubscriberPreferencesRequestPreferencesInnerToJSON)
|
|
10707
|
+
};
|
|
10708
|
+
}
|
|
10709
|
+
|
|
10600
10710
|
// src/src/models/UpdateSubscriberRequest.ts
|
|
10601
10711
|
var UpdateSubscriberRequestStatusEnum = {
|
|
10602
10712
|
ACTIVE: "active",
|
|
@@ -15077,6 +15187,39 @@ var InboxApi = class extends BaseAPI {
|
|
|
15077
15187
|
const response = await this.archiveInboxNotificationRaw({ id, markInboxReadRequest }, initOverrides);
|
|
15078
15188
|
return await response.value();
|
|
15079
15189
|
}
|
|
15190
|
+
/**
|
|
15191
|
+
* Archive a notification
|
|
15192
|
+
*/
|
|
15193
|
+
async archiveSubscriberNotificationRaw(requestParameters, initOverrides) {
|
|
15194
|
+
if (requestParameters["id"] == null) {
|
|
15195
|
+
throw new RequiredError(
|
|
15196
|
+
"id",
|
|
15197
|
+
'Required parameter "id" was null or undefined when calling archiveSubscriberNotification().'
|
|
15198
|
+
);
|
|
15199
|
+
}
|
|
15200
|
+
const queryParameters = {};
|
|
15201
|
+
const headerParameters = {};
|
|
15202
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15203
|
+
const token = this.configuration.accessToken;
|
|
15204
|
+
const tokenString = await token("EndUserToken", []);
|
|
15205
|
+
if (tokenString) {
|
|
15206
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15207
|
+
}
|
|
15208
|
+
}
|
|
15209
|
+
const response = await this.request({
|
|
15210
|
+
path: `/subscriber-inbox/{id}/archive`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
15211
|
+
method: "POST",
|
|
15212
|
+
headers: headerParameters,
|
|
15213
|
+
query: queryParameters
|
|
15214
|
+
}, initOverrides);
|
|
15215
|
+
return new VoidApiResponse(response);
|
|
15216
|
+
}
|
|
15217
|
+
/**
|
|
15218
|
+
* Archive a notification
|
|
15219
|
+
*/
|
|
15220
|
+
async archiveSubscriberNotification(id, initOverrides) {
|
|
15221
|
+
await this.archiveSubscriberNotificationRaw({ id }, initOverrides);
|
|
15222
|
+
}
|
|
15080
15223
|
/**
|
|
15081
15224
|
* Permanently delete an in-app notification.
|
|
15082
15225
|
* Delete a notification
|
|
@@ -15114,6 +15257,39 @@ var InboxApi = class extends BaseAPI {
|
|
|
15114
15257
|
async deleteInboxNotification(id, subscriberId, externalId, initOverrides) {
|
|
15115
15258
|
await this.deleteInboxNotificationRaw({ id, subscriberId, externalId }, initOverrides);
|
|
15116
15259
|
}
|
|
15260
|
+
/**
|
|
15261
|
+
* Delete a notification
|
|
15262
|
+
*/
|
|
15263
|
+
async deleteSubscriberNotificationRaw(requestParameters, initOverrides) {
|
|
15264
|
+
if (requestParameters["id"] == null) {
|
|
15265
|
+
throw new RequiredError(
|
|
15266
|
+
"id",
|
|
15267
|
+
'Required parameter "id" was null or undefined when calling deleteSubscriberNotification().'
|
|
15268
|
+
);
|
|
15269
|
+
}
|
|
15270
|
+
const queryParameters = {};
|
|
15271
|
+
const headerParameters = {};
|
|
15272
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15273
|
+
const token = this.configuration.accessToken;
|
|
15274
|
+
const tokenString = await token("EndUserToken", []);
|
|
15275
|
+
if (tokenString) {
|
|
15276
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15277
|
+
}
|
|
15278
|
+
}
|
|
15279
|
+
const response = await this.request({
|
|
15280
|
+
path: `/subscriber-inbox/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
15281
|
+
method: "DELETE",
|
|
15282
|
+
headers: headerParameters,
|
|
15283
|
+
query: queryParameters
|
|
15284
|
+
}, initOverrides);
|
|
15285
|
+
return new VoidApiResponse(response);
|
|
15286
|
+
}
|
|
15287
|
+
/**
|
|
15288
|
+
* Delete a notification
|
|
15289
|
+
*/
|
|
15290
|
+
async deleteSubscriberNotification(id, initOverrides) {
|
|
15291
|
+
await this.deleteSubscriberNotificationRaw({ id }, initOverrides);
|
|
15292
|
+
}
|
|
15117
15293
|
/**
|
|
15118
15294
|
* Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`\'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
|
|
15119
15295
|
* Generate a subscriber token
|
|
@@ -15186,6 +15362,99 @@ var InboxApi = class extends BaseAPI {
|
|
|
15186
15362
|
const response = await this.getInboxNotificationRaw({ id, subscriberId, externalId }, initOverrides);
|
|
15187
15363
|
return await response.value();
|
|
15188
15364
|
}
|
|
15365
|
+
/**
|
|
15366
|
+
* Get notification preferences grouped by category for the authenticated subscriber.
|
|
15367
|
+
* Get subscriber preferences
|
|
15368
|
+
*/
|
|
15369
|
+
async getSubscriberInboxPreferencesRaw(initOverrides) {
|
|
15370
|
+
const queryParameters = {};
|
|
15371
|
+
const headerParameters = {};
|
|
15372
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15373
|
+
const token = this.configuration.accessToken;
|
|
15374
|
+
const tokenString = await token("EndUserToken", []);
|
|
15375
|
+
if (tokenString) {
|
|
15376
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15377
|
+
}
|
|
15378
|
+
}
|
|
15379
|
+
const response = await this.request({
|
|
15380
|
+
path: `/subscriber-inbox/preferences`,
|
|
15381
|
+
method: "GET",
|
|
15382
|
+
headers: headerParameters,
|
|
15383
|
+
query: queryParameters
|
|
15384
|
+
}, initOverrides);
|
|
15385
|
+
return new VoidApiResponse(response);
|
|
15386
|
+
}
|
|
15387
|
+
/**
|
|
15388
|
+
* Get notification preferences grouped by category for the authenticated subscriber.
|
|
15389
|
+
* Get subscriber preferences
|
|
15390
|
+
*/
|
|
15391
|
+
async getSubscriberInboxPreferences(initOverrides) {
|
|
15392
|
+
await this.getSubscriberInboxPreferencesRaw(initOverrides);
|
|
15393
|
+
}
|
|
15394
|
+
/**
|
|
15395
|
+
* Get a specific notification by ID for the authenticated subscriber.
|
|
15396
|
+
* Get a notification
|
|
15397
|
+
*/
|
|
15398
|
+
async getSubscriberNotificationRaw(requestParameters, initOverrides) {
|
|
15399
|
+
if (requestParameters["id"] == null) {
|
|
15400
|
+
throw new RequiredError(
|
|
15401
|
+
"id",
|
|
15402
|
+
'Required parameter "id" was null or undefined when calling getSubscriberNotification().'
|
|
15403
|
+
);
|
|
15404
|
+
}
|
|
15405
|
+
const queryParameters = {};
|
|
15406
|
+
const headerParameters = {};
|
|
15407
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15408
|
+
const token = this.configuration.accessToken;
|
|
15409
|
+
const tokenString = await token("EndUserToken", []);
|
|
15410
|
+
if (tokenString) {
|
|
15411
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15412
|
+
}
|
|
15413
|
+
}
|
|
15414
|
+
const response = await this.request({
|
|
15415
|
+
path: `/subscriber-inbox/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
15416
|
+
method: "GET",
|
|
15417
|
+
headers: headerParameters,
|
|
15418
|
+
query: queryParameters
|
|
15419
|
+
}, initOverrides);
|
|
15420
|
+
return new VoidApiResponse(response);
|
|
15421
|
+
}
|
|
15422
|
+
/**
|
|
15423
|
+
* Get a specific notification by ID for the authenticated subscriber.
|
|
15424
|
+
* Get a notification
|
|
15425
|
+
*/
|
|
15426
|
+
async getSubscriberNotification(id, initOverrides) {
|
|
15427
|
+
await this.getSubscriberNotificationRaw({ id }, initOverrides);
|
|
15428
|
+
}
|
|
15429
|
+
/**
|
|
15430
|
+
* Get the unread notification count for the authenticated subscriber.
|
|
15431
|
+
* Get unread count
|
|
15432
|
+
*/
|
|
15433
|
+
async getSubscriberUnreadCountRaw(initOverrides) {
|
|
15434
|
+
const queryParameters = {};
|
|
15435
|
+
const headerParameters = {};
|
|
15436
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15437
|
+
const token = this.configuration.accessToken;
|
|
15438
|
+
const tokenString = await token("EndUserToken", []);
|
|
15439
|
+
if (tokenString) {
|
|
15440
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15441
|
+
}
|
|
15442
|
+
}
|
|
15443
|
+
const response = await this.request({
|
|
15444
|
+
path: `/subscriber-inbox/unread-count`,
|
|
15445
|
+
method: "GET",
|
|
15446
|
+
headers: headerParameters,
|
|
15447
|
+
query: queryParameters
|
|
15448
|
+
}, initOverrides);
|
|
15449
|
+
return new VoidApiResponse(response);
|
|
15450
|
+
}
|
|
15451
|
+
/**
|
|
15452
|
+
* Get the unread notification count for the authenticated subscriber.
|
|
15453
|
+
* Get unread count
|
|
15454
|
+
*/
|
|
15455
|
+
async getSubscriberUnreadCount(initOverrides) {
|
|
15456
|
+
await this.getSubscriberUnreadCountRaw(initOverrides);
|
|
15457
|
+
}
|
|
15189
15458
|
/**
|
|
15190
15459
|
* Get the count of unread in-app notifications for a subscriber.
|
|
15191
15460
|
* Get unread notification count
|
|
@@ -15268,6 +15537,50 @@ var InboxApi = class extends BaseAPI {
|
|
|
15268
15537
|
const response = await this.listInboxRaw({ subscriberId, externalId, category, includeRead, includeArchived, limit, offset, cursor }, initOverrides);
|
|
15269
15538
|
return await response.value();
|
|
15270
15539
|
}
|
|
15540
|
+
/**
|
|
15541
|
+
* List notifications for the authenticated subscriber. Supports cursor-based pagination.
|
|
15542
|
+
* List subscriber notifications
|
|
15543
|
+
*/
|
|
15544
|
+
async listSubscriberNotificationsRaw(requestParameters, initOverrides) {
|
|
15545
|
+
const queryParameters = {};
|
|
15546
|
+
if (requestParameters["category"] != null) {
|
|
15547
|
+
queryParameters["category"] = requestParameters["category"];
|
|
15548
|
+
}
|
|
15549
|
+
if (requestParameters["includeRead"] != null) {
|
|
15550
|
+
queryParameters["include_read"] = requestParameters["includeRead"];
|
|
15551
|
+
}
|
|
15552
|
+
if (requestParameters["includeArchived"] != null) {
|
|
15553
|
+
queryParameters["include_archived"] = requestParameters["includeArchived"];
|
|
15554
|
+
}
|
|
15555
|
+
if (requestParameters["limit"] != null) {
|
|
15556
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
15557
|
+
}
|
|
15558
|
+
if (requestParameters["cursor"] != null) {
|
|
15559
|
+
queryParameters["cursor"] = requestParameters["cursor"];
|
|
15560
|
+
}
|
|
15561
|
+
const headerParameters = {};
|
|
15562
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15563
|
+
const token = this.configuration.accessToken;
|
|
15564
|
+
const tokenString = await token("EndUserToken", []);
|
|
15565
|
+
if (tokenString) {
|
|
15566
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15567
|
+
}
|
|
15568
|
+
}
|
|
15569
|
+
const response = await this.request({
|
|
15570
|
+
path: `/subscriber-inbox`,
|
|
15571
|
+
method: "GET",
|
|
15572
|
+
headers: headerParameters,
|
|
15573
|
+
query: queryParameters
|
|
15574
|
+
}, initOverrides);
|
|
15575
|
+
return new VoidApiResponse(response);
|
|
15576
|
+
}
|
|
15577
|
+
/**
|
|
15578
|
+
* List notifications for the authenticated subscriber. Supports cursor-based pagination.
|
|
15579
|
+
* List subscriber notifications
|
|
15580
|
+
*/
|
|
15581
|
+
async listSubscriberNotifications(category, includeRead, includeArchived, limit, cursor, initOverrides) {
|
|
15582
|
+
await this.listSubscriberNotificationsRaw({ category, includeRead, includeArchived, limit, cursor }, initOverrides);
|
|
15583
|
+
}
|
|
15271
15584
|
/**
|
|
15272
15585
|
* Mark all unread in-app notifications as read for a subscriber. Optionally filter by category.
|
|
15273
15586
|
* Mark all notifications as read
|
|
@@ -15302,6 +15615,35 @@ var InboxApi = class extends BaseAPI {
|
|
|
15302
15615
|
const response = await this.markAllInboxReadRaw({ markAllInboxReadRequest }, initOverrides);
|
|
15303
15616
|
return await response.value();
|
|
15304
15617
|
}
|
|
15618
|
+
/**
|
|
15619
|
+
* Mark all notifications as read
|
|
15620
|
+
*/
|
|
15621
|
+
async markAllSubscriberNotificationsReadRaw(requestParameters, initOverrides) {
|
|
15622
|
+
const queryParameters = {};
|
|
15623
|
+
const headerParameters = {};
|
|
15624
|
+
headerParameters["Content-Type"] = "application/json";
|
|
15625
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15626
|
+
const token = this.configuration.accessToken;
|
|
15627
|
+
const tokenString = await token("EndUserToken", []);
|
|
15628
|
+
if (tokenString) {
|
|
15629
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15630
|
+
}
|
|
15631
|
+
}
|
|
15632
|
+
const response = await this.request({
|
|
15633
|
+
path: `/subscriber-inbox/read-all`,
|
|
15634
|
+
method: "POST",
|
|
15635
|
+
headers: headerParameters,
|
|
15636
|
+
query: queryParameters,
|
|
15637
|
+
body: MarkAllSubscriberNotificationsReadRequestToJSON(requestParameters["markAllSubscriberNotificationsReadRequest"])
|
|
15638
|
+
}, initOverrides);
|
|
15639
|
+
return new VoidApiResponse(response);
|
|
15640
|
+
}
|
|
15641
|
+
/**
|
|
15642
|
+
* Mark all notifications as read
|
|
15643
|
+
*/
|
|
15644
|
+
async markAllSubscriberNotificationsRead(markAllSubscriberNotificationsReadRequest, initOverrides) {
|
|
15645
|
+
await this.markAllSubscriberNotificationsReadRaw({ markAllSubscriberNotificationsReadRequest }, initOverrides);
|
|
15646
|
+
}
|
|
15305
15647
|
/**
|
|
15306
15648
|
* Mark a specific in-app notification as read.
|
|
15307
15649
|
* Mark notification as read
|
|
@@ -15336,6 +15678,39 @@ var InboxApi = class extends BaseAPI {
|
|
|
15336
15678
|
const response = await this.markInboxReadRaw({ id, markInboxReadRequest }, initOverrides);
|
|
15337
15679
|
return await response.value();
|
|
15338
15680
|
}
|
|
15681
|
+
/**
|
|
15682
|
+
* Mark notification as read
|
|
15683
|
+
*/
|
|
15684
|
+
async markSubscriberNotificationReadRaw(requestParameters, initOverrides) {
|
|
15685
|
+
if (requestParameters["id"] == null) {
|
|
15686
|
+
throw new RequiredError(
|
|
15687
|
+
"id",
|
|
15688
|
+
'Required parameter "id" was null or undefined when calling markSubscriberNotificationRead().'
|
|
15689
|
+
);
|
|
15690
|
+
}
|
|
15691
|
+
const queryParameters = {};
|
|
15692
|
+
const headerParameters = {};
|
|
15693
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15694
|
+
const token = this.configuration.accessToken;
|
|
15695
|
+
const tokenString = await token("EndUserToken", []);
|
|
15696
|
+
if (tokenString) {
|
|
15697
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15698
|
+
}
|
|
15699
|
+
}
|
|
15700
|
+
const response = await this.request({
|
|
15701
|
+
path: `/subscriber-inbox/{id}/read`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
15702
|
+
method: "POST",
|
|
15703
|
+
headers: headerParameters,
|
|
15704
|
+
query: queryParameters
|
|
15705
|
+
}, initOverrides);
|
|
15706
|
+
return new VoidApiResponse(response);
|
|
15707
|
+
}
|
|
15708
|
+
/**
|
|
15709
|
+
* Mark notification as read
|
|
15710
|
+
*/
|
|
15711
|
+
async markSubscriberNotificationRead(id, initOverrides) {
|
|
15712
|
+
await this.markSubscriberNotificationReadRaw({ id }, initOverrides);
|
|
15713
|
+
}
|
|
15339
15714
|
/**
|
|
15340
15715
|
* Send in-app notifications to multiple subscribers in a single request (max 100).
|
|
15341
15716
|
* Send batch in-app notifications
|
|
@@ -15404,6 +15779,43 @@ var InboxApi = class extends BaseAPI {
|
|
|
15404
15779
|
const response = await this.sendInAppRaw({ sendInAppRequest }, initOverrides);
|
|
15405
15780
|
return await response.value();
|
|
15406
15781
|
}
|
|
15782
|
+
/**
|
|
15783
|
+
* Update notification channel preferences for specific categories or globally.
|
|
15784
|
+
* Update subscriber preferences
|
|
15785
|
+
*/
|
|
15786
|
+
async updateSubscriberPreferencesRaw(requestParameters, initOverrides) {
|
|
15787
|
+
if (requestParameters["updateSubscriberPreferencesRequest"] == null) {
|
|
15788
|
+
throw new RequiredError(
|
|
15789
|
+
"updateSubscriberPreferencesRequest",
|
|
15790
|
+
'Required parameter "updateSubscriberPreferencesRequest" was null or undefined when calling updateSubscriberPreferences().'
|
|
15791
|
+
);
|
|
15792
|
+
}
|
|
15793
|
+
const queryParameters = {};
|
|
15794
|
+
const headerParameters = {};
|
|
15795
|
+
headerParameters["Content-Type"] = "application/json";
|
|
15796
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
15797
|
+
const token = this.configuration.accessToken;
|
|
15798
|
+
const tokenString = await token("EndUserToken", []);
|
|
15799
|
+
if (tokenString) {
|
|
15800
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
15801
|
+
}
|
|
15802
|
+
}
|
|
15803
|
+
const response = await this.request({
|
|
15804
|
+
path: `/subscriber-inbox/preferences`,
|
|
15805
|
+
method: "PUT",
|
|
15806
|
+
headers: headerParameters,
|
|
15807
|
+
query: queryParameters,
|
|
15808
|
+
body: UpdateSubscriberPreferencesRequestToJSON(requestParameters["updateSubscriberPreferencesRequest"])
|
|
15809
|
+
}, initOverrides);
|
|
15810
|
+
return new VoidApiResponse(response);
|
|
15811
|
+
}
|
|
15812
|
+
/**
|
|
15813
|
+
* Update notification channel preferences for specific categories or globally.
|
|
15814
|
+
* Update subscriber preferences
|
|
15815
|
+
*/
|
|
15816
|
+
async updateSubscriberPreferences(updateSubscriberPreferencesRequest, initOverrides) {
|
|
15817
|
+
await this.updateSubscriberPreferencesRaw({ updateSubscriberPreferencesRequest }, initOverrides);
|
|
15818
|
+
}
|
|
15407
15819
|
};
|
|
15408
15820
|
|
|
15409
15821
|
// src/src/apis/PushApi.ts
|
|
@@ -19266,7 +19678,11 @@ var Zyphr = class {
|
|
|
19266
19678
|
constructor(options) {
|
|
19267
19679
|
const config = new Configuration({
|
|
19268
19680
|
basePath: options.baseUrl,
|
|
19269
|
-
apiKey: () =>
|
|
19681
|
+
apiKey: (name) => {
|
|
19682
|
+
if (name === "X-Application-Key" && options.applicationKey) return options.applicationKey;
|
|
19683
|
+
if (name === "X-Application-Secret" && options.applicationSecret) return options.applicationSecret;
|
|
19684
|
+
return options.apiKey;
|
|
19685
|
+
},
|
|
19270
19686
|
middleware: [errorMiddleware]
|
|
19271
19687
|
});
|
|
19272
19688
|
this.emails = new EmailsApi(config);
|
|
@@ -19696,6 +20112,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
19696
20112
|
MarkAllReadResponseFromJSONTyped,
|
|
19697
20113
|
MarkAllReadResponseToJSON,
|
|
19698
20114
|
MarkAllReadResponseToJSONTyped,
|
|
20115
|
+
MarkAllSubscriberNotificationsReadRequestFromJSON,
|
|
20116
|
+
MarkAllSubscriberNotificationsReadRequestFromJSONTyped,
|
|
20117
|
+
MarkAllSubscriberNotificationsReadRequestToJSON,
|
|
20118
|
+
MarkAllSubscriberNotificationsReadRequestToJSONTyped,
|
|
19699
20119
|
MarkInboxReadRequestFromJSON,
|
|
19700
20120
|
MarkInboxReadRequestFromJSONTyped,
|
|
19701
20121
|
MarkInboxReadRequestToJSON,
|
|
@@ -20381,6 +20801,15 @@ var SDK_VERSION = "0.1.0";
|
|
|
20381
20801
|
UpdateEndUserRequestFromJSONTyped,
|
|
20382
20802
|
UpdateEndUserRequestToJSON,
|
|
20383
20803
|
UpdateEndUserRequestToJSONTyped,
|
|
20804
|
+
UpdateSubscriberPreferencesRequestFromJSON,
|
|
20805
|
+
UpdateSubscriberPreferencesRequestFromJSONTyped,
|
|
20806
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerChannelEnum,
|
|
20807
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerFromJSON,
|
|
20808
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerFromJSONTyped,
|
|
20809
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerToJSON,
|
|
20810
|
+
UpdateSubscriberPreferencesRequestPreferencesInnerToJSONTyped,
|
|
20811
|
+
UpdateSubscriberPreferencesRequestToJSON,
|
|
20812
|
+
UpdateSubscriberPreferencesRequestToJSONTyped,
|
|
20384
20813
|
UpdateSubscriberRequestFromJSON,
|
|
20385
20814
|
UpdateSubscriberRequestFromJSONTyped,
|
|
20386
20815
|
UpdateSubscriberRequestStatusEnum,
|
|
@@ -20815,6 +21244,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
20815
21244
|
instanceOfMarkAllInboxReadRequest,
|
|
20816
21245
|
instanceOfMarkAllReadData,
|
|
20817
21246
|
instanceOfMarkAllReadResponse,
|
|
21247
|
+
instanceOfMarkAllSubscriberNotificationsReadRequest,
|
|
20818
21248
|
instanceOfMarkInboxReadRequest,
|
|
20819
21249
|
instanceOfMfaBackupCodesResponse,
|
|
20820
21250
|
instanceOfMfaBackupCodesResponseData,
|
|
@@ -20980,6 +21410,8 @@ var SDK_VERSION = "0.1.0";
|
|
|
20980
21410
|
instanceOfUnsubscribeResponse,
|
|
20981
21411
|
instanceOfUpdateCategoryRequest,
|
|
20982
21412
|
instanceOfUpdateEndUserRequest,
|
|
21413
|
+
instanceOfUpdateSubscriberPreferencesRequest,
|
|
21414
|
+
instanceOfUpdateSubscriberPreferencesRequestPreferencesInner,
|
|
20983
21415
|
instanceOfUpdateSubscriberRequest,
|
|
20984
21416
|
instanceOfUpdateTemplateRequest,
|
|
20985
21417
|
instanceOfUpdateTopicRequest,
|