@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.
Files changed (130) hide show
  1. package/README.md +14 -1
  2. package/docs/sdks/bankaccounts/README.md +564 -0
  3. package/examples/accountingTaxRatesList.example.ts +1 -1
  4. package/examples/package-lock.json +1 -1
  5. package/funcs/accountingBankAccountsCreate.d.ts +18 -0
  6. package/funcs/accountingBankAccountsCreate.d.ts.map +1 -0
  7. package/funcs/accountingBankAccountsCreate.js +139 -0
  8. package/funcs/accountingBankAccountsCreate.js.map +1 -0
  9. package/funcs/accountingBankAccountsDelete.d.ts +18 -0
  10. package/funcs/accountingBankAccountsDelete.d.ts.map +1 -0
  11. package/funcs/accountingBankAccountsDelete.js +142 -0
  12. package/funcs/accountingBankAccountsDelete.js.map +1 -0
  13. package/funcs/accountingBankAccountsGet.d.ts +18 -0
  14. package/funcs/accountingBankAccountsGet.d.ts.map +1 -0
  15. package/funcs/accountingBankAccountsGet.js +143 -0
  16. package/funcs/accountingBankAccountsGet.js.map +1 -0
  17. package/funcs/accountingBankAccountsList.d.ts +21 -0
  18. package/funcs/accountingBankAccountsList.d.ts.map +1 -0
  19. package/funcs/accountingBankAccountsList.js +168 -0
  20. package/funcs/accountingBankAccountsList.js.map +1 -0
  21. package/funcs/accountingBankAccountsUpdate.d.ts +18 -0
  22. package/funcs/accountingBankAccountsUpdate.d.ts.map +1 -0
  23. package/funcs/accountingBankAccountsUpdate.js +145 -0
  24. package/funcs/accountingBankAccountsUpdate.js.map +1 -0
  25. package/jsr.json +1 -1
  26. package/lib/config.d.ts +4 -4
  27. package/lib/config.js +4 -4
  28. package/models/components/accountingbankaccount.d.ts +348 -0
  29. package/models/components/accountingbankaccount.d.ts.map +1 -0
  30. package/models/components/accountingbankaccount.js +298 -0
  31. package/models/components/accountingbankaccount.js.map +1 -0
  32. package/models/components/bankaccountsfilter.d.ts +72 -0
  33. package/models/components/bankaccountsfilter.d.ts.map +1 -0
  34. package/models/components/bankaccountsfilter.js +94 -0
  35. package/models/components/bankaccountsfilter.js.map +1 -0
  36. package/models/components/bankaccountssort.d.ts +70 -0
  37. package/models/components/bankaccountssort.d.ts.map +1 -0
  38. package/models/components/bankaccountssort.js +95 -0
  39. package/models/components/bankaccountssort.js.map +1 -0
  40. package/models/components/createbankaccountresponse.d.ts +61 -0
  41. package/models/components/createbankaccountresponse.d.ts.map +1 -0
  42. package/models/components/createbankaccountresponse.js +89 -0
  43. package/models/components/createbankaccountresponse.js.map +1 -0
  44. package/models/components/deletebankaccountresponse.d.ts +61 -0
  45. package/models/components/deletebankaccountresponse.d.ts.map +1 -0
  46. package/models/components/deletebankaccountresponse.js +89 -0
  47. package/models/components/deletebankaccountresponse.js.map +1 -0
  48. package/models/components/getbankaccountresponse.d.ts +58 -0
  49. package/models/components/getbankaccountresponse.d.ts.map +1 -0
  50. package/models/components/getbankaccountresponse.js +89 -0
  51. package/models/components/getbankaccountresponse.js.map +1 -0
  52. package/models/components/getbankaccountsresponse.d.ts +70 -0
  53. package/models/components/getbankaccountsresponse.d.ts.map +1 -0
  54. package/models/components/getbankaccountsresponse.js +95 -0
  55. package/models/components/getbankaccountsresponse.js.map +1 -0
  56. package/models/components/index.d.ts +8 -0
  57. package/models/components/index.d.ts.map +1 -1
  58. package/models/components/index.js +8 -0
  59. package/models/components/index.js.map +1 -1
  60. package/models/components/logsfilter.d.ts +8 -0
  61. package/models/components/logsfilter.d.ts.map +1 -1
  62. package/models/components/logsfilter.js +4 -0
  63. package/models/components/logsfilter.js.map +1 -1
  64. package/models/components/updatebankaccountresponse.d.ts +61 -0
  65. package/models/components/updatebankaccountresponse.d.ts.map +1 -0
  66. package/models/components/updatebankaccountresponse.js +89 -0
  67. package/models/components/updatebankaccountresponse.js.map +1 -0
  68. package/models/errors/index.d.ts +1 -0
  69. package/models/errors/index.d.ts.map +1 -1
  70. package/models/errors/index.js +1 -0
  71. package/models/errors/index.js.map +1 -1
  72. package/models/operations/accountingbankaccountsadd.d.ts +118 -0
  73. package/models/operations/accountingbankaccountsadd.d.ts.map +1 -0
  74. package/models/operations/accountingbankaccountsadd.js +163 -0
  75. package/models/operations/accountingbankaccountsadd.js.map +1 -0
  76. package/models/operations/accountingbankaccountsall.d.ts +150 -0
  77. package/models/operations/accountingbankaccountsall.d.ts.map +1 -0
  78. package/models/operations/accountingbankaccountsall.js +173 -0
  79. package/models/operations/accountingbankaccountsall.js.map +1 -0
  80. package/models/operations/accountingbankaccountsdelete.d.ts +121 -0
  81. package/models/operations/accountingbankaccountsdelete.d.ts.map +1 -0
  82. package/models/operations/accountingbankaccountsdelete.js +155 -0
  83. package/models/operations/accountingbankaccountsdelete.js.map +1 -0
  84. package/models/operations/accountingbankaccountsone.d.ts +126 -0
  85. package/models/operations/accountingbankaccountsone.d.ts.map +1 -0
  86. package/models/operations/accountingbankaccountsone.js +157 -0
  87. package/models/operations/accountingbankaccountsone.js.map +1 -0
  88. package/models/operations/accountingbankaccountsupdate.d.ts +123 -0
  89. package/models/operations/accountingbankaccountsupdate.d.ts.map +1 -0
  90. package/models/operations/accountingbankaccountsupdate.js +165 -0
  91. package/models/operations/accountingbankaccountsupdate.js.map +1 -0
  92. package/models/operations/index.d.ts +5 -0
  93. package/models/operations/index.d.ts.map +1 -1
  94. package/models/operations/index.js +5 -0
  95. package/models/operations/index.js.map +1 -1
  96. package/package.json +1 -1
  97. package/sdk/accounting.d.ts +3 -0
  98. package/sdk/accounting.d.ts.map +1 -1
  99. package/sdk/accounting.js +4 -0
  100. package/sdk/accounting.js.map +1 -1
  101. package/sdk/bankaccounts.d.ts +43 -0
  102. package/sdk/bankaccounts.d.ts.map +1 -0
  103. package/sdk/bankaccounts.js +63 -0
  104. package/sdk/bankaccounts.js.map +1 -0
  105. package/src/__tests__/bankaccounts.test.ts +293 -0
  106. package/src/funcs/accountingBankAccountsCreate.ts +225 -0
  107. package/src/funcs/accountingBankAccountsDelete.ts +231 -0
  108. package/src/funcs/accountingBankAccountsGet.ts +230 -0
  109. package/src/funcs/accountingBankAccountsList.ts +303 -0
  110. package/src/funcs/accountingBankAccountsUpdate.ts +234 -0
  111. package/src/lib/config.ts +4 -4
  112. package/src/models/components/accountingbankaccount.ts +576 -0
  113. package/src/models/components/bankaccountsfilter.ts +113 -0
  114. package/src/models/components/bankaccountssort.ts +113 -0
  115. package/src/models/components/createbankaccountresponse.ts +122 -0
  116. package/src/models/components/deletebankaccountresponse.ts +122 -0
  117. package/src/models/components/getbankaccountresponse.ts +119 -0
  118. package/src/models/components/getbankaccountsresponse.ts +145 -0
  119. package/src/models/components/index.ts +8 -0
  120. package/src/models/components/logsfilter.ts +12 -0
  121. package/src/models/components/updatebankaccountresponse.ts +122 -0
  122. package/src/models/errors/index.ts +1 -0
  123. package/src/models/operations/accountingbankaccountsadd.ts +271 -0
  124. package/src/models/operations/accountingbankaccountsall.ts +309 -0
  125. package/src/models/operations/accountingbankaccountsdelete.ts +274 -0
  126. package/src/models/operations/accountingbankaccountsone.ts +273 -0
  127. package/src/models/operations/accountingbankaccountsupdate.ts +286 -0
  128. package/src/models/operations/index.ts +5 -0
  129. package/src/sdk/accounting.ts +6 -0
  130. package/src/sdk/bankaccounts.ts +105 -0
