@gr4vy/sdk 1.9.11 → 1.9.13
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/examples/package-lock.json +1 -1
- package/funcs/threeDsScenariosCreate.d.ts +18 -0
- package/funcs/threeDsScenariosCreate.d.ts.map +1 -0
- package/funcs/threeDsScenariosCreate.js +141 -0
- package/funcs/threeDsScenariosCreate.js.map +1 -0
- package/funcs/threeDsScenariosDelete.d.ts +17 -0
- package/funcs/threeDsScenariosDelete.d.ts.map +1 -0
- package/funcs/threeDsScenariosDelete.js +141 -0
- package/funcs/threeDsScenariosDelete.js.map +1 -0
- package/funcs/threeDsScenariosList.d.ts +21 -0
- package/funcs/threeDsScenariosList.d.ts.map +1 -0
- package/funcs/threeDsScenariosList.js +177 -0
- package/funcs/threeDsScenariosList.js.map +1 -0
- package/funcs/threeDsScenariosUpdate.d.ts +18 -0
- package/funcs/threeDsScenariosUpdate.d.ts.map +1 -0
- package/funcs/threeDsScenariosUpdate.js +145 -0
- package/funcs/threeDsScenariosUpdate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/index.d.ts +8 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +8 -0
- package/models/components/index.js.map +1 -1
- package/models/components/threedsecurescenario.d.ts +33 -0
- package/models/components/threedsecurescenario.d.ts.map +1 -0
- package/models/components/threedsecurescenario.js +65 -0
- package/models/components/threedsecurescenario.js.map +1 -0
- package/models/components/threedsecurescenarioconditions.d.ts +45 -0
- package/models/components/threedsecurescenarioconditions.d.ts.map +1 -0
- package/models/components/threedsecurescenarioconditions.js +85 -0
- package/models/components/threedsecurescenarioconditions.js.map +1 -0
- package/models/components/threedsecurescenariocreate.d.ts +16 -0
- package/models/components/threedsecurescenariocreate.d.ts.map +1 -0
- package/models/components/threedsecurescenariocreate.js +52 -0
- package/models/components/threedsecurescenariocreate.js.map +1 -0
- package/models/components/threedsecurescenariooutcome.d.ts +29 -0
- package/models/components/threedsecurescenariooutcome.d.ts.map +1 -0
- package/models/components/threedsecurescenariooutcome.js +66 -0
- package/models/components/threedsecurescenariooutcome.js.map +1 -0
- package/models/components/threedsecurescenariooutcomeauthentication.d.ts +41 -0
- package/models/components/threedsecurescenariooutcomeauthentication.d.ts.map +1 -0
- package/models/components/threedsecurescenariooutcomeauthentication.js +84 -0
- package/models/components/threedsecurescenariooutcomeauthentication.js.map +1 -0
- package/models/components/threedsecurescenariooutcomeresult.d.ts +37 -0
- package/models/components/threedsecurescenariooutcomeresult.d.ts.map +1 -0
- package/models/components/threedsecurescenariooutcomeresult.js +80 -0
- package/models/components/threedsecurescenariooutcomeresult.js.map +1 -0
- package/models/components/threedsecurescenarios.d.ts +26 -0
- package/models/components/threedsecurescenarios.d.ts.map +1 -0
- package/models/components/threedsecurescenarios.js +60 -0
- package/models/components/threedsecurescenarios.js.map +1 -0
- package/models/components/threedsecurescenarioupdate.d.ts +22 -0
- package/models/components/threedsecurescenarioupdate.d.ts.map +1 -0
- package/models/components/threedsecurescenarioupdate.js +53 -0
- package/models/components/threedsecurescenarioupdate.js.map +1 -0
- package/models/operations/createthreedsscenario.d.ts +21 -0
- package/models/operations/createthreedsscenario.d.ts.map +1 -0
- package/models/operations/createthreedsscenario.js +56 -0
- package/models/operations/createthreedsscenario.js.map +1 -0
- package/models/operations/deletethreedsscenario.d.ts +23 -0
- package/models/operations/deletethreedsscenario.d.ts.map +1 -0
- package/models/operations/deletethreedsscenario.js +55 -0
- package/models/operations/deletethreedsscenario.js.map +1 -0
- package/models/operations/getthreedsscenario.d.ts +37 -0
- package/models/operations/getthreedsscenario.d.ts.map +1 -0
- package/models/operations/getthreedsscenario.js +66 -0
- package/models/operations/getthreedsscenario.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/updatethreedsscenario.d.ts +26 -0
- package/models/operations/updatethreedsscenario.d.ts.map +1 -0
- package/models/operations/updatethreedsscenario.js +58 -0
- package/models/operations/updatethreedsscenario.js.map +1 -0
- package/package.json +1 -1
- 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/sdk/threedsscenarios.d.ts +37 -0
- package/sdk/threedsscenarios.d.ts.map +1 -0
- package/sdk/threedsscenarios.js +53 -0
- package/sdk/threedsscenarios.js.map +1 -0
- package/src/funcs/threeDsScenariosCreate.ts +245 -0
- package/src/funcs/threeDsScenariosDelete.ts +252 -0
- package/src/funcs/threeDsScenariosList.ts +337 -0
- package/src/funcs/threeDsScenariosUpdate.ts +259 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/index.ts +8 -0
- package/src/models/components/threedsecurescenario.ts +73 -0
- package/src/models/components/threedsecurescenarioconditions.ts +108 -0
- package/src/models/components/threedsecurescenariocreate.ts +44 -0
- package/src/models/components/threedsecurescenariooutcome.ts +81 -0
- package/src/models/components/threedsecurescenariooutcomeauthentication.ts +114 -0
- package/src/models/components/threedsecurescenariooutcomeresult.ts +103 -0
- package/src/models/components/threedsecurescenarios.ts +59 -0
- package/src/models/components/threedsecurescenarioupdate.ts +51 -0
- package/src/models/operations/createthreedsscenario.ts +50 -0
- package/src/models/operations/deletethreedsscenario.ts +51 -0
- package/src/models/operations/getthreedsscenario.ts +82 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/updatethreedsscenario.ts +57 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/sdk/threedsscenarios.ts +97 -0
|
@@ -0,0 +1,337 @@
|
|
|
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, encodeSimple } 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 { Gr4vyError } from "../models/errors/gr4vyerror.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 { 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
|
+
import {
|
|
29
|
+
createPageIterator,
|
|
30
|
+
haltIterator,
|
|
31
|
+
PageIterator,
|
|
32
|
+
Paginator,
|
|
33
|
+
} from "../types/operations.js";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* List 3DS scenario
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* List all 3DS scenarios for a merchant account. Only available in sandbox environments.
|
|
40
|
+
*/
|
|
41
|
+
export function threeDsScenariosList(
|
|
42
|
+
client: Gr4vyCore,
|
|
43
|
+
cursor?: string | null | undefined,
|
|
44
|
+
limit?: number | undefined,
|
|
45
|
+
merchantAccountId?: string | null | undefined,
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): APIPromise<
|
|
48
|
+
PageIterator<
|
|
49
|
+
Result<
|
|
50
|
+
operations.GetThreeDsScenarioResponse,
|
|
51
|
+
| errors.Error400
|
|
52
|
+
| errors.Error401
|
|
53
|
+
| errors.Error403
|
|
54
|
+
| errors.Error404
|
|
55
|
+
| errors.Error405
|
|
56
|
+
| errors.Error409
|
|
57
|
+
| errors.HTTPValidationError
|
|
58
|
+
| errors.Error425
|
|
59
|
+
| errors.Error429
|
|
60
|
+
| errors.Error500
|
|
61
|
+
| errors.Error502
|
|
62
|
+
| errors.Error504
|
|
63
|
+
| Gr4vyError
|
|
64
|
+
| ResponseValidationError
|
|
65
|
+
| ConnectionError
|
|
66
|
+
| RequestAbortedError
|
|
67
|
+
| RequestTimeoutError
|
|
68
|
+
| InvalidRequestError
|
|
69
|
+
| UnexpectedClientError
|
|
70
|
+
| SDKValidationError
|
|
71
|
+
>,
|
|
72
|
+
{ cursor: string }
|
|
73
|
+
>
|
|
74
|
+
> {
|
|
75
|
+
return new APIPromise($do(
|
|
76
|
+
client,
|
|
77
|
+
cursor,
|
|
78
|
+
limit,
|
|
79
|
+
merchantAccountId,
|
|
80
|
+
options,
|
|
81
|
+
));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function $do(
|
|
85
|
+
client: Gr4vyCore,
|
|
86
|
+
cursor?: string | null | undefined,
|
|
87
|
+
limit?: number | undefined,
|
|
88
|
+
merchantAccountId?: string | null | undefined,
|
|
89
|
+
options?: RequestOptions,
|
|
90
|
+
): Promise<
|
|
91
|
+
[
|
|
92
|
+
PageIterator<
|
|
93
|
+
Result<
|
|
94
|
+
operations.GetThreeDsScenarioResponse,
|
|
95
|
+
| errors.Error400
|
|
96
|
+
| errors.Error401
|
|
97
|
+
| errors.Error403
|
|
98
|
+
| errors.Error404
|
|
99
|
+
| errors.Error405
|
|
100
|
+
| errors.Error409
|
|
101
|
+
| errors.HTTPValidationError
|
|
102
|
+
| errors.Error425
|
|
103
|
+
| errors.Error429
|
|
104
|
+
| errors.Error500
|
|
105
|
+
| errors.Error502
|
|
106
|
+
| errors.Error504
|
|
107
|
+
| Gr4vyError
|
|
108
|
+
| ResponseValidationError
|
|
109
|
+
| ConnectionError
|
|
110
|
+
| RequestAbortedError
|
|
111
|
+
| RequestTimeoutError
|
|
112
|
+
| InvalidRequestError
|
|
113
|
+
| UnexpectedClientError
|
|
114
|
+
| SDKValidationError
|
|
115
|
+
>,
|
|
116
|
+
{ cursor: string }
|
|
117
|
+
>,
|
|
118
|
+
APICall,
|
|
119
|
+
]
|
|
120
|
+
> {
|
|
121
|
+
const input: operations.GetThreeDsScenarioRequest | undefined = {
|
|
122
|
+
cursor: cursor,
|
|
123
|
+
limit: limit,
|
|
124
|
+
merchantAccountId: merchantAccountId,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const parsed = safeParse(
|
|
128
|
+
input,
|
|
129
|
+
(value) =>
|
|
130
|
+
operations.GetThreeDsScenarioRequest$outboundSchema.optional().parse(
|
|
131
|
+
value,
|
|
132
|
+
),
|
|
133
|
+
"Input validation failed",
|
|
134
|
+
);
|
|
135
|
+
if (!parsed.ok) {
|
|
136
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
137
|
+
}
|
|
138
|
+
const payload = parsed.value;
|
|
139
|
+
const body = null;
|
|
140
|
+
|
|
141
|
+
const path = pathToFunc("/three-ds-scenarios")();
|
|
142
|
+
|
|
143
|
+
const query = encodeFormQuery({
|
|
144
|
+
"cursor": payload?.cursor,
|
|
145
|
+
"limit": payload?.limit,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const headers = new Headers(compactMap({
|
|
149
|
+
Accept: "application/json",
|
|
150
|
+
"x-gr4vy-merchant-account-id": encodeSimple(
|
|
151
|
+
"x-gr4vy-merchant-account-id",
|
|
152
|
+
payload?.merchantAccountId ?? client._options.merchantAccountId,
|
|
153
|
+
{ explode: false, charEncoding: "none" },
|
|
154
|
+
),
|
|
155
|
+
}));
|
|
156
|
+
|
|
157
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
158
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
159
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
160
|
+
|
|
161
|
+
const context = {
|
|
162
|
+
options: client._options,
|
|
163
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
164
|
+
operationID: "get_three_ds_scenario",
|
|
165
|
+
oAuth2Scopes: null,
|
|
166
|
+
|
|
167
|
+
resolvedSecurity: requestSecurity,
|
|
168
|
+
|
|
169
|
+
securitySource: client._options.bearerAuth,
|
|
170
|
+
retryConfig: options?.retries
|
|
171
|
+
|| client._options.retryConfig
|
|
172
|
+
|| {
|
|
173
|
+
strategy: "backoff",
|
|
174
|
+
backoff: {
|
|
175
|
+
initialInterval: 200,
|
|
176
|
+
maxInterval: 200,
|
|
177
|
+
exponent: 1,
|
|
178
|
+
maxElapsedTime: 1000,
|
|
179
|
+
},
|
|
180
|
+
retryConnectionErrors: true,
|
|
181
|
+
}
|
|
182
|
+
|| { strategy: "none" },
|
|
183
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const requestRes = client._createRequest(context, {
|
|
187
|
+
security: requestSecurity,
|
|
188
|
+
method: "GET",
|
|
189
|
+
baseURL: options?.serverURL,
|
|
190
|
+
path: path,
|
|
191
|
+
headers: headers,
|
|
192
|
+
query: query,
|
|
193
|
+
body: body,
|
|
194
|
+
userAgent: client._options.userAgent,
|
|
195
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
196
|
+
}, options);
|
|
197
|
+
if (!requestRes.ok) {
|
|
198
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
199
|
+
}
|
|
200
|
+
const req = requestRes.value;
|
|
201
|
+
|
|
202
|
+
const doResult = await client._do(req, {
|
|
203
|
+
context,
|
|
204
|
+
errorCodes: [
|
|
205
|
+
"400",
|
|
206
|
+
"401",
|
|
207
|
+
"403",
|
|
208
|
+
"404",
|
|
209
|
+
"405",
|
|
210
|
+
"409",
|
|
211
|
+
"422",
|
|
212
|
+
"425",
|
|
213
|
+
"429",
|
|
214
|
+
"4XX",
|
|
215
|
+
"500",
|
|
216
|
+
"502",
|
|
217
|
+
"504",
|
|
218
|
+
"5XX",
|
|
219
|
+
],
|
|
220
|
+
retryConfig: context.retryConfig,
|
|
221
|
+
retryCodes: context.retryCodes,
|
|
222
|
+
});
|
|
223
|
+
if (!doResult.ok) {
|
|
224
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
225
|
+
}
|
|
226
|
+
const response = doResult.value;
|
|
227
|
+
|
|
228
|
+
const responseFields = {
|
|
229
|
+
HttpMeta: { Response: response, Request: req },
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const [result, raw] = await M.match<
|
|
233
|
+
operations.GetThreeDsScenarioResponse,
|
|
234
|
+
| errors.Error400
|
|
235
|
+
| errors.Error401
|
|
236
|
+
| errors.Error403
|
|
237
|
+
| errors.Error404
|
|
238
|
+
| errors.Error405
|
|
239
|
+
| errors.Error409
|
|
240
|
+
| errors.HTTPValidationError
|
|
241
|
+
| errors.Error425
|
|
242
|
+
| errors.Error429
|
|
243
|
+
| errors.Error500
|
|
244
|
+
| errors.Error502
|
|
245
|
+
| errors.Error504
|
|
246
|
+
| Gr4vyError
|
|
247
|
+
| ResponseValidationError
|
|
248
|
+
| ConnectionError
|
|
249
|
+
| RequestAbortedError
|
|
250
|
+
| RequestTimeoutError
|
|
251
|
+
| InvalidRequestError
|
|
252
|
+
| UnexpectedClientError
|
|
253
|
+
| SDKValidationError
|
|
254
|
+
>(
|
|
255
|
+
M.json(200, operations.GetThreeDsScenarioResponse$inboundSchema, {
|
|
256
|
+
key: "Result",
|
|
257
|
+
}),
|
|
258
|
+
M.jsonErr(400, errors.Error400$inboundSchema),
|
|
259
|
+
M.jsonErr(401, errors.Error401$inboundSchema),
|
|
260
|
+
M.jsonErr(403, errors.Error403$inboundSchema),
|
|
261
|
+
M.jsonErr(404, errors.Error404$inboundSchema),
|
|
262
|
+
M.jsonErr(405, errors.Error405$inboundSchema),
|
|
263
|
+
M.jsonErr(409, errors.Error409$inboundSchema),
|
|
264
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
265
|
+
M.jsonErr(425, errors.Error425$inboundSchema),
|
|
266
|
+
M.jsonErr(429, errors.Error429$inboundSchema),
|
|
267
|
+
M.jsonErr(500, errors.Error500$inboundSchema),
|
|
268
|
+
M.jsonErr(502, errors.Error502$inboundSchema),
|
|
269
|
+
M.jsonErr(504, errors.Error504$inboundSchema),
|
|
270
|
+
M.fail("4XX"),
|
|
271
|
+
M.fail("5XX"),
|
|
272
|
+
)(response, req, { extraFields: responseFields });
|
|
273
|
+
if (!result.ok) {
|
|
274
|
+
return [haltIterator(result), {
|
|
275
|
+
status: "complete",
|
|
276
|
+
request: req,
|
|
277
|
+
response,
|
|
278
|
+
}];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const nextFunc = (
|
|
282
|
+
responseData: unknown,
|
|
283
|
+
): {
|
|
284
|
+
next: Paginator<
|
|
285
|
+
Result<
|
|
286
|
+
operations.GetThreeDsScenarioResponse,
|
|
287
|
+
| errors.Error400
|
|
288
|
+
| errors.Error401
|
|
289
|
+
| errors.Error403
|
|
290
|
+
| errors.Error404
|
|
291
|
+
| errors.Error405
|
|
292
|
+
| errors.Error409
|
|
293
|
+
| errors.HTTPValidationError
|
|
294
|
+
| errors.Error425
|
|
295
|
+
| errors.Error429
|
|
296
|
+
| errors.Error500
|
|
297
|
+
| errors.Error502
|
|
298
|
+
| errors.Error504
|
|
299
|
+
| Gr4vyError
|
|
300
|
+
| ResponseValidationError
|
|
301
|
+
| ConnectionError
|
|
302
|
+
| RequestAbortedError
|
|
303
|
+
| RequestTimeoutError
|
|
304
|
+
| InvalidRequestError
|
|
305
|
+
| UnexpectedClientError
|
|
306
|
+
| SDKValidationError
|
|
307
|
+
>
|
|
308
|
+
>;
|
|
309
|
+
"~next"?: { cursor: string };
|
|
310
|
+
} => {
|
|
311
|
+
const nextCursor = dlv(responseData, "next_cursor");
|
|
312
|
+
if (typeof nextCursor !== "string") {
|
|
313
|
+
return { next: () => null };
|
|
314
|
+
}
|
|
315
|
+
if (nextCursor.trim() === "") {
|
|
316
|
+
return { next: () => null };
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const nextVal = () =>
|
|
320
|
+
threeDsScenariosList(
|
|
321
|
+
client,
|
|
322
|
+
nextCursor,
|
|
323
|
+
limit,
|
|
324
|
+
merchantAccountId,
|
|
325
|
+
options,
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
return { next: nextVal, "~next": { cursor: nextCursor } };
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
332
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
333
|
+
status: "complete",
|
|
334
|
+
request: req,
|
|
335
|
+
response,
|
|
336
|
+
}];
|
|
337
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Gr4vyCore } 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 * as components from "../models/components/index.js";
|
|
14
|
+
import { Gr4vyError } from "../models/errors/gr4vyerror.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 { 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
|
+
* Update a 3DS scenario
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Update a 3DS scenario. Only available in sandbox environments.
|
|
34
|
+
*/
|
|
35
|
+
export function threeDsScenariosUpdate(
|
|
36
|
+
client: Gr4vyCore,
|
|
37
|
+
threeDSecureScenarioUpdate: components.ThreeDSecureScenarioUpdate,
|
|
38
|
+
threeDsScenarioId: string,
|
|
39
|
+
merchantAccountId?: string | null | undefined,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): APIPromise<
|
|
42
|
+
Result<
|
|
43
|
+
components.ThreeDSecureScenario,
|
|
44
|
+
| errors.Error400
|
|
45
|
+
| errors.Error401
|
|
46
|
+
| errors.Error403
|
|
47
|
+
| errors.Error404
|
|
48
|
+
| errors.Error405
|
|
49
|
+
| errors.Error409
|
|
50
|
+
| errors.HTTPValidationError
|
|
51
|
+
| errors.Error425
|
|
52
|
+
| errors.Error429
|
|
53
|
+
| errors.Error500
|
|
54
|
+
| errors.Error502
|
|
55
|
+
| errors.Error504
|
|
56
|
+
| Gr4vyError
|
|
57
|
+
| ResponseValidationError
|
|
58
|
+
| ConnectionError
|
|
59
|
+
| RequestAbortedError
|
|
60
|
+
| RequestTimeoutError
|
|
61
|
+
| InvalidRequestError
|
|
62
|
+
| UnexpectedClientError
|
|
63
|
+
| SDKValidationError
|
|
64
|
+
>
|
|
65
|
+
> {
|
|
66
|
+
return new APIPromise($do(
|
|
67
|
+
client,
|
|
68
|
+
threeDSecureScenarioUpdate,
|
|
69
|
+
threeDsScenarioId,
|
|
70
|
+
merchantAccountId,
|
|
71
|
+
options,
|
|
72
|
+
));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function $do(
|
|
76
|
+
client: Gr4vyCore,
|
|
77
|
+
threeDSecureScenarioUpdate: components.ThreeDSecureScenarioUpdate,
|
|
78
|
+
threeDsScenarioId: string,
|
|
79
|
+
merchantAccountId?: string | null | undefined,
|
|
80
|
+
options?: RequestOptions,
|
|
81
|
+
): Promise<
|
|
82
|
+
[
|
|
83
|
+
Result<
|
|
84
|
+
components.ThreeDSecureScenario,
|
|
85
|
+
| errors.Error400
|
|
86
|
+
| errors.Error401
|
|
87
|
+
| errors.Error403
|
|
88
|
+
| errors.Error404
|
|
89
|
+
| errors.Error405
|
|
90
|
+
| errors.Error409
|
|
91
|
+
| errors.HTTPValidationError
|
|
92
|
+
| errors.Error425
|
|
93
|
+
| errors.Error429
|
|
94
|
+
| errors.Error500
|
|
95
|
+
| errors.Error502
|
|
96
|
+
| errors.Error504
|
|
97
|
+
| Gr4vyError
|
|
98
|
+
| ResponseValidationError
|
|
99
|
+
| ConnectionError
|
|
100
|
+
| RequestAbortedError
|
|
101
|
+
| RequestTimeoutError
|
|
102
|
+
| InvalidRequestError
|
|
103
|
+
| UnexpectedClientError
|
|
104
|
+
| SDKValidationError
|
|
105
|
+
>,
|
|
106
|
+
APICall,
|
|
107
|
+
]
|
|
108
|
+
> {
|
|
109
|
+
const input: operations.UpdateThreeDsScenarioRequest = {
|
|
110
|
+
threeDSecureScenarioUpdate: threeDSecureScenarioUpdate,
|
|
111
|
+
threeDsScenarioId: threeDsScenarioId,
|
|
112
|
+
merchantAccountId: merchantAccountId,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const parsed = safeParse(
|
|
116
|
+
input,
|
|
117
|
+
(value) =>
|
|
118
|
+
operations.UpdateThreeDsScenarioRequest$outboundSchema.parse(value),
|
|
119
|
+
"Input validation failed",
|
|
120
|
+
);
|
|
121
|
+
if (!parsed.ok) {
|
|
122
|
+
return [parsed, { status: "invalid" }];
|
|
123
|
+
}
|
|
124
|
+
const payload = parsed.value;
|
|
125
|
+
const body = encodeJSON("body", payload.ThreeDSecureScenarioUpdate, {
|
|
126
|
+
explode: true,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const pathParams = {
|
|
130
|
+
three_ds_scenario_id: encodeSimple(
|
|
131
|
+
"three_ds_scenario_id",
|
|
132
|
+
payload.three_ds_scenario_id,
|
|
133
|
+
{ explode: false, charEncoding: "percent" },
|
|
134
|
+
),
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const path = pathToFunc("/three-ds-scenarios/{three_ds_scenario_id}")(
|
|
138
|
+
pathParams,
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const headers = new Headers(compactMap({
|
|
142
|
+
"Content-Type": "application/json",
|
|
143
|
+
Accept: "application/json",
|
|
144
|
+
"x-gr4vy-merchant-account-id": encodeSimple(
|
|
145
|
+
"x-gr4vy-merchant-account-id",
|
|
146
|
+
payload.merchantAccountId ?? client._options.merchantAccountId,
|
|
147
|
+
{ explode: false, charEncoding: "none" },
|
|
148
|
+
),
|
|
149
|
+
}));
|
|
150
|
+
|
|
151
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
152
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
153
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
154
|
+
|
|
155
|
+
const context = {
|
|
156
|
+
options: client._options,
|
|
157
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
158
|
+
operationID: "update_three_ds_scenario",
|
|
159
|
+
oAuth2Scopes: null,
|
|
160
|
+
|
|
161
|
+
resolvedSecurity: requestSecurity,
|
|
162
|
+
|
|
163
|
+
securitySource: client._options.bearerAuth,
|
|
164
|
+
retryConfig: options?.retries
|
|
165
|
+
|| client._options.retryConfig
|
|
166
|
+
|| { strategy: "none" },
|
|
167
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const requestRes = client._createRequest(context, {
|
|
171
|
+
security: requestSecurity,
|
|
172
|
+
method: "PUT",
|
|
173
|
+
baseURL: options?.serverURL,
|
|
174
|
+
path: path,
|
|
175
|
+
headers: headers,
|
|
176
|
+
body: body,
|
|
177
|
+
userAgent: client._options.userAgent,
|
|
178
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
179
|
+
}, options);
|
|
180
|
+
if (!requestRes.ok) {
|
|
181
|
+
return [requestRes, { status: "invalid" }];
|
|
182
|
+
}
|
|
183
|
+
const req = requestRes.value;
|
|
184
|
+
|
|
185
|
+
const doResult = await client._do(req, {
|
|
186
|
+
context,
|
|
187
|
+
errorCodes: [
|
|
188
|
+
"400",
|
|
189
|
+
"401",
|
|
190
|
+
"403",
|
|
191
|
+
"404",
|
|
192
|
+
"405",
|
|
193
|
+
"409",
|
|
194
|
+
"422",
|
|
195
|
+
"425",
|
|
196
|
+
"429",
|
|
197
|
+
"4XX",
|
|
198
|
+
"500",
|
|
199
|
+
"502",
|
|
200
|
+
"504",
|
|
201
|
+
"5XX",
|
|
202
|
+
],
|
|
203
|
+
retryConfig: context.retryConfig,
|
|
204
|
+
retryCodes: context.retryCodes,
|
|
205
|
+
});
|
|
206
|
+
if (!doResult.ok) {
|
|
207
|
+
return [doResult, { status: "request-error", request: req }];
|
|
208
|
+
}
|
|
209
|
+
const response = doResult.value;
|
|
210
|
+
|
|
211
|
+
const responseFields = {
|
|
212
|
+
HttpMeta: { Response: response, Request: req },
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const [result] = await M.match<
|
|
216
|
+
components.ThreeDSecureScenario,
|
|
217
|
+
| errors.Error400
|
|
218
|
+
| errors.Error401
|
|
219
|
+
| errors.Error403
|
|
220
|
+
| errors.Error404
|
|
221
|
+
| errors.Error405
|
|
222
|
+
| errors.Error409
|
|
223
|
+
| errors.HTTPValidationError
|
|
224
|
+
| errors.Error425
|
|
225
|
+
| errors.Error429
|
|
226
|
+
| errors.Error500
|
|
227
|
+
| errors.Error502
|
|
228
|
+
| errors.Error504
|
|
229
|
+
| Gr4vyError
|
|
230
|
+
| ResponseValidationError
|
|
231
|
+
| ConnectionError
|
|
232
|
+
| RequestAbortedError
|
|
233
|
+
| RequestTimeoutError
|
|
234
|
+
| InvalidRequestError
|
|
235
|
+
| UnexpectedClientError
|
|
236
|
+
| SDKValidationError
|
|
237
|
+
>(
|
|
238
|
+
M.json(200, components.ThreeDSecureScenario$inboundSchema),
|
|
239
|
+
M.jsonErr(400, errors.Error400$inboundSchema),
|
|
240
|
+
M.jsonErr(401, errors.Error401$inboundSchema),
|
|
241
|
+
M.jsonErr(403, errors.Error403$inboundSchema),
|
|
242
|
+
M.jsonErr(404, errors.Error404$inboundSchema),
|
|
243
|
+
M.jsonErr(405, errors.Error405$inboundSchema),
|
|
244
|
+
M.jsonErr(409, errors.Error409$inboundSchema),
|
|
245
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
246
|
+
M.jsonErr(425, errors.Error425$inboundSchema),
|
|
247
|
+
M.jsonErr(429, errors.Error429$inboundSchema),
|
|
248
|
+
M.jsonErr(500, errors.Error500$inboundSchema),
|
|
249
|
+
M.jsonErr(502, errors.Error502$inboundSchema),
|
|
250
|
+
M.jsonErr(504, errors.Error504$inboundSchema),
|
|
251
|
+
M.fail("4XX"),
|
|
252
|
+
M.fail("5XX"),
|
|
253
|
+
)(response, req, { extraFields: responseFields });
|
|
254
|
+
if (!result.ok) {
|
|
255
|
+
return [result, { status: "complete", request: req, response }];
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return [result, { status: "complete", request: req, response }];
|
|
259
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -77,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
77
77
|
export const SDK_METADATA = {
|
|
78
78
|
language: "typescript",
|
|
79
79
|
openapiDocVersion: "1.0.0",
|
|
80
|
-
sdkVersion: "1.9.
|
|
81
|
-
genVersion: "2.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 1.9.
|
|
80
|
+
sdkVersion: "1.9.13",
|
|
81
|
+
genVersion: "2.797.1",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 1.9.13 2.797.1 1.0.0 @gr4vy/sdk",
|
|
83
83
|
} as const;
|
|
@@ -230,6 +230,14 @@ export * from "./threedsecuredatav1.js";
|
|
|
230
230
|
export * from "./threedsecuredatav2.js";
|
|
231
231
|
export * from "./threedsecureerror.js";
|
|
232
232
|
export * from "./threedsecuremethod.js";
|
|
233
|
+
export * from "./threedsecurescenario.js";
|
|
234
|
+
export * from "./threedsecurescenarioconditions.js";
|
|
235
|
+
export * from "./threedsecurescenariocreate.js";
|
|
236
|
+
export * from "./threedsecurescenariooutcome.js";
|
|
237
|
+
export * from "./threedsecurescenariooutcomeauthentication.js";
|
|
238
|
+
export * from "./threedsecurescenariooutcomeresult.js";
|
|
239
|
+
export * from "./threedsecurescenarios.js";
|
|
240
|
+
export * from "./threedsecurescenarioupdate.js";
|
|
233
241
|
export * from "./threedsecurestatus.js";
|
|
234
242
|
export * from "./threedsecurev2.js";
|
|
235
243
|
export * from "./tokenpaymentmethodcreate.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
ThreeDSecureScenarioConditions,
|
|
12
|
+
ThreeDSecureScenarioConditions$inboundSchema,
|
|
13
|
+
} from "./threedsecurescenarioconditions.js";
|
|
14
|
+
import {
|
|
15
|
+
ThreeDSecureScenarioOutcome,
|
|
16
|
+
ThreeDSecureScenarioOutcome$inboundSchema,
|
|
17
|
+
} from "./threedsecurescenariooutcome.js";
|
|
18
|
+
|
|
19
|
+
export type ThreeDSecureScenario = {
|
|
20
|
+
/**
|
|
21
|
+
* Always `three-d-secure-scenario`.
|
|
22
|
+
*/
|
|
23
|
+
type: "three-d-secure-scenario";
|
|
24
|
+
/**
|
|
25
|
+
* Unique identifier for the 3DS scenario
|
|
26
|
+
*/
|
|
27
|
+
id: string;
|
|
28
|
+
/**
|
|
29
|
+
* ID of the associated merchant account
|
|
30
|
+
*/
|
|
31
|
+
merchantAccountId: string;
|
|
32
|
+
/**
|
|
33
|
+
* The date and time when this 3DS scenario was first created in our system.
|
|
34
|
+
*/
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
/**
|
|
37
|
+
* The date and time when this 3DS scenario was last updated in our system.
|
|
38
|
+
*/
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
conditions: ThreeDSecureScenarioConditions;
|
|
41
|
+
outcome: ThreeDSecureScenarioOutcome;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const ThreeDSecureScenario$inboundSchema: z.ZodType<
|
|
46
|
+
ThreeDSecureScenario,
|
|
47
|
+
z.ZodTypeDef,
|
|
48
|
+
unknown
|
|
49
|
+
> = z.object({
|
|
50
|
+
type: z.literal("three-d-secure-scenario").default("three-d-secure-scenario"),
|
|
51
|
+
id: z.string(),
|
|
52
|
+
merchant_account_id: z.string(),
|
|
53
|
+
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
54
|
+
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
55
|
+
conditions: ThreeDSecureScenarioConditions$inboundSchema,
|
|
56
|
+
outcome: ThreeDSecureScenarioOutcome$inboundSchema,
|
|
57
|
+
}).transform((v) => {
|
|
58
|
+
return remap$(v, {
|
|
59
|
+
"merchant_account_id": "merchantAccountId",
|
|
60
|
+
"created_at": "createdAt",
|
|
61
|
+
"updated_at": "updatedAt",
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export function threeDSecureScenarioFromJSON(
|
|
66
|
+
jsonString: string,
|
|
67
|
+
): SafeParseResult<ThreeDSecureScenario, SDKValidationError> {
|
|
68
|
+
return safeParse(
|
|
69
|
+
jsonString,
|
|
70
|
+
(x) => ThreeDSecureScenario$inboundSchema.parse(JSON.parse(x)),
|
|
71
|
+
`Failed to parse 'ThreeDSecureScenario' from JSON`,
|
|
72
|
+
);
|
|
73
|
+
}
|