modern-treasury 2.2.0 → 2.4.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/CHANGELOG.md +75 -0
- package/README.md +43 -15
- package/_shims/ReadableStream-node.d.ts +6 -0
- package/_shims/ReadableStream-node.d.ts.map +1 -0
- package/_shims/ReadableStream-node.js +14 -0
- package/_shims/ReadableStream-node.js.map +1 -0
- package/_shims/ReadableStream-node.mjs +3 -0
- package/_shims/ReadableStream-node.mjs.map +1 -0
- package/_shims/ReadableStream.d.ts +38 -0
- package/_shims/ReadableStream.js +5 -0
- package/_shims/ReadableStream.mjs +7 -0
- package/_shims/{agent.node.d.ts → agent-node.d.ts} +1 -1
- package/_shims/agent-node.d.ts.map +1 -0
- package/_shims/{agent.node.js → agent-node.js} +1 -1
- package/_shims/{agent.node.js.map → agent-node.js.map} +1 -1
- package/_shims/{agent.node.mjs → agent-node.mjs} +1 -1
- package/_shims/{agent.node.mjs.map → agent-node.mjs.map} +1 -1
- package/_shims/agent.d.ts +1 -1
- package/_shims/agent.js +1 -1
- package/_shims/agent.mjs +1 -1
- package/_shims/{fetch.node.d.ts → fetch-node.d.ts} +12 -1
- package/_shims/fetch.d.ts +9 -1
- package/_shims/{fileFromPath.node.d.ts → fileFromPath-node.d.ts} +2 -2
- package/_shims/{fileFromPath.node.d.ts.map → fileFromPath-node.d.ts.map} +1 -1
- package/_shims/{fileFromPath.node.js → fileFromPath-node.js} +1 -1
- package/_shims/{fileFromPath.node.js.map → fileFromPath-node.js.map} +1 -1
- package/_shims/{fileFromPath.node.mjs → fileFromPath-node.mjs} +1 -1
- package/_shims/{fileFromPath.node.mjs.map → fileFromPath-node.mjs.map} +1 -1
- package/_shims/fileFromPath.d.ts +2 -2
- package/_shims/fileFromPath.d.ts.map +1 -1
- package/_shims/fileFromPath.js +1 -1
- package/_shims/fileFromPath.mjs +1 -1
- package/_shims/form-data.js +17 -0
- package/_shims/form-data.mjs +20 -0
- package/_shims/{getMultipartRequestOptions.node.d.ts → getMultipartRequestOptions-node.d.ts} +2 -2
- package/_shims/getMultipartRequestOptions-node.d.ts.map +1 -0
- package/_shims/{getMultipartRequestOptions.node.js → getMultipartRequestOptions-node.js} +1 -1
- package/_shims/{getMultipartRequestOptions.node.js.map → getMultipartRequestOptions-node.js.map} +1 -1
- package/_shims/{getMultipartRequestOptions.node.mjs → getMultipartRequestOptions-node.mjs} +1 -1
- package/_shims/{getMultipartRequestOptions.node.mjs.map → getMultipartRequestOptions-node.mjs.map} +1 -1
- package/_shims/getMultipartRequestOptions.d.ts +1 -1
- package/_shims/getMultipartRequestOptions.d.ts.map +1 -1
- package/_shims/{node-readable.node.d.ts → node-readable-node.d.ts} +1 -1
- package/_shims/{node-readable.node.d.ts.map → node-readable-node.d.ts.map} +1 -1
- package/_shims/{node-readable.node.js → node-readable-node.js} +1 -1
- package/_shims/node-readable-node.js.map +1 -0
- package/_shims/{node-readable.node.mjs → node-readable-node.mjs} +1 -1
- package/_shims/node-readable-node.mjs.map +1 -0
- package/core.d.ts +91 -34
- package/core.d.ts.map +1 -1
- package/core.js +201 -70
- package/core.js.map +1 -1
- package/core.mjs +195 -70
- package/core.mjs.map +1 -1
- package/index.d.mts +19 -7
- package/index.d.ts +19 -7
- package/index.d.ts.map +1 -1
- package/index.js +23 -9
- package/index.js.map +1 -1
- package/index.mjs +23 -9
- package/index.mjs.map +1 -1
- package/package.json +32 -9
- package/pagination.d.ts +2 -2
- package/pagination.d.ts.map +1 -1
- package/pagination.js +5 -5
- package/pagination.js.map +1 -1
- package/pagination.mjs +5 -5
- package/pagination.mjs.map +1 -1
- package/resources/account-collection-flows.d.ts +8 -33
- package/resources/account-collection-flows.d.ts.map +1 -1
- package/resources/account-collection-flows.js +22 -17
- package/resources/account-collection-flows.js.map +1 -1
- package/resources/account-collection-flows.mjs +22 -17
- package/resources/account-collection-flows.mjs.map +1 -1
- package/resources/account-details.d.ts +8 -13
- package/resources/account-details.d.ts.map +1 -1
- package/resources/account-details.js +10 -4
- package/resources/account-details.js.map +1 -1
- package/resources/account-details.mjs +10 -4
- package/resources/account-details.mjs.map +1 -1
- package/resources/connections.d.ts +5 -2
- package/resources/connections.d.ts.map +1 -1
- package/resources/connections.js +3 -3
- package/resources/connections.js.map +1 -1
- package/resources/connections.mjs +3 -3
- package/resources/connections.mjs.map +1 -1
- package/resources/counterparties.d.ts +37 -51
- package/resources/counterparties.d.ts.map +1 -1
- package/resources/counterparties.js +17 -5
- package/resources/counterparties.js.map +1 -1
- package/resources/counterparties.mjs +17 -5
- package/resources/counterparties.mjs.map +1 -1
- package/resources/documents.d.ts +6 -17
- package/resources/documents.d.ts.map +1 -1
- package/resources/documents.js +13 -7
- package/resources/documents.js.map +1 -1
- package/resources/documents.mjs +13 -7
- package/resources/documents.mjs.map +1 -1
- package/resources/events.d.ts +3 -3
- package/resources/events.d.ts.map +1 -1
- package/resources/events.js +3 -3
- package/resources/events.mjs +3 -3
- package/resources/expected-payments.d.ts +30 -39
- package/resources/expected-payments.d.ts.map +1 -1
- package/resources/expected-payments.js +10 -4
- package/resources/expected-payments.js.map +1 -1
- package/resources/expected-payments.mjs +10 -4
- package/resources/expected-payments.mjs.map +1 -1
- package/resources/external-accounts.d.ts +27 -61
- package/resources/external-accounts.d.ts.map +1 -1
- package/resources/external-accounts.js +24 -6
- package/resources/external-accounts.js.map +1 -1
- package/resources/external-accounts.mjs +24 -6
- package/resources/external-accounts.mjs.map +1 -1
- package/resources/incoming-payment-details.d.ts +20 -21
- package/resources/incoming-payment-details.d.ts.map +1 -1
- package/resources/incoming-payment-details.js +10 -4
- package/resources/incoming-payment-details.js.map +1 -1
- package/resources/incoming-payment-details.mjs +10 -4
- package/resources/incoming-payment-details.mjs.map +1 -1
- package/resources/index.d.ts +0 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/internal-accounts/balance-reports.d.ts +6 -3
- package/resources/internal-accounts/balance-reports.d.ts.map +1 -1
- package/resources/internal-accounts/balance-reports.js +3 -3
- package/resources/internal-accounts/balance-reports.js.map +1 -1
- package/resources/internal-accounts/balance-reports.mjs +3 -3
- package/resources/internal-accounts/balance-reports.mjs.map +1 -1
- package/resources/internal-accounts/internal-accounts.d.ts +16 -21
- package/resources/internal-accounts/internal-accounts.d.ts.map +1 -1
- package/resources/internal-accounts/internal-accounts.js +10 -4
- package/resources/internal-accounts/internal-accounts.js.map +1 -1
- package/resources/internal-accounts/internal-accounts.mjs +10 -4
- package/resources/internal-accounts/internal-accounts.mjs.map +1 -1
- package/resources/invoices/invoices.d.ts +67 -42
- package/resources/invoices/invoices.d.ts.map +1 -1
- package/resources/invoices/invoices.js +10 -4
- package/resources/invoices/invoices.js.map +1 -1
- package/resources/invoices/invoices.mjs +10 -4
- package/resources/invoices/invoices.mjs.map +1 -1
- package/resources/invoices/line-items.d.ts +32 -185
- package/resources/invoices/line-items.d.ts.map +1 -1
- package/resources/invoices/line-items.js +10 -4
- package/resources/invoices/line-items.js.map +1 -1
- package/resources/invoices/line-items.mjs +10 -4
- package/resources/invoices/line-items.mjs.map +1 -1
- package/resources/ledger-account-categories.d.ts +47 -87
- package/resources/ledger-account-categories.d.ts.map +1 -1
- package/resources/ledger-account-categories.js +21 -17
- package/resources/ledger-account-categories.js.map +1 -1
- package/resources/ledger-account-categories.mjs +21 -17
- package/resources/ledger-account-categories.mjs.map +1 -1
- package/resources/ledger-account-payouts.d.ts +33 -22
- package/resources/ledger-account-payouts.d.ts.map +1 -1
- package/resources/ledger-account-payouts.js +10 -4
- package/resources/ledger-account-payouts.js.map +1 -1
- package/resources/ledger-account-payouts.mjs +10 -4
- package/resources/ledger-account-payouts.mjs.map +1 -1
- package/resources/ledger-account-statements.d.ts +11 -16
- package/resources/ledger-account-statements.d.ts.map +1 -1
- package/resources/ledger-account-statements.js +8 -2
- package/resources/ledger-account-statements.js.map +1 -1
- package/resources/ledger-account-statements.mjs +8 -2
- package/resources/ledger-account-statements.mjs.map +1 -1
- package/resources/ledger-accounts.d.ts +30 -30
- package/resources/ledger-accounts.d.ts.map +1 -1
- package/resources/ledger-accounts.js +10 -4
- package/resources/ledger-accounts.js.map +1 -1
- package/resources/ledger-accounts.mjs +10 -4
- package/resources/ledger-accounts.mjs.map +1 -1
- package/resources/ledger-entries.d.ts +20 -6
- package/resources/ledger-entries.d.ts.map +1 -1
- package/resources/ledger-entries.js +3 -3
- package/resources/ledger-entries.js.map +1 -1
- package/resources/ledger-entries.mjs +3 -3
- package/resources/ledger-entries.mjs.map +1 -1
- package/resources/ledger-event-handlers.d.ts +12 -24
- package/resources/ledger-event-handlers.d.ts.map +1 -1
- package/resources/ledger-event-handlers.js +10 -4
- package/resources/ledger-event-handlers.js.map +1 -1
- package/resources/ledger-event-handlers.mjs +10 -4
- package/resources/ledger-event-handlers.mjs.map +1 -1
- package/resources/ledger-transactions/ledger-transactions.d.ts +48 -37
- package/resources/ledger-transactions/ledger-transactions.d.ts.map +1 -1
- package/resources/ledger-transactions/ledger-transactions.js +13 -7
- package/resources/ledger-transactions/ledger-transactions.js.map +1 -1
- package/resources/ledger-transactions/ledger-transactions.mjs +13 -7
- package/resources/ledger-transactions/ledger-transactions.mjs.map +1 -1
- package/resources/ledger-transactions/versions.d.ts +4 -2
- package/resources/ledger-transactions/versions.d.ts.map +1 -1
- package/resources/ledger-transactions/versions.js +3 -3
- package/resources/ledger-transactions/versions.js.map +1 -1
- package/resources/ledger-transactions/versions.mjs +3 -3
- package/resources/ledger-transactions/versions.mjs.map +1 -1
- package/resources/ledgerable-events.d.ts +13 -18
- package/resources/ledgerable-events.d.ts.map +1 -1
- package/resources/ledgerable-events.js +8 -2
- package/resources/ledgerable-events.js.map +1 -1
- package/resources/ledgerable-events.mjs +8 -2
- package/resources/ledgerable-events.mjs.map +1 -1
- package/resources/ledgers.d.ts +16 -20
- package/resources/ledgers.d.ts.map +1 -1
- package/resources/ledgers.js +10 -4
- package/resources/ledgers.js.map +1 -1
- package/resources/ledgers.mjs +10 -4
- package/resources/ledgers.mjs.map +1 -1
- package/resources/line-items.d.ts +5 -5
- package/resources/line-items.d.ts.map +1 -1
- package/resources/line-items.js +3 -3
- package/resources/line-items.mjs +3 -3
- package/resources/paper-items.d.ts +6 -3
- package/resources/paper-items.d.ts.map +1 -1
- package/resources/paper-items.js +3 -3
- package/resources/paper-items.js.map +1 -1
- package/resources/paper-items.mjs +3 -3
- package/resources/paper-items.mjs.map +1 -1
- package/resources/payment-flows.d.ts +18 -42
- package/resources/payment-flows.d.ts.map +1 -1
- package/resources/payment-flows.js +22 -17
- package/resources/payment-flows.js.map +1 -1
- package/resources/payment-flows.mjs +22 -17
- package/resources/payment-flows.mjs.map +1 -1
- package/resources/payment-orders/payment-orders.d.ts +172 -191
- package/resources/payment-orders/payment-orders.d.ts.map +1 -1
- package/resources/payment-orders/payment-orders.js +21 -11
- package/resources/payment-orders/payment-orders.js.map +1 -1
- package/resources/payment-orders/payment-orders.mjs +21 -11
- package/resources/payment-orders/payment-orders.mjs.map +1 -1
- package/resources/payment-orders/reversals.d.ts +21 -22
- package/resources/payment-orders/reversals.d.ts.map +1 -1
- package/resources/payment-orders/reversals.js +10 -4
- package/resources/payment-orders/reversals.js.map +1 -1
- package/resources/payment-orders/reversals.mjs +10 -4
- package/resources/payment-orders/reversals.mjs.map +1 -1
- package/resources/payment-references.d.ts +3 -3
- package/resources/payment-references.d.ts.map +1 -1
- package/resources/payment-references.js +3 -3
- package/resources/payment-references.mjs +3 -3
- package/resources/returns.d.ts +16 -19
- package/resources/returns.d.ts.map +1 -1
- package/resources/returns.js +10 -4
- package/resources/returns.js.map +1 -1
- package/resources/returns.mjs +10 -4
- package/resources/returns.mjs.map +1 -1
- package/resources/routing-details.d.ts +9 -15
- package/resources/routing-details.d.ts.map +1 -1
- package/resources/routing-details.js +10 -4
- package/resources/routing-details.js.map +1 -1
- package/resources/routing-details.mjs +10 -4
- package/resources/routing-details.mjs.map +1 -1
- package/resources/transactions/line-items.d.ts +5 -2
- package/resources/transactions/line-items.d.ts.map +1 -1
- package/resources/transactions/line-items.js +3 -3
- package/resources/transactions/line-items.js.map +1 -1
- package/resources/transactions/line-items.mjs +3 -3
- package/resources/transactions/line-items.mjs.map +1 -1
- package/resources/transactions/transactions.d.ts +8 -5
- package/resources/transactions/transactions.d.ts.map +1 -1
- package/resources/transactions/transactions.js +3 -3
- package/resources/transactions/transactions.js.map +1 -1
- package/resources/transactions/transactions.mjs +3 -3
- package/resources/transactions/transactions.mjs.map +1 -1
- package/resources/validations.d.ts +1 -1
- package/resources/validations.d.ts.map +1 -1
- package/resources/validations.js +1 -1
- package/resources/validations.mjs +1 -1
- package/resources/virtual-accounts.d.ts +19 -28
- package/resources/virtual-accounts.d.ts.map +1 -1
- package/resources/virtual-accounts.js +10 -4
- package/resources/virtual-accounts.js.map +1 -1
- package/resources/virtual-accounts.mjs +10 -4
- package/resources/virtual-accounts.mjs.map +1 -1
- package/resources/webhooks.js +2 -2
- package/resources/webhooks.mjs +2 -2
- package/src/_shims/ReadableStream-node.ts +6 -0
- package/src/_shims/ReadableStream.d.ts +38 -0
- package/src/_shims/ReadableStream.js +5 -0
- package/src/_shims/ReadableStream.mjs +7 -0
- package/src/_shims/agent.ts +1 -1
- package/src/_shims/{fetch.node.d.ts → fetch-node.d.ts} +20 -9
- package/src/_shims/fetch.d.ts +18 -10
- package/src/_shims/{fileFromPath.node.ts → fileFromPath-node.ts} +1 -1
- package/src/_shims/fileFromPath.ts +2 -2
- package/src/_shims/{formdata.node.d.ts → form-data-node.d.ts} +4 -4
- package/src/_shims/{formdata.d.ts → form-data.d.ts} +4 -4
- package/src/_shims/form-data.js +17 -0
- package/src/_shims/form-data.mjs +20 -0
- package/src/_shims/{getMultipartRequestOptions.node.ts → getMultipartRequestOptions-node.ts} +3 -3
- package/src/_shims/getMultipartRequestOptions.ts +3 -3
- package/src/core.ts +275 -97
- package/src/error.ts +1 -1
- package/src/index.ts +31 -18
- package/src/pagination.ts +6 -6
- package/src/resource.ts +1 -1
- package/src/resources/account-collection-flows.ts +29 -57
- package/src/resources/account-details.ts +22 -22
- package/src/resources/connections.ts +11 -8
- package/src/resources/counterparties.ts +61 -65
- package/src/resources/documents.ts +21 -30
- package/src/resources/events.ts +9 -9
- package/src/resources/expected-payments.ts +45 -49
- package/src/resources/external-accounts.ts +59 -78
- package/src/resources/incoming-payment-details.ts +38 -33
- package/src/resources/index.ts +39 -36
- package/src/resources/internal-accounts/balance-reports.ts +13 -10
- package/src/resources/internal-accounts/index.ts +2 -2
- package/src/resources/internal-accounts/internal-accounts.ts +35 -35
- package/src/resources/invoices/index.ts +2 -2
- package/src/resources/invoices/invoices.ts +91 -54
- package/src/resources/invoices/line-items.ts +46 -228
- package/src/resources/ledger-account-categories.ts +67 -111
- package/src/resources/ledger-account-payouts.ts +49 -30
- package/src/resources/ledger-account-statements.ts +21 -21
- package/src/resources/ledger-accounts.ts +46 -40
- package/src/resources/ledger-entries.ts +29 -13
- package/src/resources/ledger-event-handlers.ts +25 -35
- package/src/resources/ledger-transactions/index.ts +2 -2
- package/src/resources/ledger-transactions/ledger-transactions.ts +73 -53
- package/src/resources/ledger-transactions/versions.ts +10 -8
- package/src/resources/ledgerable-events.ts +23 -23
- package/src/resources/ledgers.ts +31 -29
- package/src/resources/line-items.ts +12 -12
- package/src/resources/paper-items.ts +13 -10
- package/src/resources/payment-flows.ts +39 -66
- package/src/resources/payment-orders/index.ts +2 -2
- package/src/resources/payment-orders/payment-orders.ts +204 -216
- package/src/resources/payment-orders/reversals.ts +36 -31
- package/src/resources/payment-references.ts +9 -9
- package/src/resources/returns.ts +30 -28
- package/src/resources/routing-details.ts +23 -24
- package/src/resources/top-level.ts +1 -1
- package/src/resources/transactions/index.ts +7 -2
- package/src/resources/transactions/line-items.ts +11 -8
- package/src/resources/transactions/transactions.ts +17 -14
- package/src/resources/validations.ts +4 -4
- package/src/resources/virtual-accounts.ts +35 -39
- package/src/resources/webhooks.ts +3 -3
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +6 -6
- package/src/version.ts +1 -1
- package/uploads.d.ts +1 -1
- package/uploads.d.ts.map +1 -1
- package/uploads.js +7 -7
- package/uploads.js.map +1 -1
- package/uploads.mjs +4 -4
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/_shims/agent.node.d.ts.map +0 -1
- package/_shims/formdata.js +0 -9
- package/_shims/formdata.mjs +0 -11
- package/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
- package/_shims/node-readable.node.js.map +0 -1
- package/_shims/node-readable.node.mjs.map +0 -1
- package/src/_shims/fetch.deno.ts +0 -23
- package/src/_shims/formdata.deno.ts +0 -16
- package/src/_shims/formdata.js +0 -9
- package/src/_shims/formdata.mjs +0 -11
- /package/_shims/{fetch.node.js → fetch-node.js} +0 -0
- /package/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
- /package/_shims/{formdata.node.d.ts → form-data-node.d.ts} +0 -0
- /package/_shims/{formdata.node.js → form-data-node.js} +0 -0
- /package/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
- /package/_shims/{formdata.d.ts → form-data.d.ts} +0 -0
- /package/src/_shims/{agent.node.ts → agent-node.ts} +0 -0
- /package/src/_shims/{fetch.node.js → fetch-node.js} +0 -0
- /package/src/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
- /package/src/_shims/{formdata.node.js → form-data-node.js} +0 -0
- /package/src/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
- /package/src/_shims/{node-readable.node.ts → node-readable-node.ts} +0 -0
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from './core';
|
|
4
|
-
import * as Pagination from './pagination';
|
|
5
|
-
import * as API from './resources/index';
|
|
6
|
-
import * as Errors from './error';
|
|
7
|
-
import type { Agent } from './_shims/agent';
|
|
8
|
-
import * as Uploads from './uploads';
|
|
3
|
+
import * as Core from './core.js';
|
|
4
|
+
import * as Pagination from './pagination.js';
|
|
5
|
+
import * as API from './resources/index.js';
|
|
6
|
+
import * as Errors from './error.js';
|
|
7
|
+
import type { Agent } from './_shims/agent.js';
|
|
8
|
+
import * as Uploads from './uploads.js';
|
|
9
9
|
import * as qs from 'qs';
|
|
10
10
|
|
|
11
11
|
export interface ClientOptions {
|
|
@@ -73,7 +73,7 @@ export interface ClientOptions {
|
|
|
73
73
|
webhookKey?: string | null;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/**
|
|
76
|
+
/** API Client for interfacing with the Modern Treasury API. */
|
|
77
77
|
export class ModernTreasury extends Core.APIClient {
|
|
78
78
|
apiKey: string;
|
|
79
79
|
organizationId: string;
|
|
@@ -81,6 +81,20 @@ export class ModernTreasury extends Core.APIClient {
|
|
|
81
81
|
|
|
82
82
|
private _options: ClientOptions;
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* API Client for interfacing with the Modern Treasury API.
|
|
86
|
+
*
|
|
87
|
+
* @param {string} [opts.apiKey=process.env['MODERN_TREASURY_API_KEY']] - The API Key to send to the API.
|
|
88
|
+
* @param {string} [opts.baseURL] - Override the default base URL for the API.
|
|
89
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
90
|
+
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
91
|
+
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
92
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
93
|
+
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
94
|
+
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
95
|
+
* @param {string} [opts.organizationId]
|
|
96
|
+
* @param {string | null} [opts.webhookKey]
|
|
97
|
+
*/
|
|
84
98
|
constructor({
|
|
85
99
|
apiKey = Core.readEnv('MODERN_TREASURY_API_KEY'),
|
|
86
100
|
organizationId = Core.readEnv('MODERN_TREASURY_ORGANIZATION_ID'),
|
|
@@ -89,7 +103,7 @@ export class ModernTreasury extends Core.APIClient {
|
|
|
89
103
|
}: ClientOptions = {}) {
|
|
90
104
|
if (apiKey === undefined) {
|
|
91
105
|
throw new Error(
|
|
92
|
-
|
|
106
|
+
"The MODERN_TREASURY_API_KEY environment variable is missing or empty; either provide it, or instantiate the ModernTreasury client with an apiKey option, like new ModernTreasury({ apiKey: 'my apiKey' }).",
|
|
93
107
|
);
|
|
94
108
|
}
|
|
95
109
|
if (organizationId === undefined) {
|
|
@@ -102,13 +116,13 @@ export class ModernTreasury extends Core.APIClient {
|
|
|
102
116
|
apiKey,
|
|
103
117
|
organizationId,
|
|
104
118
|
webhookKey,
|
|
105
|
-
baseURL: `https://app.moderntreasury.com`,
|
|
106
119
|
...opts,
|
|
120
|
+
baseURL: opts.baseURL ?? `https://app.moderntreasury.com`,
|
|
107
121
|
};
|
|
108
122
|
|
|
109
123
|
super({
|
|
110
124
|
baseURL: options.baseURL!,
|
|
111
|
-
timeout: options.timeout
|
|
125
|
+
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
112
126
|
httpAgent: options.httpAgent,
|
|
113
127
|
maxRetries: options.maxRetries,
|
|
114
128
|
fetch: options.fetch,
|
|
@@ -157,7 +171,7 @@ export class ModernTreasury extends Core.APIClient {
|
|
|
157
171
|
* A test endpoint often used to confirm credentials and headers are being passed
|
|
158
172
|
* in correctly.
|
|
159
173
|
*/
|
|
160
|
-
ping(options?: Core.RequestOptions):
|
|
174
|
+
ping(options?: Core.RequestOptions): Core.APIPromise<ModernTreasury.PingResponse> {
|
|
161
175
|
return this.get('/api/ping', options);
|
|
162
176
|
}
|
|
163
177
|
|
|
@@ -165,21 +179,21 @@ export class ModernTreasury extends Core.APIClient {
|
|
|
165
179
|
return this._options.defaultQuery;
|
|
166
180
|
}
|
|
167
181
|
|
|
168
|
-
protected override defaultHeaders(): Core.Headers {
|
|
182
|
+
protected override defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers {
|
|
169
183
|
return {
|
|
170
|
-
...super.defaultHeaders(),
|
|
184
|
+
...super.defaultHeaders(opts),
|
|
171
185
|
...this._options.defaultHeaders,
|
|
172
186
|
};
|
|
173
187
|
}
|
|
174
188
|
|
|
175
|
-
protected override authHeaders(): Core.Headers {
|
|
189
|
+
protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
|
|
176
190
|
const credentials = `${this.organizationId}:${this.apiKey}`;
|
|
177
191
|
const Authorization = `Basic ${Core.toBase64(credentials)}`;
|
|
178
192
|
return { Authorization };
|
|
179
193
|
}
|
|
180
194
|
|
|
181
195
|
protected override stringifyQuery(query: Record<string, unknown>): string {
|
|
182
|
-
return qs.stringify(query, { arrayFormat: '
|
|
196
|
+
return qs.stringify(query, { arrayFormat: 'brackets' });
|
|
183
197
|
}
|
|
184
198
|
|
|
185
199
|
static ModernTreasury = this;
|
|
@@ -221,6 +235,8 @@ export namespace ModernTreasury {
|
|
|
221
235
|
export import toFile = Uploads.toFile;
|
|
222
236
|
export import fileFromPath = Uploads.fileFromPath;
|
|
223
237
|
|
|
238
|
+
export import RequestOptions = Core.RequestOptions;
|
|
239
|
+
|
|
224
240
|
export import Page = Pagination.Page;
|
|
225
241
|
export import PageParams = Pagination.PageParams;
|
|
226
242
|
export import PageResponse = Pagination.PageResponse;
|
|
@@ -288,7 +304,6 @@ export namespace ModernTreasury {
|
|
|
288
304
|
export import AccountCollectionFlow = API.AccountCollectionFlow;
|
|
289
305
|
export import AccountCollectionFlowsPage = API.AccountCollectionFlowsPage;
|
|
290
306
|
export import AccountCollectionFlowCreateParams = API.AccountCollectionFlowCreateParams;
|
|
291
|
-
export import AccountCollectionFlowRetrieveParams = API.AccountCollectionFlowRetrieveParams;
|
|
292
307
|
export import AccountCollectionFlowUpdateParams = API.AccountCollectionFlowUpdateParams;
|
|
293
308
|
export import AccountCollectionFlowListParams = API.AccountCollectionFlowListParams;
|
|
294
309
|
|
|
@@ -329,7 +344,6 @@ export namespace ModernTreasury {
|
|
|
329
344
|
export import LedgerAccountCategoryRetrieveParams = API.LedgerAccountCategoryRetrieveParams;
|
|
330
345
|
export import LedgerAccountCategoryUpdateParams = API.LedgerAccountCategoryUpdateParams;
|
|
331
346
|
export import LedgerAccountCategoryListParams = API.LedgerAccountCategoryListParams;
|
|
332
|
-
export import LedgerAccountCategoryDeleteParams = API.LedgerAccountCategoryDeleteParams;
|
|
333
347
|
|
|
334
348
|
export import LedgerAccounts = API.LedgerAccounts;
|
|
335
349
|
export import LedgerAccount = API.LedgerAccount;
|
|
@@ -384,7 +398,6 @@ export namespace ModernTreasury {
|
|
|
384
398
|
export import PaymentFlow = API.PaymentFlow;
|
|
385
399
|
export import PaymentFlowsPage = API.PaymentFlowsPage;
|
|
386
400
|
export import PaymentFlowCreateParams = API.PaymentFlowCreateParams;
|
|
387
|
-
export import PaymentFlowRetrieveParams = API.PaymentFlowRetrieveParams;
|
|
388
401
|
export import PaymentFlowUpdateParams = API.PaymentFlowUpdateParams;
|
|
389
402
|
export import PaymentFlowListParams = API.PaymentFlowListParams;
|
|
390
403
|
|
package/src/pagination.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import { AbstractPage,
|
|
3
|
+
import { AbstractPage, Response, APIClient, FinalRequestOptions, coerceInteger, PageInfo } from './core.js';
|
|
4
4
|
|
|
5
5
|
export type PageResponse<Item> = Item[];
|
|
6
6
|
|
|
@@ -17,12 +17,12 @@ export class Page<Item> extends AbstractPage<Item> {
|
|
|
17
17
|
|
|
18
18
|
after_cursor: string | null;
|
|
19
19
|
|
|
20
|
-
constructor(client: APIClient, response:
|
|
21
|
-
super(client, response, options);
|
|
20
|
+
constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions) {
|
|
21
|
+
super(client, response, body, options);
|
|
22
22
|
|
|
23
|
-
this.items =
|
|
24
|
-
this.per_page = coerceInteger(response.
|
|
25
|
-
this.after_cursor = response.
|
|
23
|
+
this.items = body || [];
|
|
24
|
+
this.per_page = coerceInteger(this.response.headers.get('x-per-page') || null);
|
|
25
|
+
this.after_cursor = this.response.headers.get('x-after-cursor') || null;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
getPaginatedItems(): Item[] {
|
package/src/resource.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from '../core';
|
|
4
|
-
import { APIResource } from '../resource';
|
|
5
|
-
import { isRequestOptions } from '../core';
|
|
6
|
-
import * as API from './index';
|
|
7
|
-
import { Page, PageParams } from '../pagination';
|
|
3
|
+
import * as Core from '../core.js';
|
|
4
|
+
import { APIResource } from '../resource.js';
|
|
5
|
+
import { isRequestOptions } from '../core.js';
|
|
6
|
+
import * as API from './index.js';
|
|
7
|
+
import { Page, PageParams } from '../pagination.js';
|
|
8
8
|
|
|
9
9
|
export class AccountCollectionFlows extends APIResource {
|
|
10
10
|
/**
|
|
@@ -13,37 +13,26 @@ export class AccountCollectionFlows extends APIResource {
|
|
|
13
13
|
create(
|
|
14
14
|
params: AccountCollectionFlowCreateParams,
|
|
15
15
|
options?: Core.RequestOptions,
|
|
16
|
-
):
|
|
16
|
+
): Core.APIPromise<AccountCollectionFlow> {
|
|
17
|
+
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
|
|
17
18
|
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
19
|
+
if (idempotencyKey) {
|
|
20
|
+
console.warn(
|
|
21
|
+
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
|
|
22
|
+
);
|
|
23
|
+
}
|
|
18
24
|
return this.post('/api/account_collection_flows', {
|
|
19
25
|
body,
|
|
20
26
|
...options,
|
|
21
|
-
headers: { 'Idempotency-Key': idempotencyKey
|
|
27
|
+
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
|
|
22
28
|
});
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
/**
|
|
26
32
|
* get account_collection_flow
|
|
27
33
|
*/
|
|
28
|
-
retrieve(
|
|
29
|
-
id
|
|
30
|
-
query?: AccountCollectionFlowRetrieveParams,
|
|
31
|
-
options?: Core.RequestOptions,
|
|
32
|
-
): Promise<Core.APIResponse<AccountCollectionFlow>>;
|
|
33
|
-
retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<AccountCollectionFlow>>;
|
|
34
|
-
retrieve(
|
|
35
|
-
id: string,
|
|
36
|
-
query: AccountCollectionFlowRetrieveParams | Core.RequestOptions = {},
|
|
37
|
-
options?: Core.RequestOptions,
|
|
38
|
-
): Promise<Core.APIResponse<AccountCollectionFlow>> {
|
|
39
|
-
if (isRequestOptions(query)) {
|
|
40
|
-
return this.retrieve(id, {}, query);
|
|
41
|
-
}
|
|
42
|
-
const { 'Idempotency-Key': idempotencyKey } = query;
|
|
43
|
-
return this.get(`/api/account_collection_flows/${id}`, {
|
|
44
|
-
...options,
|
|
45
|
-
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
|
|
46
|
-
});
|
|
34
|
+
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<AccountCollectionFlow> {
|
|
35
|
+
return this.get(`/api/account_collection_flows/${id}`, options);
|
|
47
36
|
}
|
|
48
37
|
|
|
49
38
|
/**
|
|
@@ -53,12 +42,18 @@ export class AccountCollectionFlows extends APIResource {
|
|
|
53
42
|
id: string,
|
|
54
43
|
params: AccountCollectionFlowUpdateParams,
|
|
55
44
|
options?: Core.RequestOptions,
|
|
56
|
-
):
|
|
45
|
+
): Core.APIPromise<AccountCollectionFlow> {
|
|
46
|
+
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
|
|
57
47
|
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
48
|
+
if (idempotencyKey) {
|
|
49
|
+
console.warn(
|
|
50
|
+
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
|
|
51
|
+
);
|
|
52
|
+
}
|
|
58
53
|
return this.patch(`/api/account_collection_flows/${id}`, {
|
|
59
54
|
body,
|
|
60
55
|
...options,
|
|
61
|
-
headers: { 'Idempotency-Key': idempotencyKey
|
|
56
|
+
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
|
|
62
57
|
});
|
|
63
58
|
}
|
|
64
59
|
|
|
@@ -68,12 +63,12 @@ export class AccountCollectionFlows extends APIResource {
|
|
|
68
63
|
list(
|
|
69
64
|
query?: AccountCollectionFlowListParams,
|
|
70
65
|
options?: Core.RequestOptions,
|
|
71
|
-
): Core.PagePromise<AccountCollectionFlowsPage>;
|
|
72
|
-
list(options?: Core.RequestOptions): Core.PagePromise<AccountCollectionFlowsPage>;
|
|
66
|
+
): Core.PagePromise<AccountCollectionFlowsPage, AccountCollectionFlow>;
|
|
67
|
+
list(options?: Core.RequestOptions): Core.PagePromise<AccountCollectionFlowsPage, AccountCollectionFlow>;
|
|
73
68
|
list(
|
|
74
69
|
query: AccountCollectionFlowListParams | Core.RequestOptions = {},
|
|
75
70
|
options?: Core.RequestOptions,
|
|
76
|
-
): Core.PagePromise<AccountCollectionFlowsPage> {
|
|
71
|
+
): Core.PagePromise<AccountCollectionFlowsPage, AccountCollectionFlow> {
|
|
77
72
|
if (isRequestOptions(query)) {
|
|
78
73
|
return this.list({}, query);
|
|
79
74
|
}
|
|
@@ -131,41 +126,19 @@ export interface AccountCollectionFlow {
|
|
|
131
126
|
|
|
132
127
|
export interface AccountCollectionFlowCreateParams {
|
|
133
128
|
/**
|
|
134
|
-
*
|
|
129
|
+
* Required.
|
|
135
130
|
*/
|
|
136
131
|
counterparty_id: string;
|
|
137
132
|
|
|
138
|
-
/**
|
|
139
|
-
* Body param:
|
|
140
|
-
*/
|
|
141
133
|
payment_types: Array<string>;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Header param: This key should be something unique, preferably something like an
|
|
145
|
-
* UUID.
|
|
146
|
-
*/
|
|
147
|
-
'Idempotency-Key'?: string;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface AccountCollectionFlowRetrieveParams {
|
|
151
|
-
/**
|
|
152
|
-
* This key should be something unique, preferably something like an UUID.
|
|
153
|
-
*/
|
|
154
|
-
'Idempotency-Key'?: string;
|
|
155
134
|
}
|
|
156
135
|
|
|
157
136
|
export interface AccountCollectionFlowUpdateParams {
|
|
158
137
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
138
|
+
* Required. The updated status of the account collection flow. Can only be used to
|
|
139
|
+
* mark a flow as `cancelled`.
|
|
161
140
|
*/
|
|
162
141
|
status: 'cancelled';
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Header param: This key should be something unique, preferably something like an
|
|
166
|
-
* UUID.
|
|
167
|
-
*/
|
|
168
|
-
'Idempotency-Key'?: string;
|
|
169
142
|
}
|
|
170
143
|
|
|
171
144
|
export interface AccountCollectionFlowListParams extends PageParams {
|
|
@@ -182,7 +155,6 @@ export namespace AccountCollectionFlows {
|
|
|
182
155
|
export import AccountCollectionFlow = API.AccountCollectionFlow;
|
|
183
156
|
export type AccountCollectionFlowsPage = _AccountCollectionFlowsPage;
|
|
184
157
|
export import AccountCollectionFlowCreateParams = API.AccountCollectionFlowCreateParams;
|
|
185
|
-
export import AccountCollectionFlowRetrieveParams = API.AccountCollectionFlowRetrieveParams;
|
|
186
158
|
export import AccountCollectionFlowUpdateParams = API.AccountCollectionFlowUpdateParams;
|
|
187
159
|
export import AccountCollectionFlowListParams = API.AccountCollectionFlowListParams;
|
|
188
160
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from '../core';
|
|
4
|
-
import { APIResource } from '../resource';
|
|
5
|
-
import { isRequestOptions } from '../core';
|
|
6
|
-
import * as Shared from './shared';
|
|
7
|
-
import * as API from './index';
|
|
8
|
-
import { Page, PageParams } from '../pagination';
|
|
3
|
+
import * as Core from '../core.js';
|
|
4
|
+
import { APIResource } from '../resource.js';
|
|
5
|
+
import { isRequestOptions } from '../core.js';
|
|
6
|
+
import * as Shared from './shared.js';
|
|
7
|
+
import * as API from './index.js';
|
|
8
|
+
import { Page, PageParams } from '../pagination.js';
|
|
9
9
|
|
|
10
10
|
export class AccountDetails extends APIResource {
|
|
11
11
|
/**
|
|
@@ -16,12 +16,18 @@ export class AccountDetails extends APIResource {
|
|
|
16
16
|
accountId: string,
|
|
17
17
|
params: AccountDetailCreateParams,
|
|
18
18
|
options?: Core.RequestOptions,
|
|
19
|
-
):
|
|
19
|
+
): Core.APIPromise<AccountDetail> {
|
|
20
|
+
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
|
|
20
21
|
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
22
|
+
if (idempotencyKey) {
|
|
23
|
+
console.warn(
|
|
24
|
+
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
|
|
25
|
+
);
|
|
26
|
+
}
|
|
21
27
|
return this.post(`/api/${accountsType}/${accountId}/account_details`, {
|
|
22
28
|
body,
|
|
23
29
|
...options,
|
|
24
|
-
headers: { 'Idempotency-Key': idempotencyKey
|
|
30
|
+
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
|
|
25
31
|
});
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -33,7 +39,7 @@ export class AccountDetails extends APIResource {
|
|
|
33
39
|
accountId: string,
|
|
34
40
|
id: string,
|
|
35
41
|
options?: Core.RequestOptions,
|
|
36
|
-
):
|
|
42
|
+
): Core.APIPromise<AccountDetail> {
|
|
37
43
|
return this.get(`/api/${accountsType}/${accountId}/account_details/${id}`, options);
|
|
38
44
|
}
|
|
39
45
|
|
|
@@ -45,18 +51,18 @@ export class AccountDetails extends APIResource {
|
|
|
45
51
|
accountId: string,
|
|
46
52
|
query?: AccountDetailListParams,
|
|
47
53
|
options?: Core.RequestOptions,
|
|
48
|
-
): Core.PagePromise<AccountDetailsPage>;
|
|
54
|
+
): Core.PagePromise<AccountDetailsPage, AccountDetail>;
|
|
49
55
|
list(
|
|
50
56
|
accountsType: Shared.AccountsType,
|
|
51
57
|
accountId: string,
|
|
52
58
|
options?: Core.RequestOptions,
|
|
53
|
-
): Core.PagePromise<AccountDetailsPage>;
|
|
59
|
+
): Core.PagePromise<AccountDetailsPage, AccountDetail>;
|
|
54
60
|
list(
|
|
55
61
|
accountsType: Shared.AccountsType,
|
|
56
62
|
accountId: string,
|
|
57
63
|
query: AccountDetailListParams | Core.RequestOptions = {},
|
|
58
64
|
options?: Core.RequestOptions,
|
|
59
|
-
): Core.PagePromise<AccountDetailsPage> {
|
|
65
|
+
): Core.PagePromise<AccountDetailsPage, AccountDetail> {
|
|
60
66
|
if (isRequestOptions(query)) {
|
|
61
67
|
return this.list(accountsType, accountId, {}, query);
|
|
62
68
|
}
|
|
@@ -74,7 +80,7 @@ export class AccountDetails extends APIResource {
|
|
|
74
80
|
accountId: string,
|
|
75
81
|
id: string,
|
|
76
82
|
options?: Core.RequestOptions,
|
|
77
|
-
):
|
|
83
|
+
): Core.APIPromise<void> {
|
|
78
84
|
return this.delete(`/api/${accountsType}/${accountId}/account_details/${id}`, {
|
|
79
85
|
...options,
|
|
80
86
|
headers: { Accept: '', ...options?.headers },
|
|
@@ -122,21 +128,15 @@ export interface AccountDetail {
|
|
|
122
128
|
|
|
123
129
|
export interface AccountDetailCreateParams {
|
|
124
130
|
/**
|
|
125
|
-
*
|
|
131
|
+
* The account number for the bank account.
|
|
126
132
|
*/
|
|
127
133
|
account_number: string;
|
|
128
134
|
|
|
129
135
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
136
|
+
* One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank
|
|
137
|
+
* account number is in a generic format.
|
|
132
138
|
*/
|
|
133
139
|
account_number_type?: 'clabe' | 'iban' | 'other' | 'pan' | 'wallet_address';
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Header param: This key should be something unique, preferably something like an
|
|
137
|
-
* UUID.
|
|
138
|
-
*/
|
|
139
|
-
'Idempotency-Key'?: string;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
export interface AccountDetailListParams extends PageParams {}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from '../core';
|
|
4
|
-
import { APIResource } from '../resource';
|
|
5
|
-
import { isRequestOptions } from '../core';
|
|
6
|
-
import * as API from './index';
|
|
7
|
-
import { Page, PageParams } from '../pagination';
|
|
3
|
+
import * as Core from '../core.js';
|
|
4
|
+
import { APIResource } from '../resource.js';
|
|
5
|
+
import { isRequestOptions } from '../core.js';
|
|
6
|
+
import * as API from './index.js';
|
|
7
|
+
import { Page, PageParams } from '../pagination.js';
|
|
8
8
|
|
|
9
9
|
export class Connections extends APIResource {
|
|
10
10
|
/**
|
|
11
11
|
* Get a list of all connections.
|
|
12
12
|
*/
|
|
13
|
-
list(
|
|
14
|
-
|
|
13
|
+
list(
|
|
14
|
+
query?: ConnectionListParams,
|
|
15
|
+
options?: Core.RequestOptions,
|
|
16
|
+
): Core.PagePromise<ConnectionsPage, Connection>;
|
|
17
|
+
list(options?: Core.RequestOptions): Core.PagePromise<ConnectionsPage, Connection>;
|
|
15
18
|
list(
|
|
16
19
|
query: ConnectionListParams | Core.RequestOptions = {},
|
|
17
20
|
options?: Core.RequestOptions,
|
|
18
|
-
): Core.PagePromise<ConnectionsPage> {
|
|
21
|
+
): Core.PagePromise<ConnectionsPage, Connection> {
|
|
19
22
|
if (isRequestOptions(query)) {
|
|
20
23
|
return this.list({}, query);
|
|
21
24
|
}
|