@apideck/unify 0.29.8 → 0.29.9
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 +14 -1
- package/docs/sdks/bankaccounts/README.md +564 -0
- package/examples/accountingTaxRatesList.example.ts +1 -1
- package/examples/package-lock.json +1 -1
- package/funcs/accountingBankAccountsCreate.d.ts +18 -0
- package/funcs/accountingBankAccountsCreate.d.ts.map +1 -0
- package/funcs/accountingBankAccountsCreate.js +139 -0
- package/funcs/accountingBankAccountsCreate.js.map +1 -0
- package/funcs/accountingBankAccountsDelete.d.ts +18 -0
- package/funcs/accountingBankAccountsDelete.d.ts.map +1 -0
- package/funcs/accountingBankAccountsDelete.js +142 -0
- package/funcs/accountingBankAccountsDelete.js.map +1 -0
- package/funcs/accountingBankAccountsGet.d.ts +18 -0
- package/funcs/accountingBankAccountsGet.d.ts.map +1 -0
- package/funcs/accountingBankAccountsGet.js +143 -0
- package/funcs/accountingBankAccountsGet.js.map +1 -0
- package/funcs/accountingBankAccountsList.d.ts +21 -0
- package/funcs/accountingBankAccountsList.d.ts.map +1 -0
- package/funcs/accountingBankAccountsList.js +168 -0
- package/funcs/accountingBankAccountsList.js.map +1 -0
- package/funcs/accountingBankAccountsUpdate.d.ts +18 -0
- package/funcs/accountingBankAccountsUpdate.d.ts.map +1 -0
- package/funcs/accountingBankAccountsUpdate.js +145 -0
- package/funcs/accountingBankAccountsUpdate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/models/components/accountingbankaccount.d.ts +348 -0
- package/models/components/accountingbankaccount.d.ts.map +1 -0
- package/models/components/accountingbankaccount.js +298 -0
- package/models/components/accountingbankaccount.js.map +1 -0
- package/models/components/bankaccountsfilter.d.ts +72 -0
- package/models/components/bankaccountsfilter.d.ts.map +1 -0
- package/models/components/bankaccountsfilter.js +94 -0
- package/models/components/bankaccountsfilter.js.map +1 -0
- package/models/components/bankaccountssort.d.ts +70 -0
- package/models/components/bankaccountssort.d.ts.map +1 -0
- package/models/components/bankaccountssort.js +95 -0
- package/models/components/bankaccountssort.js.map +1 -0
- package/models/components/createbankaccountresponse.d.ts +61 -0
- package/models/components/createbankaccountresponse.d.ts.map +1 -0
- package/models/components/createbankaccountresponse.js +89 -0
- package/models/components/createbankaccountresponse.js.map +1 -0
- package/models/components/deletebankaccountresponse.d.ts +61 -0
- package/models/components/deletebankaccountresponse.d.ts.map +1 -0
- package/models/components/deletebankaccountresponse.js +89 -0
- package/models/components/deletebankaccountresponse.js.map +1 -0
- package/models/components/getbankaccountresponse.d.ts +58 -0
- package/models/components/getbankaccountresponse.d.ts.map +1 -0
- package/models/components/getbankaccountresponse.js +89 -0
- package/models/components/getbankaccountresponse.js.map +1 -0
- package/models/components/getbankaccountsresponse.d.ts +70 -0
- package/models/components/getbankaccountsresponse.d.ts.map +1 -0
- package/models/components/getbankaccountsresponse.js +95 -0
- package/models/components/getbankaccountsresponse.js.map +1 -0
- 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/logsfilter.d.ts +8 -0
- package/models/components/logsfilter.d.ts.map +1 -1
- package/models/components/logsfilter.js +4 -0
- package/models/components/logsfilter.js.map +1 -1
- package/models/components/updatebankaccountresponse.d.ts +61 -0
- package/models/components/updatebankaccountresponse.d.ts.map +1 -0
- package/models/components/updatebankaccountresponse.js +89 -0
- package/models/components/updatebankaccountresponse.js.map +1 -0
- package/models/errors/index.d.ts +1 -0
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -0
- package/models/errors/index.js.map +1 -1
- package/models/operations/accountingbankaccountsadd.d.ts +118 -0
- package/models/operations/accountingbankaccountsadd.d.ts.map +1 -0
- package/models/operations/accountingbankaccountsadd.js +163 -0
- package/models/operations/accountingbankaccountsadd.js.map +1 -0
- package/models/operations/accountingbankaccountsall.d.ts +150 -0
- package/models/operations/accountingbankaccountsall.d.ts.map +1 -0
- package/models/operations/accountingbankaccountsall.js +173 -0
- package/models/operations/accountingbankaccountsall.js.map +1 -0
- package/models/operations/accountingbankaccountsdelete.d.ts +121 -0
- package/models/operations/accountingbankaccountsdelete.d.ts.map +1 -0
- package/models/operations/accountingbankaccountsdelete.js +155 -0
- package/models/operations/accountingbankaccountsdelete.js.map +1 -0
- package/models/operations/accountingbankaccountsone.d.ts +126 -0
- package/models/operations/accountingbankaccountsone.d.ts.map +1 -0
- package/models/operations/accountingbankaccountsone.js +157 -0
- package/models/operations/accountingbankaccountsone.js.map +1 -0
- package/models/operations/accountingbankaccountsupdate.d.ts +123 -0
- package/models/operations/accountingbankaccountsupdate.d.ts.map +1 -0
- package/models/operations/accountingbankaccountsupdate.js +165 -0
- package/models/operations/accountingbankaccountsupdate.js.map +1 -0
- package/models/operations/index.d.ts +5 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +5 -0
- package/models/operations/index.js.map +1 -1
- package/package.json +1 -1
- package/sdk/accounting.d.ts +3 -0
- package/sdk/accounting.d.ts.map +1 -1
- package/sdk/accounting.js +4 -0
- package/sdk/accounting.js.map +1 -1
- package/sdk/bankaccounts.d.ts +43 -0
- package/sdk/bankaccounts.d.ts.map +1 -0
- package/sdk/bankaccounts.js +63 -0
- package/sdk/bankaccounts.js.map +1 -0
- package/src/__tests__/bankaccounts.test.ts +293 -0
- package/src/funcs/accountingBankAccountsCreate.ts +225 -0
- package/src/funcs/accountingBankAccountsDelete.ts +231 -0
- package/src/funcs/accountingBankAccountsGet.ts +230 -0
- package/src/funcs/accountingBankAccountsList.ts +303 -0
- package/src/funcs/accountingBankAccountsUpdate.ts +234 -0
- package/src/lib/config.ts +4 -4
- package/src/models/components/accountingbankaccount.ts +576 -0
- package/src/models/components/bankaccountsfilter.ts +113 -0
- package/src/models/components/bankaccountssort.ts +113 -0
- package/src/models/components/createbankaccountresponse.ts +122 -0
- package/src/models/components/deletebankaccountresponse.ts +122 -0
- package/src/models/components/getbankaccountresponse.ts +119 -0
- package/src/models/components/getbankaccountsresponse.ts +145 -0
- package/src/models/components/index.ts +8 -0
- package/src/models/components/logsfilter.ts +12 -0
- package/src/models/components/updatebankaccountresponse.ts +122 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/operations/accountingbankaccountsadd.ts +271 -0
- package/src/models/operations/accountingbankaccountsall.ts +309 -0
- package/src/models/operations/accountingbankaccountsdelete.ts +274 -0
- package/src/models/operations/accountingbankaccountsone.ts +273 -0
- package/src/models/operations/accountingbankaccountsupdate.ts +286 -0
- package/src/models/operations/index.ts +5 -0
- package/src/sdk/accounting.ts +6 -0
- package/src/sdk/bankaccounts.ts +105 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { ApideckCore } from "../core.js";
|
|
6
|
+
import { dlv } from "../lib/dlv.js";
|
|
7
|
+
import {
|
|
8
|
+
encodeDeepObjectQuery,
|
|
9
|
+
encodeFormQuery,
|
|
10
|
+
encodeSimple,
|
|
11
|
+
queryJoin,
|
|
12
|
+
} from "../lib/encodings.js";
|
|
13
|
+
import * as M from "../lib/matchers.js";
|
|
14
|
+
import { compactMap } from "../lib/primitives.js";
|
|
15
|
+
import { safeParse } from "../lib/schemas.js";
|
|
16
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
17
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
18
|
+
import { pathToFunc } from "../lib/url.js";
|
|
19
|
+
import { ApideckError } from "../models/errors/apideckerror.js";
|
|
20
|
+
import {
|
|
21
|
+
ConnectionError,
|
|
22
|
+
InvalidRequestError,
|
|
23
|
+
RequestAbortedError,
|
|
24
|
+
RequestTimeoutError,
|
|
25
|
+
UnexpectedClientError,
|
|
26
|
+
} from "../models/errors/httpclienterrors.js";
|
|
27
|
+
import * as errors from "../models/errors/index.js";
|
|
28
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
29
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
30
|
+
import * as operations from "../models/operations/index.js";
|
|
31
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
32
|
+
import { Result } from "../types/fp.js";
|
|
33
|
+
import {
|
|
34
|
+
createPageIterator,
|
|
35
|
+
haltIterator,
|
|
36
|
+
PageIterator,
|
|
37
|
+
Paginator,
|
|
38
|
+
} from "../types/operations.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* List Bank Accounts
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* List Bank Accounts
|
|
45
|
+
*/
|
|
46
|
+
export function accountingBankAccountsList(
|
|
47
|
+
client: ApideckCore,
|
|
48
|
+
request: operations.AccountingBankAccountsAllRequest,
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): APIPromise<
|
|
51
|
+
PageIterator<
|
|
52
|
+
Result<
|
|
53
|
+
operations.AccountingBankAccountsAllResponse,
|
|
54
|
+
| errors.BadRequestResponse
|
|
55
|
+
| errors.UnauthorizedResponse
|
|
56
|
+
| errors.PaymentRequiredResponse
|
|
57
|
+
| errors.NotFoundResponse
|
|
58
|
+
| errors.UnprocessableResponse
|
|
59
|
+
| ApideckError
|
|
60
|
+
| ResponseValidationError
|
|
61
|
+
| ConnectionError
|
|
62
|
+
| RequestAbortedError
|
|
63
|
+
| RequestTimeoutError
|
|
64
|
+
| InvalidRequestError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| SDKValidationError
|
|
67
|
+
>,
|
|
68
|
+
{ cursor: string }
|
|
69
|
+
>
|
|
70
|
+
> {
|
|
71
|
+
return new APIPromise($do(
|
|
72
|
+
client,
|
|
73
|
+
request,
|
|
74
|
+
options,
|
|
75
|
+
));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function $do(
|
|
79
|
+
client: ApideckCore,
|
|
80
|
+
request: operations.AccountingBankAccountsAllRequest,
|
|
81
|
+
options?: RequestOptions,
|
|
82
|
+
): Promise<
|
|
83
|
+
[
|
|
84
|
+
PageIterator<
|
|
85
|
+
Result<
|
|
86
|
+
operations.AccountingBankAccountsAllResponse,
|
|
87
|
+
| errors.BadRequestResponse
|
|
88
|
+
| errors.UnauthorizedResponse
|
|
89
|
+
| errors.PaymentRequiredResponse
|
|
90
|
+
| errors.NotFoundResponse
|
|
91
|
+
| errors.UnprocessableResponse
|
|
92
|
+
| ApideckError
|
|
93
|
+
| ResponseValidationError
|
|
94
|
+
| ConnectionError
|
|
95
|
+
| RequestAbortedError
|
|
96
|
+
| RequestTimeoutError
|
|
97
|
+
| InvalidRequestError
|
|
98
|
+
| UnexpectedClientError
|
|
99
|
+
| SDKValidationError
|
|
100
|
+
>,
|
|
101
|
+
{ cursor: string }
|
|
102
|
+
>,
|
|
103
|
+
APICall,
|
|
104
|
+
]
|
|
105
|
+
> {
|
|
106
|
+
const parsed = safeParse(
|
|
107
|
+
request,
|
|
108
|
+
(value) =>
|
|
109
|
+
operations.AccountingBankAccountsAllRequest$outboundSchema.parse(value),
|
|
110
|
+
"Input validation failed",
|
|
111
|
+
);
|
|
112
|
+
if (!parsed.ok) {
|
|
113
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
114
|
+
}
|
|
115
|
+
const payload = parsed.value;
|
|
116
|
+
const body = null;
|
|
117
|
+
|
|
118
|
+
const path = pathToFunc("/accounting/bank-accounts")();
|
|
119
|
+
|
|
120
|
+
const query = queryJoin(
|
|
121
|
+
encodeDeepObjectQuery({
|
|
122
|
+
"filter": payload.filter,
|
|
123
|
+
"pass_through": payload.pass_through,
|
|
124
|
+
"sort": payload.sort,
|
|
125
|
+
}),
|
|
126
|
+
encodeFormQuery({
|
|
127
|
+
"cursor": payload.cursor,
|
|
128
|
+
"fields": payload.fields,
|
|
129
|
+
"limit": payload.limit,
|
|
130
|
+
"raw": payload.raw,
|
|
131
|
+
}),
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const headers = new Headers(compactMap({
|
|
135
|
+
Accept: "application/json",
|
|
136
|
+
"x-apideck-app-id": encodeSimple(
|
|
137
|
+
"x-apideck-app-id",
|
|
138
|
+
payload.appId ?? client._options.appId,
|
|
139
|
+
{ explode: false, charEncoding: "none" },
|
|
140
|
+
),
|
|
141
|
+
"x-apideck-consumer-id": encodeSimple(
|
|
142
|
+
"x-apideck-consumer-id",
|
|
143
|
+
payload.consumerId ?? client._options.consumerId,
|
|
144
|
+
{ explode: false, charEncoding: "none" },
|
|
145
|
+
),
|
|
146
|
+
"x-apideck-service-id": encodeSimple(
|
|
147
|
+
"x-apideck-service-id",
|
|
148
|
+
payload.serviceId,
|
|
149
|
+
{ explode: false, charEncoding: "none" },
|
|
150
|
+
),
|
|
151
|
+
}));
|
|
152
|
+
|
|
153
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
154
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
155
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
156
|
+
|
|
157
|
+
const context = {
|
|
158
|
+
options: client._options,
|
|
159
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
160
|
+
operationID: "accounting.bankAccountsAll",
|
|
161
|
+
oAuth2Scopes: [],
|
|
162
|
+
|
|
163
|
+
resolvedSecurity: requestSecurity,
|
|
164
|
+
|
|
165
|
+
securitySource: client._options.apiKey,
|
|
166
|
+
retryConfig: options?.retries
|
|
167
|
+
|| client._options.retryConfig
|
|
168
|
+
|| {
|
|
169
|
+
strategy: "backoff",
|
|
170
|
+
backoff: {
|
|
171
|
+
initialInterval: 500,
|
|
172
|
+
maxInterval: 60000,
|
|
173
|
+
exponent: 1.5,
|
|
174
|
+
maxElapsedTime: 3600000,
|
|
175
|
+
},
|
|
176
|
+
retryConnectionErrors: true,
|
|
177
|
+
}
|
|
178
|
+
|| { strategy: "none" },
|
|
179
|
+
retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const requestRes = client._createRequest(context, {
|
|
183
|
+
security: requestSecurity,
|
|
184
|
+
method: "GET",
|
|
185
|
+
baseURL: options?.serverURL,
|
|
186
|
+
path: path,
|
|
187
|
+
headers: headers,
|
|
188
|
+
query: query,
|
|
189
|
+
body: body,
|
|
190
|
+
userAgent: client._options.userAgent,
|
|
191
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
192
|
+
}, options);
|
|
193
|
+
if (!requestRes.ok) {
|
|
194
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
195
|
+
}
|
|
196
|
+
const req = requestRes.value;
|
|
197
|
+
|
|
198
|
+
const doResult = await client._do(req, {
|
|
199
|
+
context,
|
|
200
|
+
errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
|
|
201
|
+
retryConfig: context.retryConfig,
|
|
202
|
+
retryCodes: context.retryCodes,
|
|
203
|
+
});
|
|
204
|
+
if (!doResult.ok) {
|
|
205
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
206
|
+
}
|
|
207
|
+
const response = doResult.value;
|
|
208
|
+
|
|
209
|
+
const responseFields = {
|
|
210
|
+
HttpMeta: { Response: response, Request: req },
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const [result, raw] = await M.match<
|
|
214
|
+
operations.AccountingBankAccountsAllResponse,
|
|
215
|
+
| errors.BadRequestResponse
|
|
216
|
+
| errors.UnauthorizedResponse
|
|
217
|
+
| errors.PaymentRequiredResponse
|
|
218
|
+
| errors.NotFoundResponse
|
|
219
|
+
| errors.UnprocessableResponse
|
|
220
|
+
| ApideckError
|
|
221
|
+
| ResponseValidationError
|
|
222
|
+
| ConnectionError
|
|
223
|
+
| RequestAbortedError
|
|
224
|
+
| RequestTimeoutError
|
|
225
|
+
| InvalidRequestError
|
|
226
|
+
| UnexpectedClientError
|
|
227
|
+
| SDKValidationError
|
|
228
|
+
>(
|
|
229
|
+
M.json(200, operations.AccountingBankAccountsAllResponse$inboundSchema, {
|
|
230
|
+
key: "GetBankAccountsResponse",
|
|
231
|
+
}),
|
|
232
|
+
M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
|
|
233
|
+
M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
|
|
234
|
+
M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
|
|
235
|
+
M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
|
|
236
|
+
M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
|
|
237
|
+
M.fail("4XX"),
|
|
238
|
+
M.fail("5XX"),
|
|
239
|
+
M.json(
|
|
240
|
+
"default",
|
|
241
|
+
operations.AccountingBankAccountsAllResponse$inboundSchema,
|
|
242
|
+
{ key: "UnexpectedErrorResponse" },
|
|
243
|
+
),
|
|
244
|
+
)(response, req, { extraFields: responseFields });
|
|
245
|
+
if (!result.ok) {
|
|
246
|
+
return [haltIterator(result), {
|
|
247
|
+
status: "complete",
|
|
248
|
+
request: req,
|
|
249
|
+
response,
|
|
250
|
+
}];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const nextFunc = (
|
|
254
|
+
responseData: unknown,
|
|
255
|
+
): {
|
|
256
|
+
next: Paginator<
|
|
257
|
+
Result<
|
|
258
|
+
operations.AccountingBankAccountsAllResponse,
|
|
259
|
+
| errors.BadRequestResponse
|
|
260
|
+
| errors.UnauthorizedResponse
|
|
261
|
+
| errors.PaymentRequiredResponse
|
|
262
|
+
| errors.NotFoundResponse
|
|
263
|
+
| errors.UnprocessableResponse
|
|
264
|
+
| ApideckError
|
|
265
|
+
| ResponseValidationError
|
|
266
|
+
| ConnectionError
|
|
267
|
+
| RequestAbortedError
|
|
268
|
+
| RequestTimeoutError
|
|
269
|
+
| InvalidRequestError
|
|
270
|
+
| UnexpectedClientError
|
|
271
|
+
| SDKValidationError
|
|
272
|
+
>
|
|
273
|
+
>;
|
|
274
|
+
"~next"?: { cursor: string };
|
|
275
|
+
} => {
|
|
276
|
+
const nextCursor = dlv(responseData, "meta.cursors.next");
|
|
277
|
+
if (typeof nextCursor !== "string") {
|
|
278
|
+
return { next: () => null };
|
|
279
|
+
}
|
|
280
|
+
if (nextCursor.trim() === "") {
|
|
281
|
+
return { next: () => null };
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const nextVal = () =>
|
|
285
|
+
accountingBankAccountsList(
|
|
286
|
+
client,
|
|
287
|
+
{
|
|
288
|
+
...request,
|
|
289
|
+
cursor: nextCursor,
|
|
290
|
+
},
|
|
291
|
+
options,
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
return { next: nextVal, "~next": { cursor: nextCursor } };
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
298
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
299
|
+
status: "complete",
|
|
300
|
+
request: req,
|
|
301
|
+
response,
|
|
302
|
+
}];
|
|
303
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { ApideckCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, 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 { ApideckError } from "../models/errors/apideckerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Update Bank Account
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Update Bank Account
|
|
33
|
+
*/
|
|
34
|
+
export function accountingBankAccountsUpdate(
|
|
35
|
+
client: ApideckCore,
|
|
36
|
+
request: operations.AccountingBankAccountsUpdateRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
operations.AccountingBankAccountsUpdateResponse,
|
|
41
|
+
| errors.BadRequestResponse
|
|
42
|
+
| errors.UnauthorizedResponse
|
|
43
|
+
| errors.PaymentRequiredResponse
|
|
44
|
+
| errors.NotFoundResponse
|
|
45
|
+
| errors.UnprocessableResponse
|
|
46
|
+
| ApideckError
|
|
47
|
+
| ResponseValidationError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
| RequestAbortedError
|
|
50
|
+
| RequestTimeoutError
|
|
51
|
+
| InvalidRequestError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| SDKValidationError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: ApideckCore,
|
|
65
|
+
request: operations.AccountingBankAccountsUpdateRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
operations.AccountingBankAccountsUpdateResponse,
|
|
71
|
+
| errors.BadRequestResponse
|
|
72
|
+
| errors.UnauthorizedResponse
|
|
73
|
+
| errors.PaymentRequiredResponse
|
|
74
|
+
| errors.NotFoundResponse
|
|
75
|
+
| errors.UnprocessableResponse
|
|
76
|
+
| ApideckError
|
|
77
|
+
| ResponseValidationError
|
|
78
|
+
| ConnectionError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| InvalidRequestError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| SDKValidationError
|
|
84
|
+
>,
|
|
85
|
+
APICall,
|
|
86
|
+
]
|
|
87
|
+
> {
|
|
88
|
+
const parsed = safeParse(
|
|
89
|
+
request,
|
|
90
|
+
(value) =>
|
|
91
|
+
operations.AccountingBankAccountsUpdateRequest$outboundSchema.parse(
|
|
92
|
+
value,
|
|
93
|
+
),
|
|
94
|
+
"Input validation failed",
|
|
95
|
+
);
|
|
96
|
+
if (!parsed.ok) {
|
|
97
|
+
return [parsed, { status: "invalid" }];
|
|
98
|
+
}
|
|
99
|
+
const payload = parsed.value;
|
|
100
|
+
const body = encodeJSON("body", payload.AccountingBankAccount, {
|
|
101
|
+
explode: true,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const pathParams = {
|
|
105
|
+
id: encodeSimple("id", payload.id, {
|
|
106
|
+
explode: false,
|
|
107
|
+
charEncoding: "percent",
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const path = pathToFunc("/accounting/bank-accounts/{id}")(pathParams);
|
|
112
|
+
|
|
113
|
+
const query = encodeFormQuery({
|
|
114
|
+
"raw": payload.raw,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const headers = new Headers(compactMap({
|
|
118
|
+
"Content-Type": "application/json",
|
|
119
|
+
Accept: "application/json",
|
|
120
|
+
"x-apideck-app-id": encodeSimple(
|
|
121
|
+
"x-apideck-app-id",
|
|
122
|
+
payload.appId ?? client._options.appId,
|
|
123
|
+
{ explode: false, charEncoding: "none" },
|
|
124
|
+
),
|
|
125
|
+
"x-apideck-consumer-id": encodeSimple(
|
|
126
|
+
"x-apideck-consumer-id",
|
|
127
|
+
payload.consumerId ?? client._options.consumerId,
|
|
128
|
+
{ explode: false, charEncoding: "none" },
|
|
129
|
+
),
|
|
130
|
+
"x-apideck-service-id": encodeSimple(
|
|
131
|
+
"x-apideck-service-id",
|
|
132
|
+
payload.serviceId,
|
|
133
|
+
{ explode: false, charEncoding: "none" },
|
|
134
|
+
),
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
138
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
139
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
140
|
+
|
|
141
|
+
const context = {
|
|
142
|
+
options: client._options,
|
|
143
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
144
|
+
operationID: "accounting.bankAccountsUpdate",
|
|
145
|
+
oAuth2Scopes: [],
|
|
146
|
+
|
|
147
|
+
resolvedSecurity: requestSecurity,
|
|
148
|
+
|
|
149
|
+
securitySource: client._options.apiKey,
|
|
150
|
+
retryConfig: options?.retries
|
|
151
|
+
|| client._options.retryConfig
|
|
152
|
+
|| {
|
|
153
|
+
strategy: "backoff",
|
|
154
|
+
backoff: {
|
|
155
|
+
initialInterval: 500,
|
|
156
|
+
maxInterval: 60000,
|
|
157
|
+
exponent: 1.5,
|
|
158
|
+
maxElapsedTime: 3600000,
|
|
159
|
+
},
|
|
160
|
+
retryConnectionErrors: true,
|
|
161
|
+
}
|
|
162
|
+
|| { strategy: "none" },
|
|
163
|
+
retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const requestRes = client._createRequest(context, {
|
|
167
|
+
security: requestSecurity,
|
|
168
|
+
method: "PATCH",
|
|
169
|
+
baseURL: options?.serverURL,
|
|
170
|
+
path: path,
|
|
171
|
+
headers: headers,
|
|
172
|
+
query: query,
|
|
173
|
+
body: body,
|
|
174
|
+
userAgent: client._options.userAgent,
|
|
175
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
176
|
+
}, options);
|
|
177
|
+
if (!requestRes.ok) {
|
|
178
|
+
return [requestRes, { status: "invalid" }];
|
|
179
|
+
}
|
|
180
|
+
const req = requestRes.value;
|
|
181
|
+
|
|
182
|
+
const doResult = await client._do(req, {
|
|
183
|
+
context,
|
|
184
|
+
errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
|
|
185
|
+
retryConfig: context.retryConfig,
|
|
186
|
+
retryCodes: context.retryCodes,
|
|
187
|
+
});
|
|
188
|
+
if (!doResult.ok) {
|
|
189
|
+
return [doResult, { status: "request-error", request: req }];
|
|
190
|
+
}
|
|
191
|
+
const response = doResult.value;
|
|
192
|
+
|
|
193
|
+
const responseFields = {
|
|
194
|
+
HttpMeta: { Response: response, Request: req },
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const [result] = await M.match<
|
|
198
|
+
operations.AccountingBankAccountsUpdateResponse,
|
|
199
|
+
| errors.BadRequestResponse
|
|
200
|
+
| errors.UnauthorizedResponse
|
|
201
|
+
| errors.PaymentRequiredResponse
|
|
202
|
+
| errors.NotFoundResponse
|
|
203
|
+
| errors.UnprocessableResponse
|
|
204
|
+
| ApideckError
|
|
205
|
+
| ResponseValidationError
|
|
206
|
+
| ConnectionError
|
|
207
|
+
| RequestAbortedError
|
|
208
|
+
| RequestTimeoutError
|
|
209
|
+
| InvalidRequestError
|
|
210
|
+
| UnexpectedClientError
|
|
211
|
+
| SDKValidationError
|
|
212
|
+
>(
|
|
213
|
+
M.json(200, operations.AccountingBankAccountsUpdateResponse$inboundSchema, {
|
|
214
|
+
key: "UpdateBankAccountResponse",
|
|
215
|
+
}),
|
|
216
|
+
M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
|
|
217
|
+
M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
|
|
218
|
+
M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
|
|
219
|
+
M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
|
|
220
|
+
M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
|
|
221
|
+
M.fail("4XX"),
|
|
222
|
+
M.fail("5XX"),
|
|
223
|
+
M.json(
|
|
224
|
+
"default",
|
|
225
|
+
operations.AccountingBankAccountsUpdateResponse$inboundSchema,
|
|
226
|
+
{ key: "UnexpectedErrorResponse" },
|
|
227
|
+
),
|
|
228
|
+
)(response, req, { extraFields: responseFields });
|
|
229
|
+
if (!result.ok) {
|
|
230
|
+
return [result, { status: "complete", request: req, response }];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return [result, { status: "complete", request: req, response }];
|
|
234
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -67,8 +67,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
67
67
|
|
|
68
68
|
export const SDK_METADATA = {
|
|
69
69
|
language: "typescript",
|
|
70
|
-
openapiDocVersion: "10.20.
|
|
71
|
-
sdkVersion: "0.29.
|
|
72
|
-
genVersion: "2.
|
|
73
|
-
userAgent: "speakeasy-sdk/typescript 0.29.
|
|
70
|
+
openapiDocVersion: "10.20.16",
|
|
71
|
+
sdkVersion: "0.29.9",
|
|
72
|
+
genVersion: "2.709.0",
|
|
73
|
+
userAgent: "speakeasy-sdk/typescript 0.29.9 2.709.0 10.20.16 @apideck/unify",
|
|
74
74
|
} as const;
|