@@ -0,0 +1,225 @@
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
+ * Create Bank Account
30
+ *
31
+ * @remarks
32
+ * Create Bank Account
33
+ */
34
+ export function accountingBankAccountsCreate(
35
+ client: ApideckCore,
36
+ request: operations.AccountingBankAccountsAddRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.AccountingBankAccountsAddResponse,
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.AccountingBankAccountsAddRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ operations.AccountingBankAccountsAddResponse,
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.AccountingBankAccountsAddRequest$outboundSchema.parse(value),
92
+ "Input validation failed",
93
+ );
94
+ if (!parsed.ok) {
95
+ return [parsed, { status: "invalid" }];
96
+ }
97
+ const payload = parsed.value;
98
+ const body = encodeJSON("body", payload.AccountingBankAccount, {
99
+ explode: true,
100
+ });
101
+
102
+ const path = pathToFunc("/accounting/bank-accounts")();
103
+
104
+ const query = encodeFormQuery({
105
+ "raw": payload.raw,
106
+ });
107
+
108
+ const headers = new Headers(compactMap({
109
+ "Content-Type": "application/json",
110
+ Accept: "application/json",
111
+ "x-apideck-app-id": encodeSimple(
112
+ "x-apideck-app-id",
113
+ payload.appId ?? client._options.appId,
114
+ { explode: false, charEncoding: "none" },
115
+ ),
116
+ "x-apideck-consumer-id": encodeSimple(
117
+ "x-apideck-consumer-id",
118
+ payload.consumerId ?? client._options.consumerId,
119
+ { explode: false, charEncoding: "none" },
120
+ ),
121
+ "x-apideck-service-id": encodeSimple(
122
+ "x-apideck-service-id",
123
+ payload.serviceId,
124
+ { explode: false, charEncoding: "none" },
125
+ ),
126
+ }));
127
+
128
+ const secConfig = await extractSecurity(client._options.apiKey);
129
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
130
+ const requestSecurity = resolveGlobalSecurity(securityInput);
131
+
132
+ const context = {
133
+ options: client._options,
134
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
135
+ operationID: "accounting.bankAccountsAdd",
136
+ oAuth2Scopes: [],
137
+
138
+ resolvedSecurity: requestSecurity,
139
+
140
+ securitySource: client._options.apiKey,
141
+ retryConfig: options?.retries
142
+ || client._options.retryConfig
143
+ || {
144
+ strategy: "backoff",
145
+ backoff: {
146
+ initialInterval: 500,
147
+ maxInterval: 60000,
148
+ exponent: 1.5,
149
+ maxElapsedTime: 3600000,
150
+ },
151
+ retryConnectionErrors: true,
152
+ }
153
+ || { strategy: "none" },
154
+ retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
155
+ };
156
+
157
+ const requestRes = client._createRequest(context, {
158
+ security: requestSecurity,
159
+ method: "POST",
160
+ baseURL: options?.serverURL,
161
+ path: path,
162
+ headers: headers,
163
+ query: query,
164
+ body: body,
165
+ userAgent: client._options.userAgent,
166
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
167
+ }, options);
168
+ if (!requestRes.ok) {
169
+ return [requestRes, { status: "invalid" }];
170
+ }
171
+ const req = requestRes.value;
172
+
173
+ const doResult = await client._do(req, {
174
+ context,
175
+ errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
176
+ retryConfig: context.retryConfig,
177
+ retryCodes: context.retryCodes,
178
+ });
179
+ if (!doResult.ok) {
180
+ return [doResult, { status: "request-error", request: req }];
181
+ }
182
+ const response = doResult.value;
183
+
184
+ const responseFields = {
185
+ HttpMeta: { Response: response, Request: req },
186
+ };
187
+
188
+ const [result] = await M.match<
189
+ operations.AccountingBankAccountsAddResponse,
190
+ | errors.BadRequestResponse
191
+ | errors.UnauthorizedResponse
192
+ | errors.PaymentRequiredResponse
193
+ | errors.NotFoundResponse
194
+ | errors.UnprocessableResponse
195
+ | ApideckError
196
+ | ResponseValidationError
197
+ | ConnectionError
198
+ | RequestAbortedError
199
+ | RequestTimeoutError
200
+ | InvalidRequestError
201
+ | UnexpectedClientError
202
+ | SDKValidationError
203
+ >(
204
+ M.json(201, operations.AccountingBankAccountsAddResponse$inboundSchema, {
205
+ key: "CreateBankAccountResponse",
206
+ }),
207
+ M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
208
+ M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
209
+ M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
210
+ M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
211
+ M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
212
+ M.fail("4XX"),
213
+ M.fail("5XX"),
214
+ M.json(
215
+ "default",
216
+ operations.AccountingBankAccountsAddResponse$inboundSchema,
217
+ { key: "UnexpectedErrorResponse" },
218
+ ),
219
+ )(response, req, { extraFields: responseFields });
220
+ if (!result.ok) {
221
+ return [result, { status: "complete", request: req, response }];
222
+ }
223
+
224
+ return [result, { status: "complete", request: req, response }];
225
+ }
@@ -0,0 +1,231 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import { encodeFormQuery, 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
+ * Delete Bank Account
30
+ *
31
+ * @remarks
32
+ * Delete Bank Account
33
+ */
34
+ export function accountingBankAccountsDelete(
35
+ client: ApideckCore,
36
+ request: operations.AccountingBankAccountsDeleteRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.AccountingBankAccountsDeleteResponse,
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.AccountingBankAccountsDeleteRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ operations.AccountingBankAccountsDeleteResponse,
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.AccountingBankAccountsDeleteRequest$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 = null;
101
+
102
+ const pathParams = {
103
+ id: encodeSimple("id", payload.id, {
104
+ explode: false,
105
+ charEncoding: "percent",
106
+ }),
107
+ };
108
+
109
+ const path = pathToFunc("/accounting/bank-accounts/{id}")(pathParams);
110
+
111
+ const query = encodeFormQuery({
112
+ "raw": payload.raw,
113
+ });
114
+
115
+ const headers = new Headers(compactMap({
116
+ Accept: "application/json",
117
+ "x-apideck-app-id": encodeSimple(
118
+ "x-apideck-app-id",
119
+ payload.appId ?? client._options.appId,
120
+ { explode: false, charEncoding: "none" },
121
+ ),
122
+ "x-apideck-consumer-id": encodeSimple(
123
+ "x-apideck-consumer-id",
124
+ payload.consumerId ?? client._options.consumerId,
125
+ { explode: false, charEncoding: "none" },
126
+ ),
127
+ "x-apideck-service-id": encodeSimple(
128
+ "x-apideck-service-id",
129
+ payload.serviceId,
130
+ { explode: false, charEncoding: "none" },
131
+ ),
132
+ }));
133
+
134
+ const secConfig = await extractSecurity(client._options.apiKey);
135
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
136
+ const requestSecurity = resolveGlobalSecurity(securityInput);
137
+
138
+ const context = {
139
+ options: client._options,
140
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
141
+ operationID: "accounting.bankAccountsDelete",
142
+ oAuth2Scopes: [],
143
+
144
+ resolvedSecurity: requestSecurity,
145
+
146
+ securitySource: client._options.apiKey,
147
+ retryConfig: options?.retries
148
+ || client._options.retryConfig
149
+ || {
150
+ strategy: "backoff",
151
+ backoff: {
152
+ initialInterval: 500,
153
+ maxInterval: 60000,
154
+ exponent: 1.5,
155
+ maxElapsedTime: 3600000,
156
+ },
157
+ retryConnectionErrors: true,
158
+ }
159
+ || { strategy: "none" },
160
+ retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
161
+ };
162
+
163
+ const requestRes = client._createRequest(context, {
164
+ security: requestSecurity,
165
+ method: "DELETE",
166
+ baseURL: options?.serverURL,
167
+ path: path,
168
+ headers: headers,
169
+ query: query,
170
+ body: body,
171
+ userAgent: client._options.userAgent,
172
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
173
+ }, options);
174
+ if (!requestRes.ok) {
175
+ return [requestRes, { status: "invalid" }];
176
+ }
177
+ const req = requestRes.value;
178
+
179
+ const doResult = await client._do(req, {
180
+ context,
181
+ errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
182
+ retryConfig: context.retryConfig,
183
+ retryCodes: context.retryCodes,
184
+ });
185
+ if (!doResult.ok) {
186
+ return [doResult, { status: "request-error", request: req }];
187
+ }
188
+ const response = doResult.value;
189
+
190
+ const responseFields = {
191
+ HttpMeta: { Response: response, Request: req },
192
+ };
193
+
194
+ const [result] = await M.match<
195
+ operations.AccountingBankAccountsDeleteResponse,
196
+ | errors.BadRequestResponse
197
+ | errors.UnauthorizedResponse
198
+ | errors.PaymentRequiredResponse
199
+ | errors.NotFoundResponse
200
+ | errors.UnprocessableResponse
201
+ | ApideckError
202
+ | ResponseValidationError
203
+ | ConnectionError
204
+ | RequestAbortedError
205
+ | RequestTimeoutError
206
+ | InvalidRequestError
207
+ | UnexpectedClientError
208
+ | SDKValidationError
209
+ >(
210
+ M.json(200, operations.AccountingBankAccountsDeleteResponse$inboundSchema, {
211
+ key: "DeleteBankAccountResponse",
212
+ }),
213
+ M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
214
+ M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
215
+ M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
216
+ M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
217
+ M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
218
+ M.fail("4XX"),
219
+ M.fail("5XX"),
220
+ M.json(
221
+ "default",
222
+ operations.AccountingBankAccountsDeleteResponse$inboundSchema,
223
+ { key: "UnexpectedErrorResponse" },
224
+ ),
225
+ )(response, req, { extraFields: responseFields });
226
+ if (!result.ok) {
227
+ return [result, { status: "complete", request: req, response }];
228
+ }
229
+
230
+ return [result, { status: "complete", request: req, response }];
231
+ }
@@ -0,0 +1,230 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import { encodeFormQuery, 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
+ * Get Bank Account
30
+ *
31
+ * @remarks
32
+ * Get Bank Account
33
+ */
34
+ export function accountingBankAccountsGet(
35
+ client: ApideckCore,
36
+ request: operations.AccountingBankAccountsOneRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.AccountingBankAccountsOneResponse,
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.AccountingBankAccountsOneRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ operations.AccountingBankAccountsOneResponse,
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.AccountingBankAccountsOneRequest$outboundSchema.parse(value),
92
+ "Input validation failed",
93
+ );
94
+ if (!parsed.ok) {
95
+ return [parsed, { status: "invalid" }];
96
+ }
97
+ const payload = parsed.value;
98
+ const body = null;
99
+
100
+ const pathParams = {
101
+ id: encodeSimple("id", payload.id, {
102
+ explode: false,
103
+ charEncoding: "percent",
104
+ }),
105
+ };
106
+
107
+ const path = pathToFunc("/accounting/bank-accounts/{id}")(pathParams);
108
+
109
+ const query = encodeFormQuery({
110
+ "fields": payload.fields,
111
+ "raw": payload.raw,
112
+ });
113
+
114
+ const headers = new Headers(compactMap({
115
+ Accept: "application/json",
116
+ "x-apideck-app-id": encodeSimple(
117
+ "x-apideck-app-id",
118
+ payload.appId ?? client._options.appId,
119
+ { explode: false, charEncoding: "none" },
120
+ ),
121
+ "x-apideck-consumer-id": encodeSimple(
122
+ "x-apideck-consumer-id",
123
+ payload.consumerId ?? client._options.consumerId,
124
+ { explode: false, charEncoding: "none" },
125
+ ),
126
+ "x-apideck-service-id": encodeSimple(
127
+ "x-apideck-service-id",
128
+ payload.serviceId,
129
+ { explode: false, charEncoding: "none" },
130
+ ),
131
+ }));
132
+
133
+ const secConfig = await extractSecurity(client._options.apiKey);
134
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
135
+ const requestSecurity = resolveGlobalSecurity(securityInput);
136
+
137
+ const context = {
138
+ options: client._options,
139
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
140
+ operationID: "accounting.bankAccountsOne",
141
+ oAuth2Scopes: [],
142
+
143
+ resolvedSecurity: requestSecurity,
144
+
145
+ securitySource: client._options.apiKey,
146
+ retryConfig: options?.retries
147
+ || client._options.retryConfig
148
+ || {
149
+ strategy: "backoff",
150
+ backoff: {
151
+ initialInterval: 500,
152
+ maxInterval: 60000,
153
+ exponent: 1.5,
154
+ maxElapsedTime: 3600000,
155
+ },
156
+ retryConnectionErrors: true,
157
+ }
158
+ || { strategy: "none" },
159
+ retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
160
+ };
161
+
162
+ const requestRes = client._createRequest(context, {
163
+ security: requestSecurity,
164
+ method: "GET",
165
+ baseURL: options?.serverURL,
166
+ path: path,
167
+ headers: headers,
168
+ query: query,
169
+ body: body,
170
+ userAgent: client._options.userAgent,
171
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
172
+ }, options);
173
+ if (!requestRes.ok) {
174
+ return [requestRes, { status: "invalid" }];
175
+ }
176
+ const req = requestRes.value;
177
+
178
+ const doResult = await client._do(req, {
179
+ context,
180
+ errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
181
+ retryConfig: context.retryConfig,
182
+ retryCodes: context.retryCodes,
183
+ });
184
+ if (!doResult.ok) {
185
+ return [doResult, { status: "request-error", request: req }];
186
+ }
187
+ const response = doResult.value;
188
+
189
+ const responseFields = {
190
+ HttpMeta: { Response: response, Request: req },
191
+ };
192
+
193
+ const [result] = await M.match<
194
+ operations.AccountingBankAccountsOneResponse,
195
+ | errors.BadRequestResponse
196
+ | errors.UnauthorizedResponse
197
+ | errors.PaymentRequiredResponse
198
+ | errors.NotFoundResponse
199
+ | errors.UnprocessableResponse
200
+ | ApideckError
201
+ | ResponseValidationError
202
+ | ConnectionError
203
+ | RequestAbortedError
204
+ | RequestTimeoutError
205
+ | InvalidRequestError
206
+ | UnexpectedClientError
207
+ | SDKValidationError
208
+ >(
209
+ M.json(200, operations.AccountingBankAccountsOneResponse$inboundSchema, {
210
+ key: "GetBankAccountResponse",
211
+ }),
212
+ M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
213
+ M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
214
+ M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
215
+ M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
216
+ M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
217
+ M.fail("4XX"),
218
+ M.fail("5XX"),
219
+ M.json(
220
+ "default",
221
+ operations.AccountingBankAccountsOneResponse$inboundSchema,
222
+ { key: "UnexpectedErrorResponse" },
223
+ ),
224
+ )(response, req, { extraFields: responseFields });
225
+ if (!result.ok) {
226
+ return [result, { status: "complete", request: req, response }];
227
+ }
228
+
229
+ return [result, { status: "complete", request: req, response }];
230
+ }