15
15
npm add @novu/api
16
16
```
17
17
18
+ ### PNPM
19
+
20
+ ``` bash
21
+ pnpm add @novu/api
22
+ ```
23
+
24
+ ### Bun
25
+
26
+ ``` bash
27
+ bun add @novu/api
28
+ ```
29
+
18
30
### Yarn
19
31
20
32
``` bash
21
- yarn add @novu/api
33
+ yarn add @novu/api zod
34
+
35
+ # Note that Yarn does not install peer dependencies automatically. You will need
36
+ # to install zod as shown above.
22
37
```
23
38
<!-- End SDK Installation [installation] -->
24
39
@@ -35,7 +50,6 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
35
50
36
51
``` typescript
37
52
import { Novu } from " @novu/api" ;
38
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
39
53
40
54
const novu = new Novu ({
41
55
apiKey: " <YOUR_API_KEY_HERE>" ,
@@ -49,7 +63,7 @@ async function run() {
49
63
to: [
50
64
{
51
65
topicKey: " topic_key" ,
52
- type: TopicPayloadDtoType . Topic ,
66
+ type: " Topic" ,
53
67
},
54
68
],
55
69
});
@@ -292,8 +306,7 @@ Validation errors can also occur when either method arguments or data returned f
292
306
293
307
``` typescript
294
308
import { Novu } from " @novu/api" ;
295
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
296
- import * as errors from " @novu/api/models/errors" ;
309
+ import { SDKValidationError } from " @novu/api/models/errors" ;
297
310
298
311
const novu = new Novu ({
299
312
apiKey: " <YOUR_API_KEY_HERE>" ,
@@ -309,13 +322,13 @@ async function run() {
309
322
to: [
310
323
{
311
324
topicKey: " topic_key" ,
312
- type: TopicPayloadDtoType . Topic ,
325
+ type: " Topic" ,
313
326
},
314
327
],
315
328
});
316
329
} catch (err ) {
317
330
switch (true ) {
318
- case err instanceof errors . SDKValidationError : {
331
+ case err instanceof SDKValidationError : {
319
332
// Validation errors can be pretty-printed
320
333
console .error (err .pretty ());
321
334
// Raw value may also be inspected
@@ -351,7 +364,6 @@ You can override the default server globally by passing a server index to the `s
351
364
352
365
``` typescript
353
366
import { Novu } from " @novu/api" ;
354
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
355
367
356
368
const novu = new Novu ({
357
369
serverIdx: 1 ,
@@ -366,7 +378,7 @@ async function run() {
366
378
to: [
367
379
{
368
380
topicKey: " topic_key" ,
369
- type: TopicPayloadDtoType . Topic ,
381
+ type: " Topic" ,
370
382
},
371
383
],
372
384
});
@@ -386,7 +398,6 @@ The default server can also be overridden globally by passing a URL to the `serv
386
398
387
399
``` typescript
388
400
import { Novu } from " @novu/api" ;
389
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
390
401
391
402
const novu = new Novu ({
392
403
serverURL: " https://api.novu.co" ,
@@ -401,7 +412,7 @@ async function run() {
401
412
to: [
402
413
{
403
414
topicKey: " topic_key" ,
404
- type: TopicPayloadDtoType . Topic ,
415
+ type: " Topic" ,
405
416
},
406
417
],
407
418
});
@@ -478,7 +489,6 @@ This SDK supports the following security scheme globally:
478
489
To authenticate with the API the ` apiKey ` parameter must be set when initializing the SDK client instance. For example:
479
490
``` typescript
480
491
import { Novu } from " @novu/api" ;
481
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
482
492
483
493
const novu = new Novu ({
484
494
apiKey: " <YOUR_API_KEY_HERE>" ,
@@ -492,7 +502,7 @@ async function run() {
492
502
to: [
493
503
{
494
504
topicKey: " topic_key" ,
495
- type: TopicPayloadDtoType . Topic ,
505
+ type: " Topic" ,
496
506
},
497
507
],
498
508
});
@@ -514,7 +524,6 @@ Some of the endpoints in this SDK support retries. If you use the SDK without a
514
524
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
515
525
``` typescript
516
526
import { Novu } from " @novu/api" ;
517
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
518
527
519
528
const novu = new Novu ({
520
529
apiKey: " <YOUR_API_KEY_HERE>" ,
@@ -529,7 +538,7 @@ async function run() {
529
538
to: [
530
539
{
531
540
topicKey: " topic_key" ,
532
- type: TopicPayloadDtoType . Topic ,
541
+ type: " Topic" ,
533
542
},
534
543
],
535
544
},
@@ -558,7 +567,6 @@ run();
558
567
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
559
568
``` typescript
560
569
import { Novu } from " @novu/api" ;
561
- import { TopicPayloadDtoType } from " @novu/api/models/components" ;
562
570
563
571
const novu = new Novu ({
564
572
retryConfig: {
@@ -582,7 +590,7 @@ async function run() {
582
590
to: [
583
591
{
584
592
topicKey: " topic_key" ,
585
- type: TopicPayloadDtoType . Topic ,
593
+ type: " Topic" ,
586
594
},
587
595
],
588
596
});
0 commit comments