@apideck/unify 0.25.1 → 0.27.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.
Files changed (94) hide show
  1. package/README.md +7 -0
  2. package/docs/sdks/categories/README.md +181 -0
  3. package/funcs/accountingCategoriesGet.d.ts +18 -0
  4. package/funcs/accountingCategoriesGet.d.ts.map +1 -0
  5. package/funcs/accountingCategoriesGet.js +133 -0
  6. package/funcs/accountingCategoriesGet.js.map +1 -0
  7. package/funcs/accountingCategoriesList.d.ts +21 -0
  8. package/funcs/accountingCategoriesList.d.ts.map +1 -0
  9. package/funcs/accountingCategoriesList.js +151 -0
  10. package/funcs/accountingCategoriesList.js.map +1 -0
  11. package/jsr.json +1 -1
  12. package/lib/config.d.ts +4 -4
  13. package/lib/config.js +4 -4
  14. package/models/components/bill.d.ts +2 -2
  15. package/models/components/category.d.ts +114 -0
  16. package/models/components/category.d.ts.map +1 -0
  17. package/models/components/category.js +121 -0
  18. package/models/components/category.js.map +1 -0
  19. package/models/components/expense.d.ts +10 -0
  20. package/models/components/expense.d.ts.map +1 -1
  21. package/models/components/expense.js +4 -0
  22. package/models/components/expense.js.map +1 -1
  23. package/models/components/formfieldoption.d.ts +6 -6
  24. package/models/components/formfieldoption.d.ts.map +1 -1
  25. package/models/components/formfieldoption.js +4 -4
  26. package/models/components/formfieldoption.js.map +1 -1
  27. package/models/components/getcategoriesresponse.d.ts +79 -0
  28. package/models/components/getcategoriesresponse.d.ts.map +1 -0
  29. package/models/components/getcategoriesresponse.js +89 -0
  30. package/models/components/getcategoriesresponse.js.map +1 -0
  31. package/models/components/getcategoryresponse.d.ts +67 -0
  32. package/models/components/getcategoryresponse.d.ts.map +1 -0
  33. package/models/components/getcategoryresponse.js +83 -0
  34. package/models/components/getcategoryresponse.js.map +1 -0
  35. package/models/components/index.d.ts +3 -0
  36. package/models/components/index.d.ts.map +1 -1
  37. package/models/components/index.js +3 -0
  38. package/models/components/index.js.map +1 -1
  39. package/models/components/invoice.d.ts +2 -2
  40. package/models/components/ledgeraccount.d.ts +9 -9
  41. package/models/components/ledgeraccount.d.ts.map +1 -1
  42. package/models/components/ledgeraccount.js +19 -15
  43. package/models/components/ledgeraccount.js.map +1 -1
  44. package/models/components/ledgeraccountsfilter.d.ts +61 -0
  45. package/models/components/ledgeraccountsfilter.d.ts.map +1 -1
  46. package/models/components/ledgeraccountsfilter.js +33 -1
  47. package/models/components/ledgeraccountsfilter.js.map +1 -1
  48. package/models/components/supplier.d.ts +10 -0
  49. package/models/components/supplier.d.ts.map +1 -1
  50. package/models/components/supplier.js +8 -0
  51. package/models/components/supplier.js.map +1 -1
  52. package/models/operations/accountingcategoriesall.d.ts +131 -0
  53. package/models/operations/accountingcategoriesall.d.ts.map +1 -0
  54. package/models/operations/accountingcategoriesall.js +149 -0
  55. package/models/operations/accountingcategoriesall.js.map +1 -0
  56. package/models/operations/accountingcategoriesone.d.ts +126 -0
  57. package/models/operations/accountingcategoriesone.d.ts.map +1 -0
  58. package/models/operations/accountingcategoriesone.js +145 -0
  59. package/models/operations/accountingcategoriesone.js.map +1 -0
  60. package/models/operations/index.d.ts +2 -0
  61. package/models/operations/index.d.ts.map +1 -1
  62. package/models/operations/index.js +2 -0
  63. package/models/operations/index.js.map +1 -1
  64. package/package.json +1 -1
  65. package/sdk/accounting.d.ts +3 -0
  66. package/sdk/accounting.d.ts.map +1 -1
  67. package/sdk/accounting.js +4 -0
  68. package/sdk/accounting.js.map +1 -1
  69. package/sdk/categories.d.ts +22 -0
  70. package/sdk/categories.d.ts.map +1 -0
  71. package/sdk/categories.js +33 -0
  72. package/sdk/categories.js.map +1 -0
  73. package/src/__tests__/categories.test.ts +127 -0
  74. package/src/funcs/accountingCategoriesGet.ts +230 -0
  75. package/src/funcs/accountingCategoriesList.ts +288 -0
  76. package/src/lib/config.ts +4 -4
  77. package/src/models/components/bill.ts +2 -2
  78. package/src/models/components/category.ts +193 -0
  79. package/src/models/components/expense.ts +14 -0
  80. package/src/models/components/formfieldoption.ts +12 -12
  81. package/src/models/components/getcategoriesresponse.ts +154 -0
  82. package/src/models/components/getcategoryresponse.ts +128 -0
  83. package/src/models/components/index.ts +3 -0
  84. package/src/models/components/invoice.ts +2 -2
  85. package/src/models/components/ledgeraccount.ts +25 -19
  86. package/src/models/components/ledgeraccountsfilter.ts +49 -0
  87. package/src/models/components/supplier.ts +18 -0
  88. package/src/models/operations/accountingcategoriesall.ts +277 -0
  89. package/src/models/operations/accountingcategoriesone.ts +268 -0
  90. package/src/models/operations/index.ts +2 -0
  91. package/src/sdk/accounting.ts +6 -0
  92. package/src/sdk/categories.ts +48 -0
  93. package/src/types/constdatetime.ts +1 -1
  94. package/types/constdatetime.js +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../src/sdk/categories.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAwB,MAAM,wBAAwB,CAAC;AAE5E,qBAAa,UAAW,SAAQ,SAAS;IACvC;;;;;OAKG;IACG,IAAI,CACR,OAAO,EAAE,UAAU,CAAC,8BAA8B,EAClD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,YAAY,CAAC,UAAU,CAAC,+BAA+B,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAC7E;IAQD;;;;;OAKG;IACG,GAAG,CACP,OAAO,EAAE,UAAU,CAAC,8BAA8B,EAClD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,+BAA+B,CAAC;CAOvD"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Categories = void 0;
