@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
@@ -0,0 +1,505 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
40
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
+ return new (P || (P = Promise))(function (resolve, reject) {
42
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
46
+ });
47
+ };
48
+ var __generator = (this && this.__generator) || function (thisArg, body) {
49
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
50
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
51
+ function verb(n) { return function (v) { return step([n, v]); }; }
52
+ function step(op) {
53
+ if (f) throw new TypeError("Generator is already executing.");
54
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
55
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
56
+ if (y = 0, t) op = [op[0] & 2, t.value];
57
+ switch (op[0]) {
58
+ case 0: case 1: t = op; break;
59
+ case 4: _.label++; return { value: op[1], done: false };
60
+ case 5: _.label++; y = op[1]; op = [0]; continue;
61
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
62
+ default:
63
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
64
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
65
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
66
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
67
+ if (t[2]) _.ops.pop();
68
+ _.trys.pop(); continue;
69
+ }
70
+ op = body.call(thisArg, _);
71
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
72
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
73
+ }
74
+ };
75
+ var __read = (this && this.__read) || function (o, n) {
76
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
77
+ if (!m) return o;
78
+ var i = m.call(o), r, ar = [], e;
79
+ try {
80
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
81
+ }
82
+ catch (error) { e = { error: error }; }
83
+ finally {
84
+ try {
85
+ if (r && !r.done && (m = i["return"])) m.call(i);
86
+ }
87
+ finally { if (e) throw e.error; }
88
+ }
89
+ return ar;
90
+ };
91
+ Object.defineProperty(exports, "__esModule", { value: true });
92
+ exports.Journal = void 0;
93
+ var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("../sdk/models/errors"));
95
+ var operations = __importStar(require("../sdk/models/operations"));
96
+ var shared = __importStar(require("../sdk/models/shared"));
97
+ var Journal = /** @class */ (function () {
98
+ function Journal(sdkConfig) {
99
+ this.sdkConfiguration = sdkConfig;
100
+ }
101
+ /**
102
+ * Create a journal
103
+ */
104
+ Journal.prototype.createAccountingJournal = function (req, config) {
105
+ var _a, _b;
106
+ return __awaiter(this, void 0, void 0, function () {
107
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
108
+ var _d;
109
+ return __generator(this, function (_e) {
110
+ switch (_e.label) {
111
+ case 0:
112
+ if (!(req instanceof utils.SpeakeasyBase)) {
113
+ req = new operations.CreateAccountingJournalRequest(req);
114
+ }
115
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
116
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal", req);
117
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
118
+ try {
119
+ _d = __read(utils.serializeRequestBody(req, "accountingJournal", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
120
+ }
121
+ catch (e) {
122
+ if (e instanceof Error) {
123
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
124
+ }
125
+ }
126
+ client = this.sdkConfiguration.defaultClient;
127
+ globalSecurity = this.sdkConfiguration.security;
128
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
129
+ return [4 /*yield*/, globalSecurity()];
130
+ case 1:
131
+ globalSecurity = _e.sent();
132
+ _e.label = 2;
133
+ case 2:
134
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
135
+ globalSecurity = new shared.Security(globalSecurity);
136
+ }
137
+ properties = utils.parseSecurityProperties(globalSecurity);
138
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
139
+ headers["Accept"] = "application/json";
140
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
141
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
142
+ case 3:
143
+ httpRes = _e.sent();
144
+ 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 : "";
145
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
146
+ throw new Error("status code not found in response: ".concat(httpRes));
147
+ }
148
+ res = new operations.CreateAccountingJournalResponse({
149
+ statusCode: httpRes.status,
150
+ contentType: responseContentType,
151
+ rawResponse: httpRes,
152
+ });
153
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
154
+ switch (true) {
155
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
156
+ if (utils.matchContentType(responseContentType, "application/json")) {
157
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
158
+ }
159
+ else {
160
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
161
+ }
162
+ break;
163
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
164
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
165
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
166
+ }
167
+ return [2 /*return*/, res];
168
+ }
169
+ });
170
+ });
171
+ };
172
+ /**
173
+ * Retrieve a journal
174
+ */
175
+ Journal.prototype.getAccountingJournal = function (req, config) {
176
+ var _a, _b;
177
+ return __awaiter(this, void 0, void 0, function () {
178
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
179
+ return __generator(this, function (_c) {
180
+ switch (_c.label) {
181
+ case 0:
182
+ if (!(req instanceof utils.SpeakeasyBase)) {
183
+ req = new operations.GetAccountingJournalRequest(req);
184
+ }
185
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
186
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
187
+ client = this.sdkConfiguration.defaultClient;
188
+ globalSecurity = this.sdkConfiguration.security;
189
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
190
+ return [4 /*yield*/, globalSecurity()];
191
+ case 1:
192
+ globalSecurity = _c.sent();
193
+ _c.label = 2;
194
+ case 2:
195
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
196
+ globalSecurity = new shared.Security(globalSecurity);
197
+ }
198
+ properties = utils.parseSecurityProperties(globalSecurity);
199
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
200
+ queryParams = utils.serializeQueryParams(req);
201
+ headers["Accept"] = "application/json";
202
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
203
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
204
+ case 3:
205
+ httpRes = _c.sent();
206
+ 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 : "";
207
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
208
+ throw new Error("status code not found in response: ".concat(httpRes));
209
+ }
210
+ res = new operations.GetAccountingJournalResponse({
211
+ statusCode: httpRes.status,
212
+ contentType: responseContentType,
213
+ rawResponse: httpRes,
214
+ });
215
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
216
+ switch (true) {
217
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
218
+ if (utils.matchContentType(responseContentType, "application/json")) {
219
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
220
+ }
221
+ else {
222
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
223
+ }
224
+ break;
225
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
226
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
227
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
228
+ }
229
+ return [2 /*return*/, res];
230
+ }
231
+ });
232
+ });
233
+ };
234
+ /**
235
+ * List all journals
236
+ */
237
+ Journal.prototype.listAccountingJournals = function (req, config) {
238
+ var _a, _b;
239
+ return __awaiter(this, void 0, void 0, function () {
240
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
241
+ return __generator(this, function (_c) {
242
+ switch (_c.label) {
243
+ case 0:
244
+ if (!(req instanceof utils.SpeakeasyBase)) {
245
+ req = new operations.ListAccountingJournalsRequest(req);
246
+ }
247
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
248
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal", req);
249
+ client = this.sdkConfiguration.defaultClient;
250
+ globalSecurity = this.sdkConfiguration.security;
251
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
252
+ return [4 /*yield*/, globalSecurity()];
253
+ case 1:
254
+ globalSecurity = _c.sent();
255
+ _c.label = 2;
256
+ case 2:
257
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
258
+ globalSecurity = new shared.Security(globalSecurity);
259
+ }
260
+ properties = utils.parseSecurityProperties(globalSecurity);
261
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
262
+ queryParams = utils.serializeQueryParams(req);
263
+ headers["Accept"] = "application/json";
264
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
265
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
266
+ case 3:
267
+ httpRes = _c.sent();
268
+ 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 : "";
269
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
270
+ throw new Error("status code not found in response: ".concat(httpRes));
271
+ }
272
+ res = new operations.ListAccountingJournalsResponse({
273
+ statusCode: httpRes.status,
274
+ contentType: responseContentType,
275
+ rawResponse: httpRes,
276
+ });
277
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
278
+ switch (true) {
279
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
280
+ if (utils.matchContentType(responseContentType, "application/json")) {
281
+ res.accountingJournals = [];
282
+ resFieldDepth = utils.getResFieldDepth(res);
283
+ res.accountingJournals = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal, resFieldDepth);
284
+ }
285
+ else {
286
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
287
+ }
288
+ break;
289
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
290
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
291
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
292
+ }
293
+ return [2 /*return*/, res];
294
+ }
295
+ });
296
+ });
297
+ };
298
+ /**
299
+ * Update a journal
300
+ */
301
+ Journal.prototype.patchAccountingJournal = function (req, config) {
302
+ var _a, _b;
303
+ return __awaiter(this, void 0, void 0, function () {
304
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
305
+ var _d;
306
+ return __generator(this, function (_e) {
307
+ switch (_e.label) {
308
+ case 0:
309
+ if (!(req instanceof utils.SpeakeasyBase)) {
310
+ req = new operations.PatchAccountingJournalRequest(req);
311
+ }
312
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
313
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
314
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
315
+ try {
316
+ _d = __read(utils.serializeRequestBody(req, "accountingJournal", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
317
+ }
318
+ catch (e) {
319
+ if (e instanceof Error) {
320
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
321
+ }
322
+ }
323
+ client = this.sdkConfiguration.defaultClient;
324
+ globalSecurity = this.sdkConfiguration.security;
325
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
326
+ return [4 /*yield*/, globalSecurity()];
327
+ case 1:
328
+ globalSecurity = _e.sent();
329
+ _e.label = 2;
330
+ case 2:
331
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
332
+ globalSecurity = new shared.Security(globalSecurity);
333
+ }
334
+ properties = utils.parseSecurityProperties(globalSecurity);
335
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
336
+ headers["Accept"] = "application/json";
337
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
338
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
339
+ case 3:
340
+ httpRes = _e.sent();
341
+ 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 : "";
342
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
343
+ throw new Error("status code not found in response: ".concat(httpRes));
344
+ }
345
+ res = new operations.PatchAccountingJournalResponse({
346
+ statusCode: httpRes.status,
347
+ contentType: responseContentType,
348
+ rawResponse: httpRes,
349
+ });
350
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
351
+ switch (true) {
352
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
353
+ if (utils.matchContentType(responseContentType, "application/json")) {
354
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
355
+ }
356
+ else {
357
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
358
+ }
359
+ break;
360
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
361
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
362
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
363
+ }
364
+ return [2 /*return*/, res];
365
+ }
366
+ });
367
+ });
368
+ };
369
+ /**
370
+ * Remove a journal
371
+ */
372
+ Journal.prototype.removeAccountingJournal = function (req, config) {
373
+ var _a, _b;
374
+ return __awaiter(this, void 0, void 0, function () {
375
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
376
+ return __generator(this, function (_c) {
377
+ switch (_c.label) {
378
+ case 0:
379
+ if (!(req instanceof utils.SpeakeasyBase)) {
380
+ req = new operations.RemoveAccountingJournalRequest(req);
381
+ }
382
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
383
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
384
+ client = this.sdkConfiguration.defaultClient;
385
+ globalSecurity = this.sdkConfiguration.security;
386
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
387
+ return [4 /*yield*/, globalSecurity()];
388
+ case 1:
389
+ globalSecurity = _c.sent();
390
+ _c.label = 2;
391
+ case 2:
392
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
393
+ globalSecurity = new shared.Security(globalSecurity);
394
+ }
395
+ properties = utils.parseSecurityProperties(globalSecurity);
396
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
397
+ headers["Accept"] = "application/json";
398
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
399
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
400
+ case 3:
401
+ httpRes = _c.sent();
402
+ 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 : "";
403
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
404
+ throw new Error("status code not found in response: ".concat(httpRes));
405
+ }
406
+ res = new operations.RemoveAccountingJournalResponse({
407
+ statusCode: httpRes.status,
408
+ contentType: responseContentType,
409
+ rawResponse: httpRes,
410
+ });
411
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
412
+ switch (true) {
413
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 200 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 300:
414
+ break;
415
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
416
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
417
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
418
+ default:
419
+ if (utils.matchContentType(responseContentType, "application/json")) {
420
+ res.string = JSON.parse(decodedRes);
421
+ }
422
+ else {
423
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
424
+ }
425
+ break;
426
+ }
427
+ return [2 /*return*/, res];
428
+ }
429
+ });
430
+ });
431
+ };
432
+ /**
433
+ * Update a journal
434
+ */
435
+ Journal.prototype.updateAccountingJournal = function (req, config) {
436
+ var _a, _b;
437
+ return __awaiter(this, void 0, void 0, function () {
438
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
439
+ var _d;
440
+ return __generator(this, function (_e) {
441
+ switch (_e.label) {
442
+ case 0:
443
+ if (!(req instanceof utils.SpeakeasyBase)) {
444
+ req = new operations.UpdateAccountingJournalRequest(req);
445
+ }
446
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
447
+ operationUrl = utils.generateURL(baseURL, "/accounting/{connection_id}/journal/{id}", req);
448
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
449
+ try {
450
+ _d = __read(utils.serializeRequestBody(req, "accountingJournal", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
451
+ }
452
+ catch (e) {
453
+ if (e instanceof Error) {
454
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
455
+ }
456
+ }
457
+ client = this.sdkConfiguration.defaultClient;
458
+ globalSecurity = this.sdkConfiguration.security;
459
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
460
+ return [4 /*yield*/, globalSecurity()];
461
+ case 1:
462
+ globalSecurity = _e.sent();
463
+ _e.label = 2;
464
+ case 2:
465
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
466
+ globalSecurity = new shared.Security(globalSecurity);
467
+ }
468
+ properties = utils.parseSecurityProperties(globalSecurity);
469
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
470
+ headers["Accept"] = "application/json";
471
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
472
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
473
+ case 3:
474
+ httpRes = _e.sent();
475
+ 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 : "";
476
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
477
+ throw new Error("status code not found in response: ".concat(httpRes));
478
+ }
479
+ res = new operations.UpdateAccountingJournalResponse({
480
+ statusCode: httpRes.status,
481
+ contentType: responseContentType,
482
+ rawResponse: httpRes,
483
+ });
484
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
485
+ switch (true) {
486
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
487
+ if (utils.matchContentType(responseContentType, "application/json")) {
488
+ res.accountingJournal = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingJournal);
489
+ }
490
+ else {
491
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
492
+ }
493
+ break;
494
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
495
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
496
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
497
+ }
498
+ return [2 /*return*/, res];
499
+ }
500
+ });
501
+ });
502
+ };
503
+ return Journal;
504
+ }());
505
+ exports.Journal = Journal;
@@ -0,0 +1,28 @@
1
+ import { SpeakeasyBase } from "../../../internal/utils";
2
+ import * as shared from "../../../sdk/models/shared";
3
+ import { AxiosResponse } from "axios";
4
+ export declare class CreateAccountingJournalRequest extends SpeakeasyBase {
5
+ accountingJournal?: shared.AccountingJournal;
6
+ /**
7
+ * ID of the connection
8
+ */
9
+ connectionId: string;
10
+ }
11
+ export declare class CreateAccountingJournalResponse extends SpeakeasyBase {
12
+ /**
13
+ * Successful
14
+ */
15
+ accountingJournal?: shared.AccountingJournal;
16
+ /**
17
+ * HTTP response content type for this operation
18
+ */
19
+ contentType: string;
20
+ /**
21
+ * HTTP response status code for this operation
22
+ */
23
+ statusCode: number;
24
+ /**
25
+ * Raw HTTP response; suitable for custom response parsing
26
+ */
27
+ rawResponse: AxiosResponse;
28
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __extends = (this && this.__extends) || (function () {
6
+ var extendStatics = function (d, b) {
7
+ extendStatics = Object.setPrototypeOf ||
8
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
9
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
10
+ return extendStatics(d, b);
11
+ };
12
+ return function (d, b) {
13
+ if (typeof b !== "function" && b !== null)
14
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
15
+ extendStatics(d, b);
16
+ function __() { this.constructor = d; }
17
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18
+ };
19
+ })();
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
32
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
33
+ }) : function(o, v) {
34
+ o["default"] = v;
35
+ });
36
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
37
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
40
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
41
+ };
42
+ var __importStar = (this && this.__importStar) || function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ var __metadata = (this && this.__metadata) || function (k, v) {
50
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.CreateAccountingJournalResponse = exports.CreateAccountingJournalRequest = void 0;
54
+ var utils_1 = require("../../../internal/utils");
55
+ var shared = __importStar(require("../../../sdk/models/shared"));
56
+ var CreateAccountingJournalRequest = /** @class */ (function (_super) {
57
+ __extends(CreateAccountingJournalRequest, _super);
58
+ function CreateAccountingJournalRequest() {
59
+ return _super !== null && _super.apply(this, arguments) || this;
60
+ }
61
+ __decorate([
62
+ (0, utils_1.SpeakeasyMetadata)({ data: "request, media_type=application/json" }),
63
+ __metadata("design:type", shared.AccountingJournal)
64
+ ], CreateAccountingJournalRequest.prototype, "accountingJournal", void 0);
65
+ __decorate([
66
+ (0, utils_1.SpeakeasyMetadata)({ data: "pathParam, style=simple;explode=false;name=connection_id" }),
67
+ __metadata("design:type", String)
68
+ ], CreateAccountingJournalRequest.prototype, "connectionId", void 0);
69
+ return CreateAccountingJournalRequest;
70
+ }(utils_1.SpeakeasyBase));
71
+ exports.CreateAccountingJournalRequest = CreateAccountingJournalRequest;
72
+ var CreateAccountingJournalResponse = /** @class */ (function (_super) {
73
+ __extends(CreateAccountingJournalResponse, _super);
74
+ function CreateAccountingJournalResponse() {
75
+ return _super !== null && _super.apply(this, arguments) || this;
76
+ }
77
+ __decorate([
78
+ (0, utils_1.SpeakeasyMetadata)(),
79
+ __metadata("design:type", shared.AccountingJournal)
80
+ ], CreateAccountingJournalResponse.prototype, "accountingJournal", void 0);
81
+ __decorate([
82
+ (0, utils_1.SpeakeasyMetadata)(),
83
+ __metadata("design:type", String)
84
+ ], CreateAccountingJournalResponse.prototype, "contentType", void 0);
85
+ __decorate([
86
+ (0, utils_1.SpeakeasyMetadata)(),
87
+ __metadata("design:type", Number)
88
+ ], CreateAccountingJournalResponse.prototype, "statusCode", void 0);
89
+ __decorate([
90
+ (0, utils_1.SpeakeasyMetadata)(),
91
+ __metadata("design:type", Object)
92
+ ], CreateAccountingJournalResponse.prototype, "rawResponse", void 0);
93
+ return CreateAccountingJournalResponse;
94
+ }(utils_1.SpeakeasyBase));
95
+ exports.CreateAccountingJournalResponse = CreateAccountingJournalResponse;