@apideck/unify 0.25.0 → 0.26.0
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 +7 -0
- package/docs/sdks/categories/README.md +181 -0
- package/funcs/accountingCategoriesGet.d.ts +18 -0
- package/funcs/accountingCategoriesGet.d.ts.map +1 -0
- package/funcs/accountingCategoriesGet.js +133 -0
- package/funcs/accountingCategoriesGet.js.map +1 -0
- package/funcs/accountingCategoriesList.d.ts +21 -0
- package/funcs/accountingCategoriesList.d.ts.map +1 -0
- package/funcs/accountingCategoriesList.js +151 -0
- package/funcs/accountingCategoriesList.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/lib/files.d.ts +5 -0
- package/lib/files.d.ts.map +1 -1
- package/lib/files.js +41 -0
- package/lib/files.js.map +1 -1
- package/lib/security.d.ts +2 -2
- package/lib/security.d.ts.map +1 -1
- package/models/components/bill.d.ts +2 -2
- package/models/components/category.d.ts +114 -0
- package/models/components/category.d.ts.map +1 -0
- package/models/components/category.js +121 -0
- package/models/components/category.js.map +1 -0
- package/models/components/contact.d.ts +4 -4
- package/models/components/contact.d.ts.map +1 -1
- package/models/components/contact.js +4 -4
- package/models/components/contact.js.map +1 -1
- package/models/components/expense.d.ts +10 -0
- package/models/components/expense.d.ts.map +1 -1
- package/models/components/expense.js +4 -0
- package/models/components/expense.js.map +1 -1
- package/models/components/formfieldoption.d.ts +6 -6
- package/models/components/formfieldoption.d.ts.map +1 -1
- package/models/components/formfieldoption.js +4 -4
- package/models/components/formfieldoption.js.map +1 -1
- package/models/components/getcategoriesresponse.d.ts +79 -0
- package/models/components/getcategoriesresponse.d.ts.map +1 -0
- package/models/components/getcategoriesresponse.js +89 -0
- package/models/components/getcategoriesresponse.js.map +1 -0
- package/models/components/getcategoryresponse.d.ts +67 -0
- package/models/components/getcategoryresponse.d.ts.map +1 -0
- package/models/components/getcategoryresponse.js +83 -0
- package/models/components/getcategoryresponse.js.map +1 -0
- package/models/components/index.d.ts +3 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +3 -0
- package/models/components/index.js.map +1 -1
- package/models/components/invoice.d.ts +2 -2
- package/models/components/supplier.d.ts +10 -0
- package/models/components/supplier.d.ts.map +1 -1
- package/models/components/supplier.js +8 -0
- package/models/components/supplier.js.map +1 -1
- package/models/operations/accountingcategoriesall.d.ts +131 -0
- package/models/operations/accountingcategoriesall.d.ts.map +1 -0
- package/models/operations/accountingcategoriesall.js +149 -0
- package/models/operations/accountingcategoriesall.js.map +1 -0
- package/models/operations/accountingcategoriesone.d.ts +126 -0
- package/models/operations/accountingcategoriesone.d.ts.map +1 -0
- package/models/operations/accountingcategoriesone.js +145 -0
- package/models/operations/accountingcategoriesone.js.map +1 -0
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -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/categories.d.ts +22 -0
- package/sdk/categories.d.ts.map +1 -0
- package/sdk/categories.js +33 -0
- package/sdk/categories.js.map +1 -0
- package/src/__tests__/categories.test.ts +127 -0
- package/src/funcs/accountingCategoriesGet.ts +230 -0
- package/src/funcs/accountingCategoriesList.ts +288 -0
- package/src/lib/config.ts +4 -4
- package/src/lib/files.ts +42 -0
- package/src/lib/security.ts +2 -2
- package/src/models/components/bill.ts +2 -2
- package/src/models/components/category.ts +193 -0
- package/src/models/components/contact.ts +8 -8
- package/src/models/components/expense.ts +14 -0
- package/src/models/components/formfieldoption.ts +12 -12
- package/src/models/components/getcategoriesresponse.ts +154 -0
- package/src/models/components/getcategoryresponse.ts +128 -0
- package/src/models/components/index.ts +3 -0
- package/src/models/components/invoice.ts +2 -2
- package/src/models/components/supplier.ts +18 -0
- package/src/models/operations/accountingcategoriesall.ts +277 -0
- package/src/models/operations/accountingcategoriesone.ts +268 -0
- package/src/models/operations/index.ts +2 -0
- package/src/sdk/accounting.ts +6 -0
- package/src/sdk/categories.ts +48 -0
- package/src/types/constdatetime.ts +1 -1
- package/types/constdatetime.js +1 -1
|
@@ -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 Category
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Get Category
|
|
33
|
+
*/
|
|
34
|
+
export function accountingCategoriesGet(
|
|
35
|
+
client: ApideckCore,
|
|
36
|
+
request: operations.AccountingCategoriesOneRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
operations.AccountingCategoriesOneResponse,
|
|
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.AccountingCategoriesOneRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
operations.AccountingCategoriesOneResponse,
|
|
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.AccountingCategoriesOneRequest$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/categories/{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.categoriesOne",
|
|
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.AccountingCategoriesOneResponse,
|
|
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.AccountingCategoriesOneResponse$inboundSchema, {
|
|
210
|
+
key: "GetCategoryResponse",
|
|
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.AccountingCategoriesOneResponse$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
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
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 { 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 { ApideckError } from "../models/errors/apideckerror.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 Categories
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* List Categories
|
|
40
|
+
*/
|
|
41
|
+
export function accountingCategoriesList(
|
|
42
|
+
client: ApideckCore,
|
|
43
|
+
request: operations.AccountingCategoriesAllRequest,
|
|
44
|
+
options?: RequestOptions,
|
|
45
|
+
): APIPromise<
|
|
46
|
+
PageIterator<
|
|
47
|
+
Result<
|
|
48
|
+
operations.AccountingCategoriesAllResponse,
|
|
49
|
+
| errors.BadRequestResponse
|
|
50
|
+
| errors.UnauthorizedResponse
|
|
51
|
+
| errors.PaymentRequiredResponse
|
|
52
|
+
| errors.NotFoundResponse
|
|
53
|
+
| errors.UnprocessableResponse
|
|
54
|
+
| ApideckError
|
|
55
|
+
| ResponseValidationError
|
|
56
|
+
| ConnectionError
|
|
57
|
+
| RequestAbortedError
|
|
58
|
+
| RequestTimeoutError
|
|
59
|
+
| InvalidRequestError
|
|
60
|
+
| UnexpectedClientError
|
|
61
|
+
| SDKValidationError
|
|
62
|
+
>,
|
|
63
|
+
{ cursor: string }
|
|
64
|
+
>
|
|
65
|
+
> {
|
|
66
|
+
return new APIPromise($do(
|
|
67
|
+
client,
|
|
68
|
+
request,
|
|
69
|
+
options,
|
|
70
|
+
));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function $do(
|
|
74
|
+
client: ApideckCore,
|
|
75
|
+
request: operations.AccountingCategoriesAllRequest,
|
|
76
|
+
options?: RequestOptions,
|
|
77
|
+
): Promise<
|
|
78
|
+
[
|
|
79
|
+
PageIterator<
|
|
80
|
+
Result<
|
|
81
|
+
operations.AccountingCategoriesAllResponse,
|
|
82
|
+
| errors.BadRequestResponse
|
|
83
|
+
| errors.UnauthorizedResponse
|
|
84
|
+
| errors.PaymentRequiredResponse
|
|
85
|
+
| errors.NotFoundResponse
|
|
86
|
+
| errors.UnprocessableResponse
|
|
87
|
+
| ApideckError
|
|
88
|
+
| ResponseValidationError
|
|
89
|
+
| ConnectionError
|
|
90
|
+
| RequestAbortedError
|
|
91
|
+
| RequestTimeoutError
|
|
92
|
+
| InvalidRequestError
|
|
93
|
+
| UnexpectedClientError
|
|
94
|
+
| SDKValidationError
|
|
95
|
+
>,
|
|
96
|
+
{ cursor: string }
|
|
97
|
+
>,
|
|
98
|
+
APICall,
|
|
99
|
+
]
|
|
100
|
+
> {
|
|
101
|
+
const parsed = safeParse(
|
|
102
|
+
request,
|
|
103
|
+
(value) =>
|
|
104
|
+
operations.AccountingCategoriesAllRequest$outboundSchema.parse(value),
|
|
105
|
+
"Input validation failed",
|
|
106
|
+
);
|
|
107
|
+
if (!parsed.ok) {
|
|
108
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
109
|
+
}
|
|
110
|
+
const payload = parsed.value;
|
|
111
|
+
const body = null;
|
|
112
|
+
|
|
113
|
+
const path = pathToFunc("/accounting/categories")();
|
|
114
|
+
|
|
115
|
+
const query = encodeFormQuery({
|
|
116
|
+
"cursor": payload.cursor,
|
|
117
|
+
"fields": payload.fields,
|
|
118
|
+
"limit": payload.limit,
|
|
119
|
+
"raw": payload.raw,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const headers = new Headers(compactMap({
|
|
123
|
+
Accept: "application/json",
|
|
124
|
+
"x-apideck-app-id": encodeSimple(
|
|
125
|
+
"x-apideck-app-id",
|
|
126
|
+
payload.appId ?? client._options.appId,
|
|
127
|
+
{ explode: false, charEncoding: "none" },
|
|
128
|
+
),
|
|
129
|
+
"x-apideck-consumer-id": encodeSimple(
|
|
130
|
+
"x-apideck-consumer-id",
|
|
131
|
+
payload.consumerId ?? client._options.consumerId,
|
|
132
|
+
{ explode: false, charEncoding: "none" },
|
|
133
|
+
),
|
|
134
|
+
"x-apideck-service-id": encodeSimple(
|
|
135
|
+
"x-apideck-service-id",
|
|
136
|
+
payload.serviceId,
|
|
137
|
+
{ explode: false, charEncoding: "none" },
|
|
138
|
+
),
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
142
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
143
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
144
|
+
|
|
145
|
+
const context = {
|
|
146
|
+
options: client._options,
|
|
147
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
148
|
+
operationID: "accounting.categoriesAll",
|
|
149
|
+
oAuth2Scopes: [],
|
|
150
|
+
|
|
151
|
+
resolvedSecurity: requestSecurity,
|
|
152
|
+
|
|
153
|
+
securitySource: client._options.apiKey,
|
|
154
|
+
retryConfig: options?.retries
|
|
155
|
+
|| client._options.retryConfig
|
|
156
|
+
|| {
|
|
157
|
+
strategy: "backoff",
|
|
158
|
+
backoff: {
|
|
159
|
+
initialInterval: 500,
|
|
160
|
+
maxInterval: 60000,
|
|
161
|
+
exponent: 1.5,
|
|
162
|
+
maxElapsedTime: 3600000,
|
|
163
|
+
},
|
|
164
|
+
retryConnectionErrors: true,
|
|
165
|
+
}
|
|
166
|
+
|| { strategy: "none" },
|
|
167
|
+
retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const requestRes = client._createRequest(context, {
|
|
171
|
+
security: requestSecurity,
|
|
172
|
+
method: "GET",
|
|
173
|
+
baseURL: options?.serverURL,
|
|
174
|
+
path: path,
|
|
175
|
+
headers: headers,
|
|
176
|
+
query: query,
|
|
177
|
+
body: body,
|
|
178
|
+
userAgent: client._options.userAgent,
|
|
179
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
180
|
+
}, options);
|
|
181
|
+
if (!requestRes.ok) {
|
|
182
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
183
|
+
}
|
|
184
|
+
const req = requestRes.value;
|
|
185
|
+
|
|
186
|
+
const doResult = await client._do(req, {
|
|
187
|
+
context,
|
|
188
|
+
errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
|
|
189
|
+
retryConfig: context.retryConfig,
|
|
190
|
+
retryCodes: context.retryCodes,
|
|
191
|
+
});
|
|
192
|
+
if (!doResult.ok) {
|
|
193
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
194
|
+
}
|
|
195
|
+
const response = doResult.value;
|
|
196
|
+
|
|
197
|
+
const responseFields = {
|
|
198
|
+
HttpMeta: { Response: response, Request: req },
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const [result, raw] = await M.match<
|
|
202
|
+
operations.AccountingCategoriesAllResponse,
|
|
203
|
+
| errors.BadRequestResponse
|
|
204
|
+
| errors.UnauthorizedResponse
|
|
205
|
+
| errors.PaymentRequiredResponse
|
|
206
|
+
| errors.NotFoundResponse
|
|
207
|
+
| errors.UnprocessableResponse
|
|
208
|
+
| ApideckError
|
|
209
|
+
| ResponseValidationError
|
|
210
|
+
| ConnectionError
|
|
211
|
+
| RequestAbortedError
|
|
212
|
+
| RequestTimeoutError
|
|
213
|
+
| InvalidRequestError
|
|
214
|
+
| UnexpectedClientError
|
|
215
|
+
| SDKValidationError
|
|
216
|
+
>(
|
|
217
|
+
M.json(200, operations.AccountingCategoriesAllResponse$inboundSchema, {
|
|
218
|
+
key: "GetCategoriesResponse",
|
|
219
|
+
}),
|
|
220
|
+
M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
|
|
221
|
+
M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
|
|
222
|
+
M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
|
|
223
|
+
M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
|
|
224
|
+
M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
|
|
225
|
+
M.fail("4XX"),
|
|
226
|
+
M.fail("5XX"),
|
|
227
|
+
M.json(
|
|
228
|
+
"default",
|
|
229
|
+
operations.AccountingCategoriesAllResponse$inboundSchema,
|
|
230
|
+
{ key: "UnexpectedErrorResponse" },
|
|
231
|
+
),
|
|
232
|
+
)(response, req, { extraFields: responseFields });
|
|
233
|
+
if (!result.ok) {
|
|
234
|
+
return [haltIterator(result), {
|
|
235
|
+
status: "complete",
|
|
236
|
+
request: req,
|
|
237
|
+
response,
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const nextFunc = (
|
|
242
|
+
responseData: unknown,
|
|
243
|
+
): {
|
|
244
|
+
next: Paginator<
|
|
245
|
+
Result<
|
|
246
|
+
operations.AccountingCategoriesAllResponse,
|
|
247
|
+
| errors.BadRequestResponse
|
|
248
|
+
| errors.UnauthorizedResponse
|
|
249
|
+
| errors.PaymentRequiredResponse
|
|
250
|
+
| errors.NotFoundResponse
|
|
251
|
+
| errors.UnprocessableResponse
|
|
252
|
+
| ApideckError
|
|
253
|
+
| ResponseValidationError
|
|
254
|
+
| ConnectionError
|
|
255
|
+
| RequestAbortedError
|
|
256
|
+
| RequestTimeoutError
|
|
257
|
+
| InvalidRequestError
|
|
258
|
+
| UnexpectedClientError
|
|
259
|
+
| SDKValidationError
|
|
260
|
+
>
|
|
261
|
+
>;
|
|
262
|
+
"~next"?: { cursor: string };
|
|
263
|
+
} => {
|
|
264
|
+
const nextCursor = dlv(responseData, "meta.cursors.next");
|
|
265
|
+
if (typeof nextCursor !== "string") {
|
|
266
|
+
return { next: () => null };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const nextVal = () =>
|
|
270
|
+
accountingCategoriesList(
|
|
271
|
+
client,
|
|
272
|
+
{
|
|
273
|
+
...request,
|
|
274
|
+
cursor: nextCursor,
|
|
275
|
+
},
|
|
276
|
+
options,
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
return { next: nextVal, "~next": { cursor: nextCursor } };
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
283
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
284
|
+
status: "complete",
|
|
285
|
+
request: req,
|
|
286
|
+
response,
|
|
287
|
+
}];
|
|
288
|
+
}
|
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.
|
|
71
|
-
sdkVersion: "0.
|
|
72
|
-
genVersion: "2.
|
|
73
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
70
|
+
openapiDocVersion: "10.18.0",
|
|
71
|
+
sdkVersion: "0.26.0",
|
|
72
|
+
genVersion: "2.632.2",
|
|
73
|
+
userAgent: "speakeasy-sdk/typescript 0.26.0 2.632.2 10.18.0 @apideck/unify",
|
|
74
74
|
} as const;
|
package/src/lib/files.ts
CHANGED
|
@@ -38,3 +38,45 @@ export async function readableStreamToArrayBuffer(
|
|
|
38
38
|
|
|
39
39
|
return concatenatedChunks.buffer as ArrayBuffer;
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Determines the MIME content type based on a file's extension.
|
|
44
|
+
* Returns null if the extension is not recognized.
|
|
45
|
+
*/
|
|
46
|
+
export function getContentTypeFromFileName(fileName: string): string | null {
|
|
47
|
+
if (!fileName) return null;
|
|
48
|
+
|
|
49
|
+
const ext = fileName.toLowerCase().split(".").pop();
|
|
50
|
+
if (!ext) return null;
|
|
51
|
+
|
|
52
|
+
const mimeTypes: Record<string, string> = {
|
|
53
|
+
json: "application/json",
|
|
54
|
+
xml: "application/xml",
|
|
55
|
+
html: "text/html",
|
|
56
|
+
htm: "text/html",
|
|
57
|
+
txt: "text/plain",
|
|
58
|
+
csv: "text/csv",
|
|
59
|
+
pdf: "application/pdf",
|
|
60
|
+
png: "image/png",
|
|
61
|
+
jpg: "image/jpeg",
|
|
62
|
+
jpeg: "image/jpeg",
|
|
63
|
+
gif: "image/gif",
|
|
64
|
+
svg: "image/svg+xml",
|
|
65
|
+
js: "application/javascript",
|
|
66
|
+
css: "text/css",
|
|
67
|
+
zip: "application/zip",
|
|
68
|
+
tar: "application/x-tar",
|
|
69
|
+
gz: "application/gzip",
|
|
70
|
+
mp4: "video/mp4",
|
|
71
|
+
mp3: "audio/mpeg",
|
|
72
|
+
wav: "audio/wav",
|
|
73
|
+
webp: "image/webp",
|
|
74
|
+
ico: "image/x-icon",
|
|
75
|
+
woff: "font/woff",
|
|
76
|
+
woff2: "font/woff2",
|
|
77
|
+
ttf: "font/ttf",
|
|
78
|
+
otf: "font/otf",
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return mimeTypes[ext] || null;
|
|
82
|
+
}
|
package/src/lib/security.ts
CHANGED
|
@@ -141,7 +141,7 @@ export type Bill = {
|
|
|
141
141
|
*/
|
|
142
142
|
poNumber?: string | null | undefined;
|
|
143
143
|
/**
|
|
144
|
-
* Optional
|
|
144
|
+
* Optional reference identifier for the transaction.
|
|
145
145
|
*/
|
|
146
146
|
reference?: string | null | undefined;
|
|
147
147
|
lineItems?: Array<BillLineItem> | undefined;
|
|
@@ -285,7 +285,7 @@ export type BillInput = {
|
|
|
285
285
|
*/
|
|
286
286
|
poNumber?: string | null | undefined;
|
|
287
287
|
/**
|
|
288
|
-
* Optional
|
|
288
|
+
* Optional reference identifier for the transaction.
|
|
289
289
|
*/
|
|
290
290
|
reference?: string | null | undefined;
|
|
291
291
|
lineItems?: Array<BillLineItemInput> | undefined;
|