@novu/api 0.1.2 → 0.1.5
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 +7 -3
- 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 +166 -5
- package/docs/sdks/subscribers/README.md +2 -2
- package/docs/sdks/topics/README.md +0 -4
- 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/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/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/preferences.d.ts +15 -1
- package/sdk/preferences.d.ts.map +1 -1
- package/sdk/preferences.js +22 -2
- package/sdk/preferences.js.map +1 -1
- package/sources/json-development.json +1165 -0
- package/src/funcs/subscribersPreferencesRetrieve.ts +203 -0
- package/src/funcs/subscribersPreferencesUpdate.ts +27 -20
- package/src/funcs/subscribersPreferencesUpdateLegacy.ts +202 -0
- 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/preferences.ts +46 -2
package/README.md
CHANGED
|
@@ -330,7 +330,9 @@ run();
|
|
|
330
330
|
* [list](docs/sdks/preferences/README.md#list) - Get subscriber preferences
|
|
331
331
|
* [updateGlobal](docs/sdks/preferences/README.md#updateglobal) - Update subscriber global preferences
|
|
332
332
|
* [retrieveByLevel](docs/sdks/preferences/README.md#retrievebylevel) - Get subscriber preferences by level
|
|
333
|
-
* [
|
|
333
|
+
* [updateLegacy](docs/sdks/preferences/README.md#updatelegacy) - Update subscriber preference
|
|
334
|
+
* [retrieve](docs/sdks/preferences/README.md#retrieve) - Get subscriber preferences
|
|
335
|
+
* [update](docs/sdks/preferences/README.md#update) - Update subscriber global or workflow specific preferences
|
|
334
336
|
|
|
335
337
|
#### [subscribers.properties](docs/sdks/properties/README.md)
|
|
336
338
|
|
|
@@ -399,9 +401,11 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
|
399
401
|
- [`subscribersNotificationsUnseenCount`](docs/sdks/novunotifications/README.md#unseencount) - Get the unseen in-app notifications count for subscribers feed
|
|
400
402
|
- [`subscribersPatch`](docs/sdks/subscribers/README.md#patch) - Patch subscriber
|
|
401
403
|
- [`subscribersPreferencesList`](docs/sdks/preferences/README.md#list) - Get subscriber preferences
|
|
404
|
+
- [`subscribersPreferencesRetrieve`](docs/sdks/preferences/README.md#retrieve) - Get subscriber preferences
|
|
402
405
|
- [`subscribersPreferencesRetrieveByLevel`](docs/sdks/preferences/README.md#retrievebylevel) - Get subscriber preferences by level
|
|
403
|
-
- [`subscribersPreferencesUpdate`](docs/sdks/preferences/README.md#update) - Update subscriber
|
|
406
|
+
- [`subscribersPreferencesUpdate`](docs/sdks/preferences/README.md#update) - Update subscriber global or workflow specific preferences
|
|
404
407
|
- [`subscribersPreferencesUpdateGlobal`](docs/sdks/preferences/README.md#updateglobal) - Update subscriber global preferences
|
|
408
|
+
- [`subscribersPreferencesUpdateLegacy`](docs/sdks/preferences/README.md#updatelegacy) - Update subscriber preference
|
|
405
409
|
- [`subscribersPropertiesUpdateOnlineFlag`](docs/sdks/properties/README.md#updateonlineflag) - Update subscriber online status
|
|
406
410
|
- [`subscribersRetrieve`](docs/sdks/subscribers/README.md#retrieve) - Get subscriber
|
|
407
411
|
- [`subscribersRetrieveLegacy`](docs/sdks/subscribers/README.md#retrievelegacy) - Get subscriber
|
|
@@ -443,7 +447,7 @@ const novu = new Novu({
|
|
|
443
447
|
});
|
|
444
448
|
|
|
445
449
|
async function run() {
|
|
446
|
-
const result = await novu.subscribers.list(
|
|
450
|
+
const result = await novu.subscribers.list();
|
|
447
451
|
|
|
448
452
|
for await (const page of result) {
|
|
449
453
|
// Handle the page
|
|
@@ -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) {
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* [list](#list) - Get subscriber preferences
|
|
9
9
|
* [updateGlobal](#updateglobal) - Update subscriber global preferences
|
|
10
10
|
* [retrieveByLevel](#retrievebylevel) - Get subscriber preferences by level
|
|
11
|
-
* [
|
|
11
|
+
* [updateLegacy](#updatelegacy) - Update subscriber preference
|
|
12
|
+
* [retrieve](#retrieve) - Get subscriber preferences
|
|
13
|
+
* [update](#update) - Update subscriber global or workflow specific preferences
|
|
12
14
|
|
|
13
15
|
## list
|
|
14
16
|
|
|
@@ -248,7 +250,7 @@ run();
|
|
|
248
250
|
| errors.ErrorDto | 500 | application/json |
|
|
249
251
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
250
252
|
|
|
251
|
-
##
|
|
253
|
+
## updateLegacy
|
|
252
254
|
|
|
253
255
|
Update subscriber preference
|
|
254
256
|
|
|
@@ -262,7 +264,7 @@ const novu = new Novu({
|
|
|
262
264
|
});
|
|
263
265
|
|
|
264
266
|
async function run() {
|
|
265
|
-
const result = await novu.subscribers.preferences.
|
|
267
|
+
const result = await novu.subscribers.preferences.updateLegacy({
|
|
266
268
|
subscriberId: "<id>",
|
|
267
269
|
workflowId: "<id>",
|
|
268
270
|
updateSubscriberPreferenceRequestDto: {},
|
|
@@ -281,7 +283,7 @@ The standalone function version of this method:
|
|
|
281
283
|
|
|
282
284
|
```typescript
|
|
283
285
|
import { NovuCore } from "@novu/api/core.js";
|
|
284
|
-
import {
|
|
286
|
+
import { subscribersPreferencesUpdateLegacy } from "@novu/api/funcs/subscribersPreferencesUpdateLegacy.js";
|
|
285
287
|
|
|
286
288
|
// Use `NovuCore` for best tree-shaking performance.
|
|
287
289
|
// You can create one instance of it to use across an application.
|
|
@@ -290,7 +292,7 @@ const novu = new NovuCore({
|
|
|
290
292
|
});
|
|
291
293
|
|
|
292
294
|
async function run() {
|
|
293
|
-
const res = await
|
|
295
|
+
const res = await subscribersPreferencesUpdateLegacy(novu, {
|
|
294
296
|
subscriberId: "<id>",
|
|
295
297
|
workflowId: "<id>",
|
|
296
298
|
updateSubscriberPreferenceRequestDto: {},
|
|
@@ -324,6 +326,165 @@ run();
|
|
|
324
326
|
|
|
325
327
|
### Errors
|
|
326
328
|
|
|
329
|
+
| Error Type | Status Code | Content Type |
|
|
330
|
+
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
|
331
|
+
| errors.ErrorDto | 414 | application/json |
|
|
332
|
+
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
|
|
333
|
+
| errors.ValidationErrorDto | 422 | application/json |
|
|
334
|
+
| errors.ErrorDto | 500 | application/json |
|
|
335
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
336
|
+
|
|
337
|
+
## retrieve
|
|
338
|
+
|
|
339
|
+
Get subscriber global and workflow specific preferences
|
|
340
|
+
|
|
341
|
+
### Example Usage
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { Novu } from "@novu/api";
|
|
345
|
+
|
|
346
|
+
const novu = new Novu({
|
|
347
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
async function run() {
|
|
351
|
+
const result = await novu.subscribers.preferences.retrieve("<id>");
|
|
352
|
+
|
|
353
|
+
// Handle the result
|
|
354
|
+
console.log(result);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
run();
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Standalone function
|
|
361
|
+
|
|
362
|
+
The standalone function version of this method:
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
import { NovuCore } from "@novu/api/core.js";
|
|
366
|
+
import { subscribersPreferencesRetrieve } from "@novu/api/funcs/subscribersPreferencesRetrieve.js";
|
|
367
|
+
|
|
368
|
+
// Use `NovuCore` for best tree-shaking performance.
|
|
369
|
+
// You can create one instance of it to use across an application.
|
|
370
|
+
const novu = new NovuCore({
|
|
371
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
async function run() {
|
|
375
|
+
const res = await subscribersPreferencesRetrieve(novu, "<id>");
|
|
376
|
+
|
|
377
|
+
if (!res.ok) {
|
|
378
|
+
throw res.error;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const { value: result } = res;
|
|
382
|
+
|
|
383
|
+
// Handle the result
|
|
384
|
+
console.log(result);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
run();
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Parameters
|
|
391
|
+
|
|
392
|
+
| Parameter | Type | Required | Description |
|
|
393
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
394
|
+
| `subscriberId` | *string* | :heavy_check_mark: | N/A |
|
|
395
|
+
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
|
|
396
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
397
|
+
| `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. |
|
|
398
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
399
|
+
|
|
400
|
+
### Response
|
|
401
|
+
|
|
402
|
+
**Promise\<[operations.SubscribersControllerGetSubscriberPreferencesResponse](../../models/operations/subscriberscontrollergetsubscriberpreferencesresponse.md)\>**
|
|
403
|
+
|
|
404
|
+
### Errors
|
|
405
|
+
|
|
406
|
+
| Error Type | Status Code | Content Type |
|
|
407
|
+
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
|
408
|
+
| errors.ErrorDto | 414 | application/json |
|
|
409
|
+
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
|
|
410
|
+
| errors.ValidationErrorDto | 422 | application/json |
|
|
411
|
+
| errors.ErrorDto | 500 | application/json |
|
|
412
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
413
|
+
|
|
414
|
+
## update
|
|
415
|
+
|
|
416
|
+
Update subscriber global or workflow specific preferences
|
|
417
|
+
|
|
418
|
+
### Example Usage
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
import { Novu } from "@novu/api";
|
|
422
|
+
|
|
423
|
+
const novu = new Novu({
|
|
424
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
async function run() {
|
|
428
|
+
const result = await novu.subscribers.preferences.update({
|
|
429
|
+
channels: {},
|
|
430
|
+
}, "<id>");
|
|
431
|
+
|
|
432
|
+
// Handle the result
|
|
433
|
+
console.log(result);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
run();
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Standalone function
|
|
440
|
+
|
|
441
|
+
The standalone function version of this method:
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
import { NovuCore } from "@novu/api/core.js";
|
|
445
|
+
import { subscribersPreferencesUpdate } from "@novu/api/funcs/subscribersPreferencesUpdate.js";
|
|
446
|
+
|
|
447
|
+
// Use `NovuCore` for best tree-shaking performance.
|
|
448
|
+
// You can create one instance of it to use across an application.
|
|
449
|
+
const novu = new NovuCore({
|
|
450
|
+
secretKey: "<YOUR_API_KEY_HERE>",
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
async function run() {
|
|
454
|
+
const res = await subscribersPreferencesUpdate(novu, {
|
|
455
|
+
channels: {},
|
|
456
|
+
}, "<id>");
|
|
457
|
+
|
|
458
|
+
if (!res.ok) {
|
|
459
|
+
throw res.error;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
const { value: result } = res;
|
|
463
|
+
|
|
464
|
+
// Handle the result
|
|
465
|
+
console.log(result);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
run();
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### Parameters
|
|
472
|
+
|
|
473
|
+
| Parameter | Type | Required | Description |
|
|
474
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
475
|
+
| `subscriberId` | *string* | :heavy_check_mark: | N/A |
|
|
476
|
+
| `patchSubscriberPreferencesDto` | [components.PatchSubscriberPreferencesDto](../../models/components/patchsubscriberpreferencesdto.md) | :heavy_check_mark: | N/A |
|
|
477
|
+
| `idempotencyKey` | *string* | :heavy_minus_sign: | A header for idempotency purposes |
|
|
478
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
479
|
+
| `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. |
|
|
480
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
481
|
+
|
|
482
|
+
### Response
|
|
483
|
+
|
|
484
|
+
**Promise\<[operations.SubscribersControllerUpdateSubscriberPreferencesResponse](../../models/operations/subscriberscontrollerupdatesubscriberpreferencesresponse.md)\>**
|
|
485
|
+
|
|
486
|
+
### Errors
|
|
487
|
+
|
|
327
488
|
| Error Type | Status Code | Content Type |
|
|
328
489
|
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
|
329
490
|
| errors.ErrorDto | 414 | application/json |
|
|
@@ -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;
|
|
@@ -112,8 +112,6 @@ const novu = new Novu({
|
|
|
112
112
|
|
|
113
113
|
async function run() {
|
|
114
114
|
const result = await novu.topics.list({
|
|
115
|
-
page: 0,
|
|
116
|
-
pageSize: 10,
|
|
117
115
|
key: "exampleKey",
|
|
118
116
|
});
|
|
119
117
|
|
|
@@ -140,8 +138,6 @@ const novu = new NovuCore({
|
|
|
140
138
|
|
|
141
139
|
async function run() {
|
|
142
140
|
const res = await topicsList(novu, {
|
|
143
|
-
page: 0,
|
|
144
|
-
pageSize: 10,
|
|
145
141
|
key: "exampleKey",
|
|
146
142
|
});
|
|
147
143
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NovuCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
6
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
7
|
+
import * as operations from "../models/operations/index.js";
|
|
8
|
+
import { Result } from "../types/fp.js";
|
|
9
|
+
/**
|
|
10
|
+
* Get subscriber preferences
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Get subscriber global and workflow specific preferences
|
|
14
|
+
*/
|
|
15
|
+
export declare function subscribersPreferencesRetrieve(client: NovuCore, subscriberId: string, idempotencyKey?: string | undefined, options?: RequestOptions): Promise<Result<operations.SubscribersControllerGetSubscriberPreferencesResponse, errors.ErrorDto | errors.ErrorDto | errors.ValidationErrorDto | errors.ErrorDto | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
|
|
16
|
+
//# sourceMappingURL=subscribersPreferencesRetrieve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribersPreferencesRetrieve.d.ts","sourceRoot":"","sources":["../src/funcs/subscribersPreferencesRetrieve.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,QAAQ,EAChB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,qDAAqD,EAC9D,MAAM,CAAC,QAAQ,GACf,MAAM,CAAC,QAAQ,GACf,MAAM,CAAC,kBAAkB,GACzB,MAAM,CAAC,QAAQ,GACf,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAuJA"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.subscribersPreferencesRetrieve = void 0;
|
|
30
|
+
const encodings_js_1 = require("../lib/encodings.js");
|
|
31
|
+
const M = __importStar(require("../lib/matchers.js"));
|
|
32
|
+
const primitives_js_1 = require("../lib/primitives.js");
|
|
33
|
+
const schemas_js_1 = require("../lib/schemas.js");
|
|
34
|
+
const security_js_1 = require("../lib/security.js");
|
|
35
|
+
const url_js_1 = require("../lib/url.js");
|
|
36
|
+
const errors = __importStar(require("../models/errors/index.js"));
|
|
37
|
+
const operations = __importStar(require("../models/operations/index.js"));
|
|
38
|
+
/**
|
|
39
|
+
* Get subscriber preferences
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Get subscriber global and workflow specific preferences
|
|
43
|
+
*/
|
|
44
|
+
async function subscribersPreferencesRetrieve(client, subscriberId, idempotencyKey, options) {
|
|
45
|
+
const input = {
|
|
46
|
+
subscriberId: subscriberId,
|
|
47
|
+
idempotencyKey: idempotencyKey,
|
|
48
|
+
};
|
|
49
|
+
const parsed = (0, schemas_js_1.safeParse)(input, (value) => operations
|
|
50
|
+
.SubscribersControllerGetSubscriberPreferencesRequest$outboundSchema
|
|
51
|
+
.parse(value), "Input validation failed");
|
|
52
|
+
if (!parsed.ok) {
|
|
53
|
+
return parsed;
|
|
54
|
+
}
|
|
55
|
+
const payload = parsed.value;
|
|
56
|
+
const body = null;
|
|
57
|
+
const pathParams = {
|
|
58
|
+
subscriberId: (0, encodings_js_1.encodeSimple)("subscriberId", payload.subscriberId, {
|
|
59
|
+
explode: false,
|
|
60
|
+
charEncoding: "percent",
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
const path = (0, url_js_1.pathToFunc)("/v2/subscribers/{subscriberId}/preferences")(pathParams);
|
|
64
|
+
const headers = new Headers((0, primitives_js_1.compactMap)({
|
|
65
|
+
Accept: "application/json",
|
|
66
|
+
"idempotency-key": (0, encodings_js_1.encodeSimple)("idempotency-key", payload["idempotency-key"], { explode: false, charEncoding: "none" }),
|
|
67
|
+
}));
|
|
68
|
+
const secConfig = await (0, security_js_1.extractSecurity)(client._options.secretKey);
|
|
69
|
+
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
|
|
70
|
+
const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
|
|
71
|
+
const context = {
|
|
72
|
+
operationID: "SubscribersController_getSubscriberPreferences",
|
|
73
|
+
oAuth2Scopes: [],
|
|
74
|
+
resolvedSecurity: requestSecurity,
|
|
75
|
+
securitySource: client._options.secretKey,
|
|
76
|
+
retryConfig: options?.retries
|
|
77
|
+
|| client._options.retryConfig
|
|
78
|
+
|| {
|
|
79
|
+
strategy: "backoff",
|
|
80
|
+
backoff: {
|
|
81
|
+
initialInterval: 1000,
|
|
82
|
+
maxInterval: 30000,
|
|
83
|
+
exponent: 1.5,
|
|
84
|
+
maxElapsedTime: 3600000,
|
|
85
|
+
},
|
|
86
|
+
retryConnectionErrors: true,
|
|
87
|
+
}
|
|
88
|
+
|| { strategy: "none" },
|
|
89
|
+
retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
|
|
90
|
+
};
|
|
91
|
+
const requestRes = client._createRequest(context, {
|
|
92
|
+
security: requestSecurity,
|
|
93
|
+
method: "GET",
|
|
94
|
+
baseURL: options?.serverURL,
|
|
95
|
+
path: path,
|
|
96
|
+
headers: headers,
|
|
97
|
+
body: body,
|
|
98
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
99
|
+
}, options);
|
|
100
|
+
if (!requestRes.ok) {
|
|
101
|
+
return requestRes;
|
|
102
|
+
}
|
|
103
|
+
const req = requestRes.value;
|
|
104
|
+
const doResult = await client._do(req, {
|
|
105
|
+
context,
|
|
106
|
+
errorCodes: [
|
|
107
|
+
"400",
|
|
108
|
+
"401",
|
|
109
|
+
"403",
|
|
110
|
+
"404",
|
|
111
|
+
"405",
|
|
112
|
+
"409",
|
|
113
|
+
"413",
|
|
114
|
+
"414",
|
|
115
|
+
"415",
|
|
116
|
+
"422",
|
|
117
|
+
"429",
|
|
118
|
+
"4XX",
|
|
119
|
+
"500",
|
|
120
|
+
"503",
|
|
121
|
+
"5XX",
|
|
122
|
+
],
|
|
123
|
+
retryConfig: context.retryConfig,
|
|
124
|
+
retryCodes: context.retryCodes,
|
|
125
|
+
});
|
|
126
|
+
if (!doResult.ok) {
|
|
127
|
+
return doResult;
|
|
128
|
+
}
|
|
129
|
+
const response = doResult.value;
|
|
130
|
+
const responseFields = {
|
|
131
|
+
HttpMeta: { Response: response, Request: req },
|
|
132
|
+
};
|
|
133
|
+
const [result] = await M.match(M.json(200, operations
|
|
134
|
+
.SubscribersControllerGetSubscriberPreferencesResponse$inboundSchema, { hdrs: true, key: "Result" }), M.jsonErr(414, errors.ErrorDto$inboundSchema), M.jsonErr([400, 401, 403, 404, 405, 409, 413, 415], errors.ErrorDto$inboundSchema, { hdrs: true }), M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }), M.fail(429), M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }), M.fail(503), M.fail("4XX"), M.fail("5XX"))(response, { extraFields: responseFields });
|
|
135
|
+
if (!result.ok) {
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
exports.subscribersPreferencesRetrieve = subscribersPreferencesRetrieve;
|
|
141
|
+
//# sourceMappingURL=subscribersPreferencesRetrieve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribersPreferencesRetrieve.js","sourceRoot":"","sources":["../src/funcs/subscribersPreferencesRetrieve.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NovuCore } from "../core.js";
|
|
2
2
|
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import * as components from "../models/components/index.js";
|
|
3
4
|
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
5
|
import * as errors from "../models/errors/index.js";
|
|
5
6
|
import { SDKError } from "../models/errors/sdkerror.js";
|
|
@@ -7,7 +8,10 @@ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
|
7
8
|
import * as operations from "../models/operations/index.js";
|
|
8
9
|
import { Result } from "../types/fp.js";
|
|
9
10
|
/**
|
|
10
|
-
* Update subscriber
|
|
11
|
+
* Update subscriber global or workflow specific preferences
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Update subscriber global or workflow specific preferences
|
|
11
15
|
*/
|
|
12
|
-
export declare function subscribersPreferencesUpdate(client: NovuCore,
|
|
16
|
+
export declare function subscribersPreferencesUpdate(client: NovuCore, patchSubscriberPreferencesDto: components.PatchSubscriberPreferencesDto, subscriberId: string, idempotencyKey?: string | undefined, options?: RequestOptions): Promise<Result<operations.SubscribersControllerUpdateSubscriberPreferencesResponse, errors.ErrorDto | errors.ErrorDto | errors.ValidationErrorDto | errors.ErrorDto | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
|
|
13
17
|
//# sourceMappingURL=subscribersPreferencesUpdate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribersPreferencesUpdate.d.ts","sourceRoot":"","sources":["../src/funcs/subscribersPreferencesUpdate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"subscribersPreferencesUpdate.d.ts","sourceRoot":"","sources":["../src/funcs/subscribersPreferencesUpdate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,QAAQ,EAChB,6BAA6B,EAAE,UAAU,CAAC,6BAA6B,EACvE,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,wDAAwD,EACjE,MAAM,CAAC,QAAQ,GACf,MAAM,CAAC,QAAQ,GACf,MAAM,CAAC,kBAAkB,GACzB,MAAM,CAAC,QAAQ,GACf,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CA2JA"}
|
|
@@ -36,28 +36,34 @@ const url_js_1 = require("../lib/url.js");
|
|
|
36
36
|
const errors = __importStar(require("../models/errors/index.js"));
|
|
37
37
|
const operations = __importStar(require("../models/operations/index.js"));
|
|
38
38
|
/**
|
|
39
|
-
* Update subscriber
|
|
39
|
+
* Update subscriber global or workflow specific preferences
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Update subscriber global or workflow specific preferences
|
|
40
43
|
*/
|
|
41
|
-
async function subscribersPreferencesUpdate(client,
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
+
async function subscribersPreferencesUpdate(client, patchSubscriberPreferencesDto, subscriberId, idempotencyKey, options) {
|
|
45
|
+
const input = {
|
|
46
|
+
patchSubscriberPreferencesDto: patchSubscriberPreferencesDto,
|
|
47
|
+
subscriberId: subscriberId,
|
|
48
|
+
idempotencyKey: idempotencyKey,
|
|
49
|
+
};
|
|
50
|
+
const parsed = (0, schemas_js_1.safeParse)(input, (value) => operations
|
|
51
|
+
.SubscribersControllerUpdateSubscriberPreferencesRequest$outboundSchema
|
|
44
52
|
.parse(value), "Input validation failed");
|
|
45
53
|
if (!parsed.ok) {
|
|
46
54
|
return parsed;
|
|
47
55
|
}
|
|
48
56
|
const payload = parsed.value;
|
|
49
|
-
const body = (0, encodings_js_1.encodeJSON)("body", payload.
|
|
57
|
+
const body = (0, encodings_js_1.encodeJSON)("body", payload.PatchSubscriberPreferencesDto, {
|
|
58
|
+
explode: true,
|
|
59
|
+
});
|
|
50
60
|
const pathParams = {
|
|
51
61
|
subscriberId: (0, encodings_js_1.encodeSimple)("subscriberId", payload.subscriberId, {
|
|
52
62
|
explode: false,
|
|
53
63
|
charEncoding: "percent",
|
|
54
64
|
}),
|
|
55
|
-
parameter: (0, encodings_js_1.encodeSimple)("parameter", payload.workflowId, {
|
|
56
|
-
explode: false,
|
|
57
|
-
charEncoding: "percent",
|
|
58
|
-
}),
|
|
59
65
|
};
|
|
60
|
-
const path = (0, url_js_1.pathToFunc)("/
|
|
66
|
+
const path = (0, url_js_1.pathToFunc)("/v2/subscribers/{subscriberId}/preferences")(pathParams);
|
|
61
67
|
const headers = new Headers((0, primitives_js_1.compactMap)({
|
|
62
68
|
"Content-Type": "application/json",
|
|
63
69
|
Accept: "application/json",
|
|
@@ -67,7 +73,7 @@ async function subscribersPreferencesUpdate(client, request, options) {
|
|
|
67
73
|
const securityInput = secConfig == null ? {} : { secretKey: secConfig };
|
|
68
74
|
const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
|
|
69
75
|
const context = {
|
|
70
|
-
operationID: "
|
|
76
|
+
operationID: "SubscribersController_updateSubscriberPreferences",
|
|
71
77
|
oAuth2Scopes: [],
|
|
72
78
|
resolvedSecurity: requestSecurity,
|
|
73
79
|
securitySource: client._options.secretKey,
|
|
@@ -129,7 +135,7 @@ async function subscribersPreferencesUpdate(client, request, options) {
|
|
|
129
135
|
HttpMeta: { Response: response, Request: req },
|
|
130
136
|
};
|
|
131
137
|
const [result] = await M.match(M.json(200, operations
|
|
132
|
-
.
|
|
138
|
+
.SubscribersControllerUpdateSubscriberPreferencesResponse$inboundSchema, { hdrs: true, key: "Result" }), M.jsonErr(414, errors.ErrorDto$inboundSchema), M.jsonErr([400, 401, 403, 404, 405, 409, 413, 415], errors.ErrorDto$inboundSchema, { hdrs: true }), M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }), M.fail(429), M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }), M.fail(503), M.fail("4XX"), M.fail("5XX"))(response, { extraFields: responseFields });
|
|
133
139
|
if (!result.ok) {
|
|
134
140
|
return result;
|
|
135
141
|
}
|