@unified-api/typescript-sdk 1.0.37 → 1.0.39

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 (56) hide show
  1. package/dist/sdk/accounting.d.ts +24 -0
  2. package/dist/sdk/accounting.js +402 -0
  3. package/dist/sdk/journal.d.ts +31 -0
  4. package/dist/sdk/journal.js +505 -0
  5. package/dist/sdk/models/operations/createaccountingjournal.d.ts +28 -0
  6. package/dist/sdk/models/operations/createaccountingjournal.js +95 -0
  7. package/dist/sdk/models/operations/getaccountingjournal.d.ts +35 -0
  8. package/dist/sdk/models/operations/getaccountingjournal.js +99 -0
  9. package/dist/sdk/models/operations/getunifiedintegrationauth.d.ts +2 -0
  10. package/dist/sdk/models/operations/getunifiedintegrationauth.js +2 -0
  11. package/dist/sdk/models/operations/index.d.ts +6 -0
  12. package/dist/sdk/models/operations/index.js +6 -0
  13. package/dist/sdk/models/operations/listaccountingjournals.d.ts +43 -0
  14. package/dist/sdk/models/operations/listaccountingjournals.js +119 -0
  15. package/dist/sdk/models/operations/listaccountingtransactions.d.ts +1 -0
  16. package/dist/sdk/models/operations/listaccountingtransactions.js +4 -0
  17. package/dist/sdk/models/operations/patchaccountingjournal.d.ts +32 -0
  18. package/dist/sdk/models/operations/patchaccountingjournal.js +99 -0
  19. package/dist/sdk/models/operations/removeaccountingjournal.d.ts +30 -0
  20. package/dist/sdk/models/operations/removeaccountingjournal.js +71 -0
  21. package/dist/sdk/models/operations/updateaccountingjournal.d.ts +32 -0
  22. package/dist/sdk/models/operations/updateaccountingjournal.js +99 -0
  23. package/dist/sdk/models/shared/accountingjournal.d.ts +17 -0
  24. package/dist/sdk/models/shared/accountingjournal.js +92 -0
  25. package/dist/sdk/models/shared/{accountingtransactionlineitem.d.ts → accountingjournallineitem.d.ts} +1 -1
  26. package/dist/sdk/models/shared/{accountingtransactionlineitem.js → accountingjournallineitem.js} +14 -14
  27. package/dist/sdk/models/shared/accountingtransaction.d.ts +12 -9
  28. package/dist/sdk/models/shared/accountingtransaction.js +53 -12
  29. package/dist/sdk/models/shared/index.d.ts +2 -1
  30. package/dist/sdk/models/shared/index.js +2 -1
  31. package/dist/sdk/models/shared/propertyconnectionpermissions.d.ts +2 -0
  32. package/dist/sdk/models/shared/propertyconnectionpermissions.js +2 -0
  33. package/dist/sdk/models/shared/webhook.d.ts +1 -0
  34. package/dist/sdk/models/shared/webhook.js +1 -0
  35. package/dist/sdk/sdk.d.ts +2 -0
  36. package/dist/sdk/sdk.js +5 -3
  37. package/docs/sdk/models/operations/createaccountingjournalrequest.md +9 -0
  38. package/docs/sdk/models/operations/createaccountingjournalresponse.md +11 -0
  39. package/docs/sdk/models/operations/getaccountingjournalrequest.md +10 -0
  40. package/docs/sdk/models/operations/getaccountingjournalresponse.md +11 -0
  41. package/docs/sdk/models/operations/listaccountingjournalsrequest.md +15 -0
  42. package/docs/sdk/models/operations/listaccountingjournalsresponse.md +11 -0
  43. package/docs/sdk/models/operations/listaccountingtransactionsrequest.md +1 -0
  44. package/docs/sdk/models/operations/patchaccountingjournalrequest.md +10 -0
  45. package/docs/sdk/models/operations/patchaccountingjournalresponse.md +11 -0
  46. package/docs/sdk/models/operations/removeaccountingjournalrequest.md +9 -0
  47. package/docs/sdk/models/operations/removeaccountingjournalresponse.md +11 -0
  48. package/docs/sdk/models/operations/scopes.md +2 -0
  49. package/docs/sdk/models/operations/updateaccountingjournalrequest.md +10 -0
  50. package/docs/sdk/models/operations/updateaccountingjournalresponse.md +11 -0
  51. package/docs/sdk/models/shared/accountingjournal.md +17 -0
  52. package/docs/sdk/models/shared/{accountingtransactionlineitem.md → accountingjournallineitem.md} +1 -1
  53. package/docs/sdk/models/shared/accountingtransaction.md +19 -12
  54. package/docs/sdk/models/shared/objecttype.md +1 -0
  55. package/docs/sdk/models/shared/propertyconnectionpermissions.md +2 -0
  56. package/package.json +1 -1
