@codat/lending 1.1.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +46 -48
  2. package/dist/sdk/accountingbankdata.d.ts +1 -1
  3. package/dist/sdk/accountingbankdata.js +1 -1
  4. package/dist/sdk/accountspayable.d.ts +4 -38
  5. package/dist/sdk/accountspayable.js +5 -264
  6. package/dist/sdk/accountspayablebills.d.ts +28 -0
  7. package/dist/sdk/accountspayablebills.js +183 -1
  8. package/dist/sdk/accountsreceivable.d.ts +6 -6
  9. package/dist/sdk/accountsreceivable.js +6 -6
  10. package/dist/sdk/banking.d.ts +5 -5
  11. package/dist/sdk/banking.js +5 -5
  12. package/dist/sdk/financialstatements.d.ts +4 -4
  13. package/dist/sdk/financialstatements.js +4 -4
  14. package/dist/sdk/managedata.d.ts +2 -2
  15. package/dist/sdk/managedata.js +2 -2
  16. package/dist/sdk/sales.d.ts +11 -11
  17. package/dist/sdk/sales.js +11 -11
  18. package/dist/sdk/sdk.d.ts +1 -4
  19. package/dist/sdk/sdk.js +3 -3
  20. package/dist/sdk/transactions.d.ts +5 -5
  21. package/dist/sdk/transactions.js +5 -5
  22. package/docs/sdks/accountspayable/README.md +0 -100
  23. package/docs/sdks/accountspayablebillcreditnotes/README.md +2 -2
  24. package/docs/sdks/accountspayablebillpayments/README.md +2 -2
  25. package/docs/sdks/accountspayablebills/README.md +99 -3
  26. package/docs/sdks/accountspayablesuppliers/README.md +5 -5
  27. package/docs/sdks/bankingaccounts/README.md +3 -3
  28. package/docs/sdks/bankingtransactions/README.md +3 -3
  29. package/docs/sdks/companies/README.md +1 -1
  30. package/docs/sdks/connections/README.md +3 -3
  31. package/docs/sdks/dataintegrity/README.md +2 -2
  32. package/docs/sdks/excelreports/README.md +3 -3
  33. package/docs/sdks/fileupload/README.md +2 -2
  34. package/docs/sdks/liabilities/README.md +1 -1
  35. package/docs/sdks/salescustomers/README.md +3 -3
  36. package/docs/sdks/salesdisputes/README.md +3 -3
  37. package/docs/sdks/saleslocations/README.md +3 -3
  38. package/docs/sdks/salesmetrics/README.md +4 -4
  39. package/docs/sdks/salesorders/README.md +3 -3
  40. package/docs/sdks/salespayments/README.md +3 -3
  41. package/docs/sdks/salesproducts/README.md +3 -3
  42. package/docs/sdks/salesreports/README.md +3 -3
  43. package/docs/sdks/salestransactions/README.md +3 -3
  44. package/docs/sdks/transactionsjournals/README.md +3 -3
  45. package/docs/sdks/transactionstransfers/README.md +3 -3
  46. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Lending helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from the operating systems they are already using. You can use that data for automating decisioning and surfacing new insights on the customer, all via one API.
4
4
 
5
+ <!-- Start SDK Installation -->
5
6
  ## SDK Installation
6
7
 
7
8
  ### NPM
@@ -14,11 +15,11 @@ npm add @codat/lending
14
15
 
15
16
  ```bash
16
17
  yarn add @codat/lending
17
- ```<!-- Start SDK Installation -->
18
-
18
+ ```
19
19
  <!-- End SDK Installation -->
20
20
 
21
21
  ## Example Usage
22
+ <!-- Start SDK Example Usage -->
22
23
 
23
24
 
24
25
  ```typescript
@@ -44,10 +45,10 @@ sdk.accountingBankData.listTransactions({
44
45
  // handle response
45
46
  }
46
47
  });
47
- ```<!-- Start SDK Example Usage -->
48
-
48
+ ```
49
49
  <!-- End SDK Example Usage -->
50
50
 
51
+ <!-- Start SDK Available Operations -->
51
52
  ## Available Resources and Operations
52
53
 
53
54
 