7
+ const accountingCategoriesGet_js_1 = require("../funcs/accountingCategoriesGet.js");
8
+ const accountingCategoriesList_js_1 = require("../funcs/accountingCategoriesList.js");
9
+ const sdks_js_1 = require("../lib/sdks.js");
10
+ const fp_js_1 = require("../types/fp.js");
11
+ const operations_js_1 = require("../types/operations.js");
12
+ class Categories extends sdks_js_1.ClientSDK {
13
+ /**
14
+ * List Categories
15
+ *
16
+ * @remarks
17
+ * List Categories
18
+ */
19
+ async list(request, options) {
20
+ return (0, operations_js_1.unwrapResultIterator)((0, accountingCategoriesList_js_1.accountingCategoriesList)(this, request, options));
21
+ }
22
+ /**
23
+ * Get Category
24
+ *
25
+ * @remarks
26
+ * Get Category
27
+ */
28
+ async get(request, options) {
29
+ return (0, fp_js_1.unwrapAsync)((0, accountingCategoriesGet_js_1.accountingCategoriesGet)(this, request, options));
30
+ }
31
+ }
32
+ exports.Categories = Categories;
33
+ //# sourceMappingURL=categories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"categories.js","sourceRoot":"","sources":["../src/sdk/categories.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oFAA8E;AAC9E,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAC7C,0DAA4E;AAE5E,MAAa,UAAW,SAAQ,mBAAS;IACvC;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,OAAkD,EAClD,OAAwB;QAIxB,OAAO,IAAA,oCAAoB,EAAC,IAAA,sDAAwB,EAClD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,OAAkD,EAClD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,oDAAuB,EACxC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AApCD,gCAoCC"}
@@ -0,0 +1,127 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { expect, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Categories Accounting Categories All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.categoriesAll");
11
+
12
+ const apideck = new Apideck({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
+ });
17
+
18
+ const result = await apideck.accounting.categories.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ fields: "id,updated_at",
23
+ });
24
+ expect(result.httpMeta.response.status).toBe(200);
25
+ expect(result.getCategoriesResponse).toBeDefined();
26
+ expect(result.getCategoriesResponse).toEqual({
27
+ statusCode: 200,
28
+ status: "OK",
29
+ service: "xero",
30
+ resource: "categories",
31
+ operation: "all",
32
+ data: [
33
+ {
34
+ id: "12345",
35
+ name: "Insurance",
36
+ status: "active",
37
+ rowVersion: "1-12345",
38
+ updatedBy: "12345",
39
+ createdBy: "12345",
40
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
41
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
42
+ passThrough: [
43
+ {
44
+ serviceId: "<id>",
45
+ extendPaths: [
46
+ {
47
+ path: "$.nested.property",
48
+ value: {
49
+ "TaxClassificationRef": {
50
+ "value": "EUC-99990201-V1-00020000",
51
+ },
52
+ },
53
+ },
54
+ ],
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ meta: {
60
+ itemsOnPage: 50,
61
+ cursors: {
62
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
63
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
64
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
65
+ },
66
+ },
67
+ links: {
68
+ previous:
69
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
70
+ current: "https://unify.apideck.com/crm/companies",
71
+ next:
72
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
73
+ },
74
+ });
75
+ });
76
+
77
+ test("Categories Accounting Categories One", async () => {
78
+ const testHttpClient = createTestHTTPClient("accounting.categoriesOne");
79
+
80
+ const apideck = new Apideck({
81
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
82
+ httpClient: testHttpClient,
83
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
84
+ });
85
+
86
+ const result = await apideck.accounting.categories.get({
87
+ id: "<id>",
88
+ consumerId: "test-consumer",
89
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
90
+ serviceId: "salesforce",
91
+ fields: "id,updated_at",
92
+ });
93
+ expect(result.httpMeta.response.status).toBe(200);
94
+ expect(result.getCategoryResponse).toBeDefined();
95
+ expect(result.getCategoryResponse).toEqual({
96
+ statusCode: 200,
97
+ status: "OK",
98
+ service: "xero",
99
+ resource: "categories",
100
+ operation: "one",
101
+ data: {
102
+ id: "12345",
103
+ name: "Insurance",
104
+ status: "active",
105
+ rowVersion: "1-12345",
106
+ updatedBy: "12345",
107
+ createdBy: "12345",
108
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
109
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
110
+ passThrough: [
111
+ {
112
+ serviceId: "<id>",
113
+ extendPaths: [
114
+ {
115
+ path: "$.nested.property",
116
+ value: {
117
+ "TaxClassificationRef": {
118
+ "value": "EUC-99990201-V1-00020000",
119
+ },
120
+ },
121
+ },
122
+ ],
123
+ },
124
+ ],
125
+ },
126
+ });
127
+ });
@@ -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.17.2",
71
- sdkVersion: "0.25.1",
72
- genVersion: "2.629.1",
73
- userAgent: "speakeasy-sdk/typescript 0.25.1 2.629.1 10.17.2 @apideck/unify",
70
+ openapiDocVersion: "10.18.0",
71
+ sdkVersion: "0.27.0",
72
+ genVersion: "2.638.1",
73
+ userAgent: "speakeasy-sdk/typescript 0.27.0 2.638.1 10.18.0 @apideck/unify",
74
74
  } as const;