@novu/api 0.1.0 → 0.1.1

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.
Files changed (67) hide show
  1. package/FUNCTIONS.md +15 -8
  2. package/README.md +161 -73
  3. package/docs/sdks/credentials/README.md +44 -0
  4. package/docs/sdks/messages/README.md +8 -2
  5. package/docs/sdks/notifications/README.md +2 -32
  6. package/docs/sdks/novu/README.md +277 -47
  7. package/docs/sdks/novumessages/README.md +4 -4
  8. package/docs/sdks/novunotifications/README.md +4 -2
  9. package/docs/sdks/preferences/README.md +4 -4
  10. package/docs/sdks/properties/README.md +2 -2
  11. package/docs/sdks/subscribers/README.md +2 -4
  12. package/funcs/create.d.ts +9 -0
  13. package/funcs/create.d.ts.map +1 -0
  14. package/funcs/create.js +110 -0
  15. package/funcs/create.js.map +1 -0
  16. package/funcs/supportControllerFetchUserOrganizations.d.ts +10 -0
  17. package/funcs/supportControllerFetchUserOrganizations.d.ts.map +1 -0
  18. package/funcs/supportControllerFetchUserOrganizations.js +111 -0
  19. package/funcs/supportControllerFetchUserOrganizations.js.map +1 -0
  20. package/jsr.json +1 -1
  21. package/lib/config.d.ts +3 -3
  22. package/lib/config.js +3 -3
  23. package/lib/schemas.d.ts +1 -1
  24. package/lib/schemas.d.ts.map +1 -1
  25. package/lib/schemas.js +4 -1
  26. package/lib/schemas.js.map +1 -1
  27. package/models/components/createsupportthreaddto.d.ts +29 -0
  28. package/models/components/createsupportthreaddto.d.ts.map +1 -0
  29. package/models/components/createsupportthreaddto.js +59 -0
  30. package/models/components/createsupportthreaddto.js.map +1 -0
  31. package/models/components/index.d.ts +2 -0
  32. package/models/components/index.d.ts.map +1 -1
  33. package/models/components/index.js +2 -0
  34. package/models/components/index.js.map +1 -1
  35. package/models/components/plaincardrequestdto.d.ts +100 -0
  36. package/models/components/plaincardrequestdto.d.ts.map +1 -0
  37. package/models/components/plaincardrequestdto.js +139 -0
  38. package/models/components/plaincardrequestdto.js.map +1 -0
  39. package/models/operations/index.d.ts +2 -0
  40. package/models/operations/index.d.ts.map +1 -1
  41. package/models/operations/index.js +2 -0
  42. package/models/operations/index.js.map +1 -1
  43. package/models/operations/supportcontrollercreatethread.d.ts +35 -0
  44. package/models/operations/supportcontrollercreatethread.d.ts.map +1 -0
  45. package/models/operations/supportcontrollercreatethread.js +73 -0
  46. package/models/operations/supportcontrollercreatethread.js.map +1 -0
  47. package/models/operations/supportcontrollerfetchuserorganizations.d.ts +56 -0
  48. package/models/operations/supportcontrollerfetchuserorganizations.d.ts.map +1 -0
  49. package/models/operations/supportcontrollerfetchuserorganizations.js +96 -0
  50. package/models/operations/supportcontrollerfetchuserorganizations.js.map +1 -0
  51. package/package.json +5 -1
  52. package/sdk/sdk.d.ts +8 -0
  53. package/sdk/sdk.d.ts.map +1 -1
  54. package/sdk/sdk.js +14 -0
  55. package/sdk/sdk.js.map +1 -1
  56. package/sources/json-development.json +116 -0
  57. package/src/funcs/create.ts +148 -0
  58. package/src/funcs/supportControllerFetchUserOrganizations.ts +150 -0
  59. package/src/lib/config.ts +3 -3
  60. package/src/lib/schemas.ts +5 -0
  61. package/src/models/components/createsupportthreaddto.ts +66 -0
  62. package/src/models/components/index.ts +2 -0
  63. package/src/models/components/plaincardrequestdto.ts +223 -0
  64. package/src/models/operations/index.ts +2 -0
  65. package/src/models/operations/supportcontrollercreatethread.ts +90 -0
  66. package/src/models/operations/supportcontrollerfetchuserorganizations.ts +163 -0
  67. package/src/sdk/sdk.ts +34 -0