@@ -16,6 +16,10 @@ export declare class Accounting {
16
16
  * Create an invoice
17
17
  */
18
18
  createAccountingInvoice(req: operations.CreateAccountingInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.CreateAccountingInvoiceResponse>;
19
+ /**
20
+ * Create a journal
21
+ */
22
+ createAccountingJournal(req: operations.CreateAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.CreateAccountingJournalResponse>;
19
23
  /**
20
24
  * Create a taxrate
21
25
  */
@@ -36,6 +40,10 @@ export declare class Accounting {
36
40
  * Retrieve an invoice
37
41
  */
38
42
  getAccountingInvoice(req: operations.GetAccountingInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.GetAccountingInvoiceResponse>;
43
+ /**
44
+ * Retrieve a journal
45
+ */
46
+ getAccountingJournal(req: operations.GetAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.GetAccountingJournalResponse>;
39
47
  /**
40
48
  * Retrieve an organization
41
49
  */
@@ -60,6 +68,10 @@ export declare class Accounting {
60
68
  * List all invoices
61
69
  */
62
70
  listAccountingInvoices(req: operations.ListAccountingInvoicesRequest, config?: AxiosRequestConfig): Promise<operations.ListAccountingInvoicesResponse>;
71
+ /**
72
+ * List all journals
73
+ */
74
+ listAccountingJournals(req: operations.ListAccountingJournalsRequest, config?: AxiosRequestConfig): Promise<operations.ListAccountingJournalsResponse>;
63
75
  /**
64
76
  * List all organizations
65
77
  */
@@ -84,6 +96,10 @@ export declare class Accounting {
84
96
  * Update an invoice
85
97
  */
86
98
  patchAccountingInvoice(req: operations.PatchAccountingInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.PatchAccountingInvoiceResponse>;
99
+ /**
100
+ * Update a journal
101
+ */
102
+ patchAccountingJournal(req: operations.PatchAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.PatchAccountingJournalResponse>;
87
103
  /**
88
104
  * Update a taxrate
89
105
  */
@@ -104,6 +120,10 @@ export declare class Accounting {
104
120
  * Remove an invoice
105
121
  */
106
122
  removeAccountingInvoice(req: operations.RemoveAccountingInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.RemoveAccountingInvoiceResponse>;
123
+ /**
124
+ * Remove a journal
125
+ */
126
+ removeAccountingJournal(req: operations.RemoveAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.RemoveAccountingJournalResponse>;
107
127
  /**
108
128
  * Remove a taxrate
109
129
  */
@@ -124,6 +144,10 @@ export declare class Accounting {
124
144
  * Update an invoice
125
145
  */
126
146
  updateAccountingInvoice(req: operations.UpdateAccountingInvoiceRequest, config?: AxiosRequestConfig): Promise<operations.UpdateAccountingInvoiceResponse>;
147
+ /**
148
+ * Update a journal
149
+ */
150
+ updateAccountingJournal(req: operations.UpdateAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.UpdateAccountingJournalResponse>;
127
151
  /**
128
152
  * Update a taxrate
129
153
  */
@@ -311,6 +311,77 @@ var Accounting = /** @class */ (function () {
311
311
  });
312
312
  });
313
313
  };
314
+ /**
315
+ * Create a journal
316
+ */
317
+ Accounting.prototype.createAccountingJournal = function (req, config) {
318
+ var _a, _b;
319
+ return __awaiter(this, void 0, void 0, function () {
320
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
321
+ var _d;
322
+ return __generator(this, function (_e) {
323
+ switch (_e.label) {
324
+ case 0:
325
+ if (!(req instanceof utils.SpeakeasyBase)) {
326
+ req = new operations.CreateAccountingJournalRequest(req);
327
+ }
328
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
329
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal", req);
330
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
331
+ try {
332
+ _d = __read(utils.serializeRequestBody(req, "accountingJournal", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
333
+ }
334
+ catch (e) {
335
+ if (e instanceof Error) {
336
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
337
+ }
338
+ }
339
+ client = this.sdkConfiguration.defaultClient;
340
+ globalSecurity = this.sdkConfiguration.security;
341
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
342
+ return [4 /*yield*/, globalSecurity()];
343
+ case 1:
344
+ globalSecurity = _e.sent();
345
+ _e.label = 2;
346
+ case 2:
347
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
348
+ globalSecurity = new shared.Security(globalSecurity);
349
+ }
350
+ properties = utils.parseSecurityProperties(globalSecurity);
351
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
352
+ headers["Accept"] = "application/json";
353
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
354
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
355
+ case 3:
356
+ httpRes = _e.sent();
357
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
358
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
359
+ throw new Error("status code not found in response: ".concat(httpRes));
360
+ }
361
+ res = new operations.CreateAccountingJournalResponse({
362
+ statusCode: httpRes.status,
363
+ contentType: responseContentType,
364
+ rawResponse: httpRes,
365
+ });
366
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
367
+ switch (true) {
368
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
369
+ if (utils.matchContentType(responseContentType, "application/json")) {
370
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
371
+ }
372
+ else {
373
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
374
+ }
375
+ break;
376
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
377
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
378
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
379
+ }
380
+ return [2 /*return*/, res];
381
+ }
382
+ });
383
+ });
384
+ };
314
385
  /**
315
386
  * Create a taxrate
316
387
  */
@@ -639,6 +710,68 @@ var Accounting = /** @class */ (function () {
639
710
  });
640
711
  });
641
712
  };
713
+ /**
714
+ * Retrieve a journal
715
+ */
716
+ Accounting.prototype.getAccountingJournal = function (req, config) {
717
+ var _a, _b;
718
+ return __awaiter(this, void 0, void 0, function () {
719
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
720
+ return __generator(this, function (_c) {
721
+ switch (_c.label) {
722
+ case 0:
723
+ if (!(req instanceof utils.SpeakeasyBase)) {
724
+ req = new operations.GetAccountingJournalRequest(req);
725
+ }
726
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
727
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
728
+ client = this.sdkConfiguration.defaultClient;
729
+ globalSecurity = this.sdkConfiguration.security;
730
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
731
+ return [4 /*yield*/, globalSecurity()];
732
+ case 1:
733
+ globalSecurity = _c.sent();
734
+ _c.label = 2;
735
+ case 2:
736
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
737
+ globalSecurity = new shared.Security(globalSecurity);
738
+ }
739
+ properties = utils.parseSecurityProperties(globalSecurity);
740
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
741
+ queryParams = utils.serializeQueryParams(req);
742
+ headers["Accept"] = "application/json";
743
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
744
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
745
+ case 3:
746
+ httpRes = _c.sent();
747
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
748
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
749
+ throw new Error("status code not found in response: ".concat(httpRes));
750
+ }
751
+ res = new operations.GetAccountingJournalResponse({
752
+ statusCode: httpRes.status,
753
+ contentType: responseContentType,
754
+ rawResponse: httpRes,
755
+ });
756
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
757
+ switch (true) {
758
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
759
+ if (utils.matchContentType(responseContentType, "application/json")) {
760
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
761
+ }
762
+ else {
763
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
764
+ }
765
+ break;
766
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
767
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
768
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
769
+ }
770
+ return [2 /*return*/, res];
771
+ }
772
+ });
773
+ });
774
+ };
642
775
  /**
643
776
  * Retrieve an organization
644
777
  */
@@ -1017,6 +1150,70 @@ var Accounting = /** @class */ (function () {
1017
1150
  });
1018
1151
  });
1019
1152
  };
1153
+ /**
1154
+ * List all journals
1155
+ */
1156
+ Accounting.prototype.listAccountingJournals = function (req, config) {
1157
+ var _a, _b;
1158
+ return __awaiter(this, void 0, void 0, function () {
1159
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
1160
+ return __generator(this, function (_c) {
1161
+ switch (_c.label) {
1162
+ case 0:
1163
+ if (!(req instanceof utils.SpeakeasyBase)) {
1164
+ req = new operations.ListAccountingJournalsRequest(req);
1165
+ }
1166
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1167
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal", req);
1168
+ client = this.sdkConfiguration.defaultClient;
1169
+ globalSecurity = this.sdkConfiguration.security;
1170
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1171
+ return [4 /*yield*/, globalSecurity()];
1172
+ case 1:
1173
+ globalSecurity = _c.sent();
1174
+ _c.label = 2;
1175
+ case 2:
1176
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1177
+ globalSecurity = new shared.Security(globalSecurity);
1178
+ }
1179
+ properties = utils.parseSecurityProperties(globalSecurity);
1180
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1181
+ queryParams = utils.serializeQueryParams(req);
1182
+ headers["Accept"] = "application/json";
1183
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1184
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
1185
+ case 3:
1186
+ httpRes = _c.sent();
1187
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1188
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1189
+ throw new Error("status code not found in response: ".concat(httpRes));
1190
+ }
1191
+ res = new operations.ListAccountingJournalsResponse({
1192
+ statusCode: httpRes.status,
1193
+ contentType: responseContentType,
1194
+ rawResponse: httpRes,
1195
+ });
1196
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1197
+ switch (true) {
1198
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1199
+ if (utils.matchContentType(responseContentType, "application/json")) {
1200
+ res.accountingJournals = [];
1201
+ resFieldDepth = utils.getResFieldDepth(res);
1202
+ res.accountingJournals = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal, resFieldDepth);
1203
+ }
1204
+ else {
1205
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
1206
+ }
1207
+ break;
1208
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1209
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1210
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1211
+ }
1212
+ return [2 /*return*/, res];
1213
+ }
1214
+ });
1215
+ });
1216
+ };
1020
1217
  /**
1021
1218
  * List all organizations
1022
1219
  */
@@ -1422,6 +1619,77 @@ var Accounting = /** @class */ (function () {
1422
1619
  });
1423
1620
  });
