@novu/api 0.1.2 → 0.1.6
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 +18 -11
- package/docs/sdks/legacy/README.md +86 -0
- package/docs/sdks/messages/README.md +2 -8
- package/docs/sdks/notifications/README.md +2 -6
- package/docs/sdks/novunotifications/README.md +0 -6
- package/docs/sdks/preferences/README.md +123 -37
- package/docs/sdks/subscribers/README.md +7 -7
- package/docs/sdks/topics/README.md +0 -4
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.d.ts +14 -0
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.d.ts.map +1 -0
- package/funcs/{subscribersPreferencesUpdateGlobal.js → subscribersPreferencesLegacyUpdateGlobal.js} +4 -4
- package/funcs/subscribersPreferencesLegacyUpdateGlobal.js.map +1 -0
- package/funcs/{subscribersPreferencesUpdateGlobal.d.ts → subscribersPreferencesListLegacy.d.ts} +5 -4
- package/funcs/subscribersPreferencesListLegacy.d.ts.map +1 -0
- package/funcs/{subscribersPreferencesList.js → subscribersPreferencesListLegacy.js} +6 -4
- package/funcs/subscribersPreferencesListLegacy.js.map +1 -0
- package/funcs/subscribersPreferencesRetrieve.d.ts +16 -0
- package/funcs/subscribersPreferencesRetrieve.d.ts.map +1 -0
- package/funcs/subscribersPreferencesRetrieve.js +141 -0
- package/funcs/subscribersPreferencesRetrieve.js.map +1 -0
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.d.ts +15 -0
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.d.ts.map +1 -0
- package/funcs/{subscribersPreferencesRetrieveByLevel.js → subscribersPreferencesRetrieveByLevelLegacy.js} +6 -4
- package/funcs/subscribersPreferencesRetrieveByLevelLegacy.js.map +1 -0
- package/funcs/subscribersPreferencesUpdate.d.ts +6 -2
- package/funcs/subscribersPreferencesUpdate.d.ts.map +1 -1
- package/funcs/subscribersPreferencesUpdate.js +18 -12
- package/funcs/subscribersPreferencesUpdate.js.map +1 -1
- package/funcs/subscribersPreferencesUpdateLegacy.d.ts +13 -0
- package/funcs/subscribersPreferencesUpdateLegacy.d.ts.map +1 -0
- package/funcs/subscribersPreferencesUpdateLegacy.js +139 -0
- package/funcs/subscribersPreferencesUpdateLegacy.js.map +1 -0
- package/funcs/{subscribersUpdate.d.ts → subscribersUpdateLegacy.d.ts} +2 -2
- package/funcs/subscribersUpdateLegacy.d.ts.map +1 -0
- package/funcs/{subscribersUpdate.js → subscribersUpdateLegacy.js} +4 -4
- package/funcs/subscribersUpdateLegacy.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/getsubscriberpreferencesdto.d.ts +39 -0
- package/models/components/getsubscriberpreferencesdto.d.ts.map +1 -0
- package/models/components/getsubscriberpreferencesdto.js +63 -0
- package/models/components/getsubscriberpreferencesdto.js.map +1 -0
- package/models/components/globalpreferencedto.d.ts +38 -0
- package/models/components/globalpreferencedto.d.ts.map +1 -0
- package/models/components/globalpreferencedto.js +62 -0
- package/models/components/globalpreferencedto.js.map +1 -0
- package/models/components/index.d.ts +7 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +7 -0
- package/models/components/index.js.map +1 -1
- package/models/components/overrides.d.ts +112 -0
- package/models/components/overrides.d.ts.map +1 -0
- package/models/components/overrides.js +110 -0
- package/models/components/overrides.js.map +1 -0
- package/models/components/patchpreferencechannelsdto.d.ts +52 -0
- package/models/components/patchpreferencechannelsdto.d.ts.map +1 -0
- package/models/components/patchpreferencechannelsdto.js +76 -0
- package/models/components/patchpreferencechannelsdto.js.map +1 -0
- package/models/components/patchsubscriberpreferencesdto.d.ts +38 -0
- package/models/components/patchsubscriberpreferencesdto.d.ts.map +1 -0
- package/models/components/patchsubscriberpreferencesdto.js +62 -0
- package/models/components/patchsubscriberpreferencesdto.js.map +1 -0
- package/models/components/triggereventtoallrequestdto.d.ts +15 -15
- package/models/components/triggereventtoallrequestdto.d.ts.map +1 -1
- package/models/components/triggereventtoallrequestdto.js +20 -18
- package/models/components/triggereventtoallrequestdto.js.map +1 -1
- package/models/components/workflowinfodto.d.ts +42 -0
- package/models/components/workflowinfodto.d.ts.map +1 -0
- package/models/components/workflowinfodto.js +63 -0
- package/models/components/workflowinfodto.js.map +1 -0
- package/models/components/workflowpreferencedto.d.ts +50 -0
- package/models/components/workflowpreferencedto.d.ts.map +1 -0
- package/models/components/workflowpreferencedto.js +68 -0
- package/models/components/workflowpreferencedto.js.map +1 -0
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/subscriberscontrollergetsubscriberpreferences.d.ts +66 -0
- package/models/operations/subscriberscontrollergetsubscriberpreferences.d.ts.map +1 -0
- package/models/operations/subscriberscontrollergetsubscriberpreferences.js +110 -0
- package/models/operations/subscriberscontrollergetsubscriberpreferences.js.map +1 -0
- package/models/operations/subscriberscontrollerupdatesubscriberpreferences.d.ts +68 -0
- package/models/operations/subscriberscontrollerupdatesubscriberpreferences.d.ts.map +1 -0
- package/models/operations/subscriberscontrollerupdatesubscriberpreferences.js +118 -0
- package/models/operations/subscriberscontrollerupdatesubscriberpreferences.js.map +1 -0
- package/package.json +1 -1
- package/sdk/legacy.d.ts +10 -0
- package/sdk/legacy.d.ts.map +1 -0
- package/sdk/legacy.js +19 -0
- package/sdk/legacy.js.map +1 -0
- package/sdk/preferences.d.ts +24 -7
- package/sdk/preferences.d.ts.map +1 -1
- package/sdk/preferences.js +35 -14
- package/sdk/preferences.js.map +1 -1
- package/sdk/subscribers.d.ts +1 -1
- package/sdk/subscribers.d.ts.map +1 -1
- package/sdk/subscribers.js +3 -3
- package/sdk/subscribers.js.map +1 -1
- package/sources/json-development.json +1225 -57
- package/src/funcs/{subscribersPreferencesUpdateGlobal.ts → subscribersPreferencesLegacyUpdateGlobal.ts} +1 -1
- package/src/funcs/{subscribersPreferencesList.ts → subscribersPreferencesListLegacy.ts} +3 -1
- package/src/funcs/subscribersPreferencesRetrieve.ts +203 -0
- package/src/funcs/{subscribersPreferencesRetrieveByLevel.ts → subscribersPreferencesRetrieveByLevelLegacy.ts} +3 -1
- package/src/funcs/subscribersPreferencesUpdate.ts +27 -20
- package/src/funcs/subscribersPreferencesUpdateLegacy.ts +202 -0
- package/src/funcs/{subscribersUpdate.ts → subscribersUpdateLegacy.ts} +1 -1
- package/src/lib/config.ts +3 -3
- package/src/models/components/getsubscriberpreferencesdto.ts +90 -0
- package/src/models/components/globalpreferencedto.ts +82 -0
- package/src/models/components/index.ts +7 -0
- package/src/models/components/overrides.ts +141 -0
- package/src/models/components/patchpreferencechannelsdto.ts +106 -0
- package/src/models/components/patchsubscriberpreferencesdto.ts +84 -0
- package/src/models/components/triggereventtoallrequestdto.ts +35 -24
- package/src/models/components/workflowinfodto.ts +81 -0
- package/src/models/components/workflowpreferencedto.ts +108 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/subscriberscontrollergetsubscriberpreferences.ts +183 -0
- package/src/models/operations/subscriberscontrollerupdatesubscriberpreferences.ts +189 -0
- package/src/sdk/legacy.ts +32 -0
- package/src/sdk/preferences.ts +58 -26
- package/src/sdk/subscribers.ts +3 -3
- package/funcs/subscribersPreferencesList.d.ts +0 -13
- package/funcs/subscribersPreferencesList.d.ts.map +0 -1
- package/funcs/subscribersPreferencesList.js.map +0 -1
- package/funcs/subscribersPreferencesRetrieveByLevel.d.ts +0 -13
- package/funcs/subscribersPreferencesRetrieveByLevel.d.ts.map +0 -1
- package/funcs/subscribersPreferencesRetrieveByLevel.js.map +0 -1
- package/funcs/subscribersPreferencesUpdateGlobal.d.ts.map +0 -1
- package/funcs/subscribersPreferencesUpdateGlobal.js.map +0 -1
- package/funcs/subscribersUpdate.d.ts.map +0 -1
- package/funcs/subscribersUpdate.js.map +0 -1
package/README.md
CHANGED
|
@@ -295,7 +295,7 @@ run();
|
|
|
295
295
|
* [list](docs/sdks/subscribers/README.md#list) - Get subscribers
|
|
296
296
|
* [create](docs/sdks/subscribers/README.md#create) - Create subscriber
|
|
297
297
|
* [retrieveLegacy](docs/sdks/subscribers/README.md#retrievelegacy) - Get subscriber
|
|
298
|
-
* [
|
|
298
|
+
* [updateLegacy](docs/sdks/subscribers/README.md#updatelegacy) - Update subscriber
|
|
299
299
|
* [~~deleteLegacy~~](docs/sdks/subscribers/README.md#deletelegacy) - Delete subscriber :warning: **Deprecated**
|
|
300
300
|
* [createBulk](docs/sdks/subscribers/README.md#createbulk) - Bulk create subscribers
|
|
301
301
|
* [search](docs/sdks/subscribers/README.md#search) - Search for subscribers
|
|
@@ -327,10 +327,15 @@ run();
|
|
|
327
327
|
|
|
328
328
|
#### [subscribers.preferences](docs/sdks/preferences/README.md)
|
|
329
329
|
|
|
330
|
-
* [
|
|
331
|
-
* [
|
|
332
|
-
* [
|
|
333
|
-
* [
|
|
330
|
+
* [~~listLegacy~~](docs/sdks/preferences/README.md#listlegacy) - Get subscriber preferences :warning: **Deprecated**
|
|
331
|
+
* [~~retrieveByLevelLegacy~~](docs/sdks/preferences/README.md#retrievebylevellegacy) - Get subscriber preferences by level :warning: **Deprecated**
|
|
332
|
+
* [updateLegacy](docs/sdks/preferences/README.md#updatelegacy) - Update subscriber preference
|
|
333
|
+
* [retrieve](docs/sdks/preferences/README.md#retrieve) - Get subscriber preferences
|
|
334
|
+
* [update](docs/sdks/preferences/README.md#update) - Update subscriber global or workflow specific preferences
|
|
335
|
+
|
|
336
|
+
#### [subscribers.preferences.legacy](docs/sdks/legacy/README.md)
|
|
337
|
+
|
|
338
|
+
* [updateGlobal](docs/sdks/legacy/README.md#updateglobal) - Update subscriber global preferences
|
|
334
339
|
|
|
335
340
|
#### [subscribers.properties](docs/sdks/properties/README.md)
|
|
336
341
|
|
|
@@ -398,15 +403,15 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
|
398
403
|
- [`subscribersNotificationsFeed`](docs/sdks/novunotifications/README.md#feed) - Get in-app notification feed for a particular subscriber
|
|
399
404
|
- [`subscribersNotificationsUnseenCount`](docs/sdks/novunotifications/README.md#unseencount) - Get the unseen in-app notifications count for subscribers feed
|
|
400
405
|
- [`subscribersPatch`](docs/sdks/subscribers/README.md#patch) - Patch subscriber
|
|
401
|
-
- [`
|
|
402
|
-
- [`
|
|
403
|
-
- [`subscribersPreferencesUpdate`](docs/sdks/preferences/README.md#update) - Update subscriber
|
|
404
|
-
- [`
|
|
406
|
+
- [`subscribersPreferencesLegacyUpdateGlobal`](docs/sdks/legacy/README.md#updateglobal) - Update subscriber global preferences
|
|
407
|
+
- [`subscribersPreferencesRetrieve`](docs/sdks/preferences/README.md#retrieve) - Get subscriber preferences
|
|
408
|
+
- [`subscribersPreferencesUpdate`](docs/sdks/preferences/README.md#update) - Update subscriber global or workflow specific preferences
|
|
409
|
+
- [`subscribersPreferencesUpdateLegacy`](docs/sdks/preferences/README.md#updatelegacy) - Update subscriber preference
|
|
405
410
|
- [`subscribersPropertiesUpdateOnlineFlag`](docs/sdks/properties/README.md#updateonlineflag) - Update subscriber online status
|
|
406
411
|
- [`subscribersRetrieve`](docs/sdks/subscribers/README.md#retrieve) - Get subscriber
|
|
407
412
|
- [`subscribersRetrieveLegacy`](docs/sdks/subscribers/README.md#retrievelegacy) - Get subscriber
|
|
408
413
|
- [`subscribersSearch`](docs/sdks/subscribers/README.md#search) - Search for subscribers
|
|
409
|
-
- [`
|
|
414
|
+
- [`subscribersUpdateLegacy`](docs/sdks/subscribers/README.md#updatelegacy) - Update subscriber
|
|
410
415
|
- [`topicsCreate`](docs/sdks/topics/README.md#create) - Topic creation
|
|
411
416
|
- [`topicsDelete`](docs/sdks/topics/README.md#delete) - Delete topic
|
|
412
417
|
- [`topicsList`](docs/sdks/topics/README.md#list) - Get topic list filtered
|
|
@@ -419,6 +424,8 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
|
419
424
|
- [`triggerBroadcast`](docs/sdks/novu/README.md#triggerbroadcast) - Broadcast event to all
|
|
420
425
|
- [`triggerBulk`](docs/sdks/novu/README.md#triggerbulk) - Bulk trigger event
|
|
421
426
|
- ~~[`subscribersDeleteLegacy`](docs/sdks/subscribers/README.md#deletelegacy)~~ - Delete subscriber :warning: **Deprecated**
|
|
427
|
+
- ~~[`subscribersPreferencesListLegacy`](docs/sdks/preferences/README.md#listlegacy)~~ - Get subscriber preferences :warning: **Deprecated**
|
|
428
|
+
- ~~[`subscribersPreferencesRetrieveByLevelLegacy`](docs/sdks/preferences/README.md#retrievebylevellegacy)~~ - Get subscriber preferences by level :warning: **Deprecated**
|
|
422
429
|
|
|
423
430
|
</details>
|
|
424
431
|
<!-- End Standalone functions [standalone-funcs] -->
|
|
@@ -443,7 +450,7 @@ const novu = new Novu({
|
|
|
443
450
|
});
|
|
444
451
|
|
|
445
452
|
async function run() {
|
|
446
|
-
const result = await novu.subscribers.list(
|
|
453
|
+
const result = await novu.subscribers.list();
|
|
447
454
|
|
|
448
455
|
for await (const page of result) {
|
|
449
456
|
// Handle the page
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Legacy
|
|
2
|
+
(*subscribers.preferences.legacy*)
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
### Available Operations
|
|
7
|
+
|
|
8
|
+
* [updateGlobal](#updateglobal) - Update subscriber global preferences
|
|
9
|
+
|
|
10
|
+
## updateGlobal
|
|
11
|
+
|
|
12
|
+
Update subscriber global preferences
|
|
13
|
+
|
|
14
|
+
### Example Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { Novu } from "@novu/api";
|
|
18
|
+
|
|
19
|
+
const novu = new Novu({
|
|
20
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
async function run() {
|
|
24
|
+
const result = await novu.subscribers.preferences.legacy.updateGlobal({}, "<id>");
|
|
25
|
+
|
|
26
|
+
// Handle the result
|
|
27
|
+
console.log(result);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
run();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Standalone function
|
|
34
|
+
|
|
35
|
+
The standalone function version of this method:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { NovuCore } from "@novu/api/core.js";
|
|
39
|
+
import { subscribersPreferencesLegacyUpdateGlobal } from "@novu/api/funcs/subscribersPreferencesLegacyUpdateGlobal.js";
|
|
40
|
+
|
|
41
|
+
// Use `NovuCore` for best tree-shaking performance.
|
|
42
|
+
// You can create one instance of it to use across an application.
|
|
43
|
+
const novu = new NovuCore({
|
|
44
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
async function run() {
|
|
48
|
+
const res = await subscribersPreferencesLegacyUpdateGlobal(novu, {}, "<id>");
|
|
49
|
+
|
|
50
|
+
if (!res.ok) {
|
|
51
|
+
throw res.error;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { value: result } = res;
|
|
55
|
+
|
|
56
|
+
// Handle the result
|
|
57
|
+
console.log(result);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
run();
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Parameters
|
|
64
|
+
|
|
65
|
+
| Parameter | Type | Required | Description |
|
|
66
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
67
|
+
| `subscriberId` | *string* | :heavy_check_mark: | N/A |
|
|
68
|
+
| `updateSubscriberGlobalPreferencesRequestDto` | [components.UpdateSubscriberGlobalPreferencesRequestDto](../../models/components/updatesubscriberglobalpreferencesrequestdto.md) | :heavy_check_mark: | N/A |
|
|
69
|
+
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
|
|
70
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
71
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
72
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
73
|
+
|
|
74
|
+
### Response
|
|
75
|
+
|
|
76
|
+
**Promise\<[operations.SubscribersV1ControllerUpdateSubscriberGlobalPreferencesResponse](../../models/operations/subscribersv1controllerupdatesubscriberglobalpreferencesresponse.md)\>**
|
|
77
|
+
|
|
78
|
+
### Errors
|
|
79
|
+
|
|
80
|
+
| Error Type | Status Code | Content Type |
|
|
81
|
+
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
|
82
|
+
| errors.ErrorDto | 414 | application/json |
|
|
83
|
+
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
|
|
84
|
+
| errors.ValidationErrorDto | 422 | application/json |
|
|
85
|
+
| errors.ErrorDto | 500 | application/json |
|
|
86
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
@@ -26,10 +26,7 @@ const novu = new Novu({
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
async function run() {
|
|
29
|
-
const result = await novu.messages.retrieve({
|
|
30
|
-
page: 0,
|
|
31
|
-
limit: 10,
|
|
32
|
-
});
|
|
29
|
+
const result = await novu.messages.retrieve({});
|
|
33
30
|
|
|
34
31
|
// Handle the result
|
|
35
32
|
console.log(result);
|
|
@@ -53,10 +50,7 @@ const novu = new NovuCore({
|
|
|
53
50
|
});
|
|
54
51
|
|
|
55
52
|
async function run() {
|
|
56
|
-
const res = await messagesRetrieve(novu, {
|
|
57
|
-
page: 0,
|
|
58
|
-
limit: 10,
|
|
59
|
-
});
|
|
53
|
+
const res = await messagesRetrieve(novu, {});
|
|
60
54
|
|
|
61
55
|
if (!res.ok) {
|
|
62
56
|
throw res.error;
|
|
@@ -22,9 +22,7 @@ const novu = new Novu({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
async function run() {
|
|
25
|
-
const result = await novu.notifications.list({
|
|
26
|
-
page: 0,
|
|
27
|
-
});
|
|
25
|
+
const result = await novu.notifications.list({});
|
|
28
26
|
|
|
29
27
|
// Handle the result
|
|
30
28
|
console.log(result);
|
|
@@ -48,9 +46,7 @@ const novu = new NovuCore({
|
|
|
48
46
|
});
|
|
49
47
|
|
|
50
48
|
async function run() {
|
|
51
|
-
const res = await notificationsList(novu, {
|
|
52
|
-
page: 0,
|
|
53
|
-
});
|
|
49
|
+
const res = await notificationsList(novu, {});
|
|
54
50
|
|
|
55
51
|
if (!res.ok) {
|
|
56
52
|
throw res.error;
|
|
@@ -24,7 +24,6 @@ const novu = new Novu({
|
|
|
24
24
|
async function run() {
|
|
25
25
|
const result = await novu.subscribers.notifications.feed({
|
|
26
26
|
subscriberId: "<id>",
|
|
27
|
-
limit: 10,
|
|
28
27
|
payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=",
|
|
29
28
|
});
|
|
30
29
|
|
|
@@ -52,7 +51,6 @@ const novu = new NovuCore({
|
|
|
52
51
|
async function run() {
|
|
53
52
|
const res = await subscribersNotificationsFeed(novu, {
|
|
54
53
|
subscriberId: "<id>",
|
|
55
|
-
limit: 10,
|
|
56
54
|
payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=",
|
|
57
55
|
});
|
|
58
56
|
|
|
@@ -108,8 +106,6 @@ const novu = new Novu({
|
|
|
108
106
|
async function run() {
|
|
109
107
|
const result = await novu.subscribers.notifications.unseenCount({
|
|
110
108
|
subscriberId: "<id>",
|
|
111
|
-
seen: false,
|
|
112
|
-
limit: 100,
|
|
113
109
|
});
|
|
114
110
|
|
|
115
111
|
// Handle the result
|
|
@@ -136,8 +132,6 @@ const novu = new NovuCore({
|
|
|
136
132
|
async function run() {
|
|
137
133
|
const res = await subscribersNotificationsUnseenCount(novu, {
|
|
138
134
|
subscriberId: "<id>",
|
|
139
|
-
seen: false,
|
|
140
|
-
limit: 100,
|
|
141
135
|
});
|
|
142
136
|
|
|
143
137
|
if (!res.ok) {
|
|
@@ -5,15 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
### Available Operations
|
|
7
7
|
|
|
8
|
-
* [
|
|
9
|
-
* [
|
|
10
|
-
* [
|
|
11
|
-
* [
|
|
8
|
+
* [~~listLegacy~~](#listlegacy) - Get subscriber preferences :warning: **Deprecated**
|
|
9
|
+
* [~~retrieveByLevelLegacy~~](#retrievebylevellegacy) - Get subscriber preferences by level :warning: **Deprecated**
|
|
10
|
+
* [updateLegacy](#updatelegacy) - Update subscriber preference
|
|
11
|
+
* [retrieve](#retrieve) - Get subscriber preferences
|
|
12
|
+
* [update](#update) - Update subscriber global or workflow specific preferences
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
+
## ~~listLegacy~~
|
|
14
15
|
|
|
15
16
|
Get subscriber preferences
|
|
16
17
|
|
|
18
|
+
> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
19
|
+
|
|
17
20
|
### Example Usage
|
|
18
21
|
|
|
19
22
|
```typescript
|
|
@@ -24,7 +27,7 @@ const novu = new Novu({
|
|
|
24
27
|
});
|
|
25
28
|
|
|
26
29
|
async function run() {
|
|
27
|
-
const result = await novu.subscribers.preferences.
|
|
30
|
+
const result = await novu.subscribers.preferences.listLegacy("<id>");
|
|
28
31
|
|
|
29
32
|
// Handle the result
|
|
30
33
|
console.log(result);
|
|
@@ -39,7 +42,7 @@ The standalone function version of this method:
|
|
|
39
42
|
|
|
40
43
|
```typescript
|
|
41
44
|
import { NovuCore } from "@novu/api/core.js";
|
|
42
|
-
import {
|
|
45
|
+
import { subscribersPreferencesListLegacy } from "@novu/api/funcs/subscribersPreferencesListLegacy.js";
|
|
43
46
|
|
|
44
47
|
// Use `NovuCore` for best tree-shaking performance.
|
|
45
48
|
// You can create one instance of it to use across an application.
|
|
@@ -48,7 +51,7 @@ const novu = new NovuCore({
|
|
|
48
51
|
});
|
|
49
52
|
|
|
50
53
|
async function run() {
|
|
51
|
-
const res = await
|
|
54
|
+
const res = await subscribersPreferencesListLegacy(novu, "<id>");
|
|
52
55
|
|
|
53
56
|
if (!res.ok) {
|
|
54
57
|
throw res.error;
|
|
@@ -88,9 +91,11 @@ run();
|
|
|
88
91
|
| errors.ErrorDto | 500 | application/json |
|
|
89
92
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
90
93
|
|
|
91
|
-
##
|
|
94
|
+
## ~~retrieveByLevelLegacy~~
|
|
95
|
+
|
|
96
|
+
Get subscriber preferences by level
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
94
99
|
|
|
95
100
|
### Example Usage
|
|
96
101
|
|
|
@@ -102,7 +107,10 @@ const novu = new Novu({
|
|
|
102
107
|
});
|
|
103
108
|
|
|
104
109
|
async function run() {
|
|
105
|
-
const result = await novu.subscribers.preferences.
|
|
110
|
+
const result = await novu.subscribers.preferences.retrieveByLevelLegacy({
|
|
111
|
+
preferenceLevel: "template",
|
|
112
|
+
subscriberId: "<id>",
|
|
113
|
+
});
|
|
106
114
|
|
|
107
115
|
// Handle the result
|
|
108
116
|
console.log(result);
|
|
@@ -117,7 +125,7 @@ The standalone function version of this method:
|
|
|
117
125
|
|
|
118
126
|
```typescript
|
|
119
127
|
import { NovuCore } from "@novu/api/core.js";
|
|
120
|
-
import {
|
|
128
|
+
import { subscribersPreferencesRetrieveByLevelLegacy } from "@novu/api/funcs/subscribersPreferencesRetrieveByLevelLegacy.js";
|
|
121
129
|
|
|
122
130
|
// Use `NovuCore` for best tree-shaking performance.
|
|
123
131
|
// You can create one instance of it to use across an application.
|
|
@@ -126,7 +134,10 @@ const novu = new NovuCore({
|
|
|
126
134
|
});
|
|
127
135
|
|
|
128
136
|
async function run() {
|
|
129
|
-
const res = await
|
|
137
|
+
const res = await subscribersPreferencesRetrieveByLevelLegacy(novu, {
|
|
138
|
+
preferenceLevel: "template",
|
|
139
|
+
subscriberId: "<id>",
|
|
140
|
+
});
|
|
130
141
|
|
|
131
142
|
if (!res.ok) {
|
|
132
143
|
throw res.error;
|
|
@@ -145,16 +156,14 @@ run();
|
|
|
145
156
|
|
|
146
157
|
| Parameter | Type | Required | Description |
|
|
147
158
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
148
|
-
| `
|
|
149
|
-
| `updateSubscriberGlobalPreferencesRequestDto` | [components.UpdateSubscriberGlobalPreferencesRequestDto](../../models/components/updatesubscriberglobalpreferencesrequestdto.md) | :heavy_check_mark: | N/A |
|
|
150
|
-
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
|
|
159
|
+
| `request` | [operations.SubscribersV1ControllerGetSubscriberPreferenceByLevelRequest](../../models/operations/subscribersv1controllergetsubscriberpreferencebylevelrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
151
160
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
152
161
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
153
162
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
154
163
|
|
|
155
164
|
### Response
|
|
156
165
|
|
|
157
|
-
**Promise\<[operations.
|
|
166
|
+
**Promise\<[operations.SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse](../../models/operations/subscribersv1controllergetsubscriberpreferencebylevelresponse.md)\>**
|
|
158
167
|
|
|
159
168
|
### Errors
|
|
160
169
|
|
|
@@ -166,9 +175,9 @@ run();
|
|
|
166
175
|
| errors.ErrorDto | 500 | application/json |
|
|
167
176
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
168
177
|
|
|
169
|
-
##
|
|
178
|
+
## updateLegacy
|
|
170
179
|
|
|
171
|
-
|
|
180
|
+
Update subscriber preference
|
|
172
181
|
|
|
173
182
|
### Example Usage
|
|
174
183
|
|
|
@@ -180,9 +189,10 @@ const novu = new Novu({
|
|
|
180
189
|
});
|
|
181
190
|
|
|
182
191
|
async function run() {
|
|
183
|
-
const result = await novu.subscribers.preferences.
|
|
184
|
-
preferenceLevel: "template",
|
|
192
|
+
const result = await novu.subscribers.preferences.updateLegacy({
|
|
185
193
|
subscriberId: "<id>",
|
|
194
|
+
workflowId: "<id>",
|
|
195
|
+
updateSubscriberPreferenceRequestDto: {},
|
|
186
196
|
});
|
|
187
197
|
|
|
188
198
|
// Handle the result
|
|
@@ -198,7 +208,7 @@ The standalone function version of this method:
|
|
|
198
208
|
|
|
199
209
|
```typescript
|
|
200
210
|
import { NovuCore } from "@novu/api/core.js";
|
|
201
|
-
import {
|
|
211
|
+
import { subscribersPreferencesUpdateLegacy } from "@novu/api/funcs/subscribersPreferencesUpdateLegacy.js";
|
|
202
212
|
|
|
203
213
|
// Use `NovuCore` for best tree-shaking performance.
|
|
204
214
|
// You can create one instance of it to use across an application.
|
|
@@ -207,9 +217,10 @@ const novu = new NovuCore({
|
|
|
207
217
|
});
|
|
208
218
|
|
|
209
219
|
async function run() {
|
|
210
|
-
const res = await
|
|
211
|
-
preferenceLevel: "template",
|
|
220
|
+
const res = await subscribersPreferencesUpdateLegacy(novu, {
|
|
212
221
|
subscriberId: "<id>",
|
|
222
|
+
workflowId: "<id>",
|
|
223
|
+
updateSubscriberPreferenceRequestDto: {},
|
|
213
224
|
});
|
|
214
225
|
|
|
215
226
|
if (!res.ok) {
|
|
@@ -229,14 +240,91 @@ run();
|
|
|
229
240
|
|
|
230
241
|
| Parameter | Type | Required | Description |
|
|
231
242
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
232
|
-
| `request` | [operations.
|
|
243
|
+
| `request` | [operations.SubscribersV1ControllerUpdateSubscriberPreferenceRequest](../../models/operations/subscribersv1controllerupdatesubscriberpreferencerequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
233
244
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
234
245
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
235
246
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
236
247
|
|
|
237
248
|
### Response
|
|
238
249
|
|
|
239
|
-
**Promise\<[operations.
|
|
250
|
+
**Promise\<[operations.SubscribersV1ControllerUpdateSubscriberPreferenceResponse](../../models/operations/subscribersv1controllerupdatesubscriberpreferenceresponse.md)\>**
|
|
251
|
+
|
|
252
|
+
### Errors
|
|
253
|
+
|
|
254
|
+
| Error Type | Status Code | Content Type |
|
|
255
|
+
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
|
256
|
+
| errors.ErrorDto | 414 | application/json |
|
|
257
|
+
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
|
|
258
|
+
| errors.ValidationErrorDto | 422 | application/json |
|
|
259
|
+
| errors.ErrorDto | 500 | application/json |
|
|
260
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
261
|
+
|
|
262
|
+
## retrieve
|
|
263
|
+
|
|
264
|
+
Get subscriber global and workflow specific preferences
|
|
265
|
+
|
|
266
|
+
### Example Usage
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
import { Novu } from "@novu/api";
|
|
270
|
+
|
|
271
|
+
const novu = new Novu({
|
|
272
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
async function run() {
|
|
276
|
+
const result = await novu.subscribers.preferences.retrieve("<id>");
|
|
277
|
+
|
|
278
|
+
// Handle the result
|
|
279
|
+
console.log(result);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
run();
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Standalone function
|
|
286
|
+
|
|
287
|
+
The standalone function version of this method:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { NovuCore } from "@novu/api/core.js";
|
|
291
|
+
import { subscribersPreferencesRetrieve } from "@novu/api/funcs/subscribersPreferencesRetrieve.js";
|
|
292
|
+
|
|
293
|
+
// Use `NovuCore` for best tree-shaking performance.
|
|
294
|
+
// You can create one instance of it to use across an application.
|
|
295
|
+
const novu = new NovuCore({
|
|
296
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
async function run() {
|
|
300
|
+
const res = await subscribersPreferencesRetrieve(novu, "<id>");
|
|
301
|
+
|
|
302
|
+
if (!res.ok) {
|
|
303
|
+
throw res.error;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const { value: result } = res;
|
|
307
|
+
|
|
308
|
+
// Handle the result
|
|
309
|
+
console.log(result);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
run();
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Parameters
|
|
316
|
+
|
|
317
|
+
| Parameter | Type | Required | Description |
|
|
318
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
319
|
+
| `subscriberId` | *string* | :heavy_check_mark: | N/A |
|
|
320
|
+
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
|
|
321
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
322
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
323
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
324
|
+
|
|
325
|
+
### Response
|
|
326
|
+
|
|
327
|
+
**Promise\<[operations.SubscribersControllerGetSubscriberPreferencesResponse](../../models/operations/subscriberscontrollergetsubscriberpreferencesresponse.md)\>**
|
|
240
328
|
|
|
241
329
|
### Errors
|
|
242
330
|
|
|
@@ -250,7 +338,7 @@ run();
|
|
|
250
338
|
|
|
251
339
|
## update
|
|
252
340
|
|
|
253
|
-
Update subscriber
|
|
341
|
+
Update subscriber global or workflow specific preferences
|
|
254
342
|
|
|
255
343
|
### Example Usage
|
|
256
344
|
|
|
@@ -263,10 +351,8 @@ const novu = new Novu({
|
|
|
263
351
|
|
|
264
352
|
async function run() {
|
|
265
353
|
const result = await novu.subscribers.preferences.update({
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
updateSubscriberPreferenceRequestDto: {},
|
|
269
|
-
});
|
|
354
|
+
channels: {},
|
|
355
|
+
}, "<id>");
|
|
270
356
|
|
|
271
357
|
// Handle the result
|
|
272
358
|
console.log(result);
|
|
@@ -291,10 +377,8 @@ const novu = new NovuCore({
|
|
|
291
377
|
|
|
292
378
|
async function run() {
|
|
293
379
|
const res = await subscribersPreferencesUpdate(novu, {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
updateSubscriberPreferenceRequestDto: {},
|
|
297
|
-
});
|
|
380
|
+
channels: {},
|
|
381
|
+
}, "<id>");
|
|
298
382
|
|
|
299
383
|
if (!res.ok) {
|
|
300
384
|
throw res.error;
|
|
@@ -313,14 +397,16 @@ run();
|
|
|
313
397
|
|
|
314
398
|
| Parameter | Type | Required | Description |
|
|
315
399
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
316
|
-
| `
|
|
400
|
+
| `subscriberId` | *string* | :heavy_check_mark: | N/A |
|
|
401
|
+
| `patchSubscriberPreferencesDto` | [components.PatchSubscriberPreferencesDto](../../models/components/patchsubscriberpreferencesdto.md) | :heavy_check_mark: | N/A |
|
|
402
|
+
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
|
|
317
403
|
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
318
404
|
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
319
405
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
320
406
|
|
|
321
407
|
### Response
|
|
322
408
|
|
|
323
|
-
**Promise\<[operations.
|
|
409
|
+
**Promise\<[operations.SubscribersControllerUpdateSubscriberPreferencesResponse](../../models/operations/subscriberscontrollerupdatesubscriberpreferencesresponse.md)\>**
|
|
324
410
|
|
|
325
411
|
### Errors
|
|
326
412
|
|
|
@@ -11,7 +11,7 @@ A subscriber in Novu represents someone who should receive a message. A subscrib
|
|
|
11
11
|
* [list](#list) - Get subscribers
|
|
12
12
|
* [create](#create) - Create subscriber
|
|
13
13
|
* [retrieveLegacy](#retrievelegacy) - Get subscriber
|
|
14
|
-
* [
|
|
14
|
+
* [updateLegacy](#updatelegacy) - Update subscriber
|
|
15
15
|
* [~~deleteLegacy~~](#deletelegacy) - Delete subscriber :warning: **Deprecated**
|
|
16
16
|
* [createBulk](#createbulk) - Bulk create subscribers
|
|
17
17
|
* [search](#search) - Search for subscribers
|
|
@@ -33,7 +33,7 @@ const novu = new Novu({
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
async function run() {
|
|
36
|
-
const result = await novu.subscribers.list(
|
|
36
|
+
const result = await novu.subscribers.list();
|
|
37
37
|
|
|
38
38
|
for await (const page of result) {
|
|
39
39
|
// Handle the page
|
|
@@ -59,7 +59,7 @@ const novu = new NovuCore({
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
async function run() {
|
|
62
|
-
const res = await subscribersList(novu
|
|
62
|
+
const res = await subscribersList(novu);
|
|
63
63
|
|
|
64
64
|
if (!res.ok) {
|
|
65
65
|
throw res.error;
|
|
@@ -260,7 +260,7 @@ run();
|
|
|
260
260
|
| errors.ErrorDto | 500 | application/json |
|
|
261
261
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
262
262
|
|
|
263
|
-
##
|
|
263
|
+
## updateLegacy
|
|
264
264
|
|
|
265
265
|
Used to update the subscriber entity with new information
|
|
266
266
|
|
|
@@ -274,7 +274,7 @@ const novu = new Novu({
|
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
async function run() {
|
|
277
|
-
const result = await novu.subscribers.
|
|
277
|
+
const result = await novu.subscribers.updateLegacy({
|
|
278
278
|
email: "john.doe@example.com",
|
|
279
279
|
firstName: "John",
|
|
280
280
|
lastName: "Doe",
|
|
@@ -306,7 +306,7 @@ The standalone function version of this method:
|
|
|
306
306
|
|
|
307
307
|
```typescript
|
|
308
308
|
import { NovuCore } from "@novu/api/core.js";
|
|
309
|
-
import {
|
|
309
|
+
import { subscribersUpdateLegacy } from "@novu/api/funcs/subscribersUpdateLegacy.js";
|
|
310
310
|
|
|
311
311
|
// Use `NovuCore` for best tree-shaking performance.
|
|
312
312
|
// You can create one instance of it to use across an application.
|
|
@@ -315,7 +315,7 @@ const novu = new NovuCore({
|
|
|
315
315
|
});
|
|
316
316
|
|
|
317
317
|
async function run() {
|
|
318
|
-
const res = await
|
|
318
|
+
const res = await subscribersUpdateLegacy(novu, {
|
|
319
319
|
email: "john.doe@example.com",
|
|
320
320
|
firstName: "John",
|
|
321
321
|
lastName: "Doe",
|