@gr4vy/sdk 0.18.13 → 0.18.14
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.
- package/README.md +11 -0
- package/bin/mcp-server.js +1776 -630
- package/bin/mcp-server.js.map +29 -9
- package/docs/sdks/merchantaccounts/README.md +454 -0
- package/funcs/merchantAccountsCreate.d.ts +17 -0
- package/funcs/merchantAccountsCreate.d.ts.map +1 -0
- package/funcs/merchantAccountsCreate.js +133 -0
- package/funcs/merchantAccountsCreate.js.map +1 -0
- package/funcs/merchantAccountsGet.d.ts +17 -0
- package/funcs/merchantAccountsGet.d.ts.map +1 -0
- package/funcs/merchantAccountsGet.js +137 -0
- package/funcs/merchantAccountsGet.js.map +1 -0
- package/funcs/merchantAccountsList.d.ts +20 -0
- package/funcs/merchantAccountsList.d.ts.map +1 -0
- package/funcs/merchantAccountsList.js +162 -0
- package/funcs/merchantAccountsList.js.map +1 -0
- package/funcs/merchantAccountsUpdate.d.ts +17 -0
- package/funcs/merchantAccountsUpdate.d.ts.map +1 -0
- package/funcs/merchantAccountsUpdate.js +137 -0
- package/funcs/merchantAccountsUpdate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/lib/config.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +9 -1
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools/merchantAccountsCreate.d.ts +10 -0
- package/mcp-server/tools/merchantAccountsCreate.d.ts.map +1 -0
- package/mcp-server/tools/merchantAccountsCreate.js +56 -0
- package/mcp-server/tools/merchantAccountsCreate.js.map +1 -0
- package/mcp-server/tools/merchantAccountsGet.d.ts +8 -0
- package/mcp-server/tools/merchantAccountsGet.d.ts.map +1 -0
- package/mcp-server/tools/merchantAccountsGet.js +54 -0
- package/mcp-server/tools/merchantAccountsGet.js.map +1 -0
- package/mcp-server/tools/merchantAccountsList.d.ts +10 -0
- package/mcp-server/tools/merchantAccountsList.d.ts.map +1 -0
- package/mcp-server/tools/merchantAccountsList.js +56 -0
- package/mcp-server/tools/merchantAccountsList.js.map +1 -0
- package/mcp-server/tools/merchantAccountsUpdate.d.ts +11 -0
- package/mcp-server/tools/merchantAccountsUpdate.d.ts.map +1 -0
- package/mcp-server/tools/merchantAccountsUpdate.js +57 -0
- package/mcp-server/tools/merchantAccountsUpdate.js.map +1 -0
- package/models/components/collectionmerchantaccount.d.ts +48 -0
- package/models/components/collectionmerchantaccount.d.ts.map +1 -0
- package/models/components/collectionmerchantaccount.js +77 -0
- package/models/components/collectionmerchantaccount.js.map +1 -0
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/merchantaccount.d.ts +148 -0
- package/models/components/merchantaccount.d.ts.map +1 -0
- package/models/components/merchantaccount.js +159 -0
- package/models/components/merchantaccount.js.map +1 -0
- package/models/components/merchantaccountcreate.d.ts +133 -0
- package/models/components/merchantaccountcreate.d.ts.map +1 -0
- package/models/components/merchantaccountcreate.js +149 -0
- package/models/components/merchantaccountcreate.js.map +1 -0
- package/models/components/merchantaccountupdate.d.ts +128 -0
- package/models/components/merchantaccountupdate.d.ts.map +1 -0
- package/models/components/merchantaccountupdate.js +147 -0
- package/models/components/merchantaccountupdate.js.map +1 -0
- package/models/errors/createmerchantaccount.d.ts +31 -0
- package/models/errors/createmerchantaccount.d.ts.map +1 -0
- package/models/errors/createmerchantaccount.js +66 -0
- package/models/errors/createmerchantaccount.js.map +1 -0
- package/models/errors/getmerchantaccount.d.ts +31 -0
- package/models/errors/getmerchantaccount.d.ts.map +1 -0
- package/models/errors/getmerchantaccount.js +66 -0
- package/models/errors/getmerchantaccount.js.map +1 -0
- package/models/errors/index.d.ts +4 -0
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +4 -0
- package/models/errors/index.js.map +1 -1
- package/models/errors/listmerchantaccounts.d.ts +31 -0
- package/models/errors/listmerchantaccounts.d.ts.map +1 -0
- package/models/errors/listmerchantaccounts.js +66 -0
- package/models/errors/listmerchantaccounts.js.map +1 -0
- package/models/errors/updatemerchantaccount.d.ts +31 -0
- package/models/errors/updatemerchantaccount.d.ts.map +1 -0
- package/models/errors/updatemerchantaccount.js +66 -0
- package/models/errors/updatemerchantaccount.js.map +1 -0
- package/models/operations/createmerchantaccount.d.ts +32 -0
- package/models/operations/createmerchantaccount.d.ts.map +1 -0
- package/models/operations/createmerchantaccount.js +73 -0
- package/models/operations/createmerchantaccount.js.map +1 -0
- package/models/operations/getmerchantaccount.d.ts +29 -0
- package/models/operations/getmerchantaccount.d.ts.map +1 -0
- package/models/operations/getmerchantaccount.js +68 -0
- package/models/operations/getmerchantaccount.js.map +1 -0
- package/models/operations/index.d.ts +4 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +4 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/listmerchantaccounts.d.ts +59 -0
- package/models/operations/listmerchantaccounts.d.ts.map +1 -0
- package/models/operations/listmerchantaccounts.js +100 -0
- package/models/operations/listmerchantaccounts.js.map +1 -0
- package/models/operations/updatemerchantaccount.d.ts +34 -0
- package/models/operations/updatemerchantaccount.d.ts.map +1 -0
- package/models/operations/updatemerchantaccount.js +77 -0
- package/models/operations/updatemerchantaccount.js.map +1 -0
- package/package.json +1 -1
- package/sdk/merchantaccounts.d.ts +37 -0
- package/sdk/merchantaccounts.d.ts.map +1 -0
- package/sdk/merchantaccounts.js +53 -0
- package/sdk/merchantaccounts.js.map +1 -0
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +4 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/merchantAccountsCreate.ts +243 -0
- package/src/funcs/merchantAccountsGet.ts +249 -0
- package/src/funcs/merchantAccountsList.ts +326 -0
- package/src/funcs/merchantAccountsUpdate.ts +257 -0
- package/src/lib/config.ts +4 -4
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +9 -1
- package/src/mcp-server/tools/merchantAccountsCreate.ts +40 -0
- package/src/mcp-server/tools/merchantAccountsGet.ts +37 -0
- package/src/mcp-server/tools/merchantAccountsList.ts +41 -0
- package/src/mcp-server/tools/merchantAccountsUpdate.ts +42 -0
- package/src/models/components/collectionmerchantaccount.ts +107 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/merchantaccount.ts +296 -0
- package/src/models/components/merchantaccountcreate.ts +273 -0
- package/src/models/components/merchantaccountupdate.ts +266 -0
- package/src/models/errors/createmerchantaccount.ts +107 -0
- package/src/models/errors/getmerchantaccount.ts +107 -0
- package/src/models/errors/index.ts +4 -0
- package/src/models/errors/listmerchantaccounts.ts +107 -0
- package/src/models/errors/updatemerchantaccount.ts +107 -0
- package/src/models/operations/createmerchantaccount.ts +84 -0
- package/src/models/operations/getmerchantaccount.ts +75 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/listmerchantaccounts.ts +146 -0
- package/src/models/operations/updatemerchantaccount.ts +90 -0
- package/src/sdk/merchantaccounts.ts +95 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Gr4vyCore } 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 * as components from "../models/components/index.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 { SDKError } from "../models/errors/sdkerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get a merchant account
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Get info about a merchant account in an instance.
|
|
33
|
+
*/
|
|
34
|
+
export function merchantAccountsGet(
|
|
35
|
+
client: Gr4vyCore,
|
|
36
|
+
merchantAccountId: string,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
components.MerchantAccount,
|
|
41
|
+
| errors.Error400
|
|
42
|
+
| errors.Error401
|
|
43
|
+
| errors.GetMerchantAccountResponse403GetMerchantAccount
|
|
44
|
+
| errors.Error404
|
|
45
|
+
| errors.Error405
|
|
46
|
+
| errors.Error409
|
|
47
|
+
| errors.HTTPValidationError
|
|
48
|
+
| errors.Error425
|
|
49
|
+
| errors.Error429
|
|
50
|
+
| errors.Error500
|
|
51
|
+
| errors.Error502
|
|
52
|
+
| errors.Error504
|
|
53
|
+
| SDKError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
| UnexpectedClientError
|
|
56
|
+
| InvalidRequestError
|
|
57
|
+
| RequestAbortedError
|
|
58
|
+
| RequestTimeoutError
|
|
59
|
+
| ConnectionError
|
|
60
|
+
>
|
|
61
|
+
> {
|
|
62
|
+
return new APIPromise($do(
|
|
63
|
+
client,
|
|
64
|
+
merchantAccountId,
|
|
65
|
+
options,
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function $do(
|
|
70
|
+
client: Gr4vyCore,
|
|
71
|
+
merchantAccountId: string,
|
|
72
|
+
options?: RequestOptions,
|
|
73
|
+
): Promise<
|
|
74
|
+
[
|
|
75
|
+
Result<
|
|
76
|
+
components.MerchantAccount,
|
|
77
|
+
| errors.Error400
|
|
78
|
+
| errors.Error401
|
|
79
|
+
| errors.GetMerchantAccountResponse403GetMerchantAccount
|
|
80
|
+
| errors.Error404
|
|
81
|
+
| errors.Error405
|
|
82
|
+
| errors.Error409
|
|
83
|
+
| errors.HTTPValidationError
|
|
84
|
+
| errors.Error425
|
|
85
|
+
| errors.Error429
|
|
86
|
+
| errors.Error500
|
|
87
|
+
| errors.Error502
|
|
88
|
+
| errors.Error504
|
|
89
|
+
| SDKError
|
|
90
|
+
| SDKValidationError
|
|
91
|
+
| UnexpectedClientError
|
|
92
|
+
| InvalidRequestError
|
|
93
|
+
| RequestAbortedError
|
|
94
|
+
| RequestTimeoutError
|
|
95
|
+
| ConnectionError
|
|
96
|
+
>,
|
|
97
|
+
APICall,
|
|
98
|
+
]
|
|
99
|
+
> {
|
|
100
|
+
const input: operations.GetMerchantAccountRequest = {
|
|
101
|
+
merchantAccountId: merchantAccountId,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const parsed = safeParse(
|
|
105
|
+
input,
|
|
106
|
+
(value) => operations.GetMerchantAccountRequest$outboundSchema.parse(value),
|
|
107
|
+
"Input validation failed",
|
|
108
|
+
);
|
|
109
|
+
if (!parsed.ok) {
|
|
110
|
+
return [parsed, { status: "invalid" }];
|
|
111
|
+
}
|
|
112
|
+
const payload = parsed.value;
|
|
113
|
+
const body = null;
|
|
114
|
+
|
|
115
|
+
const pathParams = {
|
|
116
|
+
merchant_account_id: encodeSimple(
|
|
117
|
+
"merchant_account_id",
|
|
118
|
+
payload.merchant_account_id,
|
|
119
|
+
{ explode: false, charEncoding: "percent" },
|
|
120
|
+
),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const path = pathToFunc("/merchant-accounts/{merchant_account_id}")(
|
|
124
|
+
pathParams,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const headers = new Headers(compactMap({
|
|
128
|
+
Accept: "application/json",
|
|
129
|
+
}));
|
|
130
|
+
|
|
131
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
132
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
133
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
134
|
+
|
|
135
|
+
const context = {
|
|
136
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
137
|
+
operationID: "get_merchant_account",
|
|
138
|
+
oAuth2Scopes: [],
|
|
139
|
+
|
|
140
|
+
resolvedSecurity: requestSecurity,
|
|
141
|
+
|
|
142
|
+
securitySource: client._options.bearerAuth,
|
|
143
|
+
retryConfig: options?.retries
|
|
144
|
+
|| client._options.retryConfig
|
|
145
|
+
|| {
|
|
146
|
+
strategy: "backoff",
|
|
147
|
+
backoff: {
|
|
148
|
+
initialInterval: 200,
|
|
149
|
+
maxInterval: 200,
|
|
150
|
+
exponent: 1,
|
|
151
|
+
maxElapsedTime: 1000,
|
|
152
|
+
},
|
|
153
|
+
retryConnectionErrors: true,
|
|
154
|
+
}
|
|
155
|
+
|| { strategy: "none" },
|
|
156
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const requestRes = client._createRequest(context, {
|
|
160
|
+
security: requestSecurity,
|
|
161
|
+
method: "GET",
|
|
162
|
+
baseURL: options?.serverURL,
|
|
163
|
+
path: path,
|
|
164
|
+
headers: headers,
|
|
165
|
+
body: body,
|
|
166
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
167
|
+
}, options);
|
|
168
|
+
if (!requestRes.ok) {
|
|
169
|
+
return [requestRes, { status: "invalid" }];
|
|
170
|
+
}
|
|
171
|
+
const req = requestRes.value;
|
|
172
|
+
|
|
173
|
+
const doResult = await client._do(req, {
|
|
174
|
+
context,
|
|
175
|
+
errorCodes: [
|
|
176
|
+
"400",
|
|
177
|
+
"401",
|
|
178
|
+
"403",
|
|
179
|
+
"404",
|
|
180
|
+
"405",
|
|
181
|
+
"409",
|
|
182
|
+
"422",
|
|
183
|
+
"425",
|
|
184
|
+
"429",
|
|
185
|
+
"4XX",
|
|
186
|
+
"500",
|
|
187
|
+
"502",
|
|
188
|
+
"504",
|
|
189
|
+
"5XX",
|
|
190
|
+
],
|
|
191
|
+
retryConfig: context.retryConfig,
|
|
192
|
+
retryCodes: context.retryCodes,
|
|
193
|
+
});
|
|
194
|
+
if (!doResult.ok) {
|
|
195
|
+
return [doResult, { status: "request-error", request: req }];
|
|
196
|
+
}
|
|
197
|
+
const response = doResult.value;
|
|
198
|
+
|
|
199
|
+
const responseFields = {
|
|
200
|
+
HttpMeta: { Response: response, Request: req },
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const [result] = await M.match<
|
|
204
|
+
components.MerchantAccount,
|
|
205
|
+
| errors.Error400
|
|
206
|
+
| errors.Error401
|
|
207
|
+
| errors.GetMerchantAccountResponse403GetMerchantAccount
|
|
208
|
+
| errors.Error404
|
|
209
|
+
| errors.Error405
|
|
210
|
+
| errors.Error409
|
|
211
|
+
| errors.HTTPValidationError
|
|
212
|
+
| errors.Error425
|
|
213
|
+
| errors.Error429
|
|
214
|
+
| errors.Error500
|
|
215
|
+
| errors.Error502
|
|
216
|
+
| errors.Error504
|
|
217
|
+
| SDKError
|
|
218
|
+
| SDKValidationError
|
|
219
|
+
| UnexpectedClientError
|
|
220
|
+
| InvalidRequestError
|
|
221
|
+
| RequestAbortedError
|
|
222
|
+
| RequestTimeoutError
|
|
223
|
+
| ConnectionError
|
|
224
|
+
>(
|
|
225
|
+
M.json(200, components.MerchantAccount$inboundSchema),
|
|
226
|
+
M.jsonErr(400, errors.Error400$inboundSchema),
|
|
227
|
+
M.jsonErr(401, errors.Error401$inboundSchema),
|
|
228
|
+
M.jsonErr(
|
|
229
|
+
403,
|
|
230
|
+
errors.GetMerchantAccountResponse403GetMerchantAccount$inboundSchema,
|
|
231
|
+
),
|
|
232
|
+
M.jsonErr(404, errors.Error404$inboundSchema),
|
|
233
|
+
M.jsonErr(405, errors.Error405$inboundSchema),
|
|
234
|
+
M.jsonErr(409, errors.Error409$inboundSchema),
|
|
235
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
236
|
+
M.jsonErr(425, errors.Error425$inboundSchema),
|
|
237
|
+
M.jsonErr(429, errors.Error429$inboundSchema),
|
|
238
|
+
M.jsonErr(500, errors.Error500$inboundSchema),
|
|
239
|
+
M.jsonErr(502, errors.Error502$inboundSchema),
|
|
240
|
+
M.jsonErr(504, errors.Error504$inboundSchema),
|
|
241
|
+
M.fail("4XX"),
|
|
242
|
+
M.fail("5XX"),
|
|
243
|
+
)(response, { extraFields: responseFields });
|
|
244
|
+
if (!result.ok) {
|
|
245
|
+
return [result, { status: "complete", request: req, response }];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return [result, { status: "complete", request: req, response }];
|
|
249
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Gr4vyCore } from "../core.js";
|
|
6
|
+
import { dlv } from "../lib/dlv.js";
|
|
7
|
+
import { encodeFormQuery } from "../lib/encodings.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 { SDKError } from "../models/errors/sdkerror.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
|
+
import {
|
|
28
|
+
createPageIterator,
|
|
29
|
+
haltIterator,
|
|
30
|
+
PageIterator,
|
|
31
|
+
Paginator,
|
|
32
|
+
} from "../types/operations.js";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* List all merchant accounts
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* List all merchant accounts in an instance.
|
|
39
|
+
*/
|
|
40
|
+
export function merchantAccountsList(
|
|
41
|
+
client: Gr4vyCore,
|
|
42
|
+
cursor?: string | null | undefined,
|
|
43
|
+
limit?: number | undefined,
|
|
44
|
+
search?: string | null | undefined,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
PageIterator<
|
|
48
|
+
Result<
|
|
49
|
+
operations.ListMerchantAccountsResponse,
|
|
50
|
+
| errors.Error400
|
|
51
|
+
| errors.Error401
|
|
52
|
+
| errors.ListMerchantAccountsResponse403ListMerchantAccounts
|
|
53
|
+
| errors.Error404
|
|
54
|
+
| errors.Error405
|
|
55
|
+
| errors.Error409
|
|
56
|
+
| errors.HTTPValidationError
|
|
57
|
+
| errors.Error425
|
|
58
|
+
| errors.Error429
|
|
59
|
+
| errors.Error500
|
|
60
|
+
| errors.Error502
|
|
61
|
+
| errors.Error504
|
|
62
|
+
| SDKError
|
|
63
|
+
| SDKValidationError
|
|
64
|
+
| UnexpectedClientError
|
|
65
|
+
| InvalidRequestError
|
|
66
|
+
| RequestAbortedError
|
|
67
|
+
| RequestTimeoutError
|
|
68
|
+
| ConnectionError
|
|
69
|
+
>,
|
|
70
|
+
{ cursor: string }
|
|
71
|
+
>
|
|
72
|
+
> {
|
|
73
|
+
return new APIPromise($do(
|
|
74
|
+
client,
|
|
75
|
+
cursor,
|
|
76
|
+
limit,
|
|
77
|
+
search,
|
|
78
|
+
options,
|
|
79
|
+
));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function $do(
|
|
83
|
+
client: Gr4vyCore,
|
|
84
|
+
cursor?: string | null | undefined,
|
|
85
|
+
limit?: number | undefined,
|
|
86
|
+
search?: string | null | undefined,
|
|
87
|
+
options?: RequestOptions,
|
|
88
|
+
): Promise<
|
|
89
|
+
[
|
|
90
|
+
PageIterator<
|
|
91
|
+
Result<
|
|
92
|
+
operations.ListMerchantAccountsResponse,
|
|
93
|
+
| errors.Error400
|
|
94
|
+
| errors.Error401
|
|
95
|
+
| errors.ListMerchantAccountsResponse403ListMerchantAccounts
|
|
96
|
+
| errors.Error404
|
|
97
|
+
| errors.Error405
|
|
98
|
+
| errors.Error409
|
|
99
|
+
| errors.HTTPValidationError
|
|
100
|
+
| errors.Error425
|
|
101
|
+
| errors.Error429
|
|
102
|
+
| errors.Error500
|
|
103
|
+
| errors.Error502
|
|
104
|
+
| errors.Error504
|
|
105
|
+
| SDKError
|
|
106
|
+
| SDKValidationError
|
|
107
|
+
| UnexpectedClientError
|
|
108
|
+
| InvalidRequestError
|
|
109
|
+
| RequestAbortedError
|
|
110
|
+
| RequestTimeoutError
|
|
111
|
+
| ConnectionError
|
|
112
|
+
>,
|
|
113
|
+
{ cursor: string }
|
|
114
|
+
>,
|
|
115
|
+
APICall,
|
|
116
|
+
]
|
|
117
|
+
> {
|
|
118
|
+
const input: operations.ListMerchantAccountsRequest | undefined = {
|
|
119
|
+
cursor: cursor,
|
|
120
|
+
limit: limit,
|
|
121
|
+
search: search,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const parsed = safeParse(
|
|
125
|
+
input,
|
|
126
|
+
(value) =>
|
|
127
|
+
operations.ListMerchantAccountsRequest$outboundSchema.optional().parse(
|
|
128
|
+
value,
|
|
129
|
+
),
|
|
130
|
+
"Input validation failed",
|
|
131
|
+
);
|
|
132
|
+
if (!parsed.ok) {
|
|
133
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
134
|
+
}
|
|
135
|
+
const payload = parsed.value;
|
|
136
|
+
const body = null;
|
|
137
|
+
|
|
138
|
+
const path = pathToFunc("/merchant-accounts")();
|
|
139
|
+
|
|
140
|
+
const query = encodeFormQuery({
|
|
141
|
+
"cursor": payload?.cursor,
|
|
142
|
+
"limit": payload?.limit,
|
|
143
|
+
"search": payload?.search,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const headers = new Headers(compactMap({
|
|
147
|
+
Accept: "application/json",
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
151
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
152
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
153
|
+
|
|
154
|
+
const context = {
|
|
155
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
156
|
+
operationID: "list_merchant_accounts",
|
|
157
|
+
oAuth2Scopes: [],
|
|
158
|
+
|
|
159
|
+
resolvedSecurity: requestSecurity,
|
|
160
|
+
|
|
161
|
+
securitySource: client._options.bearerAuth,
|
|
162
|
+
retryConfig: options?.retries
|
|
163
|
+
|| client._options.retryConfig
|
|
164
|
+
|| {
|
|
165
|
+
strategy: "backoff",
|
|
166
|
+
backoff: {
|
|
167
|
+
initialInterval: 200,
|
|
168
|
+
maxInterval: 200,
|
|
169
|
+
exponent: 1,
|
|
170
|
+
maxElapsedTime: 1000,
|
|
171
|
+
},
|
|
172
|
+
retryConnectionErrors: true,
|
|
173
|
+
}
|
|
174
|
+
|| { strategy: "none" },
|
|
175
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const requestRes = client._createRequest(context, {
|
|
179
|
+
security: requestSecurity,
|
|
180
|
+
method: "GET",
|
|
181
|
+
baseURL: options?.serverURL,
|
|
182
|
+
path: path,
|
|
183
|
+
headers: headers,
|
|
184
|
+
query: query,
|
|
185
|
+
body: body,
|
|
186
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
187
|
+
}, options);
|
|
188
|
+
if (!requestRes.ok) {
|
|
189
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
190
|
+
}
|
|
191
|
+
const req = requestRes.value;
|
|
192
|
+
|
|
193
|
+
const doResult = await client._do(req, {
|
|
194
|
+
context,
|
|
195
|
+
errorCodes: [
|
|
196
|
+
"400",
|
|
197
|
+
"401",
|
|
198
|
+
"403",
|
|
199
|
+
"404",
|
|
200
|
+
"405",
|
|
201
|
+
"409",
|
|
202
|
+
"422",
|
|
203
|
+
"425",
|
|
204
|
+
"429",
|
|
205
|
+
"4XX",
|
|
206
|
+
"500",
|
|
207
|
+
"502",
|
|
208
|
+
"504",
|
|
209
|
+
"5XX",
|
|
210
|
+
],
|
|
211
|
+
retryConfig: context.retryConfig,
|
|
212
|
+
retryCodes: context.retryCodes,
|
|
213
|
+
});
|
|
214
|
+
if (!doResult.ok) {
|
|
215
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
216
|
+
}
|
|
217
|
+
const response = doResult.value;
|
|
218
|
+
|
|
219
|
+
const responseFields = {
|
|
220
|
+
HttpMeta: { Response: response, Request: req },
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const [result, raw] = await M.match<
|
|
224
|
+
operations.ListMerchantAccountsResponse,
|
|
225
|
+
| errors.Error400
|
|
226
|
+
| errors.Error401
|
|
227
|
+
| errors.ListMerchantAccountsResponse403ListMerchantAccounts
|
|
228
|
+
| errors.Error404
|
|
229
|
+
| errors.Error405
|
|
230
|
+
| errors.Error409
|
|
231
|
+
| errors.HTTPValidationError
|
|
232
|
+
| errors.Error425
|
|
233
|
+
| errors.Error429
|
|
234
|
+
| errors.Error500
|
|
235
|
+
| errors.Error502
|
|
236
|
+
| errors.Error504
|
|
237
|
+
| SDKError
|
|
238
|
+
| SDKValidationError
|
|
239
|
+
| UnexpectedClientError
|
|
240
|
+
| InvalidRequestError
|
|
241
|
+
| RequestAbortedError
|
|
242
|
+
| RequestTimeoutError
|
|
243
|
+
| ConnectionError
|
|
244
|
+
>(
|
|
245
|
+
M.json(200, operations.ListMerchantAccountsResponse$inboundSchema, {
|
|
246
|
+
key: "Result",
|
|
247
|
+
}),
|
|
248
|
+
M.jsonErr(400, errors.Error400$inboundSchema),
|
|
249
|
+
M.jsonErr(401, errors.Error401$inboundSchema),
|
|
250
|
+
M.jsonErr(
|
|
251
|
+
403,
|
|
252
|
+
errors.ListMerchantAccountsResponse403ListMerchantAccounts$inboundSchema,
|
|
253
|
+
),
|
|
254
|
+
M.jsonErr(404, errors.Error404$inboundSchema),
|
|
255
|
+
M.jsonErr(405, errors.Error405$inboundSchema),
|
|
256
|
+
M.jsonErr(409, errors.Error409$inboundSchema),
|
|
257
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
258
|
+
M.jsonErr(425, errors.Error425$inboundSchema),
|
|
259
|
+
M.jsonErr(429, errors.Error429$inboundSchema),
|
|
260
|
+
M.jsonErr(500, errors.Error500$inboundSchema),
|
|
261
|
+
M.jsonErr(502, errors.Error502$inboundSchema),
|
|
262
|
+
M.jsonErr(504, errors.Error504$inboundSchema),
|
|
263
|
+
M.fail("4XX"),
|
|
264
|
+
M.fail("5XX"),
|
|
265
|
+
)(response, { extraFields: responseFields });
|
|
266
|
+
if (!result.ok) {
|
|
267
|
+
return [haltIterator(result), {
|
|
268
|
+
status: "complete",
|
|
269
|
+
request: req,
|
|
270
|
+
response,
|
|
271
|
+
}];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const nextFunc = (
|
|
275
|
+
responseData: unknown,
|
|
276
|
+
): {
|
|
277
|
+
next: Paginator<
|
|
278
|
+
Result<
|
|
279
|
+
operations.ListMerchantAccountsResponse,
|
|
280
|
+
| errors.Error400
|
|
281
|
+
| errors.Error401
|
|
282
|
+
| errors.ListMerchantAccountsResponse403ListMerchantAccounts
|
|
283
|
+
| errors.Error404
|
|
284
|
+
| errors.Error405
|
|
285
|
+
| errors.Error409
|
|
286
|
+
| errors.HTTPValidationError
|
|
287
|
+
| errors.Error425
|
|
288
|
+
| errors.Error429
|
|
289
|
+
| errors.Error500
|
|
290
|
+
| errors.Error502
|
|
291
|
+
| errors.Error504
|
|
292
|
+
| SDKError
|
|
293
|
+
| SDKValidationError
|
|
294
|
+
| UnexpectedClientError
|
|
295
|
+
| InvalidRequestError
|
|
296
|
+
| RequestAbortedError
|
|
297
|
+
| RequestTimeoutError
|
|
298
|
+
| ConnectionError
|
|
299
|
+
>
|
|
300
|
+
>;
|
|
301
|
+
"~next"?: { cursor: string };
|
|
302
|
+
} => {
|
|
303
|
+
const nextCursor = dlv(responseData, "next_cursor");
|
|
304
|
+
if (typeof nextCursor !== "string") {
|
|
305
|
+
return { next: () => null };
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const nextVal = () =>
|
|
309
|
+
merchantAccountsList(
|
|
310
|
+
client,
|
|
311
|
+
nextCursor,
|
|
312
|
+
limit,
|
|
313
|
+
search,
|
|
314
|
+
options,
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
return { next: nextVal, "~next": { cursor: nextCursor } };
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
321
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
322
|
+
status: "complete",
|
|
323
|
+
request: req,
|
|
324
|
+
response,
|
|
325
|
+
}];
|
|
326
|
+
}
|