@novu/api 3.17.0 → 3.17.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 (180) hide show
  1. package/README.md +20 -14
  2. package/funcs/integrationsCreate.d.ts +1 -1
  3. package/funcs/integrationsCreate.js +1 -1
  4. package/funcs/integrationsCreateMobileLink.d.ts +19 -0
  5. package/funcs/integrationsCreateMobileLink.d.ts.map +1 -0
  6. package/funcs/integrationsCreateMobileLink.js +141 -0
  7. package/funcs/integrationsCreateMobileLink.js.map +1 -0
  8. package/funcs/integrationsDelete.d.ts +1 -1
  9. package/funcs/integrationsDelete.js +1 -1
  10. package/funcs/integrationsIntegrationsControllerAutoConfigureIntegration.d.ts +1 -1
  11. package/funcs/integrationsIntegrationsControllerAutoConfigureIntegration.js +1 -1
  12. package/funcs/integrationsIntegrationsControllerConfigureIntegrationWebhook.d.ts +18 -0
  13. package/funcs/integrationsIntegrationsControllerConfigureIntegrationWebhook.d.ts.map +1 -0
  14. package/funcs/integrationsIntegrationsControllerConfigureIntegrationWebhook.js +139 -0
  15. package/funcs/integrationsIntegrationsControllerConfigureIntegrationWebhook.js.map +1 -0
  16. package/funcs/integrationsLinkChannelEndpoint.d.ts +19 -0
  17. package/funcs/integrationsLinkChannelEndpoint.d.ts.map +1 -0
  18. package/funcs/integrationsLinkChannelEndpoint.js +138 -0
  19. package/funcs/integrationsLinkChannelEndpoint.js.map +1 -0
  20. package/funcs/integrationsList.d.ts +1 -1
  21. package/funcs/integrationsList.js +1 -1
  22. package/funcs/integrationsListActive.d.ts +1 -1
  23. package/funcs/integrationsListActive.js +1 -1
  24. package/funcs/integrationsSetAsPrimary.d.ts +1 -0
  25. package/funcs/integrationsSetAsPrimary.d.ts.map +1 -1
  26. package/funcs/integrationsSetAsPrimary.js +1 -0
  27. package/funcs/integrationsSetAsPrimary.js.map +1 -1
  28. package/funcs/integrationsUpdate.d.ts +1 -1
  29. package/funcs/integrationsUpdate.js +1 -1
  30. package/funcs/subscribersMessagesMarkAll.d.ts +3 -1
  31. package/funcs/subscribersMessagesMarkAll.d.ts.map +1 -1
  32. package/funcs/subscribersMessagesMarkAll.js +3 -1
  33. package/funcs/subscribersMessagesMarkAll.js.map +1 -1
  34. package/funcs/subscribersMessagesMarkAllAs.d.ts +4 -2
  35. package/funcs/subscribersMessagesMarkAllAs.d.ts.map +1 -1
  36. package/funcs/subscribersMessagesMarkAllAs.js +4 -2
  37. package/funcs/subscribersMessagesMarkAllAs.js.map +1 -1
  38. package/funcs/subscribersMessagesUpdateAsSeen.d.ts +3 -1
  39. package/funcs/subscribersMessagesUpdateAsSeen.d.ts.map +1 -1
  40. package/funcs/subscribersMessagesUpdateAsSeen.js +3 -1
  41. package/funcs/subscribersMessagesUpdateAsSeen.js.map +1 -1
  42. package/funcs/subscribersNotificationsFeed.d.ts +3 -1
  43. package/funcs/subscribersNotificationsFeed.d.ts.map +1 -1
  44. package/funcs/subscribersNotificationsFeed.js +3 -1
  45. package/funcs/subscribersNotificationsFeed.js.map +1 -1
  46. package/funcs/subscribersNotificationsUnseenCount.d.ts +3 -1
  47. package/funcs/subscribersNotificationsUnseenCount.d.ts.map +1 -1
  48. package/funcs/subscribersNotificationsUnseenCount.js +3 -1
  49. package/funcs/subscribersNotificationsUnseenCount.js.map +1 -1
  50. package/hooks/types.d.ts +1 -0
  51. package/hooks/types.d.ts.map +1 -1
  52. package/jsr.json +1 -1
  53. package/lib/config.d.ts +4 -4
  54. package/lib/config.js +4 -4
  55. package/lib/encodings.js +12 -12
  56. package/lib/encodings.js.map +1 -1
  57. package/lib/matchers.js +3 -3
  58. package/lib/matchers.js.map +1 -1
  59. package/lib/primitives.d.ts +1 -0
  60. package/lib/primitives.d.ts.map +1 -1
  61. package/lib/primitives.js +18 -0
  62. package/lib/primitives.js.map +1 -1
  63. package/lib/retries.js +7 -0
  64. package/lib/retries.js.map +1 -1
  65. package/lib/sdks.d.ts.map +1 -1
  66. package/lib/sdks.js +50 -16
  67. package/lib/sdks.js.map +1 -1
  68. package/models/components/configuretelegramwebhookresponsedto.d.ts +21 -0
  69. package/models/components/configuretelegramwebhookresponsedto.d.ts.map +1 -0
  70. package/models/components/configuretelegramwebhookresponsedto.js +52 -0
  71. package/models/components/configuretelegramwebhookresponsedto.js.map +1 -0
  72. package/models/components/credentialsdto.d.ts +2 -0
  73. package/models/components/credentialsdto.d.ts.map +1 -1
  74. package/models/components/credentialsdto.js +2 -0
  75. package/models/components/credentialsdto.js.map +1 -1
  76. package/models/components/index.d.ts +5 -0
  77. package/models/components/index.d.ts.map +1 -1
  78. package/models/components/index.js +5 -0
  79. package/models/components/index.js.map +1 -1
  80. package/models/components/issueintegrationmobilelinkrequestdto.d.ts +15 -0
  81. package/models/components/issueintegrationmobilelinkrequestdto.d.ts.map +1 -0
  82. package/models/components/issueintegrationmobilelinkrequestdto.js +49 -0
  83. package/models/components/issueintegrationmobilelinkrequestdto.js.map +1 -0
  84. package/models/components/issuetelegrammobilelinkresponsedto.d.ts +21 -0
  85. package/models/components/issuetelegrammobilelinkresponsedto.d.ts.map +1 -0
  86. package/models/components/issuetelegrammobilelinkresponsedto.js +52 -0
  87. package/models/components/issuetelegrammobilelinkresponsedto.js.map +1 -0
  88. package/models/components/linkchannelendpointrequestdto.d.ts +20 -0
  89. package/models/components/linkchannelendpointrequestdto.d.ts.map +1 -0
  90. package/models/components/linkchannelendpointrequestdto.js +50 -0
  91. package/models/components/linkchannelendpointrequestdto.js.map +1 -0
  92. package/models/components/linkchannelendpointresponsedto.d.ts +19 -0
  93. package/models/components/linkchannelendpointresponsedto.d.ts.map +1 -0
  94. package/models/components/linkchannelendpointresponsedto.js +51 -0
  95. package/models/components/linkchannelendpointresponsedto.js.map +1 -0
  96. package/models/components/previewpayloaddto.d.ts +5 -0
  97. package/models/components/previewpayloaddto.d.ts.map +1 -1
  98. package/models/components/previewpayloaddto.js +2 -0
  99. package/models/components/previewpayloaddto.js.map +1 -1
  100. package/models/components/updateworkflowdto.d.ts +5 -4
  101. package/models/components/updateworkflowdto.d.ts.map +1 -1
  102. package/models/components/updateworkflowdto.js +3 -0
  103. package/models/components/updateworkflowdto.js.map +1 -1
  104. package/models/operations/index.d.ts +3 -0
  105. package/models/operations/index.d.ts.map +1 -1
  106. package/models/operations/index.js +3 -0
  107. package/models/operations/index.js.map +1 -1
  108. package/models/operations/integrationscontrollerconfigureintegrationwebhook.d.ts +29 -0
  109. package/models/operations/integrationscontrollerconfigureintegrationwebhook.d.ts.map +1 -0
  110. package/models/operations/integrationscontrollerconfigureintegrationwebhook.js +73 -0
  111. package/models/operations/integrationscontrollerconfigureintegrationwebhook.js.map +1 -0
  112. package/models/operations/integrationscontrollercreateintegrationmobilelink.d.ts +31 -0
  113. package/models/operations/integrationscontrollercreateintegrationmobilelink.d.ts.map +1 -0
  114. package/models/operations/integrationscontrollercreateintegrationmobilelink.js +75 -0
  115. package/models/operations/integrationscontrollercreateintegrationmobilelink.js.map +1 -0
  116. package/models/operations/integrationscontrollerlinkchannelendpoint.d.ts +29 -0
  117. package/models/operations/integrationscontrollerlinkchannelendpoint.d.ts.map +1 -0
  118. package/models/operations/integrationscontrollerlinkchannelendpoint.js +72 -0
  119. package/models/operations/integrationscontrollerlinkchannelendpoint.js.map +1 -0
  120. package/package.json +1 -1
  121. package/sdk/integrations.d.ts +28 -6
  122. package/sdk/integrations.d.ts.map +1 -1
  123. package/sdk/integrations.js +37 -6
  124. package/sdk/integrations.js.map +1 -1
  125. package/sdk/novumessages.d.ts +10 -4
  126. package/sdk/novumessages.d.ts.map +1 -1
  127. package/sdk/novumessages.js +10 -4
  128. package/sdk/novumessages.js.map +1 -1
  129. package/sdk/novunotifications.d.ts +6 -2
  130. package/sdk/novunotifications.d.ts.map +1 -1
  131. package/sdk/novunotifications.js +6 -2
  132. package/sdk/novunotifications.js.map +1 -1
  133. package/src/funcs/integrationsCreate.ts +1 -1
  134. package/src/funcs/integrationsCreateMobileLink.ts +236 -0
  135. package/src/funcs/integrationsDelete.ts +1 -1
  136. package/src/funcs/integrationsIntegrationsControllerAutoConfigureIntegration.ts +1 -1
  137. package/src/funcs/integrationsIntegrationsControllerConfigureIntegrationWebhook.ts +223 -0
  138. package/src/funcs/integrationsLinkChannelEndpoint.ts +216 -0
  139. package/src/funcs/integrationsList.ts +1 -1
  140. package/src/funcs/integrationsListActive.ts +1 -1
  141. package/src/funcs/integrationsSetAsPrimary.ts +1 -0
  142. package/src/funcs/integrationsUpdate.ts +1 -1
  143. package/src/funcs/subscribersMessagesMarkAll.ts +3 -1
  144. package/src/funcs/subscribersMessagesMarkAllAs.ts +4 -2
  145. package/src/funcs/subscribersMessagesUpdateAsSeen.ts +3 -1
  146. package/src/funcs/subscribersNotificationsFeed.ts +3 -1
  147. package/src/funcs/subscribersNotificationsUnseenCount.ts +3 -1
  148. package/src/hooks/types.ts +1 -0
  149. package/src/lib/config.ts +4 -4
  150. package/src/lib/encodings.ts +1 -1
  151. package/src/lib/matchers.ts +1 -1
  152. package/src/lib/primitives.ts +16 -0
  153. package/src/lib/retries.ts +8 -0
  154. package/src/lib/sdks.ts +54 -17
  155. package/src/models/components/configuretelegramwebhookresponsedto.ts +45 -0
  156. package/src/models/components/credentialsdto.ts +4 -0
  157. package/src/models/components/index.ts +5 -0
  158. package/src/models/components/issueintegrationmobilelinkrequestdto.ts +36 -0
  159. package/src/models/components/issuetelegrammobilelinkresponsedto.ts +45 -0
  160. package/src/models/components/linkchannelendpointrequestdto.ts +42 -0
  161. package/src/models/components/linkchannelendpointresponsedto.ts +39 -0
  162. package/src/models/components/previewpayloaddto.ts +7 -0
  163. package/src/models/components/updateworkflowdto.ts +11 -0
  164. package/src/models/operations/index.ts +3 -0
  165. package/src/models/operations/integrationscontrollerconfigureintegrationwebhook.ts +86 -0
  166. package/src/models/operations/integrationscontrollercreateintegrationmobilelink.ts +94 -0
  167. package/src/models/operations/integrationscontrollerlinkchannelendpoint.ts +90 -0
  168. package/src/sdk/integrations.ts +76 -6
  169. package/src/sdk/novumessages.ts +10 -4
  170. package/src/sdk/novunotifications.ts +6 -2
  171. package/lib/dlv.d.ts +0 -14
  172. package/lib/dlv.d.ts.map +0 -1
  173. package/lib/dlv.js +0 -49
  174. package/lib/dlv.js.map +0 -1
  175. package/lib/is-plain-object.d.ts +0 -2
  176. package/lib/is-plain-object.d.ts.map +0 -1
  177. package/lib/is-plain-object.js +0 -41
  178. package/lib/is-plain-object.js.map +0 -1
  179. package/src/lib/dlv.ts +0 -53
  180. package/src/lib/is-plain-object.ts +0 -43