1424
1621
  };
1622
+ /**
1623
+ * Update a journal
1624
+ */
1625
+ Accounting.prototype.patchAccountingJournal = function (req, config) {
1626
+ var _a, _b;
1627
+ return __awaiter(this, void 0, void 0, function () {
1628
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
1629
+ var _d;
1630
+ return __generator(this, function (_e) {
1631
+ switch (_e.label) {
1632
+ case 0:
1633
+ if (!(req instanceof utils.SpeakeasyBase)) {
1634
+ req = new operations.PatchAccountingJournalRequest(req);
1635
+ }
1636
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1637
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
1638
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
1639
+ try {
1640
+ _d = __read(utils.serializeRequestBody(req, "accountingJournal", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
1641
+ }
1642
+ catch (e) {
1643
+ if (e instanceof Error) {
1644
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
1645
+ }
1646
+ }
1647
+ client = this.sdkConfiguration.defaultClient;
1648
+ globalSecurity = this.sdkConfiguration.security;
1649
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
1650
+ return [4 /*yield*/, globalSecurity()];
1651
+ case 1:
1652
+ globalSecurity = _e.sent();
1653
+ _e.label = 2;
1654
+ case 2:
1655
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
1656
+ globalSecurity = new shared.Security(globalSecurity);
1657
+ }
1658
+ properties = utils.parseSecurityProperties(globalSecurity);
1659
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
1660
+ headers["Accept"] = "application/json";
1661
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
1662
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
1663
+ case 3:
1664
+ httpRes = _e.sent();
1665
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1666
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1667
+ throw new Error("status code not found in response: ".concat(httpRes));
1668
+ }
1669
+ res = new operations.PatchAccountingJournalResponse({
1670
+ statusCode: httpRes.status,
1671
+ contentType: responseContentType,
1672
+ rawResponse: httpRes,
1673
+ });
1674
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1675
+ switch (true) {
1676
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1677
+ if (utils.matchContentType(responseContentType, "application/json")) {
1678
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
1679
+ }
1680
+ else {
1681
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
1682
+ }
1683
+ break;
1684
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
1685
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
1686
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
1687
+ }
1688
+ return [2 /*return*/, res];
1689
+ }
1690
+ });
1691
+ });
1692
+ };
1425
1693
  /**
1426
1694
  * Update a taxrate
1427
1695
  */
