@moovio/sdk 26.4.0-dev.10 → 26.4.0-dev.11

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 (127) hide show
  1. package/README.md +95 -55
  2. package/bin/mcp-server.js +1202 -423
  3. package/bin/mcp-server.js.map +27 -11
  4. package/funcs/resolutionLinksCreate.d.ts +20 -0
  5. package/funcs/resolutionLinksCreate.d.ts.map +1 -0
  6. package/funcs/resolutionLinksCreate.js +145 -0
  7. package/funcs/resolutionLinksCreate.js.map +1 -0
  8. package/funcs/resolutionLinksDisable.d.ts +18 -0
  9. package/funcs/resolutionLinksDisable.d.ts.map +1 -0
  10. package/funcs/resolutionLinksDisable.js +135 -0
  11. package/funcs/resolutionLinksDisable.js.map +1 -0
  12. package/funcs/resolutionLinksGet.d.ts +17 -0
  13. package/funcs/resolutionLinksGet.d.ts.map +1 -0
  14. package/funcs/resolutionLinksGet.js +126 -0
  15. package/funcs/resolutionLinksGet.js.map +1 -0
  16. package/funcs/resolutionLinksList.d.ts +17 -0
  17. package/funcs/resolutionLinksList.d.ts.map +1 -0
  18. package/funcs/resolutionLinksList.js +125 -0
  19. package/funcs/resolutionLinksList.js.map +1 -0
  20. package/hooks/moov-version-hook.d.ts +3 -4
  21. package/hooks/moov-version-hook.d.ts.map +1 -1
  22. package/hooks/moov-version-hook.js +5 -4
  23. package/hooks/moov-version-hook.js.map +1 -1
  24. package/hooks/registration.js +1 -1
  25. package/hooks/registration.js.map +1 -1
  26. package/jsr.json +1 -1
  27. package/lib/config.d.ts +3 -3
  28. package/lib/config.js +3 -3
  29. package/mcp-server/mcp-server.js +1 -1
  30. package/mcp-server/server.d.ts.map +1 -1
  31. package/mcp-server/server.js +9 -1
  32. package/mcp-server/server.js.map +1 -1
  33. package/mcp-server/tools/resolutionLinksCreate.d.ts +8 -0
  34. package/mcp-server/tools/resolutionLinksCreate.d.ts.map +1 -0
  35. package/mcp-server/tools/resolutionLinksCreate.js +67 -0
  36. package/mcp-server/tools/resolutionLinksCreate.js.map +1 -0
  37. package/mcp-server/tools/resolutionLinksDisable.d.ts +8 -0
  38. package/mcp-server/tools/resolutionLinksDisable.d.ts.map +1 -0
  39. package/mcp-server/tools/resolutionLinksDisable.js +64 -0
  40. package/mcp-server/tools/resolutionLinksDisable.js.map +1 -0
  41. package/mcp-server/tools/resolutionLinksGet.d.ts +8 -0
  42. package/mcp-server/tools/resolutionLinksGet.d.ts.map +1 -0
  43. package/mcp-server/tools/resolutionLinksGet.js +65 -0
  44. package/mcp-server/tools/resolutionLinksGet.js.map +1 -0
  45. package/mcp-server/tools/resolutionLinksList.d.ts +8 -0
  46. package/mcp-server/tools/resolutionLinksList.d.ts.map +1 -0
  47. package/mcp-server/tools/resolutionLinksList.js +65 -0
  48. package/mcp-server/tools/resolutionLinksList.js.map +1 -0
  49. package/models/components/createresolutionlink.d.ts +24 -0
  50. package/models/components/createresolutionlink.d.ts.map +1 -0
  51. package/models/components/createresolutionlink.js +59 -0
  52. package/models/components/createresolutionlink.js.map +1 -0
  53. package/models/components/index.d.ts +3 -0
  54. package/models/components/index.d.ts.map +1 -1
  55. package/models/components/index.js +3 -0
  56. package/models/components/index.js.map +1 -1
  57. package/models/components/resolutionlink.d.ts +63 -0
  58. package/models/components/resolutionlink.d.ts.map +1 -0
  59. package/models/components/resolutionlink.js +75 -0
  60. package/models/components/resolutionlink.js.map +1 -0
  61. package/models/components/resolutionlinkrecipient.d.ts +29 -0
  62. package/models/components/resolutionlinkrecipient.d.ts.map +1 -0
  63. package/models/components/resolutionlinkrecipient.js +61 -0
  64. package/models/components/resolutionlinkrecipient.js.map +1 -0
  65. package/models/errors/createresolutionlinkerror.d.ts +45 -0
  66. package/models/errors/createresolutionlinkerror.d.ts.map +1 -0
  67. package/models/errors/createresolutionlinkerror.js +82 -0
  68. package/models/errors/createresolutionlinkerror.js.map +1 -0
  69. package/models/errors/index.d.ts +1 -0
  70. package/models/errors/index.d.ts.map +1 -1
  71. package/models/errors/index.js +1 -0
  72. package/models/errors/index.js.map +1 -1
  73. package/models/operations/createresolutionlink.d.ts +66 -0
  74. package/models/operations/createresolutionlink.d.ts.map +1 -0
  75. package/models/operations/createresolutionlink.js +122 -0
  76. package/models/operations/createresolutionlink.js.map +1 -0
  77. package/models/operations/disableresolutionlink.d.ts +63 -0
  78. package/models/operations/disableresolutionlink.d.ts.map +1 -0
  79. package/models/operations/disableresolutionlink.js +109 -0
  80. package/models/operations/disableresolutionlink.js.map +1 -0
  81. package/models/operations/getresolutionlink.d.ts +66 -0
  82. package/models/operations/getresolutionlink.d.ts.map +1 -0
  83. package/models/operations/getresolutionlink.js +114 -0
  84. package/models/operations/getresolutionlink.js.map +1 -0
  85. package/models/operations/index.d.ts +4 -0
  86. package/models/operations/index.d.ts.map +1 -1
  87. package/models/operations/index.js +4 -0
  88. package/models/operations/index.js.map +1 -1
  89. package/models/operations/listresolutionlinks.d.ts +64 -0
  90. package/models/operations/listresolutionlinks.d.ts.map +1 -0
  91. package/models/operations/listresolutionlinks.js +112 -0
  92. package/models/operations/listresolutionlinks.js.map +1 -0
  93. package/package.json +1 -1
  94. package/sdk/resolutionlinks.d.ts +35 -0
  95. package/sdk/resolutionlinks.d.ts.map +1 -0
  96. package/sdk/resolutionlinks.js +54 -0
  97. package/sdk/resolutionlinks.js.map +1 -0
  98. package/sdk/sdk.d.ts +3 -0
  99. package/sdk/sdk.d.ts.map +1 -1
  100. package/sdk/sdk.js +4 -0
  101. package/sdk/sdk.js.map +1 -1
  102. package/src/funcs/resolutionLinksCreate.ts +208 -0
  103. package/src/funcs/resolutionLinksDisable.ts +204 -0
  104. package/src/funcs/resolutionLinksGet.ts +186 -0
  105. package/src/funcs/resolutionLinksList.ts +180 -0
  106. package/src/hooks/moov-version-hook.ts +10 -6
  107. package/src/hooks/registration.ts +1 -1
  108. package/src/lib/config.ts +3 -3
  109. package/src/mcp-server/mcp-server.ts +1 -1
  110. package/src/mcp-server/server.ts +9 -1
  111. package/src/mcp-server/tools/resolutionLinksCreate.ts +41 -0
  112. package/src/mcp-server/tools/resolutionLinksDisable.ts +37 -0
  113. package/src/mcp-server/tools/resolutionLinksGet.ts +38 -0
  114. package/src/mcp-server/tools/resolutionLinksList.ts +38 -0
  115. package/src/models/components/createresolutionlink.ts +63 -0
  116. package/src/models/components/index.ts +3 -0
  117. package/src/models/components/resolutionlink.ts +110 -0
  118. package/src/models/components/resolutionlinkrecipient.ts +70 -0
  119. package/src/models/errors/createresolutionlinkerror.ts +90 -0
  120. package/src/models/errors/index.ts +1 -0
  121. package/src/models/operations/createresolutionlink.ts +193 -0
  122. package/src/models/operations/disableresolutionlink.ts +178 -0
  123. package/src/models/operations/getresolutionlink.ts +179 -0
  124. package/src/models/operations/index.ts +4 -0
  125. package/src/models/operations/listresolutionlinks.ts +177 -0
  126. package/src/sdk/resolutionlinks.ts +83 -0
  127. package/src/sdk/sdk.ts +6 -0
