@novu/api 0.2.0 → 0.3.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 (288) hide show
  1. package/README.md +4 -4
  2. package/funcs/cancel.d.ts +2 -1
  3. package/funcs/cancel.d.ts.map +1 -1
  4. package/funcs/cancel.js +12 -7
  5. package/funcs/cancel.js.map +1 -1
  6. package/funcs/integrationsCreate.d.ts +2 -1
  7. package/funcs/integrationsCreate.d.ts.map +1 -1
  8. package/funcs/integrationsCreate.js +12 -7
  9. package/funcs/integrationsCreate.js.map +1 -1
  10. package/funcs/integrationsDelete.d.ts +2 -1
  11. package/funcs/integrationsDelete.d.ts.map +1 -1
  12. package/funcs/integrationsDelete.js +12 -7
  13. package/funcs/integrationsDelete.js.map +1 -1
  14. package/funcs/integrationsList.d.ts +2 -1
  15. package/funcs/integrationsList.d.ts.map +1 -1
  16. package/funcs/integrationsList.js +12 -7
  17. package/funcs/integrationsList.js.map +1 -1
  18. package/funcs/integrationsListActive.d.ts +2 -1
  19. package/funcs/integrationsListActive.d.ts.map +1 -1
  20. package/funcs/integrationsListActive.js +12 -7
  21. package/funcs/integrationsListActive.js.map +1 -1
  22. package/funcs/integrationsSetAsPrimary.d.ts +2 -1
  23. package/funcs/integrationsSetAsPrimary.d.ts.map +1 -1
  24. package/funcs/integrationsSetAsPrimary.js +12 -7
  25. package/funcs/integrationsSetAsPrimary.js.map +1 -1
  26. package/funcs/integrationsUpdate.d.ts +2 -1
  27. package/funcs/integrationsUpdate.d.ts.map +1 -1
  28. package/funcs/integrationsUpdate.js +12 -7
  29. package/funcs/integrationsUpdate.js.map +1 -1
  30. package/funcs/integrationsWebhooksRetrieve.d.ts +2 -1
  31. package/funcs/integrationsWebhooksRetrieve.d.ts.map +1 -1
  32. package/funcs/integrationsWebhooksRetrieve.js +12 -7
  33. package/funcs/integrationsWebhooksRetrieve.js.map +1 -1
  34. package/funcs/messagesDelete.d.ts +2 -1
  35. package/funcs/messagesDelete.d.ts.map +1 -1
  36. package/funcs/messagesDelete.js +12 -7
  37. package/funcs/messagesDelete.js.map +1 -1
  38. package/funcs/messagesDeleteByTransactionId.d.ts +2 -1
  39. package/funcs/messagesDeleteByTransactionId.d.ts.map +1 -1
  40. package/funcs/messagesDeleteByTransactionId.js +12 -7
  41. package/funcs/messagesDeleteByTransactionId.js.map +1 -1
  42. package/funcs/messagesRetrieve.d.ts +2 -1
  43. package/funcs/messagesRetrieve.d.ts.map +1 -1
  44. package/funcs/messagesRetrieve.js +12 -7
  45. package/funcs/messagesRetrieve.js.map +1 -1
  46. package/funcs/notificationsList.d.ts +2 -1
  47. package/funcs/notificationsList.d.ts.map +1 -1
  48. package/funcs/notificationsList.js +13 -7
  49. package/funcs/notificationsList.js.map +1 -1
  50. package/funcs/notificationsRetrieve.d.ts +2 -1
  51. package/funcs/notificationsRetrieve.d.ts.map +1 -1
  52. package/funcs/notificationsRetrieve.js +12 -7
  53. package/funcs/notificationsRetrieve.js.map +1 -1
  54. package/funcs/notificationsStatsGraph.d.ts +2 -1
  55. package/funcs/notificationsStatsGraph.d.ts.map +1 -1
  56. package/funcs/notificationsStatsGraph.js +12 -7
  57. package/funcs/notificationsStatsGraph.js.map +1 -1
  58. package/funcs/notificationsStatsRetrieve.d.ts +2 -1
  59. package/funcs/notificationsStatsRetrieve.d.ts.map +1 -1
  60. package/funcs/notificationsStatsRetrieve.js +12 -7
  61. package/funcs/notificationsStatsRetrieve.js.map +1 -1
  62. package/funcs/subscribersAuthenticationChatAccessOauth.d.ts +2 -1
  63. package/funcs/subscribersAuthenticationChatAccessOauth.d.ts.map +1 -1
  64. package/funcs/subscribersAuthenticationChatAccessOauth.js +12 -7
  65. package/funcs/subscribersAuthenticationChatAccessOauth.js.map +1 -1
  66. package/funcs/subscribersAuthenticationChatAccessOauthCallBack.d.ts +2 -1
  67. package/funcs/subscribersAuthenticationChatAccessOauthCallBack.d.ts.map +1 -1
  68. package/funcs/subscribersAuthenticationChatAccessOauthCallBack.js +12 -7
  69. package/funcs/subscribersAuthenticationChatAccessOauthCallBack.js.map +1 -1
  70. package/funcs/subscribersCreate.d.ts +2 -1
  71. package/funcs/subscribersCreate.d.ts.map +1 -1
  72. package/funcs/subscribersCreate.js +13 -8
  73. package/funcs/subscribersCreate.js.map +1 -1
  74. package/funcs/subscribersCreateBulk.d.ts +2 -1
  75. package/funcs/subscribersCreateBulk.d.ts.map +1 -1
  76. package/funcs/subscribersCreateBulk.js +12 -7
  77. package/funcs/subscribersCreateBulk.js.map +1 -1
  78. package/funcs/subscribersCredentialsAppend.d.ts +2 -1
  79. package/funcs/subscribersCredentialsAppend.d.ts.map +1 -1
  80. package/funcs/subscribersCredentialsAppend.js +12 -7
  81. package/funcs/subscribersCredentialsAppend.js.map +1 -1
  82. package/funcs/subscribersCredentialsDelete.d.ts +2 -1
  83. package/funcs/subscribersCredentialsDelete.d.ts.map +1 -1
  84. package/funcs/subscribersCredentialsDelete.js +12 -7
  85. package/funcs/subscribersCredentialsDelete.js.map +1 -1
  86. package/funcs/subscribersCredentialsUpdate.d.ts +2 -1
  87. package/funcs/subscribersCredentialsUpdate.d.ts.map +1 -1
  88. package/funcs/subscribersCredentialsUpdate.js +12 -7
  89. package/funcs/subscribersCredentialsUpdate.js.map +1 -1
  90. package/funcs/subscribersDelete.d.ts +2 -1
  91. package/funcs/subscribersDelete.d.ts.map +1 -1
  92. package/funcs/subscribersDelete.js +12 -7
  93. package/funcs/subscribersDelete.js.map +1 -1
  94. package/funcs/subscribersList.d.ts +2 -1
  95. package/funcs/subscribersList.d.ts.map +1 -1
  96. package/funcs/subscribersList.js +20 -7
  97. package/funcs/subscribersList.js.map +1 -1
  98. package/funcs/subscribersMessagesMarkAll.d.ts +2 -1
  99. package/funcs/subscribersMessagesMarkAll.d.ts.map +1 -1
  100. package/funcs/subscribersMessagesMarkAll.js +12 -7
  101. package/funcs/subscribersMessagesMarkAll.js.map +1 -1
  102. package/funcs/subscribersMessagesMarkAllAs.d.ts +2 -1
  103. package/funcs/subscribersMessagesMarkAllAs.d.ts.map +1 -1
  104. package/funcs/subscribersMessagesMarkAllAs.js +12 -7
  105. package/funcs/subscribersMessagesMarkAllAs.js.map +1 -1
  106. package/funcs/subscribersMessagesUpdateAsSeen.d.ts +2 -1
  107. package/funcs/subscribersMessagesUpdateAsSeen.d.ts.map +1 -1
  108. package/funcs/subscribersMessagesUpdateAsSeen.js +12 -7
  109. package/funcs/subscribersMessagesUpdateAsSeen.js.map +1 -1
  110. package/funcs/subscribersNotificationsFeed.d.ts +2 -1
  111. package/funcs/subscribersNotificationsFeed.d.ts.map +1 -1
  112. package/funcs/subscribersNotificationsFeed.js +12 -7
  113. package/funcs/subscribersNotificationsFeed.js.map +1 -1
  114. package/funcs/subscribersNotificationsUnseenCount.d.ts +2 -1
  115. package/funcs/subscribersNotificationsUnseenCount.d.ts.map +1 -1
  116. package/funcs/subscribersNotificationsUnseenCount.js +12 -7
  117. package/funcs/subscribersNotificationsUnseenCount.js.map +1 -1
  118. package/funcs/subscribersPatch.d.ts +2 -1
  119. package/funcs/subscribersPatch.d.ts.map +1 -1
  120. package/funcs/subscribersPatch.js +12 -7
  121. package/funcs/subscribersPatch.js.map +1 -1
  122. package/funcs/subscribersPreferencesList.d.ts +2 -1
  123. package/funcs/subscribersPreferencesList.d.ts.map +1 -1
  124. package/funcs/subscribersPreferencesList.js +12 -7
  125. package/funcs/subscribersPreferencesList.js.map +1 -1
  126. package/funcs/subscribersPreferencesUpdate.d.ts +2 -1
  127. package/funcs/subscribersPreferencesUpdate.d.ts.map +1 -1
  128. package/funcs/subscribersPreferencesUpdate.js +12 -7
  129. package/funcs/subscribersPreferencesUpdate.js.map +1 -1
  130. package/funcs/subscribersPropertiesUpdateOnlineFlag.d.ts +2 -1
  131. package/funcs/subscribersPropertiesUpdateOnlineFlag.d.ts.map +1 -1
  132. package/funcs/subscribersPropertiesUpdateOnlineFlag.js +12 -7
  133. package/funcs/subscribersPropertiesUpdateOnlineFlag.js.map +1 -1
  134. package/funcs/subscribersRetrieve.d.ts +2 -1
  135. package/funcs/subscribersRetrieve.d.ts.map +1 -1
  136. package/funcs/subscribersRetrieve.js +12 -7
  137. package/funcs/subscribersRetrieve.js.map +1 -1
  138. package/funcs/subscribersSearch.d.ts +2 -1
  139. package/funcs/subscribersSearch.d.ts.map +1 -1
  140. package/funcs/subscribersSearch.js +12 -7
  141. package/funcs/subscribersSearch.js.map +1 -1
  142. package/funcs/topicsCreate.d.ts +2 -1
  143. package/funcs/topicsCreate.d.ts.map +1 -1
  144. package/funcs/topicsCreate.js +12 -7
  145. package/funcs/topicsCreate.js.map +1 -1
  146. package/funcs/topicsDelete.d.ts +2 -1
  147. package/funcs/topicsDelete.d.ts.map +1 -1
  148. package/funcs/topicsDelete.js +12 -7
  149. package/funcs/topicsDelete.js.map +1 -1
  150. package/funcs/topicsList.d.ts +2 -1
  151. package/funcs/topicsList.d.ts.map +1 -1
  152. package/funcs/topicsList.js +12 -7
  153. package/funcs/topicsList.js.map +1 -1
  154. package/funcs/topicsRename.d.ts +2 -1
  155. package/funcs/topicsRename.d.ts.map +1 -1
  156. package/funcs/topicsRename.js +12 -7
  157. package/funcs/topicsRename.js.map +1 -1
  158. package/funcs/topicsRetrieve.d.ts +2 -1
  159. package/funcs/topicsRetrieve.d.ts.map +1 -1
  160. package/funcs/topicsRetrieve.js +12 -7
  161. package/funcs/topicsRetrieve.js.map +1 -1
  162. package/funcs/topicsSubscribersAssign.d.ts +2 -1
  163. package/funcs/topicsSubscribersAssign.d.ts.map +1 -1
  164. package/funcs/topicsSubscribersAssign.js +12 -7
  165. package/funcs/topicsSubscribersAssign.js.map +1 -1
  166. package/funcs/topicsSubscribersRemove.d.ts +2 -1
  167. package/funcs/topicsSubscribersRemove.d.ts.map +1 -1
  168. package/funcs/topicsSubscribersRemove.js +12 -7
  169. package/funcs/topicsSubscribersRemove.js.map +1 -1
  170. package/funcs/topicsSubscribersRetrieve.d.ts +2 -1
  171. package/funcs/topicsSubscribersRetrieve.d.ts.map +1 -1
  172. package/funcs/topicsSubscribersRetrieve.js +12 -7
  173. package/funcs/topicsSubscribersRetrieve.js.map +1 -1
  174. package/funcs/trigger.d.ts +2 -1
  175. package/funcs/trigger.d.ts.map +1 -1
  176. package/funcs/trigger.js +12 -7
  177. package/funcs/trigger.js.map +1 -1
  178. package/funcs/triggerBroadcast.d.ts +2 -1
  179. package/funcs/triggerBroadcast.d.ts.map +1 -1
  180. package/funcs/triggerBroadcast.js +12 -7
  181. package/funcs/triggerBroadcast.js.map +1 -1
  182. package/funcs/triggerBulk.d.ts +2 -1
  183. package/funcs/triggerBulk.d.ts.map +1 -1
  184. package/funcs/triggerBulk.js +12 -7
  185. package/funcs/triggerBulk.js.map +1 -1
  186. package/hooks/types.d.ts +1 -0
  187. package/hooks/types.d.ts.map +1 -1
  188. package/jsr.json +1 -1
  189. package/lib/config.d.ts +3 -3
  190. package/lib/config.js +3 -3
  191. package/lib/security.d.ts.map +1 -1
  192. package/lib/security.js.map +1 -1
  193. package/models/components/activitynotificationtemplateresponsedto.d.ts +6 -0
  194. package/models/components/activitynotificationtemplateresponsedto.d.ts.map +1 -1
  195. package/models/components/activitynotificationtemplateresponsedto.js +3 -0
  196. package/models/components/activitynotificationtemplateresponsedto.js.map +1 -1
  197. package/models/components/createsubscriberrequestdto.d.ts +28 -50
  198. package/models/components/createsubscriberrequestdto.d.ts.map +1 -1
  199. package/models/components/createsubscriberrequestdto.js +17 -41
  200. package/models/components/createsubscriberrequestdto.js.map +1 -1
  201. package/models/components/index.d.ts +1 -0
  202. package/models/components/index.d.ts.map +1 -1
  203. package/models/components/index.js +1 -0
  204. package/models/components/index.js.map +1 -1
  205. package/models/components/patchsubscriberrequestdto.d.ts +0 -5
  206. package/models/components/patchsubscriberrequestdto.d.ts.map +1 -1
  207. package/models/components/patchsubscriberrequestdto.js +0 -2
  208. package/models/components/patchsubscriberrequestdto.js.map +1 -1
  209. package/models/components/subscriberpayloaddto.d.ts +5 -0
  210. package/models/components/subscriberpayloaddto.d.ts.map +1 -1
  211. package/models/components/subscriberpayloaddto.js +2 -0
  212. package/models/components/subscriberpayloaddto.js.map +1 -1
  213. package/models/components/triggereventresponsedto.d.ts +3 -0
  214. package/models/components/triggereventresponsedto.d.ts.map +1 -1
  215. package/models/components/triggereventresponsedto.js +1 -0
  216. package/models/components/triggereventresponsedto.js.map +1 -1
  217. package/models/components/workfloworiginenum.d.ts +37 -0
  218. package/models/components/workfloworiginenum.d.ts.map +1 -0
  219. package/models/components/workfloworiginenum.js +54 -0
  220. package/models/components/workfloworiginenum.js.map +1 -0
  221. package/models/operations/notificationscontrollerlistnotifications.d.ts +5 -0
  222. package/models/operations/notificationscontrollerlistnotifications.d.ts.map +1 -1
  223. package/models/operations/notificationscontrollerlistnotifications.js +2 -0
  224. package/models/operations/notificationscontrollerlistnotifications.js.map +1 -1
  225. package/package.json +1 -1
  226. package/sources/json-development.json +57 -45
  227. package/src/funcs/cancel.ts +41 -7
  228. package/src/funcs/integrationsCreate.ts +41 -7
  229. package/src/funcs/integrationsDelete.ts +41 -7
  230. package/src/funcs/integrationsList.ts +39 -7
  231. package/src/funcs/integrationsListActive.ts +39 -7
  232. package/src/funcs/integrationsSetAsPrimary.ts +41 -7
  233. package/src/funcs/integrationsUpdate.ts +43 -7
  234. package/src/funcs/integrationsWebhooksRetrieve.ts +41 -7
  235. package/src/funcs/messagesDelete.ts +41 -7
  236. package/src/funcs/messagesDeleteByTransactionId.ts +44 -7
  237. package/src/funcs/messagesRetrieve.ts +39 -7
  238. package/src/funcs/notificationsList.ts +40 -7
  239. package/src/funcs/notificationsRetrieve.ts +41 -7
  240. package/src/funcs/notificationsStatsGraph.ts +41 -7
  241. package/src/funcs/notificationsStatsRetrieve.ts +39 -7
  242. package/src/funcs/subscribersAuthenticationChatAccessOauth.ts +39 -7
  243. package/src/funcs/subscribersAuthenticationChatAccessOauthCallBack.ts +41 -7
  244. package/src/funcs/subscribersCreate.ts +42 -8
  245. package/src/funcs/subscribersCreateBulk.ts +41 -7
  246. package/src/funcs/subscribersCredentialsAppend.ts +44 -7
  247. package/src/funcs/subscribersCredentialsDelete.ts +44 -7
  248. package/src/funcs/subscribersCredentialsUpdate.ts +44 -7
  249. package/src/funcs/subscribersDelete.ts +41 -7
  250. package/src/funcs/subscribersList.ts +54 -7
  251. package/src/funcs/subscribersMessagesMarkAll.ts +43 -7
  252. package/src/funcs/subscribersMessagesMarkAllAs.ts +43 -7
  253. package/src/funcs/subscribersMessagesUpdateAsSeen.ts +39 -7
  254. package/src/funcs/subscribersNotificationsFeed.ts +39 -7
  255. package/src/funcs/subscribersNotificationsUnseenCount.ts +39 -7
  256. package/src/funcs/subscribersPatch.ts +43 -7
  257. package/src/funcs/subscribersPreferencesList.ts +41 -7
  258. package/src/funcs/subscribersPreferencesUpdate.ts +43 -7
  259. package/src/funcs/subscribersPropertiesUpdateOnlineFlag.ts +44 -7
  260. package/src/funcs/subscribersRetrieve.ts +41 -7
  261. package/src/funcs/subscribersSearch.ts +39 -7
  262. package/src/funcs/topicsCreate.ts +41 -7
  263. package/src/funcs/topicsDelete.ts +41 -7
  264. package/src/funcs/topicsList.ts +39 -7
  265. package/src/funcs/topicsRename.ts +43 -7
  266. package/src/funcs/topicsRetrieve.ts +41 -7
  267. package/src/funcs/topicsSubscribersAssign.ts +43 -7
  268. package/src/funcs/topicsSubscribersRemove.ts +43 -7
  269. package/src/funcs/topicsSubscribersRetrieve.ts +43 -7
  270. package/src/funcs/trigger.ts +41 -7
  271. package/src/funcs/triggerBroadcast.ts +41 -7
  272. package/src/funcs/triggerBulk.ts +41 -7
  273. package/src/hooks/types.ts +1 -0
  274. package/src/lib/config.ts +3 -3
  275. package/src/lib/security.ts +0 -1
  276. package/src/models/components/activitynotificationtemplateresponsedto.ts +12 -0
  277. package/src/models/components/createsubscriberrequestdto.ts +41 -111
  278. package/src/models/components/index.ts +1 -0
  279. package/src/models/components/patchsubscriberrequestdto.ts +0 -7
  280. package/src/models/components/subscriberpayloaddto.ts +7 -0
  281. package/src/models/components/triggereventresponsedto.ts +1 -0
  282. package/src/models/components/workfloworiginenum.ts +40 -0
  283. package/src/models/operations/notificationscontrollerlistnotifications.ts +7 -0
  284. package/src/types/async.ts +68 -0
  285. package/types/async.d.ts +23 -0
  286. package/types/async.d.ts.map +1 -0
  287. package/types/async.js +44 -0
  288. package/types/async.js.map +1 -0
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
22
22
  import { SDKError } from "../models/errors/sdkerror.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
