@novu/api 3.12.0-rc.0 → 3.13.0

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 (242) hide show
  1. package/README.md +25 -23
  2. package/_speakeasy/.github/action-inputs-config.json +53 -0
  3. package/_speakeasy/.github/action-security-config.json +88 -0
  4. package/examples/package-lock.json +1 -1
  5. package/funcs/channelConnectionsCreate.d.ts +1 -1
  6. package/funcs/channelConnectionsCreate.js +1 -1
  7. package/funcs/channelConnectionsDelete.d.ts +1 -1
  8. package/funcs/channelConnectionsDelete.js +1 -1
  9. package/funcs/channelConnectionsList.d.ts +2 -2
  10. package/funcs/channelConnectionsList.js +2 -2
  11. package/funcs/channelConnectionsRetrieve.d.ts +1 -1
  12. package/funcs/channelConnectionsRetrieve.js +1 -1
  13. package/funcs/channelConnectionsUpdate.d.ts +1 -1
  14. package/funcs/channelConnectionsUpdate.js +1 -1
  15. package/funcs/channelEndpointsCreate.d.ts +1 -1
  16. package/funcs/channelEndpointsCreate.js +1 -1
  17. package/funcs/channelEndpointsDelete.d.ts +1 -1
  18. package/funcs/channelEndpointsDelete.js +1 -1
  19. package/funcs/channelEndpointsList.d.ts +2 -2
  20. package/funcs/channelEndpointsList.js +2 -2
  21. package/funcs/channelEndpointsRetrieve.d.ts +1 -1
  22. package/funcs/channelEndpointsRetrieve.js +1 -1
  23. package/funcs/channelEndpointsUpdate.d.ts +1 -1
  24. package/funcs/channelEndpointsUpdate.js +1 -1
  25. package/funcs/notificationsList.js +1 -0
  26. package/funcs/notificationsList.js.map +1 -1
  27. package/funcs/subscribersPreferencesList.d.ts +1 -1
  28. package/funcs/subscribersPreferencesList.d.ts.map +1 -1
  29. package/funcs/subscribersPreferencesList.js +5 -9
  30. package/funcs/subscribersPreferencesList.js.map +1 -1
  31. package/funcs/subscribersTopicsList.js +1 -0
  32. package/funcs/subscribersTopicsList.js.map +1 -1
  33. package/funcs/topicsSubscriptionsGetSubscription.d.ts +18 -0
  34. package/funcs/topicsSubscriptionsGetSubscription.d.ts.map +1 -0
  35. package/funcs/topicsSubscriptionsGetSubscription.js +160 -0
  36. package/funcs/topicsSubscriptionsGetSubscription.js.map +1 -0
  37. package/funcs/topicsSubscriptionsList.js +1 -0
  38. package/funcs/topicsSubscriptionsList.js.map +1 -1
  39. package/funcs/topicsSubscriptionsUpdate.d.ts +1 -1
  40. package/funcs/topicsSubscriptionsUpdate.js +6 -3
  41. package/funcs/topicsSubscriptionsUpdate.js.map +1 -1
  42. package/funcs/trigger.d.ts +1 -1
  43. package/funcs/trigger.js +1 -1
  44. package/jsr.json +1 -1
  45. package/lib/config.d.ts +4 -4
  46. package/lib/config.js +4 -4
  47. package/lib/config.js.map +1 -1
  48. package/lib/sdks.js +2 -2
  49. package/lib/sdks.js.map +1 -1
  50. package/models/components/activitynotificationjobresponsedto.d.ts +4 -4
  51. package/models/components/activitynotificationjobresponsedto.d.ts.map +1 -1
  52. package/models/components/activitynotificationjobresponsedto.js +6 -7
  53. package/models/components/activitynotificationjobresponsedto.js.map +1 -1
  54. package/models/components/bulkupdatesubscriberpreferencesdto.d.ts +34 -0
  55. package/models/components/bulkupdatesubscriberpreferencesdto.d.ts.map +1 -1
  56. package/models/components/bulkupdatesubscriberpreferencesdto.js +17 -1
  57. package/models/components/bulkupdatesubscriberpreferencesdto.js.map +1 -1
  58. package/models/components/createchannelconnectionrequestdto.d.ts +10 -10
  59. package/models/components/createchannelconnectionrequestdto.d.ts.map +1 -1
  60. package/models/components/createchannelconnectionrequestdto.js +16 -12
  61. package/models/components/createchannelconnectionrequestdto.js.map +1 -1
  62. package/models/components/createslackchannelendpointdto.d.ts +8 -8
  63. package/models/components/createslackchannelendpointdto.d.ts.map +1 -1
  64. package/models/components/createslackchannelendpointdto.js +13 -7
  65. package/models/components/createslackchannelendpointdto.js.map +1 -1
  66. package/models/components/createtopicsubscriptionsrequestdto.d.ts +34 -0
  67. package/models/components/createtopicsubscriptionsrequestdto.d.ts.map +1 -1
  68. package/models/components/createtopicsubscriptionsrequestdto.js +23 -1
  69. package/models/components/createtopicsubscriptionsrequestdto.js.map +1 -1
  70. package/models/components/delaystepresponsedto.d.ts +1 -1
  71. package/models/components/delaystepresponsedto.d.ts.map +1 -1
  72. package/models/components/emailstepresponsedto.d.ts +3 -3
  73. package/models/components/emailstepresponsedto.d.ts.map +1 -1
  74. package/models/components/generatechatoauthurlrequestdto.d.ts +1 -1
  75. package/models/components/inappcontroldto.d.ts +1 -1
  76. package/models/components/inappstepresponsedto.d.ts +2 -2
  77. package/models/components/inappstepresponsedto.d.ts.map +1 -1
  78. package/models/components/index.d.ts +1 -0
  79. package/models/components/index.d.ts.map +1 -1
  80. package/models/components/index.js +1 -0
  81. package/models/components/index.js.map +1 -1
  82. package/models/components/messageactionresult.d.ts +3 -8
  83. package/models/components/messageactionresult.d.ts.map +1 -1
  84. package/models/components/messageactionresult.js +2 -8
  85. package/models/components/messageactionresult.js.map +1 -1
  86. package/models/components/messageresponsedto.d.ts +6 -16
  87. package/models/components/messageresponsedto.d.ts.map +1 -1
  88. package/models/components/messageresponsedto.js +3 -15
  89. package/models/components/messageresponsedto.js.map +1 -1
  90. package/models/components/notificationfeeditemdto.d.ts +4 -0
  91. package/models/components/notificationfeeditemdto.d.ts.map +1 -1
  92. package/models/components/notificationfeeditemdto.js +1 -0
  93. package/models/components/notificationfeeditemdto.js.map +1 -1
  94. package/models/components/patchsubscriberpreferencesdto.d.ts +34 -0
  95. package/models/components/patchsubscriberpreferencesdto.d.ts.map +1 -1
  96. package/models/components/patchsubscriberpreferencesdto.js +19 -1
  97. package/models/components/patchsubscriberpreferencesdto.js.map +1 -1
  98. package/models/components/redirectdto.d.ts +1 -1
  99. package/models/components/subscriberworkflowpreferencedto.d.ts +4 -0
  100. package/models/components/subscriberworkflowpreferencedto.d.ts.map +1 -1
  101. package/models/components/subscriberworkflowpreferencedto.js +1 -0
  102. package/models/components/subscriberworkflowpreferencedto.js.map +1 -1
  103. package/models/components/subscriptiondetailsresponsedto.d.ts +30 -0
  104. package/models/components/subscriptiondetailsresponsedto.d.ts.map +1 -0
  105. package/models/components/{createtopicsubscriptionsresponsedto.js → subscriptiondetailsresponsedto.js} +12 -12
  106. package/models/components/subscriptiondetailsresponsedto.js.map +1 -0
  107. package/models/components/subscriptiondto.d.ts +4 -0
  108. package/models/components/subscriptiondto.d.ts.map +1 -1
  109. package/models/components/subscriptiondto.js +1 -0
  110. package/models/components/subscriptiondto.js.map +1 -1
  111. package/models/components/subscriptionresponsedto.d.ts +4 -0
  112. package/models/components/subscriptionresponsedto.d.ts.map +1 -1
  113. package/models/components/subscriptionresponsedto.js +1 -0
  114. package/models/components/subscriptionresponsedto.js.map +1 -1
  115. package/models/components/throttlestepresponsedto.d.ts +2 -2
  116. package/models/components/throttlestepresponsedto.d.ts.map +1 -1
  117. package/models/components/topicsubscriptionresponsedto.d.ts +8 -0
  118. package/models/components/topicsubscriptionresponsedto.d.ts.map +1 -1
  119. package/models/components/topicsubscriptionresponsedto.js +2 -0
  120. package/models/components/topicsubscriptionresponsedto.js.map +1 -1
  121. package/models/components/triggereventrequestdto.d.ts +2 -2
  122. package/models/components/workflowresponsedto.d.ts +2 -2
  123. package/models/components/workflowresponsedto.d.ts.map +1 -1
  124. package/models/operations/inboundwebhookscontrollerhandlewebhook.d.ts +6 -2
  125. package/models/operations/inboundwebhookscontrollerhandlewebhook.d.ts.map +1 -1
  126. package/models/operations/inboundwebhookscontrollerhandlewebhook.js +1 -1
  127. package/models/operations/inboundwebhookscontrollerhandlewebhook.js.map +1 -1
  128. package/models/operations/index.d.ts +1 -0
  129. package/models/operations/index.d.ts.map +1 -1
  130. package/models/operations/index.js +1 -0
  131. package/models/operations/index.js.map +1 -1
  132. package/models/operations/notificationscontrollerlistnotifications.d.ts +5 -0
  133. package/models/operations/notificationscontrollerlistnotifications.d.ts.map +1 -1
  134. package/models/operations/notificationscontrollerlistnotifications.js +1 -0
  135. package/models/operations/notificationscontrollerlistnotifications.js.map +1 -1
  136. package/models/operations/subscriberscontrollergetsubscriberpreferences.d.ts +5 -0
  137. package/models/operations/subscriberscontrollergetsubscriberpreferences.d.ts.map +1 -1
  138. package/models/operations/subscriberscontrollergetsubscriberpreferences.js +1 -0
  139. package/models/operations/subscriberscontrollergetsubscriberpreferences.js.map +1 -1
  140. package/models/operations/subscriberscontrollerlistsubscribertopics.d.ts +5 -0
  141. package/models/operations/subscriberscontrollerlistsubscribertopics.d.ts.map +1 -1
  142. package/models/operations/subscriberscontrollerlistsubscribertopics.js +1 -0
  143. package/models/operations/subscriberscontrollerlistsubscribertopics.js.map +1 -1
  144. package/models/operations/topicscontrollergettopicsubscription.d.ts +37 -0
  145. package/models/operations/topicscontrollergettopicsubscription.d.ts.map +1 -0
  146. package/models/operations/topicscontrollergettopicsubscription.js +72 -0
  147. package/models/operations/topicscontrollergettopicsubscription.js.map +1 -0
  148. package/models/operations/topicscontrollerlisttopicsubscriptions.d.ts +5 -0
  149. package/models/operations/topicscontrollerlisttopicsubscriptions.d.ts.map +1 -1
  150. package/models/operations/topicscontrollerlisttopicsubscriptions.js +1 -0
  151. package/models/operations/topicscontrollerlisttopicsubscriptions.js.map +1 -1
  152. package/models/operations/topicscontrollerupdatetopicsubscription.d.ts +2 -2
  153. package/models/operations/topicscontrollerupdatetopicsubscription.d.ts.map +1 -1
  154. package/models/operations/topicscontrollerupdatetopicsubscription.js +1 -1
  155. package/models/operations/topicscontrollerupdatetopicsubscription.js.map +1 -1
  156. package/package.json +1 -1
  157. package/sdk/channelconnections.d.ts +6 -6
  158. package/sdk/channelconnections.js +6 -6
  159. package/sdk/channelendpoints.d.ts +6 -6
  160. package/sdk/channelendpoints.js +6 -6
  161. package/sdk/preferences.d.ts +1 -1
  162. package/sdk/preferences.d.ts.map +1 -1
  163. package/sdk/preferences.js +2 -2
  164. package/sdk/preferences.js.map +1 -1
  165. package/sdk/sdk.d.ts +1 -1
  166. package/sdk/sdk.js +1 -1
  167. package/sdk/subscriptions.d.ts +8 -1
  168. package/sdk/subscriptions.d.ts.map +1 -1
  169. package/sdk/subscriptions.js +11 -1
  170. package/sdk/subscriptions.js.map +1 -1
  171. package/sources/json-development.json +954 -183
  172. package/src/funcs/channelConnectionsCreate.ts +1 -1
  173. package/src/funcs/channelConnectionsDelete.ts +1 -1
  174. package/src/funcs/channelConnectionsList.ts +2 -2
  175. package/src/funcs/channelConnectionsRetrieve.ts +1 -1
  176. package/src/funcs/channelConnectionsUpdate.ts +1 -1
  177. package/src/funcs/channelEndpointsCreate.ts +1 -1
  178. package/src/funcs/channelEndpointsDelete.ts +1 -1
  179. package/src/funcs/channelEndpointsList.ts +2 -2
  180. package/src/funcs/channelEndpointsRetrieve.ts +1 -1
  181. package/src/funcs/channelEndpointsUpdate.ts +1 -1
  182. package/src/funcs/notificationsList.ts +1 -0
  183. package/src/funcs/subscribersPreferencesList.ts +5 -17
  184. package/src/funcs/subscribersTopicsList.ts +1 -0
  185. package/src/funcs/topicsSubscriptionsGetSubscription.ts +242 -0
  186. package/src/funcs/topicsSubscriptionsList.ts +1 -0
  187. package/src/funcs/topicsSubscriptionsUpdate.ts +8 -9
  188. package/src/funcs/trigger.ts +1 -1
  189. package/src/lib/config.ts +4 -4
  190. package/src/lib/sdks.ts +2 -2
  191. package/src/models/components/activitynotificationjobresponsedto.ts +9 -19
  192. package/src/models/components/bulkupdatesubscriberpreferencesdto.ts +62 -0
  193. package/src/models/components/createchannelconnectionrequestdto.ts +51 -18
  194. package/src/models/components/createslackchannelendpointdto.ts +31 -13
  195. package/src/models/components/createtopicsubscriptionsrequestdto.ts +82 -0
  196. package/src/models/components/delaystepresponsedto.ts +1 -1
  197. package/src/models/components/emailstepresponsedto.ts +3 -3
  198. package/src/models/components/generatechatoauthurlrequestdto.ts +1 -1
  199. package/src/models/components/inappcontroldto.ts +1 -1
  200. package/src/models/components/inappstepresponsedto.ts +2 -2
  201. package/src/models/components/index.ts +1 -0
  202. package/src/models/components/messageactionresult.ts +2 -21
  203. package/src/models/components/messageresponsedto.ts +4 -48
  204. package/src/models/components/notificationfeeditemdto.ts +5 -0
  205. package/src/models/components/patchsubscriberpreferencesdto.ts +48 -0
  206. package/src/models/components/redirectdto.ts +1 -1
  207. package/src/models/components/subscriberworkflowpreferencedto.ts +5 -0
  208. package/src/models/components/subscriptiondetailsresponsedto.ts +58 -0
  209. package/src/models/components/subscriptiondto.ts +5 -0
  210. package/src/models/components/subscriptionresponsedto.ts +5 -0
  211. package/src/models/components/throttlestepresponsedto.ts +2 -2
  212. package/src/models/components/topicsubscriptionresponsedto.ts +10 -0
  213. package/src/models/components/triggereventrequestdto.ts +2 -2
  214. package/src/models/components/workflowresponsedto.ts +2 -2
  215. package/src/models/operations/inboundwebhookscontrollerhandlewebhook.ts +3 -3
  216. package/src/models/operations/index.ts +1 -0
  217. package/src/models/operations/notificationscontrollerlistnotifications.ts +6 -0
  218. package/src/models/operations/subscriberscontrollergetsubscriberpreferences.ts +6 -0
  219. package/src/models/operations/subscriberscontrollerlistsubscribertopics.ts +6 -0
  220. package/src/models/operations/topicscontrollergettopicsubscription.ts +96 -0
  221. package/src/models/operations/topicscontrollerlisttopicsubscriptions.ts +6 -0
  222. package/src/models/operations/topicscontrollerupdatetopicsubscription.ts +3 -3
  223. package/src/sdk/channelconnections.ts +6 -6
  224. package/src/sdk/channelendpoints.ts +6 -6
  225. package/src/sdk/preferences.ts +2 -6
  226. package/src/sdk/sdk.ts +1 -1
  227. package/src/sdk/subscriptions.ts +23 -1
  228. package/models/components/createtopicsubscriptionsresponsedto.d.ts +0 -24
  229. package/models/components/createtopicsubscriptionsresponsedto.d.ts.map +0 -1
  230. package/models/components/createtopicsubscriptionsresponsedto.js.map +0 -1
  231. package/models/components/steptypeenum.d.ts +0 -26
  232. package/models/components/steptypeenum.d.ts.map +0 -1
  233. package/models/components/steptypeenum.js +0 -60
  234. package/models/components/steptypeenum.js.map +0 -1
  235. package/models/components/uploadtranslationsrequestdto.d.ts +0 -34
  236. package/models/components/uploadtranslationsrequestdto.d.ts.map +0 -1
  237. package/models/components/uploadtranslationsrequestdto.js +0 -60
  238. package/models/components/uploadtranslationsrequestdto.js.map +0 -1
  239. package/src/models/components/createtopicsubscriptionsresponsedto.ts +0 -54
  240. package/src/models/components/steptypeenum.ts +0 -33
  241. package/src/models/components/uploadtranslationsrequestdto.ts +0 -62
  242. package/temp/example.ts +0 -5