@@ -60,35 +61,6 @@ sdk.accountingBankData.listTransactions({
60
61
  * [get](docs/sdks/accountingbankdataaccounts/README.md#get) - Get bank account
61
62
  * [list](docs/sdks/accountingbankdataaccounts/README.md#list) - List bank accounts
62
63
 
63
- ### [accountsPayable](docs/sdks/accountspayable/README.md)
64
-
65
- * [downloadBillAttachment](docs/sdks/accountspayable/README.md#downloadbillattachment) - Download bill attachment
66
- * [getBillAttachment](docs/sdks/accountspayable/README.md#getbillattachment) - Get bill attachment
67
-
68
- ### [accountsPayableBillCreditNotes](docs/sdks/accountspayablebillcreditnotes/README.md)
69
-
70
- * [get](docs/sdks/accountspayablebillcreditnotes/README.md#get) - Get bill credit note
71
- * [list](docs/sdks/accountspayablebillcreditnotes/README.md#list) - List bill credit notes
72
-
73
- ### [accountsPayableBillPayments](docs/sdks/accountspayablebillpayments/README.md)
74
-
75
- * [get](docs/sdks/accountspayablebillpayments/README.md#get) - Get bill payment
76
- * [list](docs/sdks/accountspayablebillpayments/README.md#list) - List bill payments
77
-
78
- ### [accountsPayableBills](docs/sdks/accountspayablebills/README.md)
79
-
80
- * [get](docs/sdks/accountspayablebills/README.md#get) - Get bill
81
- * [list](docs/sdks/accountspayablebills/README.md#list) - List bills
82
- * [listAttachments](docs/sdks/accountspayablebills/README.md#listattachments) - List bill attachments
83
-
84
- ### [accountsPayableSuppliers](docs/sdks/accountspayablesuppliers/README.md)
85
-
86
- * [downloadAttachment](docs/sdks/accountspayablesuppliers/README.md#downloadattachment) - Download supplier attachment
87
- * [get](docs/sdks/accountspayablesuppliers/README.md#get) - Get supplier
88
- * [getAttachment](docs/sdks/accountspayablesuppliers/README.md#getattachment) - Get supplier attachment
89
- * [list](docs/sdks/accountspayablesuppliers/README.md#list) - List suppliers
90
- * [listAttachments](docs/sdks/accountspayablesuppliers/README.md#listattachments) - List supplier attachments
91
-
92
64
  ### [companies](docs/sdks/companies/README.md)
93
65
 
94
66
  * [create](docs/sdks/companies/README.md#create) - Create company
@@ -134,6 +106,33 @@ sdk.accountingBankData.listTransactions({
134
106
  * [listLoanTransactions](docs/sdks/liabilities/README.md#listloantransactions) - List loan transactions
135
107
 
136
108
 
109
+ ### [accountsPayableBillCreditNotes](docs/sdks/accountspayablebillcreditnotes/README.md)
110
+
111
+ * [get](docs/sdks/accountspayablebillcreditnotes/README.md#get) - Get bill credit note
112
+ * [list](docs/sdks/accountspayablebillcreditnotes/README.md#list) - List bill credit notes
113
+
114
+ ### [accountsPayableBillPayments](docs/sdks/accountspayablebillpayments/README.md)
115
+
116
+ * [get](docs/sdks/accountspayablebillpayments/README.md#get) - Get bill payment
117
+ * [list](docs/sdks/accountspayablebillpayments/README.md#list) - List bill payments
118
+
119
+ ### [accountsPayableBills](docs/sdks/accountspayablebills/README.md)
120
+
121
+ * [downloadAttachment](docs/sdks/accountspayablebills/README.md#downloadattachment) - Download bill attachment
122
+ * [get](docs/sdks/accountspayablebills/README.md#get) - Get bill
123
+ * [getAttachment](docs/sdks/accountspayablebills/README.md#getattachment) - Get bill attachment
124
+ * [list](docs/sdks/accountspayablebills/README.md#list) - List bills
125
+ * [listAttachments](docs/sdks/accountspayablebills/README.md#listattachments) - List bill attachments
126
+
127
+ ### [accountsPayableSuppliers](docs/sdks/accountspayablesuppliers/README.md)
128
+
129
+ * [downloadAttachment](docs/sdks/accountspayablesuppliers/README.md#downloadattachment) - Download supplier attachment
130
+ * [get](docs/sdks/accountspayablesuppliers/README.md#get) - Get supplier
131
+ * [getAttachment](docs/sdks/accountspayablesuppliers/README.md#getattachment) - Get supplier attachment
132
+ * [list](docs/sdks/accountspayablesuppliers/README.md#list) - List suppliers
133
+ * [listAttachments](docs/sdks/accountspayablesuppliers/README.md#listattachments) - List supplier attachments
134
+
135
+
137
136
  ### [accountsReceivableCreditNotes](docs/sdks/accountsreceivablecreditnotes/README.md)
138
137
 
139
138
  * [get](docs/sdks/accountsreceivablecreditnotes/README.md#get) - Get credit note
@@ -182,7 +181,7 @@ sdk.accountingBankData.listTransactions({
182
181
 
183
182
  * [list](docs/sdks/bankingaccountbalances/README.md#list) - List account balances
184
183
 
185
- ### [bankingAccounts](docs/sdks/bankingaccounts/README.md)
184
+ ### [Banking.Accounts](docs/sdks/bankingaccounts/README.md)
186
185
 
187
186
  * [get](docs/sdks/bankingaccounts/README.md#get) - Get account
188
187
  * [list](docs/sdks/bankingaccounts/README.md#list) - List accounts
@@ -196,7 +195,7 @@ sdk.accountingBankData.listTransactions({
196
195
  * [get](docs/sdks/bankingtransactioncategories/README.md#get) - Get transaction category
197
196
  * [list](docs/sdks/bankingtransactioncategories/README.md#list) - List transaction categories
198
197
 
199
- ### [bankingTransactions](docs/sdks/bankingtransactions/README.md)
198
+ ### [Banking.Transactions](docs/sdks/bankingtransactions/README.md)
200
199
 
201
200
  * [get](docs/sdks/bankingtransactions/README.md#get) - Get bank transaction
202
201
  * [list](docs/sdks/bankingtransactions/README.md#list) - List transactions
@@ -236,28 +235,28 @@ sdk.accountingBankData.listTransactions({
236
235
  * [dataType](docs/sdks/managedatarefresh/README.md#datatype) - Refresh data type
237
236
 
238
237
 
239
- ### [salesCustomers](docs/sdks/salescustomers/README.md)
238
+ ### [Sales.Customers](docs/sdks/salescustomers/README.md)
240
239
 
241
240
  * [get](docs/sdks/salescustomers/README.md#get) - Get customer
242
241
  * [list](docs/sdks/salescustomers/README.md#list) - List customers
243
242
 
244
- ### [salesDisputes](docs/sdks/salesdisputes/README.md)
243
+ ### [Sales.Disputes](docs/sdks/salesdisputes/README.md)
245
244
 
246
245
  * [get](docs/sdks/salesdisputes/README.md#get) - Get dispute
247
246
  * [list](docs/sdks/salesdisputes/README.md#list) - List disputes
248
247
 
249
- ### [salesLocations](docs/sdks/saleslocations/README.md)
248
+ ### [Sales.Locations](docs/sdks/saleslocations/README.md)
250
249
 
251
250
  * [get](docs/sdks/saleslocations/README.md#get) - Get location
252
251
  * [list](docs/sdks/saleslocations/README.md#list) - List locations
253
252
 
254
- ### [salesMetrics](docs/sdks/salesmetrics/README.md)
253
+ ### [Sales.Metrics](docs/sdks/salesmetrics/README.md)
255
254
 
256
255
  * [getCustomerRetention](docs/sdks/salesmetrics/README.md#getcustomerretention) - Get customer retention metrics
257
256
  * [getLifetimeValue](docs/sdks/salesmetrics/README.md#getlifetimevalue) - Get lifetime value metrics
258
257
  * [getRevenue](docs/sdks/salesmetrics/README.md#getrevenue) - Get commerce revenue metrics
259
258
 
260
- ### [salesOrders](docs/sdks/salesorders/README.md)
259
+ ### [Sales.Orders](docs/sdks/salesorders/README.md)
261
260
 
262
261
  * [get](docs/sdks/salesorders/README.md#get) - Get order
263
262
  * [list](docs/sdks/salesorders/README.md#list) - List orders
@@ -267,7 +266,7 @@ sdk.accountingBankData.listTransactions({
267
266
  * [get](docs/sdks/salespaymentmethods/README.md#get) - Get payment method
268
267
  * [list](docs/sdks/salespaymentmethods/README.md#list) - List payment methods
269
268
 
270
- ### [salesPayments](docs/sdks/salespayments/README.md)
269
+ ### [Sales.Payments](docs/sdks/salespayments/README.md)
271
270
 
272
271
  * [get](docs/sdks/salespayments/README.md#get) - Get payment
273
272
  * [list](docs/sdks/salespayments/README.md#list) - List payments
@@ -277,17 +276,17 @@ sdk.accountingBankData.listTransactions({
277
276
  * [get](docs/sdks/salesproductcategories/README.md#get) - Get product category
278
277
  * [list](docs/sdks/salesproductcategories/README.md#list) - List product categories
279
278
 
280
- ### [salesProducts](docs/sdks/salesproducts/README.md)
279
+ ### [Sales.Products](docs/sdks/salesproducts/README.md)
281
280
 
282
281
  * [get](docs/sdks/salesproducts/README.md#get) - Get product
283
282
  * [list](docs/sdks/salesproducts/README.md#list) - List products
284
283
 
285
- ### [salesReports](docs/sdks/salesreports/README.md)
284
+ ### [Sales.Reports](docs/sdks/salesreports/README.md)
286
285
 
287
286
  * [getOrders](docs/sdks/salesreports/README.md#getorders) - Get orders report
288
287
  * [getRefunds](docs/sdks/salesreports/README.md#getrefunds) - Get refunds report
289
288
 
290
- ### [salesTransactions](docs/sdks/salestransactions/README.md)
289
+ ### [Sales.Transactions](docs/sdks/salestransactions/README.md)
291
290
 
292
291
  * [get](docs/sdks/salestransactions/README.md#get) - Get transaction
293
292
  * [list](docs/sdks/salestransactions/README.md#list) - List transactions
@@ -311,15 +310,14 @@ sdk.accountingBankData.listTransactions({
311
310
  * [get](docs/sdks/transactionsjournalentries/README.md#get) - Get journal entry
312
311
  * [list](docs/sdks/transactionsjournalentries/README.md#list) - List journal entries
313
312
 
314
- ### [transactionsJournals](docs/sdks/transactionsjournals/README.md)
313
+ ### [Transactions.Journals](docs/sdks/transactionsjournals/README.md)
315
314
 
316
315
  * [get](docs/sdks/transactionsjournals/README.md#get) - Get journal
317
316
  * [list](docs/sdks/transactionsjournals/README.md#list) - List journals
318
317
 
319
- ### [transactionsTransfers](docs/sdks/transactionstransfers/README.md)
318
+ ### [Transactions.Transfers](docs/sdks/transactionstransfers/README.md)
320
319
 
321
320
  * [get](docs/sdks/transactionstransfers/README.md#get) - Get transfer
322
- * [list](docs/sdks/transactionstransfers/README.md#list) - List transfers<!-- Start SDK Available Operations -->
323
-
321
+ * [list](docs/sdks/transactionstransfers/README.md#list) - List transfers
324
322
  <!-- End SDK Available Operations -->
325
323
  ### Library generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
@@ -7,7 +7,7 @@ import { AxiosRequestConfig } from "axios";
7
7
  * Access bank transactions from an accounting platform.
8
8
  */
9
9
  export declare class AccountingBankData {
10
- accountingBankDataAccounts: AccountingBankDataAccounts;
10
+ accounts: AccountingBankDataAccounts;
11
11
  private sdkConfiguration;
12
12
  constructor(sdkConfig: SDKConfiguration);
13
13
  /**
@@ -85,7 +85,7 @@ var shared = __importStar(require("./models/shared"));
85
85
  var AccountingBankData = /** @class */ (function () {
86
86
  function AccountingBankData(sdkConfig) {
87
87
  this.sdkConfiguration = sdkConfig;
88
- this.accountingBankDataAccounts = new accountingbankdataaccounts_1.AccountingBankDataAccounts(this.sdkConfiguration);
88
+ this.accounts = new accountingbankdataaccounts_1.AccountingBankDataAccounts(this.sdkConfiguration);
89
89
  }
90
90
  /**
91
91
  * List bank account transactions
@@ -1,47 +1,13 @@
1
- import * as utils from "../internal/utils";
2
1
  import { AccountsPayableBillCreditNotes } from "./accountspayablebillcreditnotes";
3
2
  import { AccountsPayableBillPayments } from "./accountspayablebillpayments";
4
3
  import { AccountsPayableBills } from "./accountspayablebills";
5
4
  import { AccountsPayableSuppliers } from "./accountspayablesuppliers";
6
- import * as operations from "./models/operations";
7
5
  import { SDKConfiguration } from "./sdk";
8
- import { AxiosRequestConfig } from "axios";
9
- /**
10
- * Data from a linked accounting platform representing money the business owes money to its suppliers.
11
- */
12
- export declare enum DownloadBillAttachmentAcceptEnum {
13
- applicationJson = "application/json",
14
- applicationOctetStream = "application/octet-stream"
15
- }
16
6
  export declare class AccountsPayable {
17
- accountsPayableBillCreditNotes: AccountsPayableBillCreditNotes;
18
- accountsPayableBillPayments: AccountsPayableBillPayments;
19
- accountsPayableBills: AccountsPayableBills;
20
- accountsPayableSuppliers: AccountsPayableSuppliers;
7
+ billCreditNotes: AccountsPayableBillCreditNotes;
8
+ billPayments: AccountsPayableBillPayments;
9
+ bills: AccountsPayableBills;
10
+ suppliers: AccountsPayableSuppliers;
21
11
  private sdkConfiguration;
22
12
  constructor(sdkConfig: SDKConfiguration);
23
- /**
24
- * Download bill attachment
25
- *
26
- * @remarks
27
- * The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`.
28
- *
29
- * [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.
30
- *
31
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support downloading a bill attachment.
32
- *
33
- */
34
- downloadBillAttachment(req: operations.DownloadAccountingBillAttachmentRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig, acceptHeaderOverride?: DownloadBillAttachmentAcceptEnum): Promise<operations.DownloadAccountingBillAttachmentResponse>;
35
- /**
36
- * Get bill attachment
37
- *
38
- * @remarks
39
- * The *Get bill attachment* endpoint returns a specific attachment for a given `billId` and `attachmentId`.
40
- *
41
- * [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.
42
- *
43
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support getting a bill attachment.
44
- *
45
- */
46
- getBillAttachment(req: operations.GetAccountingBillAttachmentRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.GetAccountingBillAttachmentResponse>;
47
13
  }
@@ -2,279 +2,20 @@
2
2
  /*
3
3
  * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
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
5
  Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.AccountsPayable = exports.DownloadBillAttachmentAcceptEnum = void 0;
77
- var utils = __importStar(require("../internal/utils"));
6
+ exports.AccountsPayable = void 0;
78
7
  var accountspayablebillcreditnotes_1 = require("./accountspayablebillcreditnotes");
79
8
  var accountspayablebillpayments_1 = require("./accountspayablebillpayments");
80
9
  var accountspayablebills_1 = require("./accountspayablebills");
81
10
  var accountspayablesuppliers_1 = require("./accountspayablesuppliers");
82
- var errors = __importStar(require("./models/errors"));
83
- var operations = __importStar(require("./models/operations"));
84
- var shared = __importStar(require("./models/shared"));
85
- /**
86
- * Data from a linked accounting platform representing money the business owes money to its suppliers.
87
- */
88
- var DownloadBillAttachmentAcceptEnum;
89
- (function (DownloadBillAttachmentAcceptEnum) {
90
- DownloadBillAttachmentAcceptEnum["applicationJson"] = "application/json";
91
- DownloadBillAttachmentAcceptEnum["applicationOctetStream"] = "application/octet-stream";
92
- })(DownloadBillAttachmentAcceptEnum = exports.DownloadBillAttachmentAcceptEnum || (exports.DownloadBillAttachmentAcceptEnum = {}));
93
11
  var AccountsPayable = /** @class */ (function () {
94
12
  function AccountsPayable(sdkConfig) {
95
13
  this.sdkConfiguration = sdkConfig;
96
- this.accountsPayableBillCreditNotes = new accountspayablebillcreditnotes_1.AccountsPayableBillCreditNotes(this.sdkConfiguration);
97
- this.accountsPayableBillPayments = new accountspayablebillpayments_1.AccountsPayableBillPayments(this.sdkConfiguration);
98
- this.accountsPayableBills = new accountspayablebills_1.AccountsPayableBills(this.sdkConfiguration);
99
- this.accountsPayableSuppliers = new accountspayablesuppliers_1.AccountsPayableSuppliers(this.sdkConfiguration);
14
+ this.billCreditNotes = new accountspayablebillcreditnotes_1.AccountsPayableBillCreditNotes(this.sdkConfiguration);
15
+ this.billPayments = new accountspayablebillpayments_1.AccountsPayableBillPayments(this.sdkConfiguration);
16
+ this.bills = new accountspayablebills_1.AccountsPayableBills(this.sdkConfiguration);
17
+ this.suppliers = new accountspayablesuppliers_1.AccountsPayableSuppliers(this.sdkConfiguration);
100
18
  }
101
- /**
102
- * Download bill attachment
103
- *
104
- * @remarks
105
- * The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`.
106
- *
107
- * [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.
108
- *
109
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support downloading a bill attachment.
110
- *
111
- */
112
- AccountsPayable.prototype.downloadBillAttachment = function (req, retries, config, acceptHeaderOverride) {
113
- var _a, _b;
114
- return __awaiter(this, void 0, void 0, function () {
115
- var baseURL, url, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
116
- return __generator(this, function (_c) {
117
- switch (_c.label) {
118
- case 0:
119
- if (!(req instanceof utils.SpeakeasyBase)) {
120
- req = new operations.DownloadAccountingBillAttachmentRequest(req);
121
- }
122
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
123
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}/download", req);
124
- client = this.sdkConfiguration.defaultClient;
125
- globalSecurity = this.sdkConfiguration.security;
126
- if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
127
- return [4 /*yield*/, globalSecurity()];
128
- case 1:
129
- globalSecurity = _c.sent();
130
- _c.label = 2;
131
- case 2:
132
- if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
133
- globalSecurity = new shared.Security(globalSecurity);
134
- }
135
- properties = utils.parseSecurityProperties(globalSecurity);
136
- headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
137
- if (acceptHeaderOverride !== undefined) {
138
- headers["Accept"] = acceptHeaderOverride.toString();
139
- }
140
- else {
141
- headers["Accept"] = "application/json;q=1, application/octet-stream;q=0";
142
- }
143
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
144
- globalRetryConfig = this.sdkConfiguration.retryConfig;
145
- retryConfig = retries;
146
- if (!retryConfig) {
147
- if (globalRetryConfig) {
148
- retryConfig = globalRetryConfig;
149
- }
150
- else {
151
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
152
- }
153
- }
154
- return [4 /*yield*/, utils.Retry(function () {
155
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
156
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
157
- case 3:
158
- httpRes = _c.sent();
159
- 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 : "";
160
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
161
- throw new Error("status code not found in response: ".concat(httpRes));
162
- }
163
- res = new operations.DownloadAccountingBillAttachmentResponse({
164
- statusCode: httpRes.status,
165
- contentType: contentType,
166
- rawResponse: httpRes,
167
- });
168
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
169
- switch (true) {
170
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
171
- if (utils.matchContentType(contentType, "application/octet-stream")) {
172
- res.data = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
173
- }
174
- else {
175
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
176
- }
177
- break;
178
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
179
- if (utils.matchContentType(contentType, "application/json")) {
180
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
181
- }
182
- else {
183
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
184
- }
185
- break;
186
- }
187
- return [2 /*return*/, res];
188
- }
189
- });
190
- });
191
- };
192
- /**
193
- * Get bill attachment
194
- *
195
- * @remarks
196
- * The *Get bill attachment* endpoint returns a specific attachment for a given `billId` and `attachmentId`.
197
- *
198
- * [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.
199
- *
200
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support getting a bill attachment.
201
- *
202
- */
203
- AccountsPayable.prototype.getBillAttachment = function (req, retries, config) {
204
- var _a, _b;
205
- return __awaiter(this, void 0, void 0, function () {
206
- var baseURL, url, client, globalSecurity, properties, headers, globalRetryConfig, retryConfig, httpRes, contentType, res, decodedRes;
207
- return __generator(this, function (_c) {
208
- switch (_c.label) {
209
- case 0:
210
- if (!(req instanceof utils.SpeakeasyBase)) {
211
- req = new operations.GetAccountingBillAttachmentRequest(req);
212
- }
213
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
214
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}", req);
215
- client = this.sdkConfiguration.defaultClient;
216
- globalSecurity = this.sdkConfiguration.security;
217
- if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
218
- return [4 /*yield*/, globalSecurity()];
219
- case 1:
220
- globalSecurity = _c.sent();
221
- _c.label = 2;
222
- case 2:
223
- if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
224
- globalSecurity = new shared.Security(globalSecurity);
225
- }
226
- properties = utils.parseSecurityProperties(globalSecurity);
227
- headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
228
- headers["Accept"] = "application/json";
229
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
230
- globalRetryConfig = this.sdkConfiguration.retryConfig;
231
- retryConfig = retries;
232
- if (!retryConfig) {
233
- if (globalRetryConfig) {
234
- retryConfig = globalRetryConfig;
235
- }
236
- else {
237
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
238
- }
239
- }
240
- return [4 /*yield*/, utils.Retry(function () {
241
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
242
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
243
- case 3:
244
- httpRes = _c.sent();
245
- 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 : "";
246
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
247
- throw new Error("status code not found in response: ".concat(httpRes));
248
- }
249
- res = new operations.GetAccountingBillAttachmentResponse({
250
- statusCode: httpRes.status,
251
- contentType: contentType,
252
- rawResponse: httpRes,
253
- });
254
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
255
- switch (true) {
256
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
257
- if (utils.matchContentType(contentType, "application/json")) {
258
- res.accountingAttachment = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingAttachment);
259
- }
260
- else {
261
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
262
- }
263
- break;
264
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
265
- if (utils.matchContentType(contentType, "application/json")) {
266
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
267
- }
268
- else {
269
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
270
- }
271
- break;
272
- }
273
- return [2 /*return*/, res];
274
- }
275
- });
276
- });
277
- };
278
19
  return AccountsPayable;
279
20
  }());
280
21
  exports.AccountsPayable = AccountsPayable;
@@ -2,9 +2,25 @@ import * as utils from "../internal/utils";
2
2
  import * as operations from "./models/operations";
3
3
  import { SDKConfiguration } from "./sdk";
4
4
  import { AxiosRequestConfig } from "axios";
5
+ export declare enum DownloadAttachmentAcceptEnum {
6
+ applicationJson = "application/json",
7
+ applicationOctetStream = "application/octet-stream"
8
+ }
5
9
  export declare class AccountsPayableBills {
6
10
  private sdkConfiguration;
7
11
  constructor(sdkConfig: SDKConfiguration);
12
+ /**
13
+ * Download bill attachment
14
+ *
15
+ * @remarks
16
+ * The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`.
17
+ *
18
+ * [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.
19
+ *
20
+ * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support downloading a bill attachment.
21
+ *
22
+ */
23
+ downloadAttachment(req: operations.DownloadAccountingBillAttachmentRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig, acceptHeaderOverride?: DownloadAttachmentAcceptEnum): Promise<operations.DownloadAccountingBillAttachmentResponse>;
8
24
  /**
9
25
  * Get bill
10
26
  *
@@ -19,6 +35,18 @@ export declare class AccountsPayableBills {
19
35
  *
20
36
  */
21
37
  get(req: operations.GetAccountingBillRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.GetAccountingBillResponse>;
38
+ /**
39
+ * Get bill attachment
40
+ *
41
+ * @remarks
42
+ * The *Get bill attachment* endpoint returns a specific attachment for a given `billId` and `attachmentId`.
43
+ *
44
+ * [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.
45
+ *
46
+ * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support getting a bill attachment.
47
+ *
48
+ */
49
+ getAttachment(req: operations.GetAccountingBillAttachmentRequest, retries?: utils.RetryConfig, config?: AxiosRequestConfig): Promise<operations.GetAccountingBillAttachmentResponse>;
22
50
  /**
23
51
  * List bills
24
52
  *