@@ -1753,6 +2021,69 @@ var Accounting = /** @class */ (function () {
1753
2021
  });
1754
2022
  });
1755
2023
  };
2024
+ /**
2025
+ * Remove a journal
2026
+ */
2027
+ Accounting.prototype.removeAccountingJournal = function (req, config) {
2028
+ var _a, _b;
2029
+ return __awaiter(this, void 0, void 0, function () {
2030
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
2031
+ return __generator(this, function (_c) {
2032
+ switch (_c.label) {
2033
+ case 0:
2034
+ if (!(req instanceof utils.SpeakeasyBase)) {
2035
+ req = new operations.RemoveAccountingJournalRequest(req);
2036
+ }
2037
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
2038
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
2039
+ client = this.sdkConfiguration.defaultClient;
2040
+ globalSecurity = this.sdkConfiguration.security;
2041
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
2042
+ return [4 /*yield*/, globalSecurity()];
2043
+ case 1:
2044
+ globalSecurity = _c.sent();
2045
+ _c.label = 2;
2046
+ case 2:
2047
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
2048
+ globalSecurity = new shared.Security(globalSecurity);
2049
+ }
2050
+ properties = utils.parseSecurityProperties(globalSecurity);
2051
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
2052
+ headers["Accept"] = "application/json";
2053
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
2054
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
2055
+ case 3:
2056
+ httpRes = _c.sent();
2057
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
2058
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
2059
+ throw new Error("status code not found in response: ".concat(httpRes));
2060
+ }
2061
+ res = new operations.RemoveAccountingJournalResponse({
2062
+ statusCode: httpRes.status,
2063
+ contentType: responseContentType,
2064
+ rawResponse: httpRes,
2065
+ });
2066
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
2067
+ switch (true) {
2068
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 200 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 300:
2069
+ break;
2070
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
2071
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
2072
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2073
+ default:
2074
+ if (utils.matchContentType(responseContentType, "application/json")) {
2075
+ res.string = JSON.parse(decodedRes);
2076
+ }
2077
+ else {
2078
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
2079
+ }
2080
+ break;
2081
+ }
2082
+ return [2 /*return*/, res];
2083
+ }
2084
+ });
2085
+ });
2086
+ };
1756
2087
  /**
1757
2088
  * Remove a taxrate
1758
2089
  */