@@ -27,7 +27,7 @@ import { APICall, APIPromise } from "../types/async.js";
27
27
  import { Result } from "../types/fp.js";
28
28
 
29
29
  /**
30
- * Create channel connection for a resource and integration
30
+ * Create a channel connection
31
31
  *
32
32
  * @remarks
33
33
  * Create a new channel connection for a resource for given integration. Only one channel connection is allowed per resource and integration.
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * Delete channel connection
29
+ * Delete a channel connection
30
30
  *
31
31
  * @remarks
32
32
  * Delete a specific channel connection by its unique identifier.
@@ -26,10 +26,10 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * List channel connections
29
+ * List all channel connections
30
30
  *
31
31
  * @remarks
32
- * Retrieve all channel connections for a resource.
32
+ * List all channel connections for a resource.
33
33
  */
34
34
  export function channelConnectionsList(
35
35
  client: NovuCore,
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * Retrieve channel connection by identifier
29
+ * Retrieve a channel connection
30
30
  *
31
31
  * @remarks
32
32
  * Retrieve a specific channel connection by its unique identifier.
@@ -27,7 +27,7 @@ import { APICall, APIPromise } from "../types/async.js";
27
27
  import { Result } from "../types/fp.js";
28
28
 
29
29
  /**
30
- * Update channel connection
30
+ * Update a channel connection
31
31
  *
32
32
  * @remarks
33
33
  * Update an existing channel connection by its unique identifier.
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * Create channel endpoint for a resource
29
+ * Create a channel endpoint
30
30
  *
31
31
  * @remarks
32
32
  * Create a new channel endpoint for a resource.
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * Delete channel endpoint by identifier
29
+ * Delete a channel endpoint
30
30
  *
31
31
  * @remarks
32
32
  * Delete a specific channel endpoint by its unique identifier.
@@ -26,10 +26,10 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * List channel endpoints
29
+ * List all channel endpoints
30
30
  *
31
31
  * @remarks
32
- * Retrieve all channel endpoints for a resource based on query filters.
32
+ * List all channel endpoints for a resource based on query filters.
33
33
  */
34
34
  export function channelEndpointsList(
35
35
  client: NovuCore,
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * Retrieve channel endpoint by identifier
29
+ * Retrieve a channel endpoint
30
30
  *
31
31
  * @remarks
32
32
  * Retrieve a specific channel endpoint by its unique identifier.
@@ -27,7 +27,7 @@ import { APICall, APIPromise } from "../types/async.js";
27
27
  import { Result } from "../types/fp.js";
28
28
 
29
29
  /**
30
- * Update channel endpoint
30
+ * Update a channel endpoint
31
31
  *
32
32
  * @remarks
33
33
  * Update an existing channel endpoint by its unique identifier.
@@ -108,6 +108,7 @@ async function $do(
108
108
  "search": payload.search,
109
109
  "severity": payload.severity,
110
110
  "subscriberIds": payload.subscriberIds,
111
+ "subscriptionId": payload.subscriptionId,
111
112
  "templates": payload.templates,
112
113
  "topicKey": payload.topicKey,
113
114
  "transactionId": payload.transactionId,
@@ -34,9 +34,7 @@ import { Result } from "../types/fp.js";
34
34
  */
35
35
  export function subscribersPreferencesList(
36
36
  client: NovuCore,
37
- subscriberId: string,
38
- criticality?: operations.Criticality | undefined,
39
- idempotencyKey?: string | undefined,
37
+ request: operations.SubscribersControllerGetSubscriberPreferencesRequest,
40
38
  options?: RequestOptions,
41
39
  ): APIPromise<
42
40
  Result<
@@ -55,18 +53,14 @@ export function subscribersPreferencesList(
55
53
  > {
56
54
  return new APIPromise($do(
57
55
  client,
58
- subscriberId,
59
- criticality,
60
- idempotencyKey,
56
+ request,
61
57
  options,
62
58
  ));
63
59
  }
64
60
 
65
61
  async function $do(
66
62
  client: NovuCore,
67
- subscriberId: string,
68
- criticality?: operations.Criticality | undefined,
69
- idempotencyKey?: string | undefined,
63
+ request: operations.SubscribersControllerGetSubscriberPreferencesRequest,
70
64
  options?: RequestOptions,
71
65
  ): Promise<
72
66
  [
@@ -86,15 +80,8 @@ async function $do(
86
80
  APICall,
87
81
  ]
88
82
  > {
89
- const input: operations.SubscribersControllerGetSubscriberPreferencesRequest =
90
- {
91
- subscriberId: subscriberId,
92
- criticality: criticality,
93
- idempotencyKey: idempotencyKey,
94
- };
95
-
96
83
  const parsed = safeParse(
97
- input,
84
+ request,
98
85
  (value) =>
99
86
  operations
100
87
  .SubscribersControllerGetSubscriberPreferencesRequest$outboundSchema
@@ -119,6 +106,7 @@ async function $do(
119
106
  );
120
107
 
121
108
  const query = encodeFormQuery({
109
+ "contextKeys": payload.contextKeys,
122
110
  "criticality": payload.criticality,
123
111
  });
124
112
 
@@ -107,6 +107,7 @@ async function $do(
107
107
  const query = encodeFormQuery({
108
108
  "after": payload.after,
109
109
  "before": payload.before,
110
+ "contextKeys": payload.contextKeys,
110
111
  "includeCursor": payload.includeCursor,
111
112
  "key": payload.key,
112
113
  "limit": payload.limit,
@@ -0,0 +1,242 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { NovuCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { NovuError } from "../models/errors/novuerror.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Get a topic subscription
30
+ *
31
+ * @remarks
32
+ * Get a subscription by its unique identifier for a topic.
33
+ */
34
+ export function topicsSubscriptionsGetSubscription(
35
+ client: NovuCore,
36
+ topicKey: string,
37
+ identifier: string,
38
+ idempotencyKey?: string | undefined,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ operations.TopicsControllerGetTopicSubscriptionResponse,
43
+ | errors.ErrorDto
44
+ | errors.ValidationErrorDto
45
+ | NovuError
46
+ | ResponseValidationError
47
+ | ConnectionError
48
+ | RequestAbortedError
49
+ | RequestTimeoutError
50
+ | InvalidRequestError
51
+ | UnexpectedClientError
52
+ | SDKValidationError
53
+ >
54
+ > {
55
+ return new APIPromise($do(
56
+ client,
57
+ topicKey,
58
+ identifier,
59
+ idempotencyKey,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ async function $do(
65
+ client: NovuCore,
66
+ topicKey: string,
67
+ identifier: string,
68
+ idempotencyKey?: string | undefined,
69
+ options?: RequestOptions,
70
+ ): Promise<
71
+ [
72
+ Result<
73
+ operations.TopicsControllerGetTopicSubscriptionResponse,
74
+ | errors.ErrorDto
75
+ | errors.ValidationErrorDto
76
+ | NovuError
77
+ | ResponseValidationError
78
+ | ConnectionError
79
+ | RequestAbortedError
80
+ | RequestTimeoutError
81
+ | InvalidRequestError
82
+ | UnexpectedClientError
83
+ | SDKValidationError
84
+ >,
85
+ APICall,
86
+ ]
87
+ > {
88
+ const input: operations.TopicsControllerGetTopicSubscriptionRequest = {
89
+ topicKey: topicKey,
90
+ identifier: identifier,
91
+ idempotencyKey: idempotencyKey,
92
+ };
93
+
94
+ const parsed = safeParse(
95
+ input,
96
+ (value) =>
97
+ operations.TopicsControllerGetTopicSubscriptionRequest$outboundSchema
98
+ .parse(value),
99
+ "Input validation failed",
100
+ );
101
+ if (!parsed.ok) {
102
+ return [parsed, { status: "invalid" }];
103
+ }
104
+ const payload = parsed.value;
105
+ const body = null;
106
+
107
+ const pathParams = {
108
+ identifier: encodeSimple("identifier", payload.identifier, {
109
+ explode: false,
110
+ charEncoding: "percent",
111
+ }),
112
+ topicKey: encodeSimple("topicKey", payload.topicKey, {
113
+ explode: false,
114
+ charEncoding: "percent",
115
+ }),
116
+ };
117
+
118
+ const path = pathToFunc("/v2/topics/{topicKey}/subscriptions/{identifier}")(
119
+ pathParams,
120
+ );
121
+
122
+ const headers = new Headers(compactMap({
123
+ Accept: "application/json",
124
+ "idempotency-key": encodeSimple(
125
+ "idempotency-key",
126
+ payload["idempotency-key"],
127
+ { explode: false, charEncoding: "none" },
128
+ ),
129
+ }));
130
+
131
+ const secConfig = await extractSecurity(client._options.secretKey);
132
+ const securityInput = secConfig == null ? {} : { secretKey: secConfig };
133
+ const requestSecurity = resolveGlobalSecurity(securityInput);
134
+
135
+ const context = {
136
+ options: client._options,
137
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
138
+ operationID: "TopicsController_getTopicSubscription",
139
+ oAuth2Scopes: null,
140
+
141
+ resolvedSecurity: requestSecurity,
142
+
143
+ securitySource: client._options.secretKey,
144
+ retryConfig: options?.retries
145
+ || client._options.retryConfig
146
+ || {
147
+ strategy: "backoff",
148
+ backoff: {
149
+ initialInterval: 1000,
150
+ maxInterval: 30000,
151
+ exponent: 1.5,
152
+ maxElapsedTime: 3600000,
153
+ },
154
+ retryConnectionErrors: true,
155
+ }
156
+ || { strategy: "none" },
157
+ retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
158
+ };
159
+
160
+ const requestRes = client._createRequest(context, {
161
+ security: requestSecurity,
162
+ method: "GET",
163
+ baseURL: options?.serverURL,
164
+ path: path,
165
+ headers: headers,
166
+ body: body,
167
+ userAgent: client._options.userAgent,
168
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
169
+ }, options);
170
+ if (!requestRes.ok) {
171
+ return [requestRes, { status: "invalid" }];
172
+ }
173
+ const req = requestRes.value;
174
+
175
+ const doResult = await client._do(req, {
176
+ context,
177
+ errorCodes: [
178
+ "400",
179
+ "401",
180
+ "403",
181
+ "404",
182
+ "405",
183
+ "409",
184
+ "413",
185
+ "414",
186
+ "415",
187
+ "422",
188
+ "429",
189
+ "4XX",
190
+ "500",
191
+ "503",
192
+ "5XX",
193
+ ],
194
+ retryConfig: context.retryConfig,
195
+ retryCodes: context.retryCodes,
196
+ });
197
+ if (!doResult.ok) {
198
+ return [doResult, { status: "request-error", request: req }];
199
+ }
200
+ const response = doResult.value;
201
+
202
+ const responseFields = {
203
+ HttpMeta: { Response: response, Request: req },
204
+ };
205
+
206
+ const [result] = await M.match<
207
+ operations.TopicsControllerGetTopicSubscriptionResponse,
208
+ | errors.ErrorDto
209
+ | errors.ValidationErrorDto
210
+ | NovuError
211
+ | ResponseValidationError
212
+ | ConnectionError
213
+ | RequestAbortedError
214
+ | RequestTimeoutError
215
+ | InvalidRequestError
216
+ | UnexpectedClientError
217
+ | SDKValidationError
218
+ >(
219
+ M.json(
220
+ 200,
221
+ operations.TopicsControllerGetTopicSubscriptionResponse$inboundSchema,
222
+ { hdrs: true, key: "Result" },
223
+ ),
224
+ M.jsonErr(414, errors.ErrorDto$inboundSchema),
225
+ M.jsonErr(
226
+ [400, 401, 403, 404, 405, 409, 413, 415],
227
+ errors.ErrorDto$inboundSchema,
228
+ { hdrs: true },
229
+ ),
230
+ M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
231
+ M.fail(429),
232
+ M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
233
+ M.fail(503),
234
+ M.fail("4XX"),
235
+ M.fail("5XX"),
236
+ )(response, req, { extraFields: responseFields });
237
+ if (!result.ok) {
238
+ return [result, { status: "complete", request: req, response }];
239
+ }
240
+
241
+ return [result, { status: "complete", request: req, response }];
242
+ }
@@ -105,6 +105,7 @@ async function $do(
105
105
  const query = encodeFormQuery({
106
106
  "after": payload.after,
107
107
  "before": payload.before,
108
+ "contextKeys": payload.contextKeys,
108
109
  "includeCursor": payload.includeCursor,
109
110
  "limit": payload.limit,
110
111
  "orderBy": payload.orderBy,
@@ -29,7 +29,7 @@ import { Result } from "../types/fp.js";
29
29
  * Update a topic subscription
30
30
  *
31
31
  * @remarks
32
- * Update a subscription by its unique identifier **subscriptionIdOrIdentifier** for a topic. You can update the preferences and name associated with the subscription.
32
+ * Update a subscription by its unique identifier for a topic. You can update the preferences and name associated with the subscription.
33
33
  */
34
34
  export function topicsSubscriptionsUpdate(
35
35
  client: NovuCore,
@@ -95,20 +95,19 @@ async function $do(
95
95
  });
96
96
 
97
97
  const pathParams = {
98
- subscriptionIdOrIdentifier: encodeSimple(
99
- "subscriptionIdOrIdentifier",
100
- payload.subscriptionIdOrIdentifier,
101
- { explode: false, charEncoding: "percent" },
102
- ),
98
+ identifier: encodeSimple("identifier", payload.identifier, {
99
+ explode: false,
100
+ charEncoding: "percent",
101
+ }),
103
102
  topicKey: encodeSimple("topicKey", payload.topicKey, {
104
103
  explode: false,
105
104
  charEncoding: "percent",
106
105
  }),
107
106
  };
108
107
 
109
- const path = pathToFunc(
110
- "/v2/topics/{topicKey}/subscriptions/{subscriptionIdOrIdentifier}",
111
- )(pathParams);
108
+ const path = pathToFunc("/v2/topics/{topicKey}/subscriptions/{identifier}")(
109
+ pathParams,
110
+ );
112
111
 
113
112
  const headers = new Headers(compactMap({
114
113
  "Content-Type": "application/json",
@@ -31,7 +31,7 @@ import { Result } from "../types/fp.js";
31
31
  *
32
32
  * @remarks
33
33
  *
34
- * Trigger event is the main (and only) way to send notifications to subscribers. The trigger identifier is used to match the particular workflow associated with it. Additional information can be passed according the body interface below.
34
+ * Trigger event is the main (and only) way to send notifications to subscribers. The trigger identifier is used to match the particular workflow associated with it. Maximum number of recipients can be 100. Additional information can be passed according the body interface below.
35
35
  * To prevent duplicate triggers, you can optionally pass a **transactionId** in the request body. If the same **transactionId** is used again, the trigger will be ignored. The retention period depends on your billing tier.
36
36
  */
37
37
  export function trigger(
package/src/lib/config.ts CHANGED
@@ -58,8 +58,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
58
58
 
59
59
  export const SDK_METADATA = {
60
60
  language: "typescript",
61
- openapiDocVersion: "3.11.0",
62
- sdkVersion: "3.12.0-rc.0",
63
- genVersion: "2.781.2",
64
- userAgent: "speakeasy-sdk/typescript 3.12.0-rc.0 2.781.2 3.11.0 @novu/api",
61
+ openapiDocVersion: "3.12.0",
62
+ sdkVersion: "3.13.0",
63
+ genVersion: "2.801.2",
64
+ userAgent: "speakeasy-sdk/typescript 3.13.0 2.801.2 3.12.0 @novu/api",
65
65
  } as const;
package/src/lib/sdks.ts CHANGED
@@ -304,9 +304,9 @@ export class ClientSDK {
304
304
  }
305
305
  }
306
306
 
307
- const jsonLikeContentTypeRE = /(application|text)\/.*?\+*json.*/;
307
+ const jsonLikeContentTypeRE = /^(application|text)\/([^+]+\+)*json.*/;
308
308
  const jsonlLikeContentTypeRE =
309
- /(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;
309
+ /^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;
310
310
  async function logRequest(logger: Logger | undefined, req: Request) {
311
311
  if (!logger) {
312
312
  return;
@@ -50,7 +50,7 @@ export type ActivityNotificationJobResponseDtoType = ClosedEnum<
50
50
  /**
51
51
  * Optional payload for the job
52
52
  */
53
- export type ActivityNotificationJobResponseDtoPayload = {};
53
+ export type Payload = {};
54
54
 
55
55
  export type ActivityNotificationJobResponseDto = {
56
56
  /**
@@ -80,7 +80,7 @@ export type ActivityNotificationJobResponseDto = {
80
80
  /**
81
81
  * Optional payload for the job
82
82
  */
83
- payload?: ActivityNotificationJobResponseDtoPayload | undefined;
83
+ payload?: Payload | undefined;
84
84
  /**
85
85
  * Provider ID of the job
86
86
  */
@@ -106,25 +106,16 @@ export const ActivityNotificationJobResponseDtoType$inboundSchema:
106
106
  );
107
107
 
108
108
  /** @internal */
109
- export const ActivityNotificationJobResponseDtoPayload$inboundSchema: z.ZodType<
110
- ActivityNotificationJobResponseDtoPayload,
111
- z.ZodTypeDef,
112
- unknown
113
- > = z.object({});
109
+ export const Payload$inboundSchema: z.ZodType<Payload, z.ZodTypeDef, unknown> =
110
+ z.object({});
114
111
 
115
- export function activityNotificationJobResponseDtoPayloadFromJSON(
112
+ export function payloadFromJSON(
116
113
  jsonString: string,
117
- ): SafeParseResult<
118
- ActivityNotificationJobResponseDtoPayload,
119
- SDKValidationError
120
- > {
114
+ ): SafeParseResult<Payload, SDKValidationError> {
121
115
  return safeParse(
122
116
  jsonString,
123
- (x) =>
124
- ActivityNotificationJobResponseDtoPayload$inboundSchema.parse(
125
- JSON.parse(x),
126
- ),
127
- `Failed to parse 'ActivityNotificationJobResponseDtoPayload' from JSON`,
117
+ (x) => Payload$inboundSchema.parse(JSON.parse(x)),
118
+ `Failed to parse 'Payload' from JSON`,
128
119
  );
129
120
  }
130
121
 
@@ -142,8 +133,7 @@ export const ActivityNotificationJobResponseDto$inboundSchema: z.ZodType<
142
133
  ),
143
134
  step: ActivityNotificationStepResponseDto$inboundSchema,
144
135
  overrides: z.record(z.any()).optional(),
145
- payload: z.lazy(() => ActivityNotificationJobResponseDtoPayload$inboundSchema)
146
- .optional(),
136
+ payload: z.lazy(() => Payload$inboundSchema).optional(),
147
137
  providerId: ProvidersIdEnum$inboundSchema,
148
138
  status: z.string(),
149
139
  updatedAt: z.string().optional(),
@@ -9,16 +9,75 @@ import {
9
9
  BulkUpdateSubscriberPreferenceItemDto$outboundSchema,
10
10
  } from "./bulkupdatesubscriberpreferenceitemdto.js";
11
11
 
12
+ /**
13
+ * Rich context object with id and optional data
14
+ */
15
+ export type Context2 = {
16
+ id: string;
17
+ /**
18
+ * Optional additional context data
19
+ */
20
+ data?: { [k: string]: any } | undefined;
21
+ };
22
+
23
+ export type BulkUpdateSubscriberPreferencesDtoContext = Context2 | string;
24
+
12
25
  export type BulkUpdateSubscriberPreferencesDto = {
13
26
  /**
14
27
  * Array of workflow preferences to update (maximum 100 items)
15
28
  */
16
29
  preferences: Array<BulkUpdateSubscriberPreferenceItemDto>;
30
+ context?: { [k: string]: Context2 | string } | undefined;
17
31
  };
18
32
 
33
+ /** @internal */
34
+ export type Context2$Outbound = {
35
+ id: string;
36
+ data?: { [k: string]: any } | undefined;
37
+ };
38
+
39
+ /** @internal */
40
+ export const Context2$outboundSchema: z.ZodType<
41
+ Context2$Outbound,
42
+ z.ZodTypeDef,
43
+ Context2
44
+ > = z.object({
45
+ id: z.string(),
46
+ data: z.record(z.any()).optional(),
47
+ });
48
+
49
+ export function context2ToJSON(context2: Context2): string {
50
+ return JSON.stringify(Context2$outboundSchema.parse(context2));
51
+ }
52
+
53
+ /** @internal */
54
+ export type BulkUpdateSubscriberPreferencesDtoContext$Outbound =
55
+ | Context2$Outbound
56
+ | string;
57
+
58
+ /** @internal */
59
+ export const BulkUpdateSubscriberPreferencesDtoContext$outboundSchema:
60
+ z.ZodType<
61
+ BulkUpdateSubscriberPreferencesDtoContext$Outbound,
62
+ z.ZodTypeDef,
63
+ BulkUpdateSubscriberPreferencesDtoContext
64
+ > = z.union([z.lazy(() => Context2$outboundSchema), z.string()]);
65
+
66
+ export function bulkUpdateSubscriberPreferencesDtoContextToJSON(
67
+ bulkUpdateSubscriberPreferencesDtoContext:
68
+ BulkUpdateSubscriberPreferencesDtoContext,
69
+ ): string {
70
+ return JSON.stringify(
71
+ BulkUpdateSubscriberPreferencesDtoContext$outboundSchema.parse(
72
+ bulkUpdateSubscriberPreferencesDtoContext,
73
+ ),
74
+ );
75
+ }
76
+
19
77
  /** @internal */
20
78
  export type BulkUpdateSubscriberPreferencesDto$Outbound = {
21
79
  preferences: Array<BulkUpdateSubscriberPreferenceItemDto$Outbound>;
80
+ context?: { [k: string]: Context2$Outbound | string } | undefined;
22
81
  };
23
82
 
24
83
  /** @internal */
@@ -28,6 +87,9 @@ export const BulkUpdateSubscriberPreferencesDto$outboundSchema: z.ZodType<
28
87
  BulkUpdateSubscriberPreferencesDto
29
88
  > = z.object({
30
89
  preferences: z.array(BulkUpdateSubscriberPreferenceItemDto$outboundSchema),
90
+ context: z.record(
91
+ z.union([z.lazy(() => Context2$outboundSchema), z.string()]),
92
+ ).optional(),
31
93
  });
32
94
 
33
95
  export function bulkUpdateSubscriberPreferencesDtoToJSON(