@@ -30,13 +31,13 @@ import { Result } from "../types/fp.js";
30
31
  * @remarks
31
32
  * Add subscribers to a topic by key
32
33
  */
33
- export async function topicsSubscribersAssign(
34
+ export function topicsSubscribersAssign(
34
35
  client: NovuCore,
35
36
  addSubscribersRequestDto: components.AddSubscribersRequestDto,
36
37
  topicKey: string,
37
38
  idempotencyKey?: string | undefined,
38
39
  options?: RequestOptions,
39
- ): Promise<
40
+ ): APIPromise<
40
41
  Result<
41
42
  operations.TopicsControllerAssignResponse,
42
43
  | errors.ErrorDto
@@ -51,6 +52,40 @@ export async function topicsSubscribersAssign(
51
52
  | RequestTimeoutError
52
53
  | ConnectionError
53
54
  >
55
+ > {
56
+ return new APIPromise($do(
57
+ client,
58
+ addSubscribersRequestDto,
59
+ topicKey,
60
+ idempotencyKey,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: NovuCore,
67
+ addSubscribersRequestDto: components.AddSubscribersRequestDto,
68
+ topicKey: string,
69
+ idempotencyKey?: string | undefined,
70
+ options?: RequestOptions,
71
+ ): Promise<
72
+ [
73
+ Result<
74
+ operations.TopicsControllerAssignResponse,
75
+ | errors.ErrorDto
76
+ | errors.ErrorDto
77
+ | errors.ValidationErrorDto
78
+ | errors.ErrorDto
79
+ | SDKError
80
+ | SDKValidationError
81
+ | UnexpectedClientError
82
+ | InvalidRequestError
83
+ | RequestAbortedError
84
+ | RequestTimeoutError
85
+ | ConnectionError
86
+ >,
87
+ APICall,
88
+ ]
54
89
  > {
55
90
  const input: operations.TopicsControllerAssignRequest = {
56
91
  addSubscribersRequestDto: addSubscribersRequestDto,
@@ -65,7 +100,7 @@ export async function topicsSubscribersAssign(
65
100
  "Input validation failed",
66
101
  );
67
102
  if (!parsed.ok) {
68
- return parsed;
103
+ return [parsed, { status: "invalid" }];
69
104
  }
70
105
  const payload = parsed.value;
71
106
  const body = encodeJSON("body", payload.AddSubscribersRequestDto, {
@@ -96,6 +131,7 @@ export async function topicsSubscribersAssign(
96
131
  const requestSecurity = resolveGlobalSecurity(securityInput);
97
132
 
98
133
  const context = {
134
+ baseURL: options?.serverURL ?? "",
99
135
  operationID: "TopicsController_assign",
100
136
  oAuth2Scopes: [],
101
137
 
@@ -128,7 +164,7 @@ export async function topicsSubscribersAssign(
128
164
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
129
165
  }, options);
130
166
  if (!requestRes.ok) {
131
- return requestRes;
167
+ return [requestRes, { status: "invalid" }];
132
168
  }
133
169
  const req = requestRes.value;
134
170
 
@@ -155,7 +191,7 @@ export async function topicsSubscribersAssign(
155
191
  retryCodes: context.retryCodes,
156
192
  });
157
193
  if (!doResult.ok) {
158
- return doResult;
194
+ return [doResult, { status: "request-error", request: req }];
159
195
  }
160
196
  const response = doResult.value;
161
197
 
@@ -195,8 +231,8 @@ export async function topicsSubscribersAssign(
195
231
  M.fail("5XX"),
196
232
  )(response, { extraFields: responseFields });
197
233
  if (!result.ok) {
198
- return result;
234
+ return [result, { status: "complete", request: req, response }];
199
235
  }
200
236
 
201
- return result;
237
+ return [result, { status: "complete", request: req, response }];
202
238
  }
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
22
22
  import { SDKError } from "../models/errors/sdkerror.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
@@ -30,13 +31,13 @@ import { Result } from "../types/fp.js";
30
31
  * @remarks
31
32
  * Remove subscribers from a topic
32
33
  */
33
- export async function topicsSubscribersRemove(
34
+ export function topicsSubscribersRemove(
34
35
  client: NovuCore,
35
36
  removeSubscribersRequestDto: components.RemoveSubscribersRequestDto,
36
37
  topicKey: string,
37
38
  idempotencyKey?: string | undefined,
38
39
  options?: RequestOptions,
39
- ): Promise<
40
+ ): APIPromise<
40
41
  Result<
41
42
  operations.TopicsControllerRemoveSubscribersResponse | undefined,
42
43
  | errors.ErrorDto
@@ -51,6 +52,40 @@ export async function topicsSubscribersRemove(
51
52
  | RequestTimeoutError
52
53
  | ConnectionError
53
54
  >
55
+ > {
56
+ return new APIPromise($do(
57
+ client,
58
+ removeSubscribersRequestDto,
59
+ topicKey,
60
+ idempotencyKey,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: NovuCore,
67
+ removeSubscribersRequestDto: components.RemoveSubscribersRequestDto,
68
+ topicKey: string,
69
+ idempotencyKey?: string | undefined,
70
+ options?: RequestOptions,
71
+ ): Promise<
72
+ [
73
+ Result<
74
+ operations.TopicsControllerRemoveSubscribersResponse | undefined,
75
+ | errors.ErrorDto
76
+ | errors.ErrorDto
77
+ | errors.ValidationErrorDto
78
+ | errors.ErrorDto
79
+ | SDKError
80
+ | SDKValidationError
81
+ | UnexpectedClientError
82
+ | InvalidRequestError
83
+ | RequestAbortedError
84
+ | RequestTimeoutError
85
+ | ConnectionError
86
+ >,
87
+ APICall,
88
+ ]
54
89
  > {
55
90
  const input: operations.TopicsControllerRemoveSubscribersRequest = {
56
91
  removeSubscribersRequestDto: removeSubscribersRequestDto,
@@ -67,7 +102,7 @@ export async function topicsSubscribersRemove(
67
102
  "Input validation failed",
68
103
  );
69
104
  if (!parsed.ok) {
70
- return parsed;
105
+ return [parsed, { status: "invalid" }];
71
106
  }
72
107
  const payload = parsed.value;
73
108
  const body = encodeJSON("body", payload.RemoveSubscribersRequestDto, {
@@ -100,6 +135,7 @@ export async function topicsSubscribersRemove(
100
135
  const requestSecurity = resolveGlobalSecurity(securityInput);
101
136
 
102
137
  const context = {
138
+ baseURL: options?.serverURL ?? "",
103
139
  operationID: "TopicsController_removeSubscribers",
104
140
  oAuth2Scopes: [],
105
141
 
@@ -132,7 +168,7 @@ export async function topicsSubscribersRemove(
132
168
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
133
169
  }, options);
134
170
  if (!requestRes.ok) {
135
- return requestRes;
171
+ return [requestRes, { status: "invalid" }];
136
172
  }
137
173
  const req = requestRes.value;
138
174
 
@@ -159,7 +195,7 @@ export async function topicsSubscribersRemove(
159
195
  retryCodes: context.retryCodes,
160
196
  });
161
197
  if (!doResult.ok) {
162
- return doResult;
198
+ return [doResult, { status: "request-error", request: req }];
163
199
  }
164
200
  const response = doResult.value;
165
201
 
@@ -201,8 +237,8 @@ export async function topicsSubscribersRemove(
201
237
  M.fail("5XX"),
202
238
  )(response, { extraFields: responseFields });
203
239
  if (!result.ok) {
204
- return result;
240
+ return [result, { status: "complete", request: req, response }];
205
241
  }
206
242
 
207
- return result;
243
+ return [result, { status: "complete", request: req, response }];
208
244
  }
@@ -21,6 +21,7 @@ import * as errors from "../models/errors/index.js";
21
21
  import { SDKError } from "../models/errors/sdkerror.js";
22
22
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
23
  import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
24
25
  import { Result } from "../types/fp.js";
25
26
 
26
27
  /**
@@ -29,13 +30,13 @@ import { Result } from "../types/fp.js";
29
30
  * @remarks
30
31
  * Check if a subscriber belongs to a certain topic
31
32
  */
32
- export async function topicsSubscribersRetrieve(
33
+ export function topicsSubscribersRetrieve(
33
34
  client: NovuCore,
34
35
  externalSubscriberId: string,
35
36
  topicKey: string,
36
37
  idempotencyKey?: string | undefined,
37
38
  options?: RequestOptions,
38
- ): Promise<
39
+ ): APIPromise<
39
40
  Result<
40
41
  operations.TopicsControllerGetTopicSubscriberResponse,
41
42
  | errors.ErrorDto
@@ -50,6 +51,40 @@ export async function topicsSubscribersRetrieve(
50
51
  | RequestTimeoutError
51
52
  | ConnectionError
52
53
  >
54
+ > {
55
+ return new APIPromise($do(
56
+ client,
57
+ externalSubscriberId,
58
+ topicKey,
59
+ idempotencyKey,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ async function $do(
65
+ client: NovuCore,
66
+ externalSubscriberId: string,
67
+ topicKey: string,
68
+ idempotencyKey?: string | undefined,
69
+ options?: RequestOptions,
70
+ ): Promise<
71
+ [
72
+ Result<
73
+ operations.TopicsControllerGetTopicSubscriberResponse,
74
+ | errors.ErrorDto
75
+ | errors.ErrorDto
76
+ | errors.ValidationErrorDto
77
+ | errors.ErrorDto
78
+ | SDKError
79
+ | SDKValidationError
80
+ | UnexpectedClientError
81
+ | InvalidRequestError
82
+ | RequestAbortedError
83
+ | RequestTimeoutError
84
+ | ConnectionError
85
+ >,
86
+ APICall,
87
+ ]
53
88
  > {
54
89
  const input: operations.TopicsControllerGetTopicSubscriberRequest = {
55
90
  externalSubscriberId: externalSubscriberId,
@@ -66,7 +101,7 @@ export async function topicsSubscribersRetrieve(
66
101
  "Input validation failed",
67
102
  );
68
103
  if (!parsed.ok) {
69
- return parsed;
104
+ return [parsed, { status: "invalid" }];
70
105
  }
71
106
  const payload = parsed.value;
72
107
  const body = null;
@@ -101,6 +136,7 @@ export async function topicsSubscribersRetrieve(
101
136
  const requestSecurity = resolveGlobalSecurity(securityInput);
102
137
 
103
138
  const context = {
139
+ baseURL: options?.serverURL ?? "",
104
140
  operationID: "TopicsController_getTopicSubscriber",
105
141
  oAuth2Scopes: [],
106
142
 
@@ -133,7 +169,7 @@ export async function topicsSubscribersRetrieve(
133
169
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
134
170
  }, options);
135
171
  if (!requestRes.ok) {
136
- return requestRes;
172
+ return [requestRes, { status: "invalid" }];
137
173
  }
138
174
  const req = requestRes.value;
139
175
 
@@ -160,7 +196,7 @@ export async function topicsSubscribersRetrieve(
160
196
  retryCodes: context.retryCodes,
161
197
  });
162
198
  if (!doResult.ok) {
163
- return doResult;
199
+ return [doResult, { status: "request-error", request: req }];
164
200
  }
165
201
  const response = doResult.value;
166
202
 
@@ -201,8 +237,8 @@ export async function topicsSubscribersRetrieve(
201
237
  M.fail("5XX"),
202
238
  )(response, { extraFields: responseFields });
203
239
  if (!result.ok) {
204
- return result;
240
+ return [result, { status: "complete", request: req, response }];
205
241
  }
206
242
 
207
- return result;
243
+ return [result, { status: "complete", request: req, response }];
208
244
  }
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
22
22
  import { SDKError } from "../models/errors/sdkerror.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
@@ -33,12 +34,12 @@ import { Result } from "../types/fp.js";
33
34
  * The trigger identifier is used to match the particular workflow associated with it.
34
35
  * Additional information can be passed according the body interface below.
35
36
  */
36
- export async function trigger(
37
+ export function trigger(
37
38
  client: NovuCore,
38
39
  triggerEventRequestDto: components.TriggerEventRequestDto,
39
40
  idempotencyKey?: string | undefined,
40
41
  options?: RequestOptions,
41
- ): Promise<
42
+ ): APIPromise<
42
43
  Result<
43
44
  operations.EventsControllerTriggerResponse,
44
45
  | errors.ErrorDto
@@ -53,6 +54,38 @@ export async function trigger(
53
54
  | RequestTimeoutError
54
55
  | ConnectionError
55
56
  >
57
+ > {
58
+ return new APIPromise($do(
59
+ client,
60
+ triggerEventRequestDto,
61
+ idempotencyKey,
62
+ options,
63
+ ));
64
+ }
65
+
66
+ async function $do(
67
+ client: NovuCore,
68
+ triggerEventRequestDto: components.TriggerEventRequestDto,
69
+ idempotencyKey?: string | undefined,
70
+ options?: RequestOptions,
71
+ ): Promise<
72
+ [
73
+ Result<
74
+ operations.EventsControllerTriggerResponse,
75
+ | errors.ErrorDto
76
+ | errors.ErrorDto
77
+ | errors.ValidationErrorDto
78
+ | errors.ErrorDto
79
+ | SDKError
80
+ | SDKValidationError
81
+ | UnexpectedClientError
82
+ | InvalidRequestError
83
+ | RequestAbortedError
84
+ | RequestTimeoutError
85
+ | ConnectionError
86
+ >,
87
+ APICall,
88
+ ]
56
89
  > {
57
90
  const input: operations.EventsControllerTriggerRequest = {
58
91
  triggerEventRequestDto: triggerEventRequestDto,
@@ -66,7 +99,7 @@ export async function trigger(
66
99
  "Input validation failed",
67
100
  );
68
101
  if (!parsed.ok) {
69
- return parsed;
102
+ return [parsed, { status: "invalid" }];
70
103
  }
71
104
  const payload = parsed.value;
72
105
  const body = encodeJSON("body", payload.TriggerEventRequestDto, {
@@ -90,6 +123,7 @@ export async function trigger(
90
123
  const requestSecurity = resolveGlobalSecurity(securityInput);
91
124
 
92
125
  const context = {
126
+ baseURL: options?.serverURL ?? "",
93
127
  operationID: "EventsController_trigger",
94
128
  oAuth2Scopes: [],
95
129
 
@@ -122,7 +156,7 @@ export async function trigger(
122
156
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
123
157
  }, options);
124
158
  if (!requestRes.ok) {
125
- return requestRes;
159
+ return [requestRes, { status: "invalid" }];
126
160
  }
127
161
  const req = requestRes.value;
128
162
 
@@ -149,7 +183,7 @@ export async function trigger(
149
183
  retryCodes: context.retryCodes,
150
184
  });
151
185
  if (!doResult.ok) {
152
- return doResult;
186
+ return [doResult, { status: "request-error", request: req }];
153
187
  }
154
188
  const response = doResult.value;
155
189
 
@@ -189,8 +223,8 @@ export async function trigger(
189
223
  M.fail("5XX"),
190
224
  )(response, { extraFields: responseFields });
191
225
  if (!result.ok) {
192
- return result;
226
+ return [result, { status: "complete", request: req, response }];
193
227
  }
194
228
 
195
- return result;
229
+ return [result, { status: "complete", request: req, response }];
196
230
  }
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
22
22
  import { SDKError } from "../models/errors/sdkerror.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
@@ -31,12 +32,12 @@ import { Result } from "../types/fp.js";
31
32
  * Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc.
32
33
  * In the future could be used to trigger events to a subset of subscribers based on defined filters.
33
34
  */
34
- export async function triggerBroadcast(
35
+ export function triggerBroadcast(
35
36
  client: NovuCore,
36
37
  triggerEventToAllRequestDto: components.TriggerEventToAllRequestDto,
37
38
  idempotencyKey?: string | undefined,
38
39
  options?: RequestOptions,
39
- ): Promise<
40
+ ): APIPromise<
40
41
  Result<
41
42
  operations.EventsControllerBroadcastEventToAllResponse,
42
43
  | errors.ErrorDto
@@ -51,6 +52,38 @@ export async function triggerBroadcast(
51
52
  | RequestTimeoutError
52
53
  | ConnectionError
53
54
  >
55
+ > {
56
+ return new APIPromise($do(
57
+ client,
58
+ triggerEventToAllRequestDto,
59
+ idempotencyKey,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ async function $do(
65
+ client: NovuCore,
66
+ triggerEventToAllRequestDto: components.TriggerEventToAllRequestDto,
67
+ idempotencyKey?: string | undefined,
68
+ options?: RequestOptions,
69
+ ): Promise<
70
+ [
71
+ Result<
72
+ operations.EventsControllerBroadcastEventToAllResponse,
73
+ | errors.ErrorDto
74
+ | errors.ErrorDto
75
+ | errors.ValidationErrorDto
76
+ | errors.ErrorDto
77
+ | SDKError
78
+ | SDKValidationError
79
+ | UnexpectedClientError
80
+ | InvalidRequestError
81
+ | RequestAbortedError
82
+ | RequestTimeoutError
83
+ | ConnectionError
84
+ >,
85
+ APICall,
86
+ ]
54
87
  > {
55
88
  const input: operations.EventsControllerBroadcastEventToAllRequest = {
56
89
  triggerEventToAllRequestDto: triggerEventToAllRequestDto,
@@ -65,7 +98,7 @@ export async function triggerBroadcast(
65
98
  "Input validation failed",
66
99
  );
67
100
  if (!parsed.ok) {
68
- return parsed;
101
+ return [parsed, { status: "invalid" }];
69
102
  }
70
103
  const payload = parsed.value;
71
104
  const body = encodeJSON("body", payload.TriggerEventToAllRequestDto, {
@@ -89,6 +122,7 @@ export async function triggerBroadcast(
89
122
  const requestSecurity = resolveGlobalSecurity(securityInput);
90
123
 
91
124
  const context = {
125
+ baseURL: options?.serverURL ?? "",
92
126
  operationID: "EventsController_broadcastEventToAll",
93
127
  oAuth2Scopes: [],
94
128
 
@@ -121,7 +155,7 @@ export async function triggerBroadcast(
121
155
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
122
156
  }, options);
123
157
  if (!requestRes.ok) {
124
- return requestRes;
158
+ return [requestRes, { status: "invalid" }];
125
159
  }
126
160
  const req = requestRes.value;
127
161
 
@@ -148,7 +182,7 @@ export async function triggerBroadcast(
148
182
  retryCodes: context.retryCodes,
149
183
  });
150
184
  if (!doResult.ok) {
151
- return doResult;
185
+ return [doResult, { status: "request-error", request: req }];
152
186
  }
153
187
  const response = doResult.value;
154
188
 
@@ -189,8 +223,8 @@ export async function triggerBroadcast(
189
223
  M.fail("5XX"),
190
224
  )(response, { extraFields: responseFields });
191
225
  if (!result.ok) {
192
- return result;
226
+ return [result, { status: "complete", request: req, response }];
193
227
  }
194
228
 
195
- return result;
229
+ return [result, { status: "complete", request: req, response }];
196
230
  }
@@ -22,6 +22,7 @@ import * as errors from "../models/errors/index.js";
22
22
  import { SDKError } from "../models/errors/sdkerror.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
@@ -32,12 +33,12 @@ import { Result } from "../types/fp.js";
32
33
  * Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API.
33
34
  * The bulk API is limited to 100 events per request.
34
35
  */
35
- export async function triggerBulk(
36
+ export function triggerBulk(
36
37
  client: NovuCore,
37
38
  bulkTriggerEventDto: components.BulkTriggerEventDto,
38
39
  idempotencyKey?: string | undefined,
39
40
  options?: RequestOptions,
40
- ): Promise<
41
+ ): APIPromise<
41
42
  Result<
42
43
  operations.EventsControllerTriggerBulkResponse,
43
44
  | errors.ErrorDto
@@ -52,6 +53,38 @@ export async function triggerBulk(
52
53
  | RequestTimeoutError
53
54
  | ConnectionError
54
55
  >
56
+ > {
57
+ return new APIPromise($do(
58
+ client,
59
+ bulkTriggerEventDto,
60
+ idempotencyKey,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: NovuCore,
67
+ bulkTriggerEventDto: components.BulkTriggerEventDto,
68
+ idempotencyKey?: string | undefined,
69
+ options?: RequestOptions,
70
+ ): Promise<
71
+ [
72
+ Result<
73
+ operations.EventsControllerTriggerBulkResponse,
74
+ | errors.ErrorDto
75
+ | errors.ErrorDto
76
+ | errors.ValidationErrorDto
77
+ | errors.ErrorDto
78
+ | SDKError
79
+ | SDKValidationError
80
+ | UnexpectedClientError
81
+ | InvalidRequestError
82
+ | RequestAbortedError
83
+ | RequestTimeoutError
84
+ | ConnectionError
85
+ >,
86
+ APICall,
87
+ ]
55
88
  > {
56
89
  const input: operations.EventsControllerTriggerBulkRequest = {
57
90
  bulkTriggerEventDto: bulkTriggerEventDto,
@@ -65,7 +98,7 @@ export async function triggerBulk(
65
98
  "Input validation failed",
66
99
  );
67
100
  if (!parsed.ok) {
68
- return parsed;
101
+ return [parsed, { status: "invalid" }];
69
102
  }
70
103
  const payload = parsed.value;
71
104
  const body = encodeJSON("body", payload.BulkTriggerEventDto, {
@@ -89,6 +122,7 @@ export async function triggerBulk(
89
122
  const requestSecurity = resolveGlobalSecurity(securityInput);
90
123
 
91
124
  const context = {
125
+ baseURL: options?.serverURL ?? "",
92
126
  operationID: "EventsController_triggerBulk",
93
127
  oAuth2Scopes: [],
94
128
 
@@ -121,7 +155,7 @@ export async function triggerBulk(
121
155
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
122
156
  }, options);
123
157
  if (!requestRes.ok) {
124
- return requestRes;
158
+ return [requestRes, { status: "invalid" }];
125
159
  }
126
160
  const req = requestRes.value;
127
161
 
@@ -148,7 +182,7 @@ export async function triggerBulk(
148
182
  retryCodes: context.retryCodes,
149
183
  });
150
184
  if (!doResult.ok) {
151
- return doResult;
185
+ return [doResult, { status: "request-error", request: req }];
152
186
  }
153
187
  const response = doResult.value;
154
188
 
@@ -188,8 +222,8 @@ export async function triggerBulk(
188
222
  M.fail("5XX"),
189
223
  )(response, { extraFields: responseFields });
190
224
  if (!result.ok) {
191
- return result;
225
+ return [result, { status: "complete", request: req, response }];
192
226
  }
193
227
 
194
- return result;
228
+ return [result, { status: "complete", request: req, response }];
195
229
  }
@@ -7,6 +7,7 @@ import { RetryConfig } from "../lib/retries.js";
7
7
  import { SecurityState } from "../lib/security.js";
8
8
 
9
9
  export type HookContext = {
10
+ baseURL: string | URL;
10
11
  operationID: string;
11
12
  oAuth2Scopes?: string[];
12
13
  securitySource?: any | (() => Promise<any>);
package/src/lib/config.ts CHANGED
@@ -55,7 +55,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
55
55
  export const SDK_METADATA = {
56
56
  language: "typescript",
57
57
  openapiDocVersion: "1.0",
58
- sdkVersion: "0.2.0",
59
- genVersion: "2.506.0",
60
- userAgent: "speakeasy-sdk/typescript 0.2.0 2.506.0 1.0 @novu/api",
58
+ sdkVersion: "0.3.0",
59
+ genVersion: "2.515.0",
60
+ userAgent: "speakeasy-sdk/typescript 0.3.0 2.515.0 1.0 @novu/api",
61
61
  } as const;
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  import * as components from "../models/components/index.js";
6
-
7
6
  type OAuth2PasswordFlow = {
8
7
  username: string;
9
8
  password?: string | undefined;