@moovio/sdk 0.0.0-dev.5 → 0.0.0-dev.7

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 (210) hide show
  1. package/README.md +115 -55
  2. package/bin/mcp-server.js +1792 -876
  3. package/bin/mcp-server.js.map +43 -27
  4. package/funcs/disputesUploadEvidenceFile.js +6 -0
  5. package/funcs/disputesUploadEvidenceFile.js.map +1 -1
  6. package/funcs/filesUpload.js +6 -0
  7. package/funcs/filesUpload.js.map +1 -1
  8. package/funcs/imagesUpdate.js +7 -0
  9. package/funcs/imagesUpdate.js.map +1 -1
  10. package/funcs/imagesUpload.js +7 -0
  11. package/funcs/imagesUpload.js.map +1 -1
  12. package/funcs/invoicesDelete.d.ts +24 -0
  13. package/funcs/invoicesDelete.d.ts.map +1 -0
  14. package/funcs/invoicesDelete.js +146 -0
  15. package/funcs/invoicesDelete.js.map +1 -0
  16. package/funcs/resolutionLinksCreate.d.ts +20 -0
  17. package/funcs/resolutionLinksCreate.d.ts.map +1 -0
  18. package/funcs/resolutionLinksCreate.js +145 -0
  19. package/funcs/resolutionLinksCreate.js.map +1 -0
  20. package/funcs/resolutionLinksDisable.d.ts +18 -0
  21. package/funcs/resolutionLinksDisable.d.ts.map +1 -0
  22. package/funcs/resolutionLinksDisable.js +135 -0
  23. package/funcs/resolutionLinksDisable.js.map +1 -0
  24. package/funcs/resolutionLinksGet.d.ts +17 -0
  25. package/funcs/resolutionLinksGet.d.ts.map +1 -0
  26. package/funcs/resolutionLinksGet.js +126 -0
  27. package/funcs/resolutionLinksGet.js.map +1 -0
  28. package/funcs/resolutionLinksList.d.ts +17 -0
  29. package/funcs/resolutionLinksList.d.ts.map +1 -0
  30. package/funcs/resolutionLinksList.js +125 -0
  31. package/funcs/resolutionLinksList.js.map +1 -0
  32. package/hooks/moov-version-hook.d.ts +3 -4
  33. package/hooks/moov-version-hook.d.ts.map +1 -1
  34. package/hooks/moov-version-hook.js +5 -4
  35. package/hooks/moov-version-hook.js.map +1 -1
  36. package/hooks/registration.js +1 -1
  37. package/hooks/registration.js.map +1 -1
  38. package/jsr.json +1 -1
  39. package/lib/config.d.ts +3 -3
  40. package/lib/config.js +3 -3
  41. package/lib/config.js.map +1 -1
  42. package/lib/matchers.d.ts.map +1 -1
  43. package/lib/matchers.js +0 -1
  44. package/lib/matchers.js.map +1 -1
  45. package/lib/security.d.ts.map +1 -1
  46. package/lib/security.js +1 -2
  47. package/lib/security.js.map +1 -1
  48. package/mcp-server/mcp-server.js +1 -1
  49. package/mcp-server/server.d.ts.map +1 -1
  50. package/mcp-server/server.js +11 -1
  51. package/mcp-server/server.js.map +1 -1
  52. package/mcp-server/shared.js +1 -1
  53. package/mcp-server/shared.js.map +1 -1
  54. package/mcp-server/tools/invoicesDelete.d.ts +8 -0
  55. package/mcp-server/tools/invoicesDelete.d.ts.map +1 -0
  56. package/mcp-server/tools/invoicesDelete.js +70 -0
  57. package/mcp-server/tools/invoicesDelete.js.map +1 -0
  58. package/mcp-server/tools/resolutionLinksCreate.d.ts +8 -0
  59. package/mcp-server/tools/resolutionLinksCreate.d.ts.map +1 -0
  60. package/mcp-server/tools/resolutionLinksCreate.js +67 -0
  61. package/mcp-server/tools/resolutionLinksCreate.js.map +1 -0
  62. package/mcp-server/tools/resolutionLinksDisable.d.ts +8 -0
  63. package/mcp-server/tools/resolutionLinksDisable.d.ts.map +1 -0
  64. package/mcp-server/tools/resolutionLinksDisable.js +64 -0
  65. package/mcp-server/tools/resolutionLinksDisable.js.map +1 -0
  66. package/mcp-server/tools/resolutionLinksGet.d.ts +8 -0
  67. package/mcp-server/tools/resolutionLinksGet.d.ts.map +1 -0
  68. package/mcp-server/tools/resolutionLinksGet.js +65 -0
  69. package/mcp-server/tools/resolutionLinksGet.js.map +1 -0
  70. package/mcp-server/tools/resolutionLinksList.d.ts +8 -0
  71. package/mcp-server/tools/resolutionLinksList.d.ts.map +1 -0
  72. package/mcp-server/tools/resolutionLinksList.js +65 -0
  73. package/mcp-server/tools/resolutionLinksList.js.map +1 -0
  74. package/models/components/createinvoicelineitem.d.ts +2 -1
  75. package/models/components/createinvoicelineitem.d.ts.map +1 -1
  76. package/models/components/createinvoicelineitem.js.map +1 -1
  77. package/models/components/createpaymentlinklineitem.d.ts +2 -1
  78. package/models/components/createpaymentlinklineitem.d.ts.map +1 -1
  79. package/models/components/createpaymentlinklineitem.js.map +1 -1
  80. package/models/components/createresolutionlink.d.ts +24 -0
  81. package/models/components/createresolutionlink.d.ts.map +1 -0
  82. package/models/components/{rtpfailurecode.js → createresolutionlink.js} +18 -19
  83. package/models/components/createresolutionlink.js.map +1 -0
  84. package/models/components/index.d.ts +3 -3
  85. package/models/components/index.d.ts.map +1 -1
  86. package/models/components/index.js +3 -3
  87. package/models/components/index.js.map +1 -1
  88. package/models/components/invoice.d.ts +12 -0
  89. package/models/components/invoice.d.ts.map +1 -1
  90. package/models/components/invoice.js +6 -0
  91. package/models/components/invoice.js.map +1 -1
  92. package/models/components/invoicelineitem.d.ts +2 -1
  93. package/models/components/invoicelineitem.d.ts.map +1 -1
  94. package/models/components/invoicelineitem.js.map +1 -1
  95. package/models/components/resolutionlink.d.ts +63 -0
  96. package/models/components/resolutionlink.d.ts.map +1 -0
  97. package/models/components/resolutionlink.js +75 -0
  98. package/models/components/resolutionlink.js.map +1 -0
  99. package/models/components/resolutionlinkrecipient.d.ts +29 -0
  100. package/models/components/resolutionlinkrecipient.d.ts.map +1 -0
  101. package/models/components/{rtptransactionstatus.js → resolutionlinkrecipient.js} +20 -13
  102. package/models/components/resolutionlinkrecipient.js.map +1 -0
  103. package/models/components/transferdestination.d.ts +0 -6
  104. package/models/components/transferdestination.d.ts.map +1 -1
  105. package/models/components/transferdestination.js +0 -3
  106. package/models/components/transferdestination.js.map +1 -1
  107. package/models/components/updateinvoice.d.ts +4 -1
  108. package/models/components/updateinvoice.d.ts.map +1 -1
  109. package/models/components/updateinvoice.js.map +1 -1
  110. package/models/errors/createresolutionlinkerror.d.ts +45 -0
  111. package/models/errors/createresolutionlinkerror.d.ts.map +1 -0
  112. package/models/errors/createresolutionlinkerror.js +82 -0
  113. package/models/errors/createresolutionlinkerror.js.map +1 -0
  114. package/models/errors/index.d.ts +1 -0
  115. package/models/errors/index.d.ts.map +1 -1
  116. package/models/errors/index.js +1 -0
  117. package/models/errors/index.js.map +1 -1
  118. package/models/operations/createresolutionlink.d.ts +66 -0
  119. package/models/operations/createresolutionlink.d.ts.map +1 -0
  120. package/models/operations/createresolutionlink.js +122 -0
  121. package/models/operations/createresolutionlink.js.map +1 -0
  122. package/models/operations/deleteinvoice.d.ts +63 -0
  123. package/models/operations/deleteinvoice.d.ts.map +1 -0
  124. package/models/operations/deleteinvoice.js +109 -0
  125. package/models/operations/deleteinvoice.js.map +1 -0
  126. package/models/operations/disableresolutionlink.d.ts +63 -0
  127. package/models/operations/disableresolutionlink.d.ts.map +1 -0
  128. package/models/operations/disableresolutionlink.js +109 -0
  129. package/models/operations/disableresolutionlink.js.map +1 -0
  130. package/models/operations/getresolutionlink.d.ts +66 -0
  131. package/models/operations/getresolutionlink.d.ts.map +1 -0
  132. package/models/operations/getresolutionlink.js +114 -0
  133. package/models/operations/getresolutionlink.js.map +1 -0
  134. package/models/operations/index.d.ts +5 -0
  135. package/models/operations/index.d.ts.map +1 -1
  136. package/models/operations/index.js +5 -0
  137. package/models/operations/index.js.map +1 -1
  138. package/models/operations/listresolutionlinks.d.ts +64 -0
  139. package/models/operations/listresolutionlinks.d.ts.map +1 -0
  140. package/models/operations/listresolutionlinks.js +112 -0
  141. package/models/operations/listresolutionlinks.js.map +1 -0
  142. package/package.json +1 -1
  143. package/sdk/invoices.d.ts +13 -0
  144. package/sdk/invoices.d.ts.map +1 -1
  145. package/sdk/invoices.js +16 -0
  146. package/sdk/invoices.js.map +1 -1
  147. package/sdk/resolutionlinks.d.ts +35 -0
  148. package/sdk/resolutionlinks.d.ts.map +1 -0
  149. package/sdk/resolutionlinks.js +54 -0
  150. package/sdk/resolutionlinks.js.map +1 -0
  151. package/sdk/sdk.d.ts +3 -0
  152. package/sdk/sdk.d.ts.map +1 -1
  153. package/sdk/sdk.js +4 -0
  154. package/sdk/sdk.js.map +1 -1
  155. package/src/funcs/disputesUploadEvidenceFile.ts +15 -0
  156. package/src/funcs/filesUpload.ts +15 -0
  157. package/src/funcs/imagesUpdate.ts +16 -0
  158. package/src/funcs/imagesUpload.ts +16 -0
  159. package/src/funcs/invoicesDelete.ts +206 -0
  160. package/src/funcs/resolutionLinksCreate.ts +208 -0
  161. package/src/funcs/resolutionLinksDisable.ts +204 -0
  162. package/src/funcs/resolutionLinksGet.ts +186 -0
  163. package/src/funcs/resolutionLinksList.ts +180 -0
  164. package/src/hooks/moov-version-hook.ts +10 -6
  165. package/src/hooks/registration.ts +1 -1
  166. package/src/lib/config.ts +3 -3
  167. package/src/lib/matchers.ts +3 -2
  168. package/src/lib/security.ts +1 -2
  169. package/src/mcp-server/mcp-server.ts +1 -1
  170. package/src/mcp-server/server.ts +11 -1
  171. package/src/mcp-server/shared.ts +2 -2
  172. package/src/mcp-server/tools/invoicesDelete.ts +43 -0
  173. package/src/mcp-server/tools/resolutionLinksCreate.ts +41 -0
  174. package/src/mcp-server/tools/resolutionLinksDisable.ts +37 -0
  175. package/src/mcp-server/tools/resolutionLinksGet.ts +38 -0
  176. package/src/mcp-server/tools/resolutionLinksList.ts +38 -0
  177. package/src/models/components/createinvoicelineitem.ts +2 -1
  178. package/src/models/components/createpaymentlinklineitem.ts +2 -1
  179. package/src/models/components/createresolutionlink.ts +63 -0
  180. package/src/models/components/index.ts +3 -3
  181. package/src/models/components/invoice.ts +20 -0
  182. package/src/models/components/invoicelineitem.ts +2 -1
  183. package/src/models/components/resolutionlink.ts +110 -0
  184. package/src/models/components/resolutionlinkrecipient.ts +70 -0
  185. package/src/models/components/transferdestination.ts +0 -13
  186. package/src/models/components/updateinvoice.ts +4 -1
  187. package/src/models/errors/createresolutionlinkerror.ts +90 -0
  188. package/src/models/errors/index.ts +1 -0
  189. package/src/models/operations/createresolutionlink.ts +193 -0
  190. package/src/models/operations/deleteinvoice.ts +172 -0
  191. package/src/models/operations/disableresolutionlink.ts +178 -0
  192. package/src/models/operations/getresolutionlink.ts +179 -0
  193. package/src/models/operations/index.ts +5 -0
  194. package/src/models/operations/listresolutionlinks.ts +177 -0
  195. package/src/sdk/invoices.ts +24 -0
  196. package/src/sdk/resolutionlinks.ts +83 -0
  197. package/src/sdk/sdk.ts +6 -0
  198. package/models/components/rtpfailurecode.d.ts +0 -26
  199. package/models/components/rtpfailurecode.d.ts.map +0 -1
  200. package/models/components/rtpfailurecode.js.map +0 -1
  201. package/models/components/rtptransactiondetails.d.ts +0 -43
  202. package/models/components/rtptransactiondetails.d.ts.map +0 -1
  203. package/models/components/rtptransactiondetails.js +0 -75
  204. package/models/components/rtptransactiondetails.js.map +0 -1
  205. package/models/components/rtptransactionstatus.d.ts +0 -20
  206. package/models/components/rtptransactionstatus.d.ts.map +0 -1
  207. package/models/components/rtptransactionstatus.js.map +0 -1
  208. package/src/models/components/rtpfailurecode.ts +0 -35
  209. package/src/models/components/rtptransactiondetails.ts +0 -102
  210. package/src/models/components/rtptransactionstatus.ts +0 -29