@@ -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
+ }
@@ -0,0 +1,186 @@
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 { MoovError } from "../models/errors/mooverror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Get a resolution link by code.
29
+ *
30
+ * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
31
+ * you'll need to specify the `/accounts/{accountID}/profile.read` scope.
32
+ */
33
+ export function resolutionLinksGet(
34
+ client: MoovCore,
35
+ request: operations.GetResolutionLinkRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GetResolutionLinkResponse,
40
+ | MoovError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: MoovCore,
59
+ request: operations.GetResolutionLinkRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GetResolutionLinkResponse,
65
+ | MoovError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) => operations.GetResolutionLinkRequest$outboundSchema.parse(value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = null;
87
+
88
+ const pathParams = {
89
+ accountID: encodeSimple("accountID", payload.accountID, {
90
+ explode: false,
91
+ charEncoding: "percent",
92
+ }),
93
+ resolutionLinkCode: encodeSimple(
94
+ "resolutionLinkCode",
95
+ payload.resolutionLinkCode,
96
+ { explode: false, charEncoding: "percent" },
97
+ ),
98
+ };
99
+
100
+ const path = pathToFunc(
101
+ "/accounts/{accountID}/resolution-links/{resolutionLinkCode}",
102
+ )(pathParams);
103
+
104
+ const headers = new Headers(compactMap({
105
+ Accept: "application/json",
106
+ "X-Moov-Version": encodeSimple(
107
+ "X-Moov-Version",
108
+ client._options.xMoovVersion,
109
+ { explode: false, charEncoding: "none" },
110
+ ),
111
+ }));
112
+
113
+ const securityInput = await extractSecurity(client._options.security);
114
+ const requestSecurity = resolveGlobalSecurity(securityInput);
115
+
116
+ const context = {
117
+ options: client._options,
118
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
119
+ operationID: "getResolutionLink",
120
+ oAuth2Scopes: null,
121
+
122
+ resolvedSecurity: requestSecurity,
123
+
124
+ securitySource: client._options.security,
125
+ retryConfig: options?.retries
126
+ || client._options.retryConfig
127
+ || { strategy: "none" },
128
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
129
+ };
130
+
131
+ const requestRes = client._createRequest(context, {
132
+ security: requestSecurity,
133
+ method: "GET",
134
+ baseURL: options?.serverURL,
135
+ path: path,
136
+ headers: headers,
137
+ body: body,
138
+ userAgent: client._options.userAgent,
139
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
140
+ }, options);
141
+ if (!requestRes.ok) {
142
+ return [requestRes, { status: "invalid" }];
143
+ }
144
+ const req = requestRes.value;
145
+
146
+ const doResult = await client._do(req, {
147
+ context,
148
+ errorCodes: ["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
149
+ retryConfig: context.retryConfig,
150
+ retryCodes: context.retryCodes,
151
+ });
152
+ if (!doResult.ok) {
153
+ return [doResult, { status: "request-error", request: req }];
154
+ }
155
+ const response = doResult.value;
156
+
157
+ const responseFields = {
158
+ HttpMeta: { Response: response, Request: req },
159
+ };
160
+
161
+ const [result] = await M.match<
162
+ operations.GetResolutionLinkResponse,
163
+ | MoovError
164
+ | ResponseValidationError
165
+ | ConnectionError
166
+ | RequestAbortedError
167
+ | RequestTimeoutError
168
+ | InvalidRequestError
169
+ | UnexpectedClientError
170
+ | SDKValidationError
171
+ >(
172
+ M.json(200, operations.GetResolutionLinkResponse$inboundSchema, {
173
+ hdrs: true,
174
+ key: "Result",
175
+ }),
176
+ M.fail([401, 403, 404, 429]),
177
+ M.fail([500, 504]),
178
+ M.fail("4XX"),
179
+ M.fail("5XX"),
180
+ )(response, req, { extraFields: responseFields });
181
+ if (!result.ok) {
182
+ return [result, { status: "complete", request: req, response }];
183
+ }
184
+
185
+ return [result, { status: "complete", request: req, response }];
186
+ }