@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,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.LoanWritebackSuppliers = 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 LoanWritebackSuppliers = /** @class */ (function () {
|
|
98
|
+
function LoanWritebackSuppliers(sdkConfig) {
|
|
99
|
+
this.sdkConfiguration = sdkConfig;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create supplier
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/accounting-api#/schemas/Supplier) for a given company's connection.
|
|
106
|
+
*
|
|
107
|
+
* [Suppliers](https://docs.codat.io/accounting-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service.
|
|
108
|
+
*
|
|
109
|
+
* **Integration-specific behaviour**
|
|
110
|
+
*
|
|
111
|
+
* Required data may vary by integration. To see what data to post, first call [Get create/update supplier model](https://docs.codat.io/accounting-api#/operations/get-create-update-suppliers-model).
|
|
112
|
+
*
|
|
113
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=suppliers) for integrations that support creating an account.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
LoanWritebackSuppliers.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.CreateSupplierRequest(req);
|
|
126
|
+
}
|
|
127
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
128
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/push/suppliers", req);
|
|
129
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
130
|
+
try {
|
|
131
|
+
_d = __read(utils.serializeRequestBody(req, "accountingSupplier", "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.CreateSupplierResponse({
|
|
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.accountingCreateSupplierResponse = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCreateSupplierResponse);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case [400, 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/update supplier model
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* The *Get create/update supplier model* endpoint returns the expected data for the request payload when creating and updating a [supplier](https://docs.codat.io/accounting-api#/schemas/Supplier) for a given company and integration.
|
|
207
|
+
*
|
|
208
|
+
* [Suppliers](https://docs.codat.io/accounting-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service.
|
|
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=suppliers) for integrations that support creating and updating a supplier.
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
LoanWritebackSuppliers.prototype.getCreateUpdateModel = 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.GetCreateUpdateSuppliersModelRequest(req);
|
|
226
|
+
}
|
|
227
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
228
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/options/suppliers", 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.GetCreateUpdateSuppliersModelResponse({
|
|
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 LoanWritebackSuppliers;
|
|
293
|
+
}());
|
|
294
|
+
exports.LoanWritebackSuppliers = LoanWritebackSuppliers;
|
|
@@ -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 LoanWritebackTransfers {
|
|
6
|
+
private sdkConfiguration;
|
|
7
|
+
constructor(sdkConfig: SDKConfiguration);
|
|
8
|
+
/**
|
|
9
|
+
* Create transfer
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* The *Create transfer* endpoint creates a new [transfer](https://docs.codat.io/accounting-api#/schemas/Transfer) for a given company's connection.
|
|
13
|
+
*
|
|
14
|
+
* [Transfers](https://docs.codat.io/accounting-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account.
|
|
15
|
+
*
|
|
16
|
+
* **Integration-specific behaviour**
|
|
17
|
+
*
|
|
18
|
+
* Required data may vary by integration. To see what data to post, first call [Get create transfer model](https://docs.codat.io/accounting-api#/operations/get-create-transfers-model).
|
|
19
|
+
*
|
|
20
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=transfers) for integrations that support creating an account.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
create(req: operations.CreateTransferRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.CreateTransferResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Get create transfer model
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* The *Get create transfer model* endpoint returns the expected data for the request payload when creating a [transfer](https://docs.codat.io/accounting-api#/schemas/Transfer) for a given company and integration.
|
|
29
|
+
*
|
|
30
|
+
* [Transfers](https://docs.codat.io/accounting-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal 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=transfers) for integrations that support creating a transfer.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
getCreateModel(req: operations.GetCreateTransfersModelRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.GetCreateTransfersModelResponse>;
|
|
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.LoanWritebackTransfers = 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 LoanWritebackTransfers = /** @class */ (function () {
|
|
98
|
+
function LoanWritebackTransfers(sdkConfig) {
|
|
99
|
+
this.sdkConfiguration = sdkConfig;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create transfer
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* The *Create transfer* endpoint creates a new [transfer](https://docs.codat.io/accounting-api#/schemas/Transfer) for a given company's connection.
|
|
106
|
+
*
|
|
107
|
+
* [Transfers](https://docs.codat.io/accounting-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account.
|
|
108
|
+
*
|
|
109
|
+
* **Integration-specific behaviour**
|
|
110
|
+
*
|
|
111
|
+
* Required data may vary by integration. To see what data to post, first call [Get create transfer model](https://docs.codat.io/accounting-api#/operations/get-create-transfers-model).
|
|
112
|
+
*
|
|
113
|
+
* Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=transfers) for integrations that support creating an account.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
LoanWritebackTransfers.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.CreateTransferRequest(req);
|
|
126
|
+
}
|
|
127
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
128
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/push/transfers", req);
|
|
129
|
+
_c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
|
|
130
|
+
try {
|
|
131
|
+
_d = __read(utils.serializeRequestBody(req, "accountingTransfer", "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.CreateTransferResponse({
|
|
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.accountingCreateTransferResponse = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCreateTransferResponse);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case [400, 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 transfer model
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* The *Get create transfer model* endpoint returns the expected data for the request payload when creating a [transfer](https://docs.codat.io/accounting-api#/schemas/Transfer) for a given company and integration.
|
|
207
|
+
*
|
|
208
|
+
* [Transfers](https://docs.codat.io/accounting-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal 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=transfers) for integrations that support creating a transfer.
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
LoanWritebackTransfers.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.GetCreateTransfersModelRequest(req);
|
|
226
|
+
}
|
|
227
|
+
baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
|
|
228
|
+
url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/options/transfers", 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.GetCreateTransfersModelResponse({
|
|
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 LoanWritebackTransfers;
|
|
293
|
+
}());
|
|
294
|
+
exports.LoanWritebackTransfers = LoanWritebackTransfers;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SpeakeasyBase } from "../../../internal/utils";
|
|
2
|
+
import * as shared from "../shared";
|
|
3
|
+
import { AxiosResponse } from "axios";
|
|
4
|
+
export declare class CreateAccountRequest extends SpeakeasyBase {
|
|
5
|
+
accountingAccount?: shared.AccountingAccount;
|
|
6
|
+
allowSyncOnPushComplete?: boolean;
|
|
7
|
+
companyId: string;
|
|
8
|
+
connectionId: string;
|
|
9
|
+
/**
|
|
10
|
+
* When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check.
|
|
11
|
+
*/
|
|
12
|
+
forceUpdate?: boolean;
|
|
13
|
+
timeoutInMinutes?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class CreateAccountResponse extends SpeakeasyBase {
|
|
16
|
+
/**
|
|
17
|
+
* Success
|
|
18
|
+
*/
|
|
19
|
+
accountingCreateAccountResponse?: shared.AccountingCreateAccountResponse;
|
|
20
|
+
contentType: string;
|
|
21
|
+
/**
|
|
22
|
+
* The request made is not valid.
|
|
23
|
+
*/
|
|
24
|
+
errorMessage?: shared.ErrorMessage;
|
|
25
|
+
statusCode: number;
|
|
26
|
+
rawResponse?: AxiosResponse;
|
|
27
|
+
}
|