mollie-api-typescript 1.8.1 → 1.8.2
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 +8 -0
- package/dist/commonjs/funcs/terminalsTerminalsGetPairingCode.d.ts +28 -0
- package/dist/commonjs/funcs/terminalsTerminalsGetPairingCode.d.ts.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsGetPairingCode.js +153 -0
- package/dist/commonjs/funcs/terminalsTerminalsGetPairingCode.js.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsListPairingCodes.d.ts +24 -0
- package/dist/commonjs/funcs/terminalsTerminalsListPairingCodes.d.ts.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsListPairingCodes.js +147 -0
- package/dist/commonjs/funcs/terminalsTerminalsListPairingCodes.js.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsRequestPairingCode.d.ts +30 -0
- package/dist/commonjs/funcs/terminalsTerminalsRequestPairingCode.d.ts.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsRequestPairingCode.js +151 -0
- package/dist/commonjs/funcs/terminalsTerminalsRequestPairingCode.js.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsRevokePairingCode.d.ts +27 -0
- package/dist/commonjs/funcs/terminalsTerminalsRevokePairingCode.d.ts.map +1 -0
- package/dist/commonjs/funcs/terminalsTerminalsRevokePairingCode.js +148 -0
- package/dist/commonjs/funcs/terminalsTerminalsRevokePairingCode.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/entitypairingcode.d.ts +122 -0
- package/dist/commonjs/models/entitypairingcode.d.ts.map +1 -0
- package/dist/commonjs/models/entitypairingcode.js +109 -0
- package/dist/commonjs/models/entitypairingcode.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +1 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +1 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +4 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +4 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/terminalsgetpairingcode.d.ts +25 -0
- package/dist/commonjs/models/operations/terminalsgetpairingcode.d.ts.map +1 -0
- package/dist/commonjs/models/operations/terminalsgetpairingcode.js +57 -0
- package/dist/commonjs/models/operations/terminalsgetpairingcode.js.map +1 -0
- package/dist/commonjs/models/operations/terminalslistpairingcodes.d.ts +99 -0
- package/dist/commonjs/models/operations/terminalslistpairingcodes.d.ts.map +1 -0
- package/dist/commonjs/models/operations/terminalslistpairingcodes.js +95 -0
- package/dist/commonjs/models/operations/terminalslistpairingcodes.js.map +1 -0
- package/dist/commonjs/models/operations/terminalsrequestpairingcode.d.ts +35 -0
- package/dist/commonjs/models/operations/terminalsrequestpairingcode.d.ts.map +1 -0
- package/dist/commonjs/models/operations/terminalsrequestpairingcode.js +66 -0
- package/dist/commonjs/models/operations/terminalsrequestpairingcode.js.map +1 -0
- package/dist/commonjs/models/operations/terminalsrevokepairingcode.d.ts +20 -0
- package/dist/commonjs/models/operations/terminalsrevokepairingcode.d.ts.map +1 -0
- package/dist/commonjs/models/operations/terminalsrevokepairingcode.js +56 -0
- package/dist/commonjs/models/operations/terminalsrevokepairingcode.js.map +1 -0
- package/dist/commonjs/sdk/terminals.d.ts +54 -0
- package/dist/commonjs/sdk/terminals.d.ts.map +1 -1
- package/dist/commonjs/sdk/terminals.js +66 -0
- package/dist/commonjs/sdk/terminals.js.map +1 -1
- package/dist/esm/funcs/terminalsTerminalsGetPairingCode.d.ts +28 -0
- package/dist/esm/funcs/terminalsTerminalsGetPairingCode.d.ts.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsGetPairingCode.js +117 -0
- package/dist/esm/funcs/terminalsTerminalsGetPairingCode.js.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsListPairingCodes.d.ts +24 -0
- package/dist/esm/funcs/terminalsTerminalsListPairingCodes.d.ts.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsListPairingCodes.js +111 -0
- package/dist/esm/funcs/terminalsTerminalsListPairingCodes.js.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsRequestPairingCode.d.ts +30 -0
- package/dist/esm/funcs/terminalsTerminalsRequestPairingCode.d.ts.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsRequestPairingCode.js +115 -0
- package/dist/esm/funcs/terminalsTerminalsRequestPairingCode.js.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsRevokePairingCode.d.ts +27 -0
- package/dist/esm/funcs/terminalsTerminalsRevokePairingCode.d.ts.map +1 -0
- package/dist/esm/funcs/terminalsTerminalsRevokePairingCode.js +112 -0
- package/dist/esm/funcs/terminalsTerminalsRevokePairingCode.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/entitypairingcode.d.ts +122 -0
- package/dist/esm/models/entitypairingcode.d.ts.map +1 -0
- package/dist/esm/models/entitypairingcode.js +69 -0
- package/dist/esm/models/entitypairingcode.js.map +1 -0
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +4 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +4 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/terminalsgetpairingcode.d.ts +25 -0
- package/dist/esm/models/operations/terminalsgetpairingcode.d.ts.map +1 -0
- package/dist/esm/models/operations/terminalsgetpairingcode.js +20 -0
- package/dist/esm/models/operations/terminalsgetpairingcode.js.map +1 -0
- package/dist/esm/models/operations/terminalslistpairingcodes.d.ts +99 -0
- package/dist/esm/models/operations/terminalslistpairingcodes.d.ts.map +1 -0
- package/dist/esm/models/operations/terminalslistpairingcodes.js +55 -0
- package/dist/esm/models/operations/terminalslistpairingcodes.js.map +1 -0
- package/dist/esm/models/operations/terminalsrequestpairingcode.d.ts +35 -0
- package/dist/esm/models/operations/terminalsrequestpairingcode.d.ts.map +1 -0
- package/dist/esm/models/operations/terminalsrequestpairingcode.js +28 -0
- package/dist/esm/models/operations/terminalsrequestpairingcode.js.map +1 -0
- package/dist/esm/models/operations/terminalsrevokepairingcode.d.ts +20 -0
- package/dist/esm/models/operations/terminalsrevokepairingcode.d.ts.map +1 -0
- package/dist/esm/models/operations/terminalsrevokepairingcode.js +19 -0
- package/dist/esm/models/operations/terminalsrevokepairingcode.js.map +1 -0
- package/dist/esm/sdk/terminals.d.ts +54 -0
- package/dist/esm/sdk/terminals.d.ts.map +1 -1
- package/dist/esm/sdk/terminals.js +66 -0
- package/dist/esm/sdk/terminals.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/terminalsTerminalsGetPairingCode.ts +213 -0
- package/src/funcs/terminalsTerminalsListPairingCodes.ts +205 -0
- package/src/funcs/terminalsTerminalsRequestPairingCode.ts +209 -0
- package/src/funcs/terminalsTerminalsRevokePairingCode.ts +207 -0
- package/src/lib/config.ts +3 -3
- package/src/models/entitypairingcode.ts +223 -0
- package/src/models/index.ts +1 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/terminalsgetpairingcode.ts +54 -0
- package/src/models/operations/terminalslistpairingcodes.ts +195 -0
- package/src/models/operations/terminalsrequestpairingcode.ts +86 -0
- package/src/models/operations/terminalsrevokepairingcode.ts +48 -0
- package/src/sdk/terminals.ts +98 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 351a2c36e865
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ClientCore } from "../core.js";
|
|
7
|
+
import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import { ClientError } from "../models/errors/clienterror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as models from "../models/index.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Request terminal pairing code
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* > ℹ️ **Test mode**
|
|
36
|
+
* >
|
|
37
|
+
* > This endpoint currently does not support test mode yet.
|
|
38
|
+
*
|
|
39
|
+
* Request a pairing code to onboard a point-of-sale terminal.
|
|
40
|
+
*
|
|
41
|
+
* The response includes a human-readable `code` for manual entry on the terminal, and a QR Code as a
|
|
42
|
+
* base64 encoded SVG data URI for scanning if you specify the query parameter `include` with value `details.qrCode`.
|
|
43
|
+
*
|
|
44
|
+
* Pairing codes expire after 90 days (see `expiresAt`) and can be used multiple times.
|
|
45
|
+
*
|
|
46
|
+
* If set, this operation will use either {@link Security.apiKey} or {@link Security.oAuth} from the global security.
|
|
47
|
+
*/
|
|
48
|
+
export function terminalsTerminalsRequestPairingCode(
|
|
49
|
+
client: ClientCore,
|
|
50
|
+
request?: operations.TerminalsRequestPairingCodeRequest | undefined,
|
|
51
|
+
options?: RequestOptions,
|
|
52
|
+
): APIPromise<
|
|
53
|
+
Result<
|
|
54
|
+
models.EntityPairingCode,
|
|
55
|
+
| errors.ErrorResponse
|
|
56
|
+
| ClientError
|
|
57
|
+
| ResponseValidationError
|
|
58
|
+
| ConnectionError
|
|
59
|
+
| RequestAbortedError
|
|
60
|
+
| RequestTimeoutError
|
|
61
|
+
| InvalidRequestError
|
|
62
|
+
| UnexpectedClientError
|
|
63
|
+
| SDKValidationError
|
|
64
|
+
>
|
|
65
|
+
> {
|
|
66
|
+
return new APIPromise($do(
|
|
67
|
+
client,
|
|
68
|
+
request,
|
|
69
|
+
options,
|
|
70
|
+
));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function $do(
|
|
74
|
+
client: ClientCore,
|
|
75
|
+
request?: operations.TerminalsRequestPairingCodeRequest | undefined,
|
|
76
|
+
options?: RequestOptions,
|
|
77
|
+
): Promise<
|
|
78
|
+
[
|
|
79
|
+
Result<
|
|
80
|
+
models.EntityPairingCode,
|
|
81
|
+
| errors.ErrorResponse
|
|
82
|
+
| ClientError
|
|
83
|
+
| ResponseValidationError
|
|
84
|
+
| ConnectionError
|
|
85
|
+
| RequestAbortedError
|
|
86
|
+
| RequestTimeoutError
|
|
87
|
+
| InvalidRequestError
|
|
88
|
+
| UnexpectedClientError
|
|
89
|
+
| SDKValidationError
|
|
90
|
+
>,
|
|
91
|
+
APICall,
|
|
92
|
+
]
|
|
93
|
+
> {
|
|
94
|
+
const parsed = safeParse(
|
|
95
|
+
request,
|
|
96
|
+
(value) =>
|
|
97
|
+
operations.TerminalsRequestPairingCodeRequest$outboundSchema.optional()
|
|
98
|
+
.parse(value),
|
|
99
|
+
"Input validation failed",
|
|
100
|
+
);
|
|
101
|
+
if (!parsed.ok) {
|
|
102
|
+
return [parsed, { status: "invalid" }];
|
|
103
|
+
}
|
|
104
|
+
const payload = parsed.value;
|
|
105
|
+
const body = encodeJSON("body", payload?.RequestBody, { explode: true });
|
|
106
|
+
|
|
107
|
+
const path = pathToFunc("/v2/terminals/pairing-codes")();
|
|
108
|
+
|
|
109
|
+
const query = encodeFormQuery({
|
|
110
|
+
"include": payload?.include,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const headers = new Headers(compactMap({
|
|
114
|
+
"Content-Type": "application/json",
|
|
115
|
+
Accept: "application/hal+json",
|
|
116
|
+
"idempotency-key": encodeSimple(
|
|
117
|
+
"idempotency-key",
|
|
118
|
+
payload?.["idempotency-key"],
|
|
119
|
+
{ explode: false, charEncoding: "none" },
|
|
120
|
+
),
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
124
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0, 2]);
|
|
125
|
+
|
|
126
|
+
const context = {
|
|
127
|
+
options: client._options,
|
|
128
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
129
|
+
operationID: "terminals-request-pairing-code",
|
|
130
|
+
oAuth2Scopes: null,
|
|
131
|
+
|
|
132
|
+
resolvedSecurity: requestSecurity,
|
|
133
|
+
|
|
134
|
+
securitySource: client._options.security,
|
|
135
|
+
retryConfig: options?.retries
|
|
136
|
+
|| client._options.retryConfig
|
|
137
|
+
|| {
|
|
138
|
+
strategy: "backoff",
|
|
139
|
+
backoff: {
|
|
140
|
+
initialInterval: 500,
|
|
141
|
+
maxInterval: 5000,
|
|
142
|
+
exponent: 2,
|
|
143
|
+
maxElapsedTime: 7500,
|
|
144
|
+
},
|
|
145
|
+
retryConnectionErrors: true,
|
|
146
|
+
}
|
|
147
|
+
|| { strategy: "none" },
|
|
148
|
+
retryCodes: options?.retryCodes || ["429", "5xx"],
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const requestRes = client._createRequest(context, {
|
|
152
|
+
security: requestSecurity,
|
|
153
|
+
method: "POST",
|
|
154
|
+
baseURL: options?.serverURL,
|
|
155
|
+
path: path,
|
|
156
|
+
headers: headers,
|
|
157
|
+
query: query,
|
|
158
|
+
body: body,
|
|
159
|
+
userAgent: client._options.userAgent,
|
|
160
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
161
|
+
}, options);
|
|
162
|
+
if (!requestRes.ok) {
|
|
163
|
+
return [requestRes, { status: "invalid" }];
|
|
164
|
+
}
|
|
165
|
+
const req = requestRes.value;
|
|
166
|
+
|
|
167
|
+
const doResult = await client._do(req, {
|
|
168
|
+
context,
|
|
169
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
170
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
171
|
+
retryConfig: context.retryConfig,
|
|
172
|
+
retryCodes: context.retryCodes,
|
|
173
|
+
});
|
|
174
|
+
if (!doResult.ok) {
|
|
175
|
+
return [doResult, { status: "request-error", request: req }];
|
|
176
|
+
}
|
|
177
|
+
const response = doResult.value;
|
|
178
|
+
|
|
179
|
+
const responseFields = {
|
|
180
|
+
HttpMeta: { Response: response, Request: req },
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const [result] = await M.match<
|
|
184
|
+
models.EntityPairingCode,
|
|
185
|
+
| errors.ErrorResponse
|
|
186
|
+
| ClientError
|
|
187
|
+
| ResponseValidationError
|
|
188
|
+
| ConnectionError
|
|
189
|
+
| RequestAbortedError
|
|
190
|
+
| RequestTimeoutError
|
|
191
|
+
| InvalidRequestError
|
|
192
|
+
| UnexpectedClientError
|
|
193
|
+
| SDKValidationError
|
|
194
|
+
>(
|
|
195
|
+
M.json(201, models.EntityPairingCode$inboundSchema, {
|
|
196
|
+
ctype: "application/hal+json",
|
|
197
|
+
}),
|
|
198
|
+
M.jsonErr([422, 429], errors.ErrorResponse$inboundSchema, {
|
|
199
|
+
ctype: "application/hal+json",
|
|
200
|
+
}),
|
|
201
|
+
M.fail("4XX"),
|
|
202
|
+
M.fail("5XX"),
|
|
203
|
+
)(response, req, { extraFields: responseFields });
|
|
204
|
+
if (!result.ok) {
|
|
205
|
+
return [result, { status: "complete", request: req, response }];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return [result, { status: "complete", request: req, response }];
|
|
209
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 142d0a0681b4
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ClientCore } from "../core.js";
|
|
7
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import { ClientError } from "../models/errors/clienterror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as models from "../models/index.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Revoke terminal pairing code
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* > ℹ️ **Test mode**
|
|
36
|
+
* >
|
|
37
|
+
* > This endpoint currently does not support test mode yet.
|
|
38
|
+
*
|
|
39
|
+
* Revoke a pairing code, preventing the onboarding of new point-of-sale terminals.
|
|
40
|
+
*
|
|
41
|
+
* Terminals that have already paired with this code are not affected.
|
|
42
|
+
*
|
|
43
|
+
* If set, this operation will use either {@link Security.apiKey} or {@link Security.oAuth} from the global security.
|
|
44
|
+
*/
|
|
45
|
+
export function terminalsTerminalsRevokePairingCode(
|
|
46
|
+
client: ClientCore,
|
|
47
|
+
request: operations.TerminalsRevokePairingCodeRequest,
|
|
48
|
+
options?: RequestOptions,
|
|
49
|
+
): APIPromise<
|
|
50
|
+
Result<
|
|
51
|
+
models.EntityPairingCode,
|
|
52
|
+
| errors.ErrorResponse
|
|
53
|
+
| ClientError
|
|
54
|
+
| ResponseValidationError
|
|
55
|
+
| ConnectionError
|
|
56
|
+
| RequestAbortedError
|
|
57
|
+
| RequestTimeoutError
|
|
58
|
+
| InvalidRequestError
|
|
59
|
+
| UnexpectedClientError
|
|
60
|
+
| SDKValidationError
|
|
61
|
+
>
|
|
62
|
+
> {
|
|
63
|
+
return new APIPromise($do(
|
|
64
|
+
client,
|
|
65
|
+
request,
|
|
66
|
+
options,
|
|
67
|
+
));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function $do(
|
|
71
|
+
client: ClientCore,
|
|
72
|
+
request: operations.TerminalsRevokePairingCodeRequest,
|
|
73
|
+
options?: RequestOptions,
|
|
74
|
+
): Promise<
|
|
75
|
+
[
|
|
76
|
+
Result<
|
|
77
|
+
models.EntityPairingCode,
|
|
78
|
+
| errors.ErrorResponse
|
|
79
|
+
| ClientError
|
|
80
|
+
| ResponseValidationError
|
|
81
|
+
| ConnectionError
|
|
82
|
+
| RequestAbortedError
|
|
83
|
+
| RequestTimeoutError
|
|
84
|
+
| InvalidRequestError
|
|
85
|
+
| UnexpectedClientError
|
|
86
|
+
| SDKValidationError
|
|
87
|
+
>,
|
|
88
|
+
APICall,
|
|
89
|
+
]
|
|
90
|
+
> {
|
|
91
|
+
const parsed = safeParse(
|
|
92
|
+
request,
|
|
93
|
+
(value) =>
|
|
94
|
+
operations.TerminalsRevokePairingCodeRequest$outboundSchema.parse(value),
|
|
95
|
+
"Input validation failed",
|
|
96
|
+
);
|
|
97
|
+
if (!parsed.ok) {
|
|
98
|
+
return [parsed, { status: "invalid" }];
|
|
99
|
+
}
|
|
100
|
+
const payload = parsed.value;
|
|
101
|
+
const body = null;
|
|
102
|
+
|
|
103
|
+
const pathParams = {
|
|
104
|
+
pairingCodeId: encodeSimple("pairingCodeId", payload.pairingCodeId, {
|
|
105
|
+
explode: false,
|
|
106
|
+
charEncoding: "percent",
|
|
107
|
+
}),
|
|
108
|
+
};
|
|
109
|
+
const path = pathToFunc("/v2/terminals/pairing-codes/{pairingCodeId}")(
|
|
110
|
+
pathParams,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const headers = new Headers(compactMap({
|
|
114
|
+
Accept: "application/hal+json",
|
|
115
|
+
"idempotency-key": encodeSimple(
|
|
116
|
+
"idempotency-key",
|
|
117
|
+
payload["idempotency-key"],
|
|
118
|
+
{ explode: false, charEncoding: "none" },
|
|
119
|
+
),
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
123
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0, 2]);
|
|
124
|
+
|
|
125
|
+
const context = {
|
|
126
|
+
options: client._options,
|
|
127
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
128
|
+
operationID: "terminals-revoke-pairing-code",
|
|
129
|
+
oAuth2Scopes: null,
|
|
130
|
+
|
|
131
|
+
resolvedSecurity: requestSecurity,
|
|
132
|
+
|
|
133
|
+
securitySource: client._options.security,
|
|
134
|
+
retryConfig: options?.retries
|
|
135
|
+
|| client._options.retryConfig
|
|
136
|
+
|| {
|
|
137
|
+
strategy: "backoff",
|
|
138
|
+
backoff: {
|
|
139
|
+
initialInterval: 500,
|
|
140
|
+
maxInterval: 5000,
|
|
141
|
+
exponent: 2,
|
|
142
|
+
maxElapsedTime: 7500,
|
|
143
|
+
},
|
|
144
|
+
retryConnectionErrors: true,
|
|
145
|
+
}
|
|
146
|
+
|| { strategy: "none" },
|
|
147
|
+
retryCodes: options?.retryCodes || ["429", "5xx"],
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const requestRes = client._createRequest(context, {
|
|
151
|
+
security: requestSecurity,
|
|
152
|
+
method: "DELETE",
|
|
153
|
+
baseURL: options?.serverURL,
|
|
154
|
+
path: path,
|
|
155
|
+
headers: headers,
|
|
156
|
+
body: body,
|
|
157
|
+
userAgent: client._options.userAgent,
|
|
158
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
159
|
+
}, options);
|
|
160
|
+
if (!requestRes.ok) {
|
|
161
|
+
return [requestRes, { status: "invalid" }];
|
|
162
|
+
}
|
|
163
|
+
const req = requestRes.value;
|
|
164
|
+
|
|
165
|
+
const doResult = await client._do(req, {
|
|
166
|
+
context,
|
|
167
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
168
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
169
|
+
retryConfig: context.retryConfig,
|
|
170
|
+
retryCodes: context.retryCodes,
|
|
171
|
+
});
|
|
172
|
+
if (!doResult.ok) {
|
|
173
|
+
return [doResult, { status: "request-error", request: req }];
|
|
174
|
+
}
|
|
175
|
+
const response = doResult.value;
|
|
176
|
+
|
|
177
|
+
const responseFields = {
|
|
178
|
+
HttpMeta: { Response: response, Request: req },
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const [result] = await M.match<
|
|
182
|
+
models.EntityPairingCode,
|
|
183
|
+
| errors.ErrorResponse
|
|
184
|
+
| ClientError
|
|
185
|
+
| ResponseValidationError
|
|
186
|
+
| ConnectionError
|
|
187
|
+
| RequestAbortedError
|
|
188
|
+
| RequestTimeoutError
|
|
189
|
+
| InvalidRequestError
|
|
190
|
+
| UnexpectedClientError
|
|
191
|
+
| SDKValidationError
|
|
192
|
+
>(
|
|
193
|
+
M.json(200, models.EntityPairingCode$inboundSchema, {
|
|
194
|
+
ctype: "application/hal+json",
|
|
195
|
+
}),
|
|
196
|
+
M.jsonErr([404, 422, 429], errors.ErrorResponse$inboundSchema, {
|
|
197
|
+
ctype: "application/hal+json",
|
|
198
|
+
}),
|
|
199
|
+
M.fail("4XX"),
|
|
200
|
+
M.fail("5XX"),
|
|
201
|
+
)(response, req, { extraFields: responseFields });
|
|
202
|
+
if (!result.ok) {
|
|
203
|
+
return [result, { status: "complete", request: req, response }];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return [result, { status: "complete", request: req, response }];
|
|
207
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -78,8 +78,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
78
78
|
export const SDK_METADATA = {
|
|
79
79
|
language: "typescript",
|
|
80
80
|
openapiDocVersion: "1.0.0",
|
|
81
|
-
sdkVersion: "1.8.
|
|
82
|
-
genVersion: "2.884.
|
|
81
|
+
sdkVersion: "1.8.2",
|
|
82
|
+
genVersion: "2.884.11",
|
|
83
83
|
userAgent:
|
|
84
|
-
"speakeasy-sdk/typescript 1.8.
|
|
84
|
+
"speakeasy-sdk/typescript 1.8.2 2.884.11 1.0.0 mollie-api-typescript",
|
|
85
85
|
} as const;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 01b26dbb30ac
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import * as openEnums from "../types/enums.js";
|
|
10
|
+
import { OpenEnum } from "../types/enums.js";
|
|
11
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
12
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
13
|
+
import { Mode, Mode$inboundSchema } from "./mode.js";
|
|
14
|
+
import { Url, Url$inboundSchema } from "./url.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The status of the pairing code.
|
|
18
|
+
*/
|
|
19
|
+
export const EntityPairingCodeStatus = {
|
|
20
|
+
Active: "active",
|
|
21
|
+
Expired: "expired",
|
|
22
|
+
Revoked: "revoked",
|
|
23
|
+
} as const;
|
|
24
|
+
/**
|
|
25
|
+
* The status of the pairing code.
|
|
26
|
+
*/
|
|
27
|
+
export type EntityPairingCodeStatus = OpenEnum<typeof EntityPairingCodeStatus>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The QR code representation of the pairing code.
|
|
31
|
+
*/
|
|
32
|
+
export type EntityPairingCodeQrCode = {
|
|
33
|
+
height?: number | undefined;
|
|
34
|
+
width?: number | undefined;
|
|
35
|
+
src?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Additional pairing code data, present only when requested via the `include` parameter.
|
|
40
|
+
*/
|
|
41
|
+
export type EntityPairingCodeDetails = {
|
|
42
|
+
/**
|
|
43
|
+
* The QR code representation of the pairing code.
|
|
44
|
+
*/
|
|
45
|
+
qrCode?: EntityPairingCodeQrCode | null | undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.
|
|
50
|
+
*/
|
|
51
|
+
export type EntityPairingCodeLinks = {
|
|
52
|
+
/**
|
|
53
|
+
* In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.
|
|
54
|
+
*/
|
|
55
|
+
self: Url;
|
|
56
|
+
/**
|
|
57
|
+
* In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.
|
|
58
|
+
*/
|
|
59
|
+
profile: Url;
|
|
60
|
+
/**
|
|
61
|
+
* In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.
|
|
62
|
+
*/
|
|
63
|
+
documentation: Url;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type EntityPairingCode = {
|
|
67
|
+
/**
|
|
68
|
+
* Indicates the response contains a terminal pairing code object. Will always contain the string
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* `terminal-pairing-code` for this endpoint.
|
|
72
|
+
*/
|
|
73
|
+
resource: string;
|
|
74
|
+
/**
|
|
75
|
+
* The unique identifier of the pairing code. Example: `termpc_R7gX5Ea9bC4DkFj3G`.
|
|
76
|
+
*/
|
|
77
|
+
id: string;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this entity was created in live mode or in test mode.
|
|
80
|
+
*/
|
|
81
|
+
mode: Mode;
|
|
82
|
+
/**
|
|
83
|
+
* The human-readable pairing code to be entered on the terminal. This code is multi-use and will expire after the
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* time indicated in `expiresAt`.
|
|
87
|
+
*/
|
|
88
|
+
code: string;
|
|
89
|
+
/**
|
|
90
|
+
* The ID of the profile the terminal is being paired with.
|
|
91
|
+
*/
|
|
92
|
+
profileId: string;
|
|
93
|
+
status: EntityPairingCodeStatus;
|
|
94
|
+
/**
|
|
95
|
+
* Additional pairing code data, present only when requested via the `include` parameter.
|
|
96
|
+
*/
|
|
97
|
+
details?: EntityPairingCodeDetails | null | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* The date and time the pairing code expires, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Pairing
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* codes expire 90 days after creation. After this time, the code can no longer be used to pair a terminal.
|
|
103
|
+
*/
|
|
104
|
+
expiresAt: string;
|
|
105
|
+
/**
|
|
106
|
+
* The date and time the pairing code was revoked, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* `null` if the code has not been revoked.
|
|
110
|
+
*/
|
|
111
|
+
revokedAt?: string | null | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
114
|
+
*/
|
|
115
|
+
createdAt: string;
|
|
116
|
+
/**
|
|
117
|
+
* An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.
|
|
118
|
+
*/
|
|
119
|
+
links: EntityPairingCodeLinks;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** @internal */
|
|
123
|
+
export const EntityPairingCodeStatus$inboundSchema: z.ZodType<
|
|
124
|
+
EntityPairingCodeStatus,
|
|
125
|
+
z.ZodTypeDef,
|
|
126
|
+
unknown
|
|
127
|
+
> = openEnums.inboundSchema(EntityPairingCodeStatus);
|
|
128
|
+
|
|
129
|
+
/** @internal */
|
|
130
|
+
export const EntityPairingCodeQrCode$inboundSchema: z.ZodType<
|
|
131
|
+
EntityPairingCodeQrCode,
|
|
132
|
+
z.ZodTypeDef,
|
|
133
|
+
unknown
|
|
134
|
+
> = z.object({
|
|
135
|
+
height: z.number().optional(),
|
|
136
|
+
width: z.number().optional(),
|
|
137
|
+
src: z.string().optional(),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export function entityPairingCodeQrCodeFromJSON(
|
|
141
|
+
jsonString: string,
|
|
142
|
+
): SafeParseResult<EntityPairingCodeQrCode, SDKValidationError> {
|
|
143
|
+
return safeParse(
|
|
144
|
+
jsonString,
|
|
145
|
+
(x) => EntityPairingCodeQrCode$inboundSchema.parse(JSON.parse(x)),
|
|
146
|
+
`Failed to parse 'EntityPairingCodeQrCode' from JSON`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** @internal */
|
|
151
|
+
export const EntityPairingCodeDetails$inboundSchema: z.ZodType<
|
|
152
|
+
EntityPairingCodeDetails,
|
|
153
|
+
z.ZodTypeDef,
|
|
154
|
+
unknown
|
|
155
|
+
> = z.object({
|
|
156
|
+
qrCode: z.nullable(z.lazy(() => EntityPairingCodeQrCode$inboundSchema))
|
|
157
|
+
.optional(),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export function entityPairingCodeDetailsFromJSON(
|
|
161
|
+
jsonString: string,
|
|
162
|
+
): SafeParseResult<EntityPairingCodeDetails, SDKValidationError> {
|
|
163
|
+
return safeParse(
|
|
164
|
+
jsonString,
|
|
165
|
+
(x) => EntityPairingCodeDetails$inboundSchema.parse(JSON.parse(x)),
|
|
166
|
+
`Failed to parse 'EntityPairingCodeDetails' from JSON`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** @internal */
|
|
171
|
+
export const EntityPairingCodeLinks$inboundSchema: z.ZodType<
|
|
172
|
+
EntityPairingCodeLinks,
|
|
173
|
+
z.ZodTypeDef,
|
|
174
|
+
unknown
|
|
175
|
+
> = z.object({
|
|
176
|
+
self: Url$inboundSchema,
|
|
177
|
+
profile: Url$inboundSchema,
|
|
178
|
+
documentation: Url$inboundSchema,
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export function entityPairingCodeLinksFromJSON(
|
|
182
|
+
jsonString: string,
|
|
183
|
+
): SafeParseResult<EntityPairingCodeLinks, SDKValidationError> {
|
|
184
|
+
return safeParse(
|
|
185
|
+
jsonString,
|
|
186
|
+
(x) => EntityPairingCodeLinks$inboundSchema.parse(JSON.parse(x)),
|
|
187
|
+
`Failed to parse 'EntityPairingCodeLinks' from JSON`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** @internal */
|
|
192
|
+
export const EntityPairingCode$inboundSchema: z.ZodType<
|
|
193
|
+
EntityPairingCode,
|
|
194
|
+
z.ZodTypeDef,
|
|
195
|
+
unknown
|
|
196
|
+
> = z.object({
|
|
197
|
+
resource: z.string(),
|
|
198
|
+
id: z.string(),
|
|
199
|
+
mode: Mode$inboundSchema,
|
|
200
|
+
code: z.string(),
|
|
201
|
+
profileId: z.string(),
|
|
202
|
+
status: EntityPairingCodeStatus$inboundSchema,
|
|
203
|
+
details: z.nullable(z.lazy(() => EntityPairingCodeDetails$inboundSchema))
|
|
204
|
+
.optional(),
|
|
205
|
+
expiresAt: z.string(),
|
|
206
|
+
revokedAt: z.nullable(z.string()).optional(),
|
|
207
|
+
createdAt: z.string(),
|
|
208
|
+
_links: z.lazy(() => EntityPairingCodeLinks$inboundSchema),
|
|
209
|
+
}).transform((v) => {
|
|
210
|
+
return remap$(v, {
|
|
211
|
+
"_links": "links",
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export function entityPairingCodeFromJSON(
|
|
216
|
+
jsonString: string,
|
|
217
|
+
): SafeParseResult<EntityPairingCode, SDKValidationError> {
|
|
218
|
+
return safeParse(
|
|
219
|
+
jsonString,
|
|
220
|
+
(x) => EntityPairingCode$inboundSchema.parse(JSON.parse(x)),
|
|
221
|
+
`Failed to parse 'EntityPairingCode' from JSON`,
|
|
222
|
+
);
|
|
223
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -61,6 +61,7 @@ export * from "./entityinvoice.js";
|
|
|
61
61
|
export * from "./entitymethodget.js";
|
|
62
62
|
export * from "./entityonboardingstatus.js";
|
|
63
63
|
export * from "./entityorganization.js";
|
|
64
|
+
export * from "./entitypairingcode.js";
|
|
64
65
|
export * from "./entitypaymentroute.js";
|
|
65
66
|
export * from "./entitypaymentrouteresponse.js";
|
|
66
67
|
export * from "./entitypayoutresponse.js";
|
|
@@ -110,6 +110,10 @@ export * from "./requestapplepaypaymentsession.js";
|
|
|
110
110
|
export * from "./returnunmatchedcredittransfer.js";
|
|
111
111
|
export * from "./revokemandate.js";
|
|
112
112
|
export * from "./submitonboardingdata.js";
|
|
113
|
+
export * from "./terminalsgetpairingcode.js";
|
|
114
|
+
export * from "./terminalslistpairingcodes.js";
|
|
115
|
+
export * from "./terminalsrequestpairingcode.js";
|
|
116
|
+
export * from "./terminalsrevokepairingcode.js";
|
|
113
117
|
export * from "./testwebhook.js";
|
|
114
118
|
export * from "./updatecustomer.js";
|
|
115
119
|
export * from "./updatepayment.js";
|