@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/src/src/apis/InboxApi.ts
CHANGED
|
@@ -22,12 +22,14 @@ import type {
|
|
|
22
22
|
InboxNotificationResponse,
|
|
23
23
|
MarkAllInboxReadRequest,
|
|
24
24
|
MarkAllReadResponse,
|
|
25
|
+
MarkAllSubscriberNotificationsReadRequest,
|
|
25
26
|
MarkInboxReadRequest,
|
|
26
27
|
SendBatchInAppRequest,
|
|
27
28
|
SendBatchInAppResponse,
|
|
28
29
|
SendInAppRequest,
|
|
29
30
|
SendInAppResponse,
|
|
30
31
|
UnreadCountResponse,
|
|
32
|
+
UpdateSubscriberPreferencesRequest,
|
|
31
33
|
} from '../models/index';
|
|
32
34
|
import {
|
|
33
35
|
ApiErrorFromJSON,
|
|
@@ -44,6 +46,8 @@ import {
|
|
|
44
46
|
MarkAllInboxReadRequestToJSON,
|
|
45
47
|
MarkAllReadResponseFromJSON,
|
|
46
48
|
MarkAllReadResponseToJSON,
|
|
49
|
+
MarkAllSubscriberNotificationsReadRequestFromJSON,
|
|
50
|
+
MarkAllSubscriberNotificationsReadRequestToJSON,
|
|
47
51
|
MarkInboxReadRequestFromJSON,
|
|
48
52
|
MarkInboxReadRequestToJSON,
|
|
49
53
|
SendBatchInAppRequestFromJSON,
|
|
@@ -56,6 +60,8 @@ import {
|
|
|
56
60
|
SendInAppResponseToJSON,
|
|
57
61
|
UnreadCountResponseFromJSON,
|
|
58
62
|
UnreadCountResponseToJSON,
|
|
63
|
+
UpdateSubscriberPreferencesRequestFromJSON,
|
|
64
|
+
UpdateSubscriberPreferencesRequestToJSON,
|
|
59
65
|
} from '../models/index';
|
|
60
66
|
|
|
61
67
|
export interface InboxApiArchiveInboxNotificationRequest {
|
|
@@ -63,12 +69,20 @@ export interface InboxApiArchiveInboxNotificationRequest {
|
|
|
63
69
|
markInboxReadRequest?: MarkInboxReadRequest;
|
|
64
70
|
}
|
|
65
71
|
|
|
72
|
+
export interface InboxApiArchiveSubscriberNotificationRequest {
|
|
73
|
+
id: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
export interface InboxApiDeleteInboxNotificationRequest {
|
|
67
77
|
id: string;
|
|
68
78
|
subscriberId?: string;
|
|
69
79
|
externalId?: string;
|
|
70
80
|
}
|
|
71
81
|
|
|
82
|
+
export interface InboxApiDeleteSubscriberNotificationRequest {
|
|
83
|
+
id: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
72
86
|
export interface InboxApiGenerateSubscriberTokenOperationRequest {
|
|
73
87
|
generateSubscriberTokenRequest: GenerateSubscriberTokenRequest;
|
|
74
88
|
}
|
|
@@ -79,6 +93,10 @@ export interface InboxApiGetInboxNotificationRequest {
|
|
|
79
93
|
externalId?: string;
|
|
80
94
|
}
|
|
81
95
|
|
|
96
|
+
export interface InboxApiGetSubscriberNotificationRequest {
|
|
97
|
+
id: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
82
100
|
export interface InboxApiGetUnreadCountRequest {
|
|
83
101
|
subscriberId?: string;
|
|
84
102
|
externalId?: string;
|
|
@@ -95,15 +113,31 @@ export interface InboxApiListInboxRequest {
|
|
|
95
113
|
cursor?: string;
|
|
96
114
|
}
|
|
97
115
|
|
|
116
|
+
export interface InboxApiListSubscriberNotificationsRequest {
|
|
117
|
+
category?: string;
|
|
118
|
+
includeRead?: boolean;
|
|
119
|
+
includeArchived?: boolean;
|
|
120
|
+
limit?: number;
|
|
121
|
+
cursor?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
98
124
|
export interface InboxApiMarkAllInboxReadOperationRequest {
|
|
99
125
|
markAllInboxReadRequest: MarkAllInboxReadRequest;
|
|
100
126
|
}
|
|
101
127
|
|
|
128
|
+
export interface InboxApiMarkAllSubscriberNotificationsReadOperationRequest {
|
|
129
|
+
markAllSubscriberNotificationsReadRequest?: MarkAllSubscriberNotificationsReadRequest;
|
|
130
|
+
}
|
|
131
|
+
|
|
102
132
|
export interface InboxApiMarkInboxReadOperationRequest {
|
|
103
133
|
id: string;
|
|
104
134
|
markInboxReadRequest?: MarkInboxReadRequest;
|
|
105
135
|
}
|
|
106
136
|
|
|
137
|
+
export interface InboxApiMarkSubscriberNotificationReadRequest {
|
|
138
|
+
id: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
107
141
|
export interface InboxApiSendBatchInAppOperationRequest {
|
|
108
142
|
sendBatchInAppRequest: SendBatchInAppRequest;
|
|
109
143
|
}
|
|
@@ -112,6 +146,10 @@ export interface InboxApiSendInAppOperationRequest {
|
|
|
112
146
|
sendInAppRequest: SendInAppRequest;
|
|
113
147
|
}
|
|
114
148
|
|
|
149
|
+
export interface InboxApiUpdateSubscriberPreferencesOperationRequest {
|
|
150
|
+
updateSubscriberPreferencesRequest: UpdateSubscriberPreferencesRequest;
|
|
151
|
+
}
|
|
152
|
+
|
|
115
153
|
/**
|
|
116
154
|
* InboxApi - interface
|
|
117
155
|
*
|
|
@@ -136,6 +174,21 @@ export interface InboxApiInterface {
|
|
|
136
174
|
*/
|
|
137
175
|
archiveInboxNotification(id: string, markInboxReadRequest?: MarkInboxReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboxNotificationResponse>;
|
|
138
176
|
|
|
177
|
+
/**
|
|
178
|
+
*
|
|
179
|
+
* @summary Archive a notification
|
|
180
|
+
* @param {string} id
|
|
181
|
+
* @param {*} [options] Override http request option.
|
|
182
|
+
* @throws {RequiredError}
|
|
183
|
+
* @memberof InboxApiInterface
|
|
184
|
+
*/
|
|
185
|
+
archiveSubscriberNotificationRaw(requestParameters: InboxApiArchiveSubscriberNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Archive a notification
|
|
189
|
+
*/
|
|
190
|
+
archiveSubscriberNotification(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
191
|
+
|
|
139
192
|
/**
|
|
140
193
|
* Permanently delete an in-app notification.
|
|
141
194
|
* @summary Delete a notification
|
|
@@ -154,6 +207,21 @@ export interface InboxApiInterface {
|
|
|
154
207
|
*/
|
|
155
208
|
deleteInboxNotification(id: string, subscriberId?: string, externalId?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
156
209
|
|
|
210
|
+
/**
|
|
211
|
+
*
|
|
212
|
+
* @summary Delete a notification
|
|
213
|
+
* @param {string} id
|
|
214
|
+
* @param {*} [options] Override http request option.
|
|
215
|
+
* @throws {RequiredError}
|
|
216
|
+
* @memberof InboxApiInterface
|
|
217
|
+
*/
|
|
218
|
+
deleteSubscriberNotificationRaw(requestParameters: InboxApiDeleteSubscriberNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Delete a notification
|
|
222
|
+
*/
|
|
223
|
+
deleteSubscriberNotification(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
224
|
+
|
|
157
225
|
/**
|
|
158
226
|
* 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.
|
|
159
227
|
* @summary Generate a subscriber token
|
|
@@ -188,6 +256,52 @@ export interface InboxApiInterface {
|
|
|
188
256
|
*/
|
|
189
257
|
getInboxNotification(id: string, subscriberId?: string, externalId?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboxNotificationResponse>;
|
|
190
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Get notification preferences grouped by category for the authenticated subscriber.
|
|
261
|
+
* @summary Get subscriber preferences
|
|
262
|
+
* @param {*} [options] Override http request option.
|
|
263
|
+
* @throws {RequiredError}
|
|
264
|
+
* @memberof InboxApiInterface
|
|
265
|
+
*/
|
|
266
|
+
getSubscriberInboxPreferencesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Get notification preferences grouped by category for the authenticated subscriber.
|
|
270
|
+
* Get subscriber preferences
|
|
271
|
+
*/
|
|
272
|
+
getSubscriberInboxPreferences(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Get a specific notification by ID for the authenticated subscriber.
|
|
276
|
+
* @summary Get a notification
|
|
277
|
+
* @param {string} id
|
|
278
|
+
* @param {*} [options] Override http request option.
|
|
279
|
+
* @throws {RequiredError}
|
|
280
|
+
* @memberof InboxApiInterface
|
|
281
|
+
*/
|
|
282
|
+
getSubscriberNotificationRaw(requestParameters: InboxApiGetSubscriberNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Get a specific notification by ID for the authenticated subscriber.
|
|
286
|
+
* Get a notification
|
|
287
|
+
*/
|
|
288
|
+
getSubscriberNotification(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Get the unread notification count for the authenticated subscriber.
|
|
292
|
+
* @summary Get unread count
|
|
293
|
+
* @param {*} [options] Override http request option.
|
|
294
|
+
* @throws {RequiredError}
|
|
295
|
+
* @memberof InboxApiInterface
|
|
296
|
+
*/
|
|
297
|
+
getSubscriberUnreadCountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Get the unread notification count for the authenticated subscriber.
|
|
301
|
+
* Get unread count
|
|
302
|
+
*/
|
|
303
|
+
getSubscriberUnreadCount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
304
|
+
|
|
191
305
|
/**
|
|
192
306
|
* Get the count of unread in-app notifications for a subscriber.
|
|
193
307
|
* @summary Get unread notification count
|
|
@@ -228,6 +342,26 @@ export interface InboxApiInterface {
|
|
|
228
342
|
*/
|
|
229
343
|
listInbox(subscriberId?: string, externalId?: string, category?: string, includeRead?: boolean, includeArchived?: boolean, limit?: number, offset?: number, cursor?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboxListResponse>;
|
|
230
344
|
|
|
345
|
+
/**
|
|
346
|
+
* List notifications for the authenticated subscriber. Supports cursor-based pagination.
|
|
347
|
+
* @summary List subscriber notifications
|
|
348
|
+
* @param {string} [category] Filter by notification category
|
|
349
|
+
* @param {boolean} [includeRead] Include read notifications
|
|
350
|
+
* @param {boolean} [includeArchived] Include archived notifications
|
|
351
|
+
* @param {number} [limit]
|
|
352
|
+
* @param {string} [cursor] Pagination cursor from previous response
|
|
353
|
+
* @param {*} [options] Override http request option.
|
|
354
|
+
* @throws {RequiredError}
|
|
355
|
+
* @memberof InboxApiInterface
|
|
356
|
+
*/
|
|
357
|
+
listSubscriberNotificationsRaw(requestParameters: InboxApiListSubscriberNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* List notifications for the authenticated subscriber. Supports cursor-based pagination.
|
|
361
|
+
* List subscriber notifications
|
|
362
|
+
*/
|
|
363
|
+
listSubscriberNotifications(category?: string, includeRead?: boolean, includeArchived?: boolean, limit?: number, cursor?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
364
|
+
|
|
231
365
|
/**
|
|
232
366
|
* Mark all unread in-app notifications as read for a subscriber. Optionally filter by category.
|
|
233
367
|
* @summary Mark all notifications as read
|
|
@@ -244,6 +378,21 @@ export interface InboxApiInterface {
|
|
|
244
378
|
*/
|
|
245
379
|
markAllInboxRead(markAllInboxReadRequest: MarkAllInboxReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MarkAllReadResponse>;
|
|
246
380
|
|
|
381
|
+
/**
|
|
382
|
+
*
|
|
383
|
+
* @summary Mark all notifications as read
|
|
384
|
+
* @param {MarkAllSubscriberNotificationsReadRequest} [markAllSubscriberNotificationsReadRequest]
|
|
385
|
+
* @param {*} [options] Override http request option.
|
|
386
|
+
* @throws {RequiredError}
|
|
387
|
+
* @memberof InboxApiInterface
|
|
388
|
+
*/
|
|
389
|
+
markAllSubscriberNotificationsReadRaw(requestParameters: InboxApiMarkAllSubscriberNotificationsReadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Mark all notifications as read
|
|
393
|
+
*/
|
|
394
|
+
markAllSubscriberNotificationsRead(markAllSubscriberNotificationsReadRequest?: MarkAllSubscriberNotificationsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
395
|
+
|
|
247
396
|
/**
|
|
248
397
|
* Mark a specific in-app notification as read.
|
|
249
398
|
* @summary Mark notification as read
|
|
@@ -261,6 +410,21 @@ export interface InboxApiInterface {
|
|
|
261
410
|
*/
|
|
262
411
|
markInboxRead(id: string, markInboxReadRequest?: MarkInboxReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InboxNotificationResponse>;
|
|
263
412
|
|
|
413
|
+
/**
|
|
414
|
+
*
|
|
415
|
+
* @summary Mark notification as read
|
|
416
|
+
* @param {string} id
|
|
417
|
+
* @param {*} [options] Override http request option.
|
|
418
|
+
* @throws {RequiredError}
|
|
419
|
+
* @memberof InboxApiInterface
|
|
420
|
+
*/
|
|
421
|
+
markSubscriberNotificationReadRaw(requestParameters: InboxApiMarkSubscriberNotificationReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Mark notification as read
|
|
425
|
+
*/
|
|
426
|
+
markSubscriberNotificationRead(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
427
|
+
|
|
264
428
|
/**
|
|
265
429
|
* Send in-app notifications to multiple subscribers in a single request (max 100).
|
|
266
430
|
* @summary Send batch in-app notifications
|
|
@@ -293,6 +457,22 @@ export interface InboxApiInterface {
|
|
|
293
457
|
*/
|
|
294
458
|
sendInApp(sendInAppRequest: SendInAppRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SendInAppResponse>;
|
|
295
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Update notification channel preferences for specific categories or globally.
|
|
462
|
+
* @summary Update subscriber preferences
|
|
463
|
+
* @param {UpdateSubscriberPreferencesRequest} updateSubscriberPreferencesRequest
|
|
464
|
+
* @param {*} [options] Override http request option.
|
|
465
|
+
* @throws {RequiredError}
|
|
466
|
+
* @memberof InboxApiInterface
|
|
467
|
+
*/
|
|
468
|
+
updateSubscriberPreferencesRaw(requestParameters: InboxApiUpdateSubscriberPreferencesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Update notification channel preferences for specific categories or globally.
|
|
472
|
+
* Update subscriber preferences
|
|
473
|
+
*/
|
|
474
|
+
updateSubscriberPreferences(updateSubscriberPreferencesRequest: UpdateSubscriberPreferencesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
475
|
+
|
|
296
476
|
}
|
|
297
477
|
|
|
298
478
|
/**
|
|
@@ -342,6 +522,46 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
342
522
|
return await response.value();
|
|
343
523
|
}
|
|
344
524
|
|
|
525
|
+
/**
|
|
526
|
+
* Archive a notification
|
|
527
|
+
*/
|
|
528
|
+
async archiveSubscriberNotificationRaw(requestParameters: InboxApiArchiveSubscriberNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
529
|
+
if (requestParameters['id'] == null) {
|
|
530
|
+
throw new runtime.RequiredError(
|
|
531
|
+
'id',
|
|
532
|
+
'Required parameter "id" was null or undefined when calling archiveSubscriberNotification().'
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const queryParameters: any = {};
|
|
537
|
+
|
|
538
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
539
|
+
|
|
540
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
541
|
+
const token = this.configuration.accessToken;
|
|
542
|
+
const tokenString = await token("EndUserToken", []);
|
|
543
|
+
|
|
544
|
+
if (tokenString) {
|
|
545
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
const response = await this.request({
|
|
549
|
+
path: `/subscriber-inbox/{id}/archive`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
550
|
+
method: 'POST',
|
|
551
|
+
headers: headerParameters,
|
|
552
|
+
query: queryParameters,
|
|
553
|
+
}, initOverrides);
|
|
554
|
+
|
|
555
|
+
return new runtime.VoidApiResponse(response);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Archive a notification
|
|
560
|
+
*/
|
|
561
|
+
async archiveSubscriberNotification(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
562
|
+
await this.archiveSubscriberNotificationRaw({ id: id }, initOverrides);
|
|
563
|
+
}
|
|
564
|
+
|
|
345
565
|
/**
|
|
346
566
|
* Permanently delete an in-app notification.
|
|
347
567
|
* Delete a notification
|
|
@@ -388,6 +608,46 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
388
608
|
await this.deleteInboxNotificationRaw({ id: id, subscriberId: subscriberId, externalId: externalId }, initOverrides);
|
|
389
609
|
}
|
|
390
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Delete a notification
|
|
613
|
+
*/
|
|
614
|
+
async deleteSubscriberNotificationRaw(requestParameters: InboxApiDeleteSubscriberNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
615
|
+
if (requestParameters['id'] == null) {
|
|
616
|
+
throw new runtime.RequiredError(
|
|
617
|
+
'id',
|
|
618
|
+
'Required parameter "id" was null or undefined when calling deleteSubscriberNotification().'
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const queryParameters: any = {};
|
|
623
|
+
|
|
624
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
625
|
+
|
|
626
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
627
|
+
const token = this.configuration.accessToken;
|
|
628
|
+
const tokenString = await token("EndUserToken", []);
|
|
629
|
+
|
|
630
|
+
if (tokenString) {
|
|
631
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
const response = await this.request({
|
|
635
|
+
path: `/subscriber-inbox/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
636
|
+
method: 'DELETE',
|
|
637
|
+
headers: headerParameters,
|
|
638
|
+
query: queryParameters,
|
|
639
|
+
}, initOverrides);
|
|
640
|
+
|
|
641
|
+
return new runtime.VoidApiResponse(response);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Delete a notification
|
|
646
|
+
*/
|
|
647
|
+
async deleteSubscriberNotification(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
648
|
+
await this.deleteSubscriberNotificationRaw({ id: id }, initOverrides);
|
|
649
|
+
}
|
|
650
|
+
|
|
391
651
|
/**
|
|
392
652
|
* 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.
|
|
393
653
|
* Generate a subscriber token
|
|
@@ -477,6 +737,118 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
477
737
|
return await response.value();
|
|
478
738
|
}
|
|
479
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Get notification preferences grouped by category for the authenticated subscriber.
|
|
742
|
+
* Get subscriber preferences
|
|
743
|
+
*/
|
|
744
|
+
async getSubscriberInboxPreferencesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
745
|
+
const queryParameters: any = {};
|
|
746
|
+
|
|
747
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
748
|
+
|
|
749
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
750
|
+
const token = this.configuration.accessToken;
|
|
751
|
+
const tokenString = await token("EndUserToken", []);
|
|
752
|
+
|
|
753
|
+
if (tokenString) {
|
|
754
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
const response = await this.request({
|
|
758
|
+
path: `/subscriber-inbox/preferences`,
|
|
759
|
+
method: 'GET',
|
|
760
|
+
headers: headerParameters,
|
|
761
|
+
query: queryParameters,
|
|
762
|
+
}, initOverrides);
|
|
763
|
+
|
|
764
|
+
return new runtime.VoidApiResponse(response);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Get notification preferences grouped by category for the authenticated subscriber.
|
|
769
|
+
* Get subscriber preferences
|
|
770
|
+
*/
|
|
771
|
+
async getSubscriberInboxPreferences(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
772
|
+
await this.getSubscriberInboxPreferencesRaw(initOverrides);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Get a specific notification by ID for the authenticated subscriber.
|
|
777
|
+
* Get a notification
|
|
778
|
+
*/
|
|
779
|
+
async getSubscriberNotificationRaw(requestParameters: InboxApiGetSubscriberNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
780
|
+
if (requestParameters['id'] == null) {
|
|
781
|
+
throw new runtime.RequiredError(
|
|
782
|
+
'id',
|
|
783
|
+
'Required parameter "id" was null or undefined when calling getSubscriberNotification().'
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
const queryParameters: any = {};
|
|
788
|
+
|
|
789
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
790
|
+
|
|
791
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
792
|
+
const token = this.configuration.accessToken;
|
|
793
|
+
const tokenString = await token("EndUserToken", []);
|
|
794
|
+
|
|
795
|
+
if (tokenString) {
|
|
796
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
const response = await this.request({
|
|
800
|
+
path: `/subscriber-inbox/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
801
|
+
method: 'GET',
|
|
802
|
+
headers: headerParameters,
|
|
803
|
+
query: queryParameters,
|
|
804
|
+
}, initOverrides);
|
|
805
|
+
|
|
806
|
+
return new runtime.VoidApiResponse(response);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Get a specific notification by ID for the authenticated subscriber.
|
|
811
|
+
* Get a notification
|
|
812
|
+
*/
|
|
813
|
+
async getSubscriberNotification(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
814
|
+
await this.getSubscriberNotificationRaw({ id: id }, initOverrides);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Get the unread notification count for the authenticated subscriber.
|
|
819
|
+
* Get unread count
|
|
820
|
+
*/
|
|
821
|
+
async getSubscriberUnreadCountRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
822
|
+
const queryParameters: any = {};
|
|
823
|
+
|
|
824
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
825
|
+
|
|
826
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
827
|
+
const token = this.configuration.accessToken;
|
|
828
|
+
const tokenString = await token("EndUserToken", []);
|
|
829
|
+
|
|
830
|
+
if (tokenString) {
|
|
831
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
const response = await this.request({
|
|
835
|
+
path: `/subscriber-inbox/unread-count`,
|
|
836
|
+
method: 'GET',
|
|
837
|
+
headers: headerParameters,
|
|
838
|
+
query: queryParameters,
|
|
839
|
+
}, initOverrides);
|
|
840
|
+
|
|
841
|
+
return new runtime.VoidApiResponse(response);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Get the unread notification count for the authenticated subscriber.
|
|
846
|
+
* Get unread count
|
|
847
|
+
*/
|
|
848
|
+
async getSubscriberUnreadCount(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
849
|
+
await this.getSubscriberUnreadCountRaw(initOverrides);
|
|
850
|
+
}
|
|
851
|
+
|
|
480
852
|
/**
|
|
481
853
|
* Get the count of unread in-app notifications for a subscriber.
|
|
482
854
|
* Get unread notification count
|
|
@@ -581,6 +953,61 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
581
953
|
return await response.value();
|
|
582
954
|
}
|
|
583
955
|
|
|
956
|
+
/**
|
|
957
|
+
* List notifications for the authenticated subscriber. Supports cursor-based pagination.
|
|
958
|
+
* List subscriber notifications
|
|
959
|
+
*/
|
|
960
|
+
async listSubscriberNotificationsRaw(requestParameters: InboxApiListSubscriberNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
961
|
+
const queryParameters: any = {};
|
|
962
|
+
|
|
963
|
+
if (requestParameters['category'] != null) {
|
|
964
|
+
queryParameters['category'] = requestParameters['category'];
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
if (requestParameters['includeRead'] != null) {
|
|
968
|
+
queryParameters['include_read'] = requestParameters['includeRead'];
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
if (requestParameters['includeArchived'] != null) {
|
|
972
|
+
queryParameters['include_archived'] = requestParameters['includeArchived'];
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
if (requestParameters['limit'] != null) {
|
|
976
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
if (requestParameters['cursor'] != null) {
|
|
980
|
+
queryParameters['cursor'] = requestParameters['cursor'];
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
984
|
+
|
|
985
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
986
|
+
const token = this.configuration.accessToken;
|
|
987
|
+
const tokenString = await token("EndUserToken", []);
|
|
988
|
+
|
|
989
|
+
if (tokenString) {
|
|
990
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
const response = await this.request({
|
|
994
|
+
path: `/subscriber-inbox`,
|
|
995
|
+
method: 'GET',
|
|
996
|
+
headers: headerParameters,
|
|
997
|
+
query: queryParameters,
|
|
998
|
+
}, initOverrides);
|
|
999
|
+
|
|
1000
|
+
return new runtime.VoidApiResponse(response);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* List notifications for the authenticated subscriber. Supports cursor-based pagination.
|
|
1005
|
+
* List subscriber notifications
|
|
1006
|
+
*/
|
|
1007
|
+
async listSubscriberNotifications(category?: string, includeRead?: boolean, includeArchived?: boolean, limit?: number, cursor?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
1008
|
+
await this.listSubscriberNotificationsRaw({ category: category, includeRead: includeRead, includeArchived: includeArchived, limit: limit, cursor: cursor }, initOverrides);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
584
1011
|
/**
|
|
585
1012
|
* Mark all unread in-app notifications as read for a subscriber. Optionally filter by category.
|
|
586
1013
|
* Mark all notifications as read
|
|
@@ -623,6 +1050,42 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
623
1050
|
return await response.value();
|
|
624
1051
|
}
|
|
625
1052
|
|
|
1053
|
+
/**
|
|
1054
|
+
* Mark all notifications as read
|
|
1055
|
+
*/
|
|
1056
|
+
async markAllSubscriberNotificationsReadRaw(requestParameters: InboxApiMarkAllSubscriberNotificationsReadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
1057
|
+
const queryParameters: any = {};
|
|
1058
|
+
|
|
1059
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
1060
|
+
|
|
1061
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
1062
|
+
|
|
1063
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1064
|
+
const token = this.configuration.accessToken;
|
|
1065
|
+
const tokenString = await token("EndUserToken", []);
|
|
1066
|
+
|
|
1067
|
+
if (tokenString) {
|
|
1068
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
const response = await this.request({
|
|
1072
|
+
path: `/subscriber-inbox/read-all`,
|
|
1073
|
+
method: 'POST',
|
|
1074
|
+
headers: headerParameters,
|
|
1075
|
+
query: queryParameters,
|
|
1076
|
+
body: MarkAllSubscriberNotificationsReadRequestToJSON(requestParameters['markAllSubscriberNotificationsReadRequest']),
|
|
1077
|
+
}, initOverrides);
|
|
1078
|
+
|
|
1079
|
+
return new runtime.VoidApiResponse(response);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Mark all notifications as read
|
|
1084
|
+
*/
|
|
1085
|
+
async markAllSubscriberNotificationsRead(markAllSubscriberNotificationsReadRequest?: MarkAllSubscriberNotificationsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
1086
|
+
await this.markAllSubscriberNotificationsReadRaw({ markAllSubscriberNotificationsReadRequest: markAllSubscriberNotificationsReadRequest }, initOverrides);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
626
1089
|
/**
|
|
627
1090
|
* Mark a specific in-app notification as read.
|
|
628
1091
|
* Mark notification as read
|
|
@@ -665,6 +1128,46 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
665
1128
|
return await response.value();
|
|
666
1129
|
}
|
|
667
1130
|
|
|
1131
|
+
/**
|
|
1132
|
+
* Mark notification as read
|
|
1133
|
+
*/
|
|
1134
|
+
async markSubscriberNotificationReadRaw(requestParameters: InboxApiMarkSubscriberNotificationReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
1135
|
+
if (requestParameters['id'] == null) {
|
|
1136
|
+
throw new runtime.RequiredError(
|
|
1137
|
+
'id',
|
|
1138
|
+
'Required parameter "id" was null or undefined when calling markSubscriberNotificationRead().'
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
const queryParameters: any = {};
|
|
1143
|
+
|
|
1144
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
1145
|
+
|
|
1146
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1147
|
+
const token = this.configuration.accessToken;
|
|
1148
|
+
const tokenString = await token("EndUserToken", []);
|
|
1149
|
+
|
|
1150
|
+
if (tokenString) {
|
|
1151
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
const response = await this.request({
|
|
1155
|
+
path: `/subscriber-inbox/{id}/read`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
1156
|
+
method: 'POST',
|
|
1157
|
+
headers: headerParameters,
|
|
1158
|
+
query: queryParameters,
|
|
1159
|
+
}, initOverrides);
|
|
1160
|
+
|
|
1161
|
+
return new runtime.VoidApiResponse(response);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Mark notification as read
|
|
1166
|
+
*/
|
|
1167
|
+
async markSubscriberNotificationRead(id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
1168
|
+
await this.markSubscriberNotificationReadRaw({ id: id }, initOverrides);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
668
1171
|
/**
|
|
669
1172
|
* Send in-app notifications to multiple subscribers in a single request (max 100).
|
|
670
1173
|
* Send batch in-app notifications
|
|
@@ -749,4 +1252,49 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
|
|
|
749
1252
|
return await response.value();
|
|
750
1253
|
}
|
|
751
1254
|
|
|
1255
|
+
/**
|
|
1256
|
+
* Update notification channel preferences for specific categories or globally.
|
|
1257
|
+
* Update subscriber preferences
|
|
1258
|
+
*/
|
|
1259
|
+
async updateSubscriberPreferencesRaw(requestParameters: InboxApiUpdateSubscriberPreferencesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
1260
|
+
if (requestParameters['updateSubscriberPreferencesRequest'] == null) {
|
|
1261
|
+
throw new runtime.RequiredError(
|
|
1262
|
+
'updateSubscriberPreferencesRequest',
|
|
1263
|
+
'Required parameter "updateSubscriberPreferencesRequest" was null or undefined when calling updateSubscriberPreferences().'
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
const queryParameters: any = {};
|
|
1268
|
+
|
|
1269
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
1270
|
+
|
|
1271
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
1272
|
+
|
|
1273
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1274
|
+
const token = this.configuration.accessToken;
|
|
1275
|
+
const tokenString = await token("EndUserToken", []);
|
|
1276
|
+
|
|
1277
|
+
if (tokenString) {
|
|
1278
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const response = await this.request({
|
|
1282
|
+
path: `/subscriber-inbox/preferences`,
|
|
1283
|
+
method: 'PUT',
|
|
1284
|
+
headers: headerParameters,
|
|
1285
|
+
query: queryParameters,
|
|
1286
|
+
body: UpdateSubscriberPreferencesRequestToJSON(requestParameters['updateSubscriberPreferencesRequest']),
|
|
1287
|
+
}, initOverrides);
|
|
1288
|
+
|
|
1289
|
+
return new runtime.VoidApiResponse(response);
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Update notification channel preferences for specific categories or globally.
|
|
1294
|
+
* Update subscriber preferences
|
|
1295
|
+
*/
|
|
1296
|
+
async updateSubscriberPreferences(updateSubscriberPreferencesRequest: UpdateSubscriberPreferencesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
1297
|
+
await this.updateSubscriberPreferencesRaw({ updateSubscriberPreferencesRequest: updateSubscriberPreferencesRequest }, initOverrides);
|
|
1298
|
+
}
|
|
1299
|
+
|
|
752
1300
|
}
|