@codat/lending 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/sdk/companies.js +2 -2
- package/dist/sdk/connections.js +2 -2
- package/dist/sdk/fileupload.js +1 -1
- package/dist/sdk/loanwriteback.d.ts +19 -0
- package/dist/sdk/loanwriteback.js +27 -0
- package/dist/sdk/loanwritebackaccounts.d.ts +40 -0
- package/dist/sdk/loanwritebackaccounts.js +294 -0
- package/dist/sdk/loanwritebackbankaccounts.d.ts +39 -0
- package/dist/sdk/loanwritebackbankaccounts.js +293 -0
- package/dist/sdk/loanwritebackbanktransactions.d.ts +40 -0
- package/dist/sdk/loanwritebackbanktransactions.js +294 -0
- package/dist/sdk/loanwritebackcreateoperations.d.ts +22 -0
- package/dist/sdk/loanwritebackcreateoperations.js +250 -0
- package/dist/sdk/loanwritebackdirectcosts.d.ts +40 -0
- package/dist/sdk/loanwritebackdirectcosts.js +294 -0
- package/dist/sdk/loanwritebacksuppliers.d.ts +40 -0
- package/dist/sdk/loanwritebacksuppliers.js +294 -0
- package/dist/sdk/loanwritebacktransfers.d.ts +40 -0
- package/dist/sdk/loanwritebacktransfers.js +294 -0
- package/dist/sdk/models/operations/createaccount.d.ts +27 -0
- package/dist/sdk/models/operations/createaccount.js +115 -0
- package/dist/sdk/models/operations/createbankaccount.d.ts +27 -0
- package/dist/sdk/models/operations/createbankaccount.js +115 -0
- package/dist/sdk/models/operations/createbanktransactions.d.ts +31 -0
- package/dist/sdk/models/operations/createbanktransactions.js +119 -0
- package/dist/sdk/models/operations/createdirectcost.d.ts +27 -0
- package/dist/sdk/models/operations/createdirectcost.js +115 -0
- package/dist/sdk/models/operations/createsupplier.d.ts +27 -0
- package/dist/sdk/models/operations/createsupplier.js +115 -0
- package/dist/sdk/models/operations/createtransfer.d.ts +27 -0
- package/dist/sdk/models/operations/createtransfer.js +115 -0
- package/dist/sdk/models/operations/getcreatebanktransactionsmodel.d.ts +24 -0
- package/dist/sdk/models/operations/getcreatebanktransactionsmodel.js +103 -0
- package/dist/sdk/models/operations/getcreatechartofaccountsmodel.d.ts +20 -0
- package/dist/sdk/models/operations/getcreatechartofaccountsmodel.js +99 -0
- package/dist/sdk/models/operations/getcreatedirectcostsmodel.d.ts +20 -0
- package/dist/sdk/models/operations/getcreatedirectcostsmodel.js +99 -0
- package/dist/sdk/models/operations/getcreateoperation.d.ts +23 -0
- package/dist/sdk/models/operations/getcreateoperation.js +99 -0
- package/dist/sdk/models/operations/getcreatetransfersmodel.d.ts +20 -0
- package/dist/sdk/models/operations/getcreatetransfersmodel.js +99 -0
- package/dist/sdk/models/operations/getcreateupdatebankaccountsmodel.d.ts +20 -0
- package/dist/sdk/models/operations/getcreateupdatebankaccountsmodel.js +99 -0
- package/dist/sdk/models/operations/getcreateupdatesuppliersmodel.d.ts +20 -0
- package/dist/sdk/models/operations/getcreateupdatesuppliersmodel.js +99 -0
- package/dist/sdk/models/operations/index.d.ts +14 -0
- package/dist/sdk/models/operations/index.js +14 -0
- package/dist/sdk/models/operations/listcreateoperations.d.ts +35 -0
- package/dist/sdk/models/operations/listcreateoperations.js +111 -0
- package/dist/sdk/models/shared/accountingcreateaccountresponse.d.ts +124 -0
- package/dist/sdk/models/shared/accountingcreateaccountresponse.js +118 -0
- package/dist/sdk/models/shared/accountingcreatebankaccountresponse.d.ts +112 -0
- package/dist/sdk/models/shared/accountingcreatebankaccountresponse.js +118 -0
- package/dist/sdk/models/shared/accountingcreatebanktransactions.d.ts +6 -0
- package/dist/sdk/models/shared/accountingcreatebanktransactions.js +52 -0
- package/dist/sdk/models/shared/accountingcreatebanktransactionsresponse.d.ts +92 -0
- package/dist/sdk/models/shared/accountingcreatebanktransactionsresponse.js +118 -0
- package/dist/sdk/models/shared/accountingcreatedirectcostresponse.d.ts +111 -0
- package/dist/sdk/models/shared/accountingcreatedirectcostresponse.js +118 -0
- package/dist/sdk/models/shared/accountingcreatesupplierresponse.d.ts +101 -0
- package/dist/sdk/models/shared/accountingcreatesupplierresponse.js +118 -0
- package/dist/sdk/models/shared/accountingcreatetransferresponse.d.ts +99 -0
- package/dist/sdk/models/shared/accountingcreatetransferresponse.js +118 -0
- package/dist/sdk/models/shared/createbankaccounttransaction.d.ts +31 -0
- package/dist/sdk/models/shared/createbankaccounttransaction.js +65 -0
- package/dist/sdk/models/shared/index.d.ts +22 -0
- package/dist/sdk/models/shared/index.js +22 -0
- package/dist/sdk/models/shared/pushchangetype.d.ts +7 -0
- package/dist/sdk/models/shared/pushchangetype.js +14 -0
- package/dist/sdk/models/shared/pushfieldvalidation.d.ts +6 -0
- package/dist/sdk/models/shared/pushfieldvalidation.js +55 -0
- package/dist/sdk/models/shared/pushoperation.d.ts +90 -0
- package/dist/sdk/models/shared/pushoperation.js +111 -0
- package/dist/sdk/models/shared/pushoperationchange.d.ts +8 -0
- package/dist/sdk/models/shared/pushoperationchange.js +58 -0
- package/dist/sdk/models/shared/pushoperationref.d.ts +9 -0
- package/dist/sdk/models/shared/pushoperationref.js +51 -0
- package/dist/sdk/models/shared/pushoperations.d.ts +10 -0
- package/dist/sdk/models/shared/pushoperations.js +69 -0
- package/dist/sdk/models/shared/pushoperationstatus.d.ts +9 -0
- package/dist/sdk/models/shared/pushoperationstatus.js +16 -0
- package/dist/sdk/models/shared/pushoption.d.ts +14 -0
- package/dist/sdk/models/shared/pushoption.js +89 -0
- package/dist/sdk/models/shared/pushoptionchoice.d.ts +12 -0
- package/dist/sdk/models/shared/pushoptionchoice.js +66 -0
- package/dist/sdk/models/shared/pushoptionproperty.d.ts +13 -0
- package/dist/sdk/models/shared/pushoptionproperty.js +88 -0
- package/dist/sdk/models/shared/pushoptiontype.d.ts +10 -0
- package/dist/sdk/models/shared/pushoptiontype.js +17 -0
- package/dist/sdk/models/shared/pushvalidationinfo.d.ts +6 -0
- package/dist/sdk/models/shared/pushvalidationinfo.js +53 -0
- package/dist/sdk/models/shared/validation.d.ts +9 -0
- package/dist/sdk/models/shared/validation.js +56 -0
- package/dist/sdk/models/shared/validationitem.d.ts +6 -0
- package/dist/sdk/models/shared/validationitem.js +55 -0
- package/dist/sdk/sdk.d.ts +2 -0
- package/dist/sdk/sdk.js +4 -2
- package/docs/models/operations/createaccountrequest.md +13 -0
- package/docs/models/operations/createaccountresponse.md +12 -0
- package/docs/models/operations/createbankaccountrequest.md +13 -0
- package/docs/models/operations/createbankaccountresponse.md +12 -0
- package/docs/models/operations/createbanktransactionsrequest.md +14 -0
- package/docs/models/operations/createbanktransactionsresponse.md +12 -0
- package/docs/models/operations/createdirectcostrequest.md +13 -0
- package/docs/models/operations/createdirectcostresponse.md +12 -0
- package/docs/models/operations/createsupplierrequest.md +13 -0
- package/docs/models/operations/createsupplierresponse.md +12 -0
- package/docs/models/operations/createtransferrequest.md +13 -0
- package/docs/models/operations/createtransferresponse.md +12 -0
- package/docs/models/operations/getcreatebanktransactionsmodelrequest.md +10 -0
- package/docs/models/operations/getcreatebanktransactionsmodelresponse.md +12 -0
- package/docs/models/operations/getcreatechartofaccountsmodelrequest.md +9 -0
- package/docs/models/operations/getcreatechartofaccountsmodelresponse.md +12 -0
- package/docs/models/operations/getcreatedirectcostsmodelrequest.md +9 -0
- package/docs/models/operations/getcreatedirectcostsmodelresponse.md +12 -0
- package/docs/models/operations/getcreateoperationrequest.md +9 -0
- package/docs/models/operations/getcreateoperationresponse.md +12 -0
- package/docs/models/operations/getcreatetransfersmodelrequest.md +9 -0
- package/docs/models/operations/getcreatetransfersmodelresponse.md +12 -0
- package/docs/models/operations/getcreateupdatebankaccountsmodelrequest.md +9 -0
- package/docs/models/operations/getcreateupdatebankaccountsmodelresponse.md +12 -0
- package/docs/models/operations/getcreateupdatesuppliersmodelrequest.md +9 -0
- package/docs/models/operations/getcreateupdatesuppliersmodelresponse.md +12 -0
- package/docs/models/operations/listcreateoperationsrequest.md +12 -0
- package/docs/models/operations/listcreateoperationsresponse.md +12 -0
- package/docs/models/shared/accountingcreateaccountresponse.md +21 -0
- package/docs/models/shared/accountingcreatebankaccountresponse.md +21 -0
- package/docs/models/shared/accountingcreatebanktransactions.md +9 -0
- package/docs/models/shared/accountingcreatebanktransactionsresponse.md +21 -0
- package/docs/models/shared/accountingcreatedirectcostresponse.md +21 -0
- package/docs/models/shared/accountingcreatesupplierresponse.md +21 -0
- package/docs/models/shared/accountingcreatetransferresponse.md +21 -0
- package/docs/models/shared/createbankaccounttransaction.md +12 -0
- package/docs/models/shared/pushchangetype.md +12 -0
- package/docs/models/shared/pushfieldvalidation.md +10 -0
- package/docs/models/shared/pushoperation.md +20 -0
- package/docs/models/shared/pushoperationchange.md +10 -0
- package/docs/models/shared/pushoperationref.md +9 -0
- package/docs/models/shared/pushoperations.md +12 -0
- package/docs/models/shared/pushoperationstatus.md +13 -0
- package/docs/models/shared/pushoption.md +14 -0
- package/docs/models/shared/pushoptionchoice.md +12 -0
- package/docs/models/shared/pushoptionproperty.md +14 -0
- package/docs/models/shared/pushoptiontype.md +15 -0
- package/docs/models/shared/pushvalidationinfo.md +9 -0
- package/docs/models/shared/validation.md +11 -0
- package/docs/models/shared/validationitem.md +10 -0
- package/docs/sdks/loanwriteback/README.md +4 -0
- package/docs/sdks/loanwritebackaccounts/README.md +134 -0
- package/docs/sdks/loanwritebackbankaccounts/README.md +126 -0
- package/docs/sdks/loanwritebackbanktransactions/README.md +121 -0
- package/docs/sdks/loanwritebackcreateoperations/README.md +89 -0
- package/docs/sdks/loanwritebackdirectcosts/README.md +200 -0
- package/docs/sdks/loanwritebacksuppliers/README.md +142 -0
- package/docs/sdks/loanwritebacktransfers/README.md +156 -0
- package/docs/sdks/managedatapulloperations/README.md +1 -1
- package/docs/sdks/managedatarefresh/README.md +1 -1
- package/docs/sdks/salescustomers/README.md +2 -2
- package/docs/sdks/salesdisputes/README.md +2 -2
- package/docs/sdks/saleslocations/README.md +1 -1
- package/docs/sdks/salesmetrics/README.md +9 -9
- package/docs/sdks/salesorders/README.md +2 -2
- package/docs/sdks/salespaymentmethods/README.md +2 -2
- package/docs/sdks/salespayments/README.md +2 -2
- package/docs/sdks/salesproductcategories/README.md +2 -2
- package/docs/sdks/salesproducts/README.md +2 -2
- package/docs/sdks/salesreports/README.md +5 -5
- package/docs/sdks/salestransactions/README.md +2 -2
- package/docs/sdks/transactionsaccounttransactions/README.md +2 -2
- package/docs/sdks/transactionsdirectcosts/README.md +5 -5
- package/docs/sdks/transactionsjournalentries/README.md +2 -2
- package/docs/sdks/transactionsjournals/README.md +2 -2
- package/docs/sdks/transactionstransfers/README.md +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,293 @@
|
|
|
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.LoanWritebackBankAccounts = void 0;
|
|
93
|
+
var utils = __importStar(require("../internal/utils"));
|
|
94
|
+
var errors = __importStar(require("./models/errors"));
|
|
95
|
+
var operations = __importStar(require("./models/operations"));
|
|
96
|
+
var shared = __importStar(require("./models/shared"));
|
|
97
|
+
var LoanWritebackBankAccounts = /** @class */ (function () {
|
|
98
|
+
function LoanWritebackBankAccounts(sdkConfig) {
|
|
99
|
+
this.sdkConfiguration = sdkConfig;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create bank account
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/accounting-api#/schemas/BankAccount) for a given company's connection.
|
|
106
|
+
*
|
|
107
|
+
* [Bank accounts](https://docs.codat.io/accounting-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution.
|
|
108
|
+
*
|
|
109
|
+
* **Integration-specific behaviour**
|
|
110
|
+
*
|
|
111
|
+
* Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/accounting-api#/operations/get-create-update-bankAccounts-model).
|
|
112
|
+
*
|
|
113
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support creating an account.
|
|
114
|
+
*/
|
|
115
|
+
LoanWritebackBankAccounts.prototype.create = function (req, retries, config) {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
|
|
119
|
+
var _d;
|
|
120
|
+
return __generator(this, function (_e) {
|
|
121
|
+
switch (_e.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
124
|
+
req = new operations.CreateBankAccountRequest(req);
|
|
125
|
+
}
|
|
126
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
127
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/push/bankAccounts", req);
|
|
128
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
129
|
+
try {
|
|
130
|
+
_d = __read(utils.serializeRequestBody(req, "accountingBankAccount", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
if (e instanceof Error) {
|
|
134
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
client = this.sdkConfiguration.defaultClient;
|
|
138
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
139
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
140
|
+
return [4 /*yield*/, globalSecurity()];
|
|
141
|
+
case 1:
|
|
142
|
+
globalSecurity = _e.sent();
|
|
143
|
+
_e.label = 2;
|
|
144
|
+
case 2:
|
|
145
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
146
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
147
|
+
}
|
|
148
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
149
|
+
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
150
|
+
queryParams = utils.serializeQueryParams(req);
|
|
151
|
+
headers["Accept"] = "application/json";
|
|
152
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
153
|
+
globalRetryConfig = this.sdkConfiguration.retryConfig;
|
|
154
|
+
retryConfig = retries;
|
|
155
|
+
if (!retryConfig) {
|
|
156
|
+
if (globalRetryConfig) {
|
|
157
|
+
retryConfig = globalRetryConfig;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [4 /*yield*/, utils.Retry(function () {
|
|
164
|
+
return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config));
|
|
165
|
+
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
|
|
166
|
+
case 3:
|
|
167
|
+
httpRes = _e.sent();
|
|
168
|
+
contentType = (_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 : "";
|
|
169
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
170
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
171
|
+
}
|
|
172
|
+
res = new operations.CreateBankAccountResponse({
|
|
173
|
+
statusCode: httpRes.status,
|
|
174
|
+
contentType: contentType,
|
|
175
|
+
rawResponse: httpRes,
|
|
176
|
+
});
|
|
177
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
178
|
+
switch (true) {
|
|
179
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
180
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
181
|
+
res.accountingCreateBankAccountResponse = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCreateBankAccountResponse);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case [400, 401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
|
|
188
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
189
|
+
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
return [2 /*return*/, res];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Get create/update bank account model
|
|
203
|
+
*
|
|
204
|
+
* @remarks
|
|
205
|
+
* The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/accounting-api#/schemas/BankAccount) for a given company and integration.
|
|
206
|
+
*
|
|
207
|
+
* [Bank accounts](https://docs.codat.io/accounting-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution.
|
|
208
|
+
*
|
|
209
|
+
* **Integration-specific behaviour**
|
|
210
|
+
*
|
|
211
|
+
* See the *response examples* for integration-specific indicative models.
|
|
212
|
+
*
|
|
213
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support creating and updating a bank account.
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
LoanWritebackBankAccounts.prototype.getCreateUpdateModel = function (req, retries, config) {
|
|
217
|
+
var _a, _b;
|
|
218
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
+
var baseURL, url, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
|
|
220
|
+
return __generator(this, function (_c) {
|
|
221
|
+
switch (_c.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
224
|
+
req = new operations.GetCreateUpdateBankAccountsModelRequest(req);
|
|
225
|
+
}
|
|
226
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
227
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/options/bankAccounts", req);
|
|
228
|
+
client = this.sdkConfiguration.defaultClient;
|
|
229
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
230
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
231
|
+
return [4 /*yield*/, globalSecurity()];
|
|
232
|
+
case 1:
|
|
233
|
+
globalSecurity = _c.sent();
|
|
234
|
+
_c.label = 2;
|
|
235
|
+
case 2:
|
|
236
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
237
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
238
|
+
}
|
|
239
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
240
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
241
|
+
headers["Accept"] = "application/json";
|
|
242
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
243
|
+
globalRetryConfig = this.sdkConfiguration.retryConfig;
|
|
244
|
+
retryConfig = retries;
|
|
245
|
+
if (!retryConfig) {
|
|
246
|
+
if (globalRetryConfig) {
|
|
247
|
+
retryConfig = globalRetryConfig;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return [4 /*yield*/, utils.Retry(function () {
|
|
254
|
+
return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
|
|
255
|
+
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
|
|
256
|
+
case 3:
|
|
257
|
+
httpRes = _c.sent();
|
|
258
|
+
contentType = (_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 : "";
|
|
259
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
260
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
261
|
+
}
|
|
262
|
+
res = new operations.GetCreateUpdateBankAccountsModelResponse({
|
|
263
|
+
statusCode: httpRes.status,
|
|
264
|
+
contentType: contentType,
|
|
265
|
+
rawResponse: httpRes,
|
|
266
|
+
});
|
|
267
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
268
|
+
switch (true) {
|
|
269
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
270
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
271
|
+
res.pushOption = utils.objectToClass(JSON.parse(decodedRes), shared.PushOption);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
|
|
278
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
279
|
+
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
283
|
+
}
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
return [2 /*return*/, res];
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
return LoanWritebackBankAccounts;
|
|
292
|
+
}());
|
|
293
|
+
exports.LoanWritebackBankAccounts = LoanWritebackBankAccounts;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as utils from "../internal/utils";
|
|
2
|
+
import * as operations from "./models/operations";
|
|
3
|
+
import { SDKConfiguration } from "./sdk";
|
|
4
|
+
import { AxiosRequestConfig } from "axios";
|
|
5
|
+
export declare class LoanWritebackBankTransactions {
|
|
6
|
+
private sdkConfiguration;
|
|
7
|
+
constructor(sdkConfig: SDKConfiguration);
|
|
8
|
+
/**
|
|
9
|
+
* Create bank account transactions
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* The *Create bank account transactions* endpoint creates new [bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) for a given company's connection.
|
|
13
|
+
*
|
|
14
|
+
* [Bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account.
|
|
15
|
+
*
|
|
16
|
+
* **Integration-specific behaviour**
|
|
17
|
+
*
|
|
18
|
+
* Required data may vary by integration. To see what data to post, first call [Get create bank transaction model](https://docs.codat.io/accounting-api#/operations/get-create-bankTransactions-model).
|
|
19
|
+
*
|
|
20
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankTransactions) for integrations that support creating a bank account transactions.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
create(req: operations.CreateBankTransactionsRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.CreateBankTransactionsResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Get create bank account transactions model
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* The *Get create bank account transactions model* endpoint returns the expected data for the request payload when creating [bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) for a given company and integration.
|
|
29
|
+
*
|
|
30
|
+
* [Bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account.
|
|
31
|
+
*
|
|
32
|
+
* **Integration-specific behaviour**
|
|
33
|
+
*
|
|
34
|
+
* See the *response examples* for integration-specific indicative models.
|
|
35
|
+
*
|
|
36
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankTransactions) for integrations that support creating an bank transaction.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
getCreateModel(req: operations.GetCreateBankTransactionsModelRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.GetCreateBankTransactionsModelResponse>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
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.LoanWritebackBankTransactions = void 0;
|
|
93
|
+
var utils = __importStar(require("../internal/utils"));
|
|
94
|
+
var errors = __importStar(require("./models/errors"));
|
|
95
|
+
var operations = __importStar(require("./models/operations"));
|
|
96
|
+
var shared = __importStar(require("./models/shared"));
|
|
97
|
+
var LoanWritebackBankTransactions = /** @class */ (function () {
|
|
98
|
+
function LoanWritebackBankTransactions(sdkConfig) {
|
|
99
|
+
this.sdkConfiguration = sdkConfig;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create bank account transactions
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* The *Create bank account transactions* endpoint creates new [bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) for a given company's connection.
|
|
106
|
+
*
|
|
107
|
+
* [Bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account.
|
|
108
|
+
*
|
|
109
|
+
* **Integration-specific behaviour**
|
|
110
|
+
*
|
|
111
|
+
* Required data may vary by integration. To see what data to post, first call [Get create bank transaction model](https://docs.codat.io/accounting-api#/operations/get-create-bankTransactions-model).
|
|
112
|
+
*
|
|
113
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankTransactions) for integrations that support creating a bank account transactions.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
LoanWritebackBankTransactions.prototype.create = function (req, retries, config) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
var baseURL, url, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, queryParams, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
|
|
120
|
+
var _d;
|
|
121
|
+
return __generator(this, function (_e) {
|
|
122
|
+
switch (_e.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
125
|
+
req = new operations.CreateBankTransactionsRequest(req);
|
|
126
|
+
}
|
|
127
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
128
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/push/bankAccounts/{accountId}/bankTransactions", req);
|
|
129
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
130
|
+
try {
|
|
131
|
+
_d = __read(utils.serializeRequestBody(req, "accountingCreateBankTransactions", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
if (e instanceof Error) {
|
|
135
|
+
throw new Error("Error serializing request body, cause: ".concat(e.message));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
client = this.sdkConfiguration.defaultClient;
|
|
139
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
140
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
141
|
+
return [4 /*yield*/, globalSecurity()];
|
|
142
|
+
case 1:
|
|
143
|
+
globalSecurity = _e.sent();
|
|
144
|
+
_e.label = 2;
|
|
145
|
+
case 2:
|
|
146
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
147
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
148
|
+
}
|
|
149
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
150
|
+
headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
151
|
+
queryParams = utils.serializeQueryParams(req);
|
|
152
|
+
headers["Accept"] = "application/json";
|
|
153
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
154
|
+
globalRetryConfig = this.sdkConfiguration.retryConfig;
|
|
155
|
+
retryConfig = retries;
|
|
156
|
+
if (!retryConfig) {
|
|
157
|
+
if (globalRetryConfig) {
|
|
158
|
+
retryConfig = globalRetryConfig;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return [4 /*yield*/, utils.Retry(function () {
|
|
165
|
+
return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config));
|
|
166
|
+
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
|
|
167
|
+
case 3:
|
|
168
|
+
httpRes = _e.sent();
|
|
169
|
+
contentType = (_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 : "";
|
|
170
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
171
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
172
|
+
}
|
|
173
|
+
res = new operations.CreateBankTransactionsResponse({
|
|
174
|
+
statusCode: httpRes.status,
|
|
175
|
+
contentType: contentType,
|
|
176
|
+
rawResponse: httpRes,
|
|
177
|
+
});
|
|
178
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
179
|
+
switch (true) {
|
|
180
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
181
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
182
|
+
res.accountingCreateBankTransactionsResponse = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCreateBankTransactionsResponse);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
|
|
189
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
190
|
+
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
return [2 /*return*/, res];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Get create bank account transactions model
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* The *Get create bank account transactions model* endpoint returns the expected data for the request payload when creating [bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) for a given company and integration.
|
|
207
|
+
*
|
|
208
|
+
* [Bank account transactions](https://docs.codat.io/accounting-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account.
|
|
209
|
+
*
|
|
210
|
+
* **Integration-specific behaviour**
|
|
211
|
+
*
|
|
212
|
+
* See the *response examples* for integration-specific indicative models.
|
|
213
|
+
*
|
|
214
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankTransactions) for integrations that support creating an bank transaction.
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
LoanWritebackBankTransactions.prototype.getCreateModel = function (req, retries, config) {
|
|
218
|
+
var _a, _b;
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
var baseURL, url, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
|
|
221
|
+
return __generator(this, function (_c) {
|
|
222
|
+
switch (_c.label) {
|
|
223
|
+
case 0:
|
|
224
|
+
if (!(req instanceof utils.SpeakeasyBase)) {
|
|
225
|
+
req = new operations.GetCreateBankTransactionsModelRequest(req);
|
|
226
|
+
}
|
|
227
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
228
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/options/bankAccounts/{accountId}/bankTransactions", req);
|
|
229
|
+
client = this.sdkConfiguration.defaultClient;
|
|
230
|
+
globalSecurity = this.sdkConfiguration.security;
|
|
231
|
+
if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
|
|
232
|
+
return [4 /*yield*/, globalSecurity()];
|
|
233
|
+
case 1:
|
|
234
|
+
globalSecurity = _c.sent();
|
|
235
|
+
_c.label = 2;
|
|
236
|
+
case 2:
|
|
237
|
+
if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
|
|
238
|
+
globalSecurity = new shared.Security(globalSecurity);
|
|
239
|
+
}
|
|
240
|
+
properties = utils.parseSecurityProperties(globalSecurity);
|
|
241
|
+
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
|
|
242
|
+
headers["Accept"] = "application/json";
|
|
243
|
+
headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
|
|
244
|
+
globalRetryConfig = this.sdkConfiguration.retryConfig;
|
|
245
|
+
retryConfig = retries;
|
|
246
|
+
if (!retryConfig) {
|
|
247
|
+
if (globalRetryConfig) {
|
|
248
|
+
retryConfig = globalRetryConfig;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return [4 /*yield*/, utils.Retry(function () {
|
|
255
|
+
return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
|
|
256
|
+
}, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
|
|
257
|
+
case 3:
|
|
258
|
+
httpRes = _c.sent();
|
|
259
|
+
contentType = (_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 : "";
|
|
260
|
+
if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
|
|
261
|
+
throw new Error("status code not found in response: ".concat(httpRes));
|
|
262
|
+
}
|
|
263
|
+
res = new operations.GetCreateBankTransactionsModelResponse({
|
|
264
|
+
statusCode: httpRes.status,
|
|
265
|
+
contentType: contentType,
|
|
266
|
+
rawResponse: httpRes,
|
|
267
|
+
});
|
|
268
|
+
decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
|
|
269
|
+
switch (true) {
|
|
270
|
+
case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
|
|
271
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
272
|
+
res.pushOption = utils.objectToClass(JSON.parse(decodedRes), shared.PushOption);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
|
|
279
|
+
if (utils.matchContentType(contentType, "application/json")) {
|
|
280
|
+
res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
return [2 /*return*/, res];
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
return LoanWritebackBankTransactions;
|
|
293
|
+
}());
|
|
294
|
+
exports.LoanWritebackBankTransactions = LoanWritebackBankTransactions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as utils from "../internal/utils";
|
|
2
|
+
import * as operations from "./models/operations";
|
|
3
|
+
import { SDKConfiguration } from "./sdk";
|
|
4
|
+
import { AxiosRequestConfig } from "axios";
|
|
5
|
+
export declare class LoanWritebackCreateOperations {
|
|
6
|
+
private sdkConfiguration;
|
|
7
|
+
constructor(sdkConfig: SDKConfiguration);
|
|
8
|
+
/**
|
|
9
|
+
* Get create operation
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Retrieve create operation.
|
|
13
|
+
*/
|
|
14
|
+
get(req: operations.GetCreateOperationRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.GetCreateOperationResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* List create operations
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* List create operations.
|
|
20
|
+
*/
|
|
21
|
+
list(req: operations.ListCreateOperationsRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.ListCreateOperationsResponse>;
|
|
22
|
+
}
|