@@ -2092,6 +2423,77 @@ var Accounting = /** @class */ (function () {
2092
2423
  });
2093
2424
  });
2094
2425
  };
2426
+ /**
2427
+ * Update a journal
2428
+ */
2429
+ Accounting.prototype.updateAccountingJournal = function (req, config) {
2430
+ var _a, _b;
2431
+ return __awaiter(this, void 0, void 0, function () {
2432
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
2433
+ var _d;
2434
+ return __generator(this, function (_e) {
2435
+ switch (_e.label) {
2436
+ case 0:
2437
+ if (!(req instanceof utils.SpeakeasyBase)) {
2438
+ req = new operations.UpdateAccountingJournalRequest(req);
2439
+ }
2440
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
2441
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
2442
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
2443
+ try {
2444
+ _d = __read(utils.serializeRequestBody(req, "accountingJournal", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
2445
+ }
2446
+ catch (e) {
2447
+ if (e instanceof Error) {
2448
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
2449
+ }
2450
+ }
2451
+ client = this.sdkConfiguration.defaultClient;
2452
+ globalSecurity = this.sdkConfiguration.security;
2453
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
2454
+ return [4 /*yield*/, globalSecurity()];
2455
+ case 1:
2456
+ globalSecurity = _e.sent();
2457
+ _e.label = 2;
2458
+ case 2:
2459
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
2460
+ globalSecurity = new shared.Security(globalSecurity);
2461
+ }
2462
+ properties = utils.parseSecurityProperties(globalSecurity);
2463
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
2464
+ headers["Accept"] = "application/json";
2465
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
2466
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
2467
+ case 3:
2468
+ httpRes = _e.sent();
2469
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
2470
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
2471
+ throw new Error("status code not found in response: ".concat(httpRes));
2472
+ }
2473
+ res = new operations.UpdateAccountingJournalResponse({
2474
+ statusCode: httpRes.status,
2475
+ contentType: responseContentType,
2476
+ rawResponse: httpRes,
2477
+ });
2478
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
2479
+ switch (true) {
2480
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
2481
+ if (utils.matchContentType(responseContentType, "application/json")) {
2482
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
2483
+ }
2484
+ else {
2485
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
2486
+ }
2487
+ break;
2488
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
2489
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
2490
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
2491
+ }
2492
+ return [2 /*return*/, res];
2493
+ }
2494
+ });
2495
+ });
2496
+ };
2095
2497
  /**
2096
2498
  * Update a taxrate
2097
2499
  */