package/FUNCTIONS.md CHANGED
@@ -32,16 +32,23 @@ const novu = new NovuCore({
32
32
  async function run() {
33
33
  const res = await trigger(novu, {
34
34
  name: "workflow_identifier",
35
- to: [
36
- {
37
- topicKey: "<value>",
38
- type: "Topic",
35
+ payload: {
36
+ "comment_id": "string",
37
+ "post": {
38
+ "text": "string",
39
39
  },
40
- {
41
- topicKey: "<value>",
42
- type: "Topic",
40
+ },
41
+ bridgeUrl: "https://example.com/bridge",
42
+ overrides: {
43
+ "fcm": {
44
+ "data": {
45
+ "key": "value",
46
+ },
43
47
  },
44
- ],
48
+ },
49
+ to: {
50
+ subscriberId: "<id>",
51
+ },
45
52
  });
46
53
 
47
54
  switch (true) {
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img src="https://github.com/speakeasy-sdks/novu-ts/assets/68016351/dabaa829-32c8-451b-b912-0fa1d10300bd" width="500">
2
+ <img src="https://raw.githubusercontent.com/novuhq/novu-ts/HEAD/assets/banner.png" width="500">
3
3
  <p>Novu is an open-source notification infrastructure.</p>
4
4
  <a href="https://docs.novu.co/api-reference/overview"><img src="https://img.shields.io/static/v1?label=Docs&message=API Ref&color=000000&style=for-the-badge" /></a>
5
5
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" /></a>
@@ -89,16 +89,23 @@ const novu = new Novu({
89
89
  async function run() {
90
90
  const result = await novu.trigger({
91
91
  name: "workflow_identifier",
92
- to: [
93
- {
94
- topicKey: "<value>",
95
- type: "Topic",
92
+ payload: {
93
+ "comment_id": "string",
94
+ "post": {
95
+ "text": "string",
96
96
  },
97
- {
98
- topicKey: "<value>",
99
- type: "Topic",
97
+ },
98
+ bridgeUrl: "https://example.com/bridge",
99
+ overrides: {
100
+ "fcm": {
101
+ "data": {
102
+ "key": "value",
103
+ },
100
104
  },
101
- ],
105
+ },
106
+ to: {
107
+ subscriberId: "<id>",
108
+ },
102
109
  });
103
110
 
104
111
  // Handle the result
@@ -123,31 +130,66 @@ async function run() {
123
130
  events: [
124
131
  {
125
132
  name: "workflow_identifier",
126
- to: [
127
- {
128
- topicKey: "<value>",
129
- type: "Topic",
133
+ payload: {
134
+ "comment_id": "string",
135
+ "post": {
136
+ "text": "string",
130
137
  },
131
- {
132
- subscriberId: "<id>",
138
+ },
139
+ bridgeUrl: "https://example.com/bridge",
140
+ overrides: {
141
+ "fcm": {
142
+ "data": {
143
+ "key": "value",
144
+ },
133
145
  },
134
- ],
135
- },
136
- {
137
- name: "workflow_identifier",
138
- to: [],
146
+ },
147
+ to: {
148
+ subscriberId: "<id>",
149
+ },
139
150
  },
140
151
  {
141
152
  name: "workflow_identifier",
153
+ payload: {
154
+ "comment_id": "string",
155
+ "post": {
156
+ "text": "string",
157
+ },
158
+ },
159
+ bridgeUrl: "https://example.com/bridge",
160
+ overrides: {
161
+ "fcm": {
162
+ "data": {
163
+ "key": "value",
164
+ },
165
+ },
166
+ },
142
167
  to: [
143
168
  {
144
169
  topicKey: "<value>",
145
- type: "Topic",
170
+ type: "Subscriber",
146
171
  },
147
- {
148
- topicKey: "<value>",
149
- type: "Topic",
172
+ ],
173
+ },
174
+ {
175
+ name: "workflow_identifier",
176
+ payload: {
177
+ "comment_id": "string",
178
+ "post": {
179
+ "text": "string",
180
+ },
181
+ },
182
+ bridgeUrl: "https://example.com/bridge",
183
+ overrides: {
184
+ "fcm": {
185
+ "data": {
186
+ "key": "value",
187
+ },
150
188
  },
189
+ },
190
+ to: [
191
+ "SUBSCRIBER_ID",
192
+ "SUBSCRIBER_ID",
151
193
  ],
152
194
  },
153
195
  ],
@@ -251,6 +293,8 @@ run();
251
293
  * [triggerBulk](docs/sdks/novu/README.md#triggerbulk) - Bulk trigger event
252
294
  * [triggerBroadcast](docs/sdks/novu/README.md#triggerbroadcast) - Broadcast event to all
253
295
  * [cancel](docs/sdks/novu/README.md#cancel) - Cancel triggered event
296
+ * [supportControllerFetchUserOrganizations](docs/sdks/novu/README.md#supportcontrollerfetchuserorganizations)
297
+ * [create](docs/sdks/novu/README.md#create)
254
298
 
255
299
  ### [subscribers](docs/sdks/subscribers/README.md)
256
300
 
@@ -327,6 +371,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
327
371
  <summary>Available standalone functions</summary>
328
372
 
329
373
  - [`cancel`](docs/sdks/novu/README.md#cancel) - Cancel triggered event
374
+ - [`create`](docs/sdks/novu/README.md#create)
330
375
  - [`integrationsCreate`](docs/sdks/integrations/README.md#create) - Create integration
331
376
  - [`integrationsDelete`](docs/sdks/integrations/README.md#delete) - Delete integration
332
377
  - [`integrationsList`](docs/sdks/integrations/README.md#list) - Get integrations
@@ -362,6 +407,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
362
407
  - [`subscribersPropertiesUpdateOnlineFlag`](docs/sdks/properties/README.md#updateonlineflag) - Update subscriber online status
363
408
  - [`subscribersRetrieve`](docs/sdks/subscribers/README.md#retrieve) - Get subscriber
364
409
  - [`subscribersUpdate`](docs/sdks/subscribers/README.md#update) - Update subscriber
410
+ - [`supportControllerFetchUserOrganizations`](docs/sdks/novu/README.md#supportcontrollerfetchuserorganizations)
365
411
  - [`topicsCreate`](docs/sdks/topics/README.md#create) - Topic creation
366
412
  - [`topicsDelete`](docs/sdks/topics/README.md#delete) - Delete topic
367
413
  - [`topicsList`](docs/sdks/topics/README.md#list) - Get topic list filtered
@@ -397,7 +443,7 @@ const novu = new Novu({
397
443
  });
398
444
 
399
445
  async function run() {
400
- const result = await novu.subscribers.list();
446
+ const result = await novu.subscribers.list(10);
401
447
 
402
448
  for await (const page of result) {
403
449
  // Handle the page
@@ -442,16 +488,23 @@ async function run() {
442
488
  try {
443
489
  result = await novu.trigger({
444
490
  name: "workflow_identifier",
445
- to: [
446
- {
447
- topicKey: "<value>",
448
- type: "Topic",
491
+ payload: {
492
+ "comment_id": "string",
493
+ "post": {
494
+ "text": "string",
449
495
  },
450
- {
451
- topicKey: "<value>",
452
- type: "Topic",
496
+ },
497
+ bridgeUrl: "https://example.com/bridge",
498
+ overrides: {
499
+ "fcm": {
500
+ "data": {
501
+ "key": "value",
502
+ },
453
503
  },
454
- ],
504
+ },
505
+ to: {
506
+ subscriberId: "<id>",
507
+ },
455
508
  });
456
509
 
457
510
  // Handle the result
@@ -536,16 +589,23 @@ const novu = new Novu({
536
589
  async function run() {
537
590
  const result = await novu.trigger({
538
591
  name: "workflow_identifier",
539
- to: [
540
- {
541
- topicKey: "<value>",
542
- type: "Topic",
592
+ payload: {
593
+ "comment_id": "string",
594
+ "post": {
595
+ "text": "string",
543
596
  },
544
- {
545
- topicKey: "<value>",
546
- type: "Topic",
597
+ },
598
+ bridgeUrl: "https://example.com/bridge",
599
+ overrides: {
600
+ "fcm": {
601
+ "data": {
602
+ "key": "value",
603
+ },
547
604
  },
548
- ],
605
+ },
606
+ to: {
607
+ subscriberId: "<id>",
608
+ },
549
609
  });
550
610
 
551
611
  // Handle the result
@@ -570,16 +630,23 @@ const novu = new Novu({
570
630
  async function run() {
571
631
  const result = await novu.trigger({
572
632
  name: "workflow_identifier",
573
- to: [
574
- {
575
- topicKey: "<value>",
576
- type: "Topic",
633
+ payload: {
634
+ "comment_id": "string",
635
+ "post": {
636
+ "text": "string",
577
637
  },
578
- {
579
- topicKey: "<value>",
580
- type: "Topic",
638
+ },
639
+ bridgeUrl: "https://example.com/bridge",
640
+ overrides: {
641
+ "fcm": {
642
+ "data": {
643
+ "key": "value",
644
+ },
581
645
  },
582
- ],
646
+ },
647
+ to: {
648
+ subscriberId: "<id>",
649
+ },
583
650
  });
584
651
 
585
652
  // Handle the result
@@ -662,16 +729,23 @@ const novu = new Novu({
662
729
  async function run() {
663
730
  const result = await novu.trigger({
664
731
  name: "workflow_identifier",
665
- to: [
666
- {
667
- topicKey: "<value>",
668
- type: "Topic",
732
+ payload: {
733
+ "comment_id": "string",
734
+ "post": {
735
+ "text": "string",
669
736
  },
670
- {
671
- topicKey: "<value>",
672
- type: "Topic",
737
+ },
738
+ bridgeUrl: "https://example.com/bridge",
739
+ overrides: {
740
+ "fcm": {
741
+ "data": {
742
+ "key": "value",
743
+ },
673
744
  },
674
- ],
745
+ },
746
+ to: {
747
+ subscriberId: "<id>",
748
+ },
675
749
  });
676
750
 
677
751
  // Handle the result
@@ -699,16 +773,23 @@ const novu = new Novu({
699
773
  async function run() {
700
774
  const result = await novu.trigger({
701
775
  name: "workflow_identifier",
702
- to: [
703
- {
704
- topicKey: "<value>",
705
- type: "Topic",
776
+ payload: {
777
+ "comment_id": "string",
778
+ "post": {
779
+ "text": "string",
706
780
  },
707
- {
708
- topicKey: "<value>",
709
- type: "Topic",
781
+ },
782
+ bridgeUrl: "https://example.com/bridge",
783
+ overrides: {
784
+ "fcm": {
785
+ "data": {
786
+ "key": "value",
787
+ },
710
788
  },
711
- ],
789
+ },
790
+ to: {
791
+ subscriberId: "<id>",
792
+ },
712
793
  }, {
713
794
  retries: {
714
795
  strategy: "backoff",
@@ -751,16 +832,23 @@ const novu = new Novu({
751
832
  async function run() {
752
833
  const result = await novu.trigger({
753
834
  name: "workflow_identifier",
754
- to: [
755
- {
756
- topicKey: "<value>",
757
- type: "Topic",
835
+ payload: {
836
+ "comment_id": "string",
837
+ "post": {
838
+ "text": "string",
758
839
  },
759
- {
760
- topicKey: "<value>",
761
- type: "Topic",
840
+ },
841
+ bridgeUrl: "https://example.com/bridge",
842
+ overrides: {
843
+ "fcm": {
844
+ "data": {
845
+ "key": "value",
846
+ },
762
847
  },
763
- ],
848
+ },
849
+ to: {
850
+ subscriberId: "<id>",
851
+ },
764
852
  });
765
853
 
766
854
  // Handle the result
@@ -27,6 +27,17 @@ async function run() {
27
27
  providerId: "pushpad",
28
28
  credentials: {
29
29
  webhookUrl: "https://example.com/webhook",
30
+ channel: "general",
31
+ deviceTokens: [
32
+ "token1",
33
+ "token2",
34
+ "token3",
35
+ ],
36
+ alertUid: "12345-abcde",
37
+ title: "Critical Alert",
38
+ imageUrl: "https://example.com/image.png",
39
+ state: "resolved",
40
+ externalUrl: "https://example.com/details",
30
41
  },
31
42
  }, "<id>");
32
43
 
@@ -56,6 +67,17 @@ async function run() {
56
67
  providerId: "pushpad",
57
68
  credentials: {
58
69
  webhookUrl: "https://example.com/webhook",
70
+ channel: "general",
71
+ deviceTokens: [
72
+ "token1",
73
+ "token2",
74
+ "token3",
75
+ ],
76
+ alertUid: "12345-abcde",
77
+ title: "Critical Alert",
78
+ imageUrl: "https://example.com/image.png",
79
+ state: "resolved",
80
+ externalUrl: "https://example.com/details",
59
81
  },
60
82
  }, "<id>");
61
83
 
@@ -116,6 +138,17 @@ async function run() {
116
138
  providerId: "zulip",
117
139
  credentials: {
118
140
  webhookUrl: "https://example.com/webhook",
141
+ channel: "general",
142
+ deviceTokens: [
143
+ "token1",
144
+ "token2",
145
+ "token3",
146
+ ],
147
+ alertUid: "12345-abcde",
148
+ title: "Critical Alert",
149
+ imageUrl: "https://example.com/image.png",
150
+ state: "resolved",
151
+ externalUrl: "https://example.com/details",
119
152
  },
120
153
  }, "<id>");
121
154
 
@@ -145,6 +178,17 @@ async function run() {
145
178
  providerId: "zulip",
146
179
  credentials: {
147
180
  webhookUrl: "https://example.com/webhook",
181
+ channel: "general",
182
+ deviceTokens: [
183
+ "token1",
184
+ "token2",
185
+ "token3",
186
+ ],
187
+ alertUid: "12345-abcde",
188
+ title: "Critical Alert",
189
+ imageUrl: "https://example.com/image.png",
190
+ state: "resolved",
191
+ externalUrl: "https://example.com/details",
148
192
  },
149
193
  }, "<id>");
150
194
 
@@ -26,7 +26,10 @@ const novu = new Novu({
26
26
  });
27
27
 
28
28
  async function run() {
29
- const result = await novu.messages.retrieve({});
29
+ const result = await novu.messages.retrieve({
30
+ page: 0,
31
+ limit: 10,
32
+ });
30
33
 
31
34
  // Handle the result
32
35
  console.log(result);
@@ -50,7 +53,10 @@ const novu = new NovuCore({
50
53
  });
51
54
 
52
55
  async function run() {
53
- const res = await messagesRetrieve(novu, {});
56
+ const res = await messagesRetrieve(novu, {
57
+ page: 0,
58
+ limit: 10,
59
+ });
54
60
 
55
61
  if (!res.ok) {
56
62
  throw res.error;
@@ -23,22 +23,7 @@ const novu = new Novu({
23
23
 
24
24
  async function run() {
25
25
  const result = await novu.notifications.list({
26
- channels: [
27
- "sms",
28
- "chat",
29
- "in_app",
30
- ],
31
- templates: [
32
-
33
- ],
34
- emails: [
35
-
36
- ],
37
- search: "<value>",
38
- subscriberIds: [
39
- "<value>",
40
- "<value>",
41
- ],
26
+ page: 0,
42
27
  });
43
28
 
44
29
  // Handle the result
@@ -64,22 +49,7 @@ const novu = new NovuCore({
64
49
 
65
50
  async function run() {
66
51
  const res = await notificationsList(novu, {
67
- channels: [
68
- "sms",
69
- "chat",
70
- "in_app",
71
- ],
72
- templates: [
73
-
74
- ],
75
- emails: [
76
-
77
- ],
78
- search: "<value>",
79
- subscriberIds: [
80
- "<value>",
81
- "<value>",
82
- ],
52
+ page: 0,
83
53
  });
84
54
 
85
55
  if (!res.ok) {