@@ -0,0 +1,223 @@
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 { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { NovuError } from "../models/errors/novuerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Configure a chat integration webhook
31
+ *
32
+ * @remarks
33
+ * Registers the Novu webhook URL with the chat provider for the specified integration. Telegram is the only supported provider initially.
34
+ */
35
+ export function integrationsIntegrationsControllerConfigureIntegrationWebhook(
36
+ client: NovuCore,
37
+ integrationIdentifier: string,
38
+ idempotencyKey?: string | undefined,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ operations.IntegrationsControllerConfigureIntegrationWebhookResponse,
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
+ integrationIdentifier,
58
+ idempotencyKey,
59
+ options,
60
+ ));
61
+ }
62
+
63
+ async function $do(
64
+ client: NovuCore,
65
+ integrationIdentifier: string,
66
+ idempotencyKey?: string | undefined,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.IntegrationsControllerConfigureIntegrationWebhookResponse,
72
+ | errors.ErrorDto
73
+ | errors.ValidationErrorDto
74
+ | NovuError
75
+ | ResponseValidationError
76
+ | ConnectionError
77
+ | RequestAbortedError
78
+ | RequestTimeoutError
79
+ | InvalidRequestError
80
+ | UnexpectedClientError
81
+ | SDKValidationError
82
+ >,
83
+ APICall,
84
+ ]
85
+ > {
86
+ const input:
87
+ operations.IntegrationsControllerConfigureIntegrationWebhookRequest = {
88
+ integrationIdentifier: integrationIdentifier,
89
+ idempotencyKey: idempotencyKey,
90
+ };
91
+
92
+ const parsed = safeParse(
93
+ input,
94
+ (value) =>
95
+ operations
96
+ .IntegrationsControllerConfigureIntegrationWebhookRequest$outboundSchema
97
+ .parse(value),
98
+ "Input validation failed",
99
+ );
100
+ if (!parsed.ok) {
101
+ return [parsed, { status: "invalid" }];
102
+ }
103
+ const payload = parsed.value;
104
+ const body = null;
105
+
106
+ const pathParams = {
107
+ integrationIdentifier: encodeSimple(
108
+ "integrationIdentifier",
109
+ payload.integrationIdentifier,
110
+ { explode: false, charEncoding: "percent" },
111
+ ),
112
+ };
113
+ const path = pathToFunc(
114
+ "/v1/integrations/{integrationIdentifier}/webhook/configure",
115
+ )(pathParams);
116
+
117
+ const headers = new Headers(compactMap({
118
+ Accept: "application/json",
119
+ "idempotency-key": encodeSimple(
120
+ "idempotency-key",
121
+ payload["idempotency-key"],
122
+ { explode: false, charEncoding: "none" },
123
+ ),
124
+ }));
125
+
126
+ const secConfig = await extractSecurity(client._options.secretKey);
127
+ const securityInput = secConfig == null ? {} : { secretKey: secConfig };
128
+ const requestSecurity = resolveGlobalSecurity(securityInput);
129
+
130
+ const context = {
131
+ options: client._options,
132
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
133
+ operationID: "IntegrationsController_configureIntegrationWebhook",
134
+ oAuth2Scopes: null,
135
+
136
+ resolvedSecurity: requestSecurity,
137
+
138
+ securitySource: client._options.secretKey,
139
+ retryConfig: options?.retries
140
+ || client._options.retryConfig
141
+ || {
142
+ strategy: "backoff",
143
+ backoff: {
144
+ initialInterval: 1000,
145
+ maxInterval: 30000,
146
+ exponent: 1.5,
147
+ maxElapsedTime: 3600000,
148
+ },
149
+ retryConnectionErrors: true,
150
+ }
151
+ || { strategy: "none" },
152
+ retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
153
+ };
154
+
155
+ const requestRes = client._createRequest(context, {
156
+ security: requestSecurity,
157
+ method: "POST",
158
+ baseURL: options?.serverURL,
159
+ path: path,
160
+ headers: headers,
161
+ body: body,
162
+ userAgent: client._options.userAgent,
163
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
164
+ }, options);
165
+ if (!requestRes.ok) {
166
+ return [requestRes, { status: "invalid" }];
167
+ }
168
+ const req = requestRes.value;
169
+
170
+ const doResult = await client._do(req, {
171
+ context,
172
+ isErrorStatusCode: (statusCode: number) =>
173
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
174
+ retryConfig: context.retryConfig,
175
+ retryCodes: context.retryCodes,
176
+ });
177
+ if (!doResult.ok) {
178
+ return [doResult, { status: "request-error", request: req }];
179
+ }
180
+ const response = doResult.value;
181
+
182
+ const responseFields = {
183
+ HttpMeta: { Response: response, Request: req },
184
+ };
185
+
186
+ const [result] = await M.match<
187
+ operations.IntegrationsControllerConfigureIntegrationWebhookResponse,
188
+ | errors.ErrorDto
189
+ | errors.ValidationErrorDto
190
+ | NovuError
191
+ | ResponseValidationError
192
+ | ConnectionError
193
+ | RequestAbortedError
194
+ | RequestTimeoutError
195
+ | InvalidRequestError
196
+ | UnexpectedClientError
197
+ | SDKValidationError
198
+ >(
199
+ M.json(
200
+ 200,
201
+ operations
202
+ .IntegrationsControllerConfigureIntegrationWebhookResponse$inboundSchema,
203
+ { hdrs: true, key: "Result" },
204
+ ),
205
+ M.jsonErr(414, errors.ErrorDto$inboundSchema),
206
+ M.jsonErr(
207
+ [400, 401, 403, 404, 405, 409, 413, 415],
208
+ errors.ErrorDto$inboundSchema,
209
+ { hdrs: true },
210
+ ),
211
+ M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
212
+ M.fail(429),
213
+ M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
214
+ M.fail(503),
215
+ M.fail("4XX"),
216
+ M.fail("5XX"),
217
+ )(response, req, { extraFields: responseFields });
218
+ if (!result.ok) {
219
+ return [result, { status: "complete", request: req, response }];
220
+ }
221
+
222
+ return [result, { status: "complete", request: req, response }];
223
+ }
@@ -0,0 +1,216 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { NovuCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { NovuError } from "../models/errors/novuerror.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Issue a URL to link a subscriber chat identity
32
+ *
33
+ * @remarks
34
+ * Returns a provider-specific URL the subscriber opens to link their chat identity. The integration provider is resolved from integrationIdentifier; Telegram returns a deep link.
35
+ */
36
+ export function integrationsLinkChannelEndpoint(
37
+ client: NovuCore,
38
+ linkChannelEndpointRequestDto: components.LinkChannelEndpointRequestDto,
39
+ idempotencyKey?: string | undefined,
40
+ options?: RequestOptions,
41
+ ): APIPromise<
42
+ Result<
43
+ operations.IntegrationsControllerLinkChannelEndpointResponse,
44
+ | errors.ErrorDto
45
+ | errors.ValidationErrorDto
46
+ | NovuError
47
+ | ResponseValidationError
48
+ | ConnectionError
49
+ | RequestAbortedError
50
+ | RequestTimeoutError
51
+ | InvalidRequestError
52
+ | UnexpectedClientError
53
+ | SDKValidationError
54
+ >
55
+ > {
56
+ return new APIPromise($do(
57
+ client,
58
+ linkChannelEndpointRequestDto,
59
+ idempotencyKey,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ async function $do(
65
+ client: NovuCore,
66
+ linkChannelEndpointRequestDto: components.LinkChannelEndpointRequestDto,
67
+ idempotencyKey?: string | undefined,
68
+ options?: RequestOptions,
69
+ ): Promise<
70
+ [
71
+ Result<
72
+ operations.IntegrationsControllerLinkChannelEndpointResponse,
73
+ | errors.ErrorDto
74
+ | errors.ValidationErrorDto
75
+ | NovuError
76
+ | ResponseValidationError
77
+ | ConnectionError
78
+ | RequestAbortedError
79
+ | RequestTimeoutError
80
+ | InvalidRequestError
81
+ | UnexpectedClientError
82
+ | SDKValidationError
83
+ >,
84
+ APICall,
85
+ ]
86
+ > {
87
+ const input: operations.IntegrationsControllerLinkChannelEndpointRequest = {
88
+ linkChannelEndpointRequestDto: linkChannelEndpointRequestDto,
89
+ idempotencyKey: idempotencyKey,
90
+ };
91
+
92
+ const parsed = safeParse(
93
+ input,
94
+ (value) =>
95
+ operations.IntegrationsControllerLinkChannelEndpointRequest$outboundSchema
96
+ .parse(value),
97
+ "Input validation failed",
98
+ );
99
+ if (!parsed.ok) {
100
+ return [parsed, { status: "invalid" }];
101
+ }
102
+ const payload = parsed.value;
103
+ const body = encodeJSON("body", payload.LinkChannelEndpointRequestDto, {
104
+ explode: true,
105
+ });
106
+
107
+ const path = pathToFunc("/v1/integrations/channel-endpoints/link")();
108
+
109
+ const headers = new Headers(compactMap({
110
+ "Content-Type": "application/json",
111
+ Accept: "application/json",
112
+ "idempotency-key": encodeSimple(
113
+ "idempotency-key",
114
+ payload["idempotency-key"],
115
+ { explode: false, charEncoding: "none" },
116
+ ),
117
+ }));
118
+
119
+ const secConfig = await extractSecurity(client._options.secretKey);
120
+ const securityInput = secConfig == null ? {} : { secretKey: secConfig };
121
+ const requestSecurity = resolveGlobalSecurity(securityInput);
122
+
123
+ const context = {
124
+ options: client._options,
125
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
126
+ operationID: "IntegrationsController_linkChannelEndpoint",
127
+ oAuth2Scopes: null,
128
+
129
+ resolvedSecurity: requestSecurity,
130
+
131
+ securitySource: client._options.secretKey,
132
+ retryConfig: options?.retries
133
+ || client._options.retryConfig
134
+ || {
135
+ strategy: "backoff",
136
+ backoff: {
137
+ initialInterval: 1000,
138
+ maxInterval: 30000,
139
+ exponent: 1.5,
140
+ maxElapsedTime: 3600000,
141
+ },
142
+ retryConnectionErrors: true,
143
+ }
144
+ || { strategy: "none" },
145
+ retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
146
+ };
147
+
148
+ const requestRes = client._createRequest(context, {
149
+ security: requestSecurity,
150
+ method: "POST",
151
+ baseURL: options?.serverURL,
152
+ path: path,
153
+ headers: headers,
154
+ body: body,
155
+ userAgent: client._options.userAgent,
156
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
157
+ }, options);
158
+ if (!requestRes.ok) {
159
+ return [requestRes, { status: "invalid" }];
160
+ }
161
+ const req = requestRes.value;
162
+
163
+ const doResult = await client._do(req, {
164
+ context,
165
+ isErrorStatusCode: (statusCode: number) =>
166
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
167
+ retryConfig: context.retryConfig,
168
+ retryCodes: context.retryCodes,
169
+ });
170
+ if (!doResult.ok) {
171
+ return [doResult, { status: "request-error", request: req }];
172
+ }
173
+ const response = doResult.value;
174
+
175
+ const responseFields = {
176
+ HttpMeta: { Response: response, Request: req },
177
+ };
178
+
179
+ const [result] = await M.match<
180
+ operations.IntegrationsControllerLinkChannelEndpointResponse,
181
+ | errors.ErrorDto
182
+ | errors.ValidationErrorDto
183
+ | NovuError
184
+ | ResponseValidationError
185
+ | ConnectionError
186
+ | RequestAbortedError
187
+ | RequestTimeoutError
188
+ | InvalidRequestError
189
+ | UnexpectedClientError
190
+ | SDKValidationError
191
+ >(
192
+ M.json(
193
+ 200,
194
+ operations
195
+ .IntegrationsControllerLinkChannelEndpointResponse$inboundSchema,
196
+ { hdrs: true, key: "Result" },
197
+ ),
198
+ M.jsonErr(414, errors.ErrorDto$inboundSchema),
199
+ M.jsonErr(
200
+ [400, 401, 403, 404, 405, 409, 413, 415],
201
+ errors.ErrorDto$inboundSchema,
202
+ { hdrs: true },
203
+ ),
204
+ M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
205
+ M.fail(429),
206
+ M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
207
+ M.fail(503),
208
+ M.fail("4XX"),
209
+ M.fail("5XX"),
210
+ )(response, req, { extraFields: responseFields });
211
+ if (!result.ok) {
212
+ return [result, { status: "complete", request: req, response }];
213
+ }
214
+
215
+ return [result, { status: "complete", request: req, response }];
216
+ }
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
30
30
  * List all integrations
31
31
  *
32
32
  * @remarks
33
- * List all the channels integrations created in the organization
33
+ * List all the channels integrations created in the organization. Only integration metadata is returned, credentials field is returned as an empty object.
34
34
  */
35
35
  export function integrationsList(
36
36
  client: NovuCore,
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
30
30
  * List active integrations
31
31
  *
32
32
  * @remarks
33
- * List all the active integrations created in the organization
33
+ * List all the active integrations created in the organization. Only integration metadata is returned, credentials field is returned as an empty object.
34
34
  */
35
35
  export function integrationsListActive(
36
36
  client: NovuCore,
@@ -33,6 +33,7 @@ import { Result } from "../types/fp.js";
33
33
  * Update an integration as **primary** by its unique key identifier **integrationId**.
34
34
  * This API will set the integration as primary for that channel in the current environment.
35
35
  * Primary integration is used to deliver notification for sms and email channels in the workflow.
36
+ * Only integration metadata is returned, credentials field is returned as an empty object.
36
37
  */
37
38
  export function integrationsSetAsPrimary(
38
39
  client: NovuCore,
@@ -32,7 +32,7 @@ import { Result } from "../types/fp.js";
32
32
  *
33
33
  * @remarks
34
34
  * Update an integration by its unique key identifier **integrationId**.
35
- * Each provider supports different credentials, check the provider documentation for more details.
35
+ * Each provider supports different credentials, check the provider documentation for more details. Only integration metadata is returned, credentials field is returned as an empty object.
36
36
  */
37
37
  export function integrationsUpdate(
38
38
  client: NovuCore,
@@ -31,7 +31,9 @@ import { Result } from "../types/fp.js";
31
31
  * Update all notifications state
32
32
  *
33
33
  * @remarks
34
- * Update all subscriber in-app (inbox) notifications state such as read, unread, seen or unseen by **subscriberId**.
34
+ * This API is deprecated, use v2 API instead. Update all subscriber in-app notifications state such as read, unread, seen or unseen by **subscriberId**.
35
+ *
36
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
35
37
  */
36
38
  export function subscribersMessagesMarkAll(
37
39
  client: NovuCore,
@@ -31,8 +31,10 @@ import { Result } from "../types/fp.js";
31
31
  * Update notifications state
32
32
  *
33
33
  * @remarks
34
- * Update subscriber's multiple in-app (inbox) notifications state such as seen, read, unseen or unread by **subscriberId**.
35
- * **messageId** is of type mongodbId of notifications
34
+ * This API is deprecated, use v2 API instead. Update subscriber's multiple in-app notifications state such as seen, read, unseen or unread by **subscriberId**.
35
+ * **messageId** is of type mongodbId of notifications.
36
+ *
37
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
36
38
  */
37
39
  export function subscribersMessagesMarkAllAs(
38
40
  client: NovuCore,
@@ -30,8 +30,10 @@ import { Result } from "../types/fp.js";
30
30
  * Update notification action status
31
31
  *
32
32
  * @remarks
33
- * Update in-app (inbox) notification's action status by its unique key identifier **messageId** and type field **type**.
33
+ * This API is deprecated, use v2 API instead. Update in-app notification's action status by its unique key identifier **messageId** and type field **type**.
34
34
  * **type** field can be **primary** or **secondary**
35
+ *
36
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
35
37
  */
36
38
  export function subscribersMessagesUpdateAsSeen(
37
39
  client: NovuCore,
@@ -30,7 +30,9 @@ import { Result } from "../types/fp.js";
30
30
  * Retrieve subscriber notifications
31
31
  *
32
32
  * @remarks
33
- * Retrieve subscriber in-app (inbox) notifications by its unique key identifier **subscriberId**.
33
+ * This API is deprecated, use v2 API instead. Retrieve subscriber in-app notifications by its unique key identifier **subscriberId**.
34
+ *
35
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
34
36
  */
35
37
  export function subscribersNotificationsFeed(
36
38
  client: NovuCore,
@@ -30,7 +30,9 @@ import { Result } from "../types/fp.js";
30
30
  * Retrieve unseen notifications count
31
31
  *
32
32
  * @remarks
33
- * Retrieve unseen in-app (inbox) notifications count for a subscriber by its unique key identifier **subscriberId**.
33
+ * This API is deprecated, use v2 API instead. Retrieve unseen in-app notifications count for a subscriber by its unique key identifier **subscriberId**.
34
+ *
35
+ * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
34
36
  */
35
37
  export function subscribersNotificationsUnseenCount(
36
38
  client: NovuCore,
@@ -15,6 +15,7 @@ export type HookContext = {
15
15
  retryConfig: RetryConfig;
16
16
  resolvedSecurity: SecurityState | null;
17
17
  options: SDKOptions;
18
+ timeoutMs?: number;
18
19
  };
19
20
 
20
21
  export type Awaitable<T> = T | Promise<T>;
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.15.0",
62
- sdkVersion: "3.17.0",
63
- genVersion: "2.892.1",
64
- userAgent: "speakeasy-sdk/typescript 3.17.0 2.892.1 3.15.0 @novu/api",
61
+ openapiDocVersion: "3.17.1",
62
+ sdkVersion: "3.17.1",
63
+ genVersion: "2.916.2",
64
+ userAgent: "speakeasy-sdk/typescript 3.17.1 2.916.2 3.17.1 @novu/api",
65
65
  } as const;
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { bytesToBase64 } from "./base64.js";
6
- import { isPlainObject } from "./is-plain-object.js";
6
+ import { isPlainObject } from "./primitives.js";
7
7
 
8
8
  export class EncodingError extends Error {
9
9
  constructor(message: string) {
@@ -6,7 +6,7 @@ import { ResponseValidationError } from "../models/errors/responsevalidationerro
6
6
  import { SDKError } from "../models/errors/sdkerror.js";
7
7
  import { ERR, OK, Result } from "../types/fp.js";
8
8
  import { matchResponse, matchStatusCode, StatusCodePredicate } from "./http.js";
9
- import { isPlainObject } from "./is-plain-object.js";
9
+ import { isPlainObject } from "./primitives.js";
10
10
 
11
11
  export type Encoding =
12
12
  | "jsonl"
@@ -148,3 +148,19 @@ export function allRequired<V extends Record<string, unknown>>(
148
148
 
149
149
  return v as ReturnType<typeof allRequired<V>>;
150
150
  }
151
+
152
+ export function isPlainObject(
153
+ value: unknown,
154
+ ): value is Record<string, unknown> {
155
+ if (value === null || typeof value !== "object") return false;
156
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
157
+ const proto = Object.getPrototypeOf(value);
158
+ if (proto === null || proto === Object.prototype) return true;
159
+ // cross-realm plain objects (vm contexts, iframes) inherit from a
160
+ // different realm's Object.prototype, which itself has a null prototype
161
+ try {
162
+ return Object.getPrototypeOf(proto) === null;
163
+ } catch {
164
+ return false;
165
+ }
166
+ }
@@ -194,6 +194,14 @@ async function retryBackoff(
194
194
  }
195
195
 
196
196
  function retryIntervalFromResponse(res: Response): number {
197
+ const retryAfterMsVal = res.headers.get("retry-after-ms");
198
+ if (retryAfterMsVal) {
199
+ const parsedMs = Number(retryAfterMsVal);
200
+ if (Number.isFinite(parsedMs) && parsedMs >= 0) {
201
+ return parsedMs;
202
+ }
203
+ }
204
+
197
205
  const retryVal = res.headers.get("retry-after") || "";
198
206
  if (!retryVal) {
199
207
  return 0;