@@ -0,0 +1,31 @@
1
+ import * as operations from "../sdk/models/operations";
2
+ import { SDKConfiguration } from "./sdk";
3
+ import { AxiosRequestConfig } from "axios";
4
+ export declare class Journal {
5
+ private sdkConfiguration;
6
+ constructor(sdkConfig: SDKConfiguration);
7
+ /**
8
+ * Create a journal
9
+ */
10
+ createAccountingJournal(req: operations.CreateAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.CreateAccountingJournalResponse>;
11
+ /**
12
+ * Retrieve a journal
13
+ */
14
+ getAccountingJournal(req: operations.GetAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.GetAccountingJournalResponse>;
15
+ /**
16
+ * List all journals
17
+ */
18
+ listAccountingJournals(req: operations.ListAccountingJournalsRequest, config?: AxiosRequestConfig): Promise<operations.ListAccountingJournalsResponse>;
19
+ /**
20
+ * Update a journal
21
+ */
22
+ patchAccountingJournal(req: operations.PatchAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.PatchAccountingJournalResponse>;
23
+ /**
24
+ * Remove a journal
25
+ */
26
+ removeAccountingJournal(req: operations.RemoveAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.RemoveAccountingJournalResponse>;
27
+ /**
28
+ * Update a journal
29
+ */
30
+ updateAccountingJournal(req: operations.UpdateAccountingJournalRequest, config?: AxiosRequestConfig): Promise<operations.UpdateAccountingJournalResponse>;
31
+ }