@@ -0,0 +1,206 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { MoovCore } 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 { MoovError } from "../models/errors/mooverror.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
+ * Delete an invoice. Only invoices in `draft` status can be deleted.
30
+ *
31
+ * Deleting an invoice indicates it was created by mistake and should be completely disregarded.
32
+ * Deleted invoices are hidden from list results by default, but can still be retrieved
33
+ * individually through the get invoice endpoint. If you need to void an invoice that was
34
+ * already sent or is otherwise part of the invoice history, cancel it instead by updating
35
+ * its status to `canceled`.
36
+ *
37
+ * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
38
+ * you'll need to specify the `/accounts/{accountID}/invoices.write` scope.
39
+ */
40
+ export function invoicesDelete(
41
+ client: MoovCore,
42
+ request: operations.DeleteInvoiceRequest,
43
+ options?: RequestOptions,
44
+ ): APIPromise<
45
+ Result<
46
+ operations.DeleteInvoiceResponse | undefined,
47
+ | errors.GenericError
48
+ | MoovError
49
+ | ResponseValidationError
50
+ | ConnectionError
51
+ | RequestAbortedError
52
+ | RequestTimeoutError
53
+ | InvalidRequestError
54
+ | UnexpectedClientError
55
+ | SDKValidationError
56
+ >
57
+ > {
58
+ return new APIPromise($do(
59
+ client,
60
+ request,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ async function $do(
66
+ client: MoovCore,
67
+ request: operations.DeleteInvoiceRequest,
68
+ options?: RequestOptions,
69
+ ): Promise<
70
+ [
71
+ Result<
72
+ operations.DeleteInvoiceResponse | undefined,
73
+ | errors.GenericError
74
+ | MoovError
75
+ | ResponseValidationError
76
+ | ConnectionError
77
+ | RequestAbortedError
78
+ | RequestTimeoutError
79
+ | InvalidRequestError
80
+ | UnexpectedClientError
81
+ | SDKValidationError
82
+ >,
83
+ APICall,
84
+ ]
85
+ > {
86
+ const parsed = safeParse(
87
+ request,
88
+ (value) => operations.DeleteInvoiceRequest$outboundSchema.parse(value),
89
+ "Input validation failed",
90
+ );
91
+ if (!parsed.ok) {
92
+ return [parsed, { status: "invalid" }];
93
+ }
94
+ const payload = parsed.value;
95
+ const body = null;
96
+
97
+ const pathParams = {
98
+ accountID: encodeSimple("accountID", payload.accountID, {
99
+ explode: false,
100
+ charEncoding: "percent",
101
+ }),
102
+ invoiceID: encodeSimple("invoiceID", payload.invoiceID, {
103
+ explode: false,
104
+ charEncoding: "percent",
105
+ }),
106
+ };
107
+
108
+ const path = pathToFunc("/accounts/{accountID}/invoices/{invoiceID}")(
109
+ pathParams,
110
+ );
111
+
112
+ const headers = new Headers(compactMap({
113
+ Accept: "application/json",
114
+ "X-Moov-Version": encodeSimple(
115
+ "X-Moov-Version",
116
+ client._options.xMoovVersion,
117
+ { explode: false, charEncoding: "none" },
118
+ ),
119
+ }));
120
+
121
+ const securityInput = await extractSecurity(client._options.security);
122
+ const requestSecurity = resolveGlobalSecurity(securityInput);
123
+
124
+ const context = {
125
+ options: client._options,
126
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
127
+ operationID: "deleteInvoice",
128
+ oAuth2Scopes: null,
129
+
130
+ resolvedSecurity: requestSecurity,
131
+
132
+ securitySource: client._options.security,
133
+ retryConfig: options?.retries
134
+ || client._options.retryConfig
135
+ || { strategy: "none" },
136
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
137
+ };
138
+
139
+ const requestRes = client._createRequest(context, {
140
+ security: requestSecurity,
141
+ method: "DELETE",
142
+ baseURL: options?.serverURL,
143
+ path: path,
144
+ headers: headers,
145
+ body: body,
146
+ userAgent: client._options.userAgent,
147
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
148
+ }, options);
149
+ if (!requestRes.ok) {
150
+ return [requestRes, { status: "invalid" }];
151
+ }
152
+ const req = requestRes.value;
153
+
154
+ const doResult = await client._do(req, {
155
+ context,
156
+ errorCodes: [
157
+ "400",
158
+ "401",
159
+ "403",
160
+ "404",
161
+ "409",
162
+ "429",
163
+ "4XX",
164
+ "500",
165
+ "504",
166
+ "5XX",
167
+ ],
168
+ retryConfig: context.retryConfig,
169
+ retryCodes: context.retryCodes,
170
+ });
171
+ if (!doResult.ok) {
172
+ return [doResult, { status: "request-error", request: req }];
173
+ }
174
+ const response = doResult.value;
175
+
176
+ const responseFields = {
177
+ HttpMeta: { Response: response, Request: req },
178
+ };
179
+
180
+ const [result] = await M.match<
181
+ operations.DeleteInvoiceResponse | undefined,
182
+ | errors.GenericError
183
+ | MoovError
184
+ | ResponseValidationError
185
+ | ConnectionError
186
+ | RequestAbortedError
187
+ | RequestTimeoutError
188
+ | InvalidRequestError
189
+ | UnexpectedClientError
190
+ | SDKValidationError
191
+ >(
192
+ M.nil(204, operations.DeleteInvoiceResponse$inboundSchema.optional(), {
193
+ hdrs: true,
194
+ }),
195
+ M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
196
+ M.fail([401, 403, 404, 429]),
197
+ M.fail([500, 504]),
198
+ M.fail("4XX"),
199
+ M.fail("5XX"),
200
+ )(response, req, { extraFields: responseFields });
201
+ if (!result.ok) {
202
+ return [result, { status: "complete", request: req, response }];
203
+ }
204
+
205
+ return [result, { status: "complete", request: req, response }];
206
+ }
@@ -0,0 +1,208 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { MoovCore } from "../core.js";
6
+ import { encodeJSON, 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 { MoovError } from "../models/errors/mooverror.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
+ * Create a resolution link for the specified account. Resolution links are temporary, secure links
30
+ * sent to merchants to resolve account requirements such as KYC verification or document uploads. Only one active resolution link
31
+ * is allowed per connected account.
32
+ *
33
+ * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
34
+ * you'll need to specify the `/accounts/{accountID}/profile.write`, `/accounts/{accountID}/representatives.write` and `/accounts/{accountID}/files.write` scopes.
35
+ */
36
+ export function resolutionLinksCreate(
37
+ client: MoovCore,
38
+ request: operations.CreateResolutionLinkRequest,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ operations.CreateResolutionLinkResponse,
43
+ | errors.GenericError
44
+ | errors.CreateResolutionLinkError
45
+ | MoovError
46
+ | ResponseValidationError
47
+ | ConnectionError
48
+ | RequestAbortedError
49
+ | RequestTimeoutError
50
+ | InvalidRequestError
51
+ | UnexpectedClientError
52
+ | SDKValidationError
53
+ >
54
+ > {
55
+ return new APIPromise($do(
56
+ client,
57
+ request,
58
+ options,
59
+ ));
60
+ }
61
+
62
+ async function $do(
63
+ client: MoovCore,
64
+ request: operations.CreateResolutionLinkRequest,
65
+ options?: RequestOptions,
66
+ ): Promise<
67
+ [
68
+ Result<
69
+ operations.CreateResolutionLinkResponse,
70
+ | errors.GenericError
71
+ | errors.CreateResolutionLinkError
72
+ | MoovError
73
+ | ResponseValidationError
74
+ | ConnectionError
75
+ | RequestAbortedError
76
+ | RequestTimeoutError
77
+ | InvalidRequestError
78
+ | UnexpectedClientError
79
+ | SDKValidationError
80
+ >,
81
+ APICall,
82
+ ]
83
+ > {
84
+ const parsed = safeParse(
85
+ request,
86
+ (value) =>
87
+ operations.CreateResolutionLinkRequest$outboundSchema.parse(value),
88
+ "Input validation failed",
89
+ );
90
+ if (!parsed.ok) {
91
+ return [parsed, { status: "invalid" }];
92
+ }
93
+ const payload = parsed.value;
94
+ const body = encodeJSON("body", payload.CreateResolutionLink, {
95
+ explode: true,
96
+ });
97
+
98
+ const pathParams = {
99
+ accountID: encodeSimple("accountID", payload.accountID, {
100
+ explode: false,
101
+ charEncoding: "percent",
102
+ }),
103
+ };
104
+
105
+ const path = pathToFunc("/accounts/{accountID}/resolution-links")(pathParams);
106
+
107
+ const headers = new Headers(compactMap({
108
+ "Content-Type": "application/json",
109
+ Accept: "application/json",
110
+ "X-Moov-Version": encodeSimple(
111
+ "X-Moov-Version",
112
+ client._options.xMoovVersion,
113
+ { explode: false, charEncoding: "none" },
114
+ ),
115
+ }));
116
+
117
+ const securityInput = await extractSecurity(client._options.security);
118
+ const requestSecurity = resolveGlobalSecurity(securityInput);
119
+
120
+ const context = {
121
+ options: client._options,
122
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
123
+ operationID: "createResolutionLink",
124
+ oAuth2Scopes: null,
125
+
126
+ resolvedSecurity: requestSecurity,
127
+
128
+ securitySource: client._options.security,
129
+ retryConfig: options?.retries
130
+ || client._options.retryConfig
131
+ || { strategy: "none" },
132
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
133
+ };
134
+
135
+ const requestRes = client._createRequest(context, {
136
+ security: requestSecurity,
137
+ method: "POST",
138
+ baseURL: options?.serverURL,
139
+ path: path,
140
+ headers: headers,
141
+ body: body,
142
+ userAgent: client._options.userAgent,
143
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
144
+ }, options);
145
+ if (!requestRes.ok) {
146
+ return [requestRes, { status: "invalid" }];
147
+ }
148
+ const req = requestRes.value;
149
+
150
+ const doResult = await client._do(req, {
151
+ context,
152
+ errorCodes: [
153
+ "400",
154
+ "401",
155
+ "403",
156
+ "404",
157
+ "409",
158
+ "422",
159
+ "429",
160
+ "4XX",
161
+ "500",
162
+ "504",
163
+ "5XX",
164
+ ],
165
+ retryConfig: context.retryConfig,
166
+ retryCodes: context.retryCodes,
167
+ });
168
+ if (!doResult.ok) {
169
+ return [doResult, { status: "request-error", request: req }];
170
+ }
171
+ const response = doResult.value;
172
+
173
+ const responseFields = {
174
+ HttpMeta: { Response: response, Request: req },
175
+ };
176
+
177
+ const [result] = await M.match<
178
+ operations.CreateResolutionLinkResponse,
179
+ | errors.GenericError
180
+ | errors.CreateResolutionLinkError
181
+ | MoovError
182
+ | ResponseValidationError
183
+ | ConnectionError
184
+ | RequestAbortedError
185
+ | RequestTimeoutError
186
+ | InvalidRequestError
187
+ | UnexpectedClientError
188
+ | SDKValidationError
189
+ >(
190
+ M.json(200, operations.CreateResolutionLinkResponse$inboundSchema, {
191
+ hdrs: true,
192
+ key: "Result",
193
+ }),
194
+ M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
195
+ M.jsonErr(422, errors.CreateResolutionLinkError$inboundSchema, {
196
+ hdrs: true,
197
+ }),
198
+ M.fail([401, 403, 404, 429]),
199
+ M.fail([500, 504]),
200
+ M.fail("4XX"),
201
+ M.fail("5XX"),
202
+ )(response, req, { extraFields: responseFields });
203
+ if (!result.ok) {
204
+ return [result, { status: "complete", request: req, response }];
205
+ }
206
+
207
+ return [result, { status: "complete", request: req, response }];
208
+ }
@@ -0,0 +1,204 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { MoovCore } 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 { MoovError } from "../models/errors/mooverror.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
+ * Disable a resolution link. Disabled resolution links can no longer be used by merchants.
30
+ *
31
+ * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
32
+ * you'll need to specify the `/accounts/{accountID}/profile.write` scope.
33
+ */
34
+ export function resolutionLinksDisable(
35
+ client: MoovCore,
36
+ request: operations.DisableResolutionLinkRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.DisableResolutionLinkResponse | undefined,
41
+ | errors.GenericError
42
+ | MoovError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: MoovCore,
61
+ request: operations.DisableResolutionLinkRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ operations.DisableResolutionLinkResponse | undefined,
67
+ | errors.GenericError
68
+ | MoovError
69
+ | ResponseValidationError
70
+ | ConnectionError
71
+ | RequestAbortedError
72
+ | RequestTimeoutError
73
+ | InvalidRequestError
74
+ | UnexpectedClientError
75
+ | SDKValidationError
76
+ >,
77
+ APICall,
78
+ ]
79
+ > {
80
+ const parsed = safeParse(
81
+ request,
82
+ (value) =>
83
+ operations.DisableResolutionLinkRequest$outboundSchema.parse(value),
84
+ "Input validation failed",
85
+ );
86
+ if (!parsed.ok) {
87
+ return [parsed, { status: "invalid" }];
88
+ }
89
+ const payload = parsed.value;
90
+ const body = null;
91
+
92
+ const pathParams = {
93
+ accountID: encodeSimple("accountID", payload.accountID, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ resolutionLinkCode: encodeSimple(
98
+ "resolutionLinkCode",
99
+ payload.resolutionLinkCode,
100
+ { explode: false, charEncoding: "percent" },
101
+ ),
102
+ };
103
+
104
+ const path = pathToFunc(
105
+ "/accounts/{accountID}/resolution-links/{resolutionLinkCode}",
106
+ )(pathParams);
107
+
108
+ const headers = new Headers(compactMap({
109
+ Accept: "application/json",
110
+ "X-Moov-Version": encodeSimple(
111
+ "X-Moov-Version",
112
+ client._options.xMoovVersion,
113
+ { explode: false, charEncoding: "none" },
114
+ ),
115
+ }));
116
+
117
+ const securityInput = await extractSecurity(client._options.security);
118
+ const requestSecurity = resolveGlobalSecurity(securityInput);
119
+
120
+ const context = {
121
+ options: client._options,
122
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
123
+ operationID: "disableResolutionLink",
124
+ oAuth2Scopes: null,
125
+
126
+ resolvedSecurity: requestSecurity,
127
+
128
+ securitySource: client._options.security,
129
+ retryConfig: options?.retries
130
+ || client._options.retryConfig
131
+ || { strategy: "none" },
132
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
133
+ };
134
+
135
+ const requestRes = client._createRequest(context, {
136
+ security: requestSecurity,
137
+ method: "DELETE",
138
+ baseURL: options?.serverURL,
139
+ path: path,
140
+ headers: headers,
141
+ body: body,
142
+ userAgent: client._options.userAgent,
143
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
144
+ }, options);
145
+ if (!requestRes.ok) {
146
+ return [requestRes, { status: "invalid" }];
147
+ }
148
+ const req = requestRes.value;
149
+
150
+ const doResult = await client._do(req, {
151
+ context,
152
+ errorCodes: [
153
+ "400",
154
+ "401",
155
+ "403",
156
+ "404",
157
+ "409",
158
+ "429",
159
+ "4XX",
160
+ "500",
161
+ "504",
162
+ "5XX",
163
+ ],
164
+ retryConfig: context.retryConfig,
165
+ retryCodes: context.retryCodes,
166
+ });
167
+ if (!doResult.ok) {
168
+ return [doResult, { status: "request-error", request: req }];
169
+ }
170
+ const response = doResult.value;
171
+
172
+ const responseFields = {
173
+ HttpMeta: { Response: response, Request: req },
174
+ };
175
+
176
+ const [result] = await M.match<
177
+ operations.DisableResolutionLinkResponse | undefined,
178
+ | errors.GenericError
179
+ | MoovError
180
+ | ResponseValidationError
181
+ | ConnectionError
182
+ | RequestAbortedError
183
+ | RequestTimeoutError
184
+ | InvalidRequestError
185
+ | UnexpectedClientError
186
+ | SDKValidationError
187
+ >(
188
+ M.nil(
189
+ 204,
190
+ operations.DisableResolutionLinkResponse$inboundSchema.optional(),
191
+ { hdrs: true },
192
+ ),
193
+ M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
194
+ M.fail([401, 403, 404, 429]),
195
+ M.fail([500, 504]),
196
+ M.fail("4XX"),
197
+ M.fail("5XX"),
198
+ )(response, req, { extraFields: responseFields });
199
+ if (!result.ok) {
200
+ return [result, { status: "complete", request: req, response }];
201
+ }
202
+
203
+ return [result, { status: "complete", request: req, response }];
204
+ }