modern-treasury 2.0.0 → 2.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.
Files changed (172) hide show
  1. package/CHANGELOG.md +135 -0
  2. package/LICENSE +7 -0
  3. package/README.md +273 -0
  4. package/_shims/fetch.js +1 -1
  5. package/_shims/formdata.node.d.ts +1 -0
  6. package/core.d.ts +19 -11
  7. package/core.d.ts.map +1 -1
  8. package/core.js +122 -72
  9. package/core.js.map +1 -1
  10. package/core.mjs +112 -32
  11. package/core.mjs.map +1 -1
  12. package/error.d.ts +5 -0
  13. package/error.d.ts.map +1 -1
  14. package/error.js +20 -3
  15. package/error.js.map +1 -1
  16. package/error.mjs +18 -3
  17. package/error.mjs.map +1 -1
  18. package/index.d.mts +17 -8
  19. package/index.d.ts +17 -8
  20. package/index.d.ts.map +1 -1
  21. package/index.js +36 -20
  22. package/index.js.map +1 -1
  23. package/index.mjs +35 -20
  24. package/index.mjs.map +1 -1
  25. package/package.json +5 -5
  26. package/resources/account-collection-flows.d.ts +11 -11
  27. package/resources/account-collection-flows.d.ts.map +1 -1
  28. package/resources/account-collection-flows.js +4 -4
  29. package/resources/account-collection-flows.mjs +2 -2
  30. package/resources/account-details.d.ts.map +1 -1
  31. package/resources/connections.d.ts.map +1 -1
  32. package/resources/counterparties.d.ts.map +1 -1
  33. package/resources/documents.d.ts +2 -5
  34. package/resources/documents.d.ts.map +1 -1
  35. package/resources/documents.js +1 -7
  36. package/resources/documents.js.map +1 -1
  37. package/resources/documents.mjs +1 -7
  38. package/resources/documents.mjs.map +1 -1
  39. package/resources/events.d.ts.map +1 -1
  40. package/resources/expected-payments.d.ts.map +1 -1
  41. package/resources/external-accounts.d.ts.map +1 -1
  42. package/resources/incoming-payment-details.d.ts.map +1 -1
  43. package/resources/index.d.ts +2 -2
  44. package/resources/index.js +3 -3
  45. package/resources/index.mjs +1 -1
  46. package/resources/internal-accounts/balance-reports.d.ts.map +1 -1
  47. package/resources/internal-accounts/internal-accounts.d.ts +5 -4
  48. package/resources/internal-accounts/internal-accounts.d.ts.map +1 -1
  49. package/resources/internal-accounts/internal-accounts.js.map +1 -1
  50. package/resources/internal-accounts/internal-accounts.mjs.map +1 -1
  51. package/resources/invoices/invoices.d.ts +102 -5
  52. package/resources/invoices/invoices.d.ts.map +1 -1
  53. package/resources/invoices/invoices.js.map +1 -1
  54. package/resources/invoices/invoices.mjs.map +1 -1
  55. package/resources/invoices/line-items.d.ts +41 -0
  56. package/resources/invoices/line-items.d.ts.map +1 -1
  57. package/resources/invoices/line-items.js.map +1 -1
  58. package/resources/invoices/line-items.mjs.map +1 -1
  59. package/resources/ledger-account-categories.d.ts.map +1 -1
  60. package/resources/ledger-account-payouts.d.ts.map +1 -1
  61. package/resources/ledger-account-statements.d.ts.map +1 -1
  62. package/resources/ledger-accounts.d.ts +23 -16
  63. package/resources/ledger-accounts.d.ts.map +1 -1
  64. package/resources/ledger-accounts.js.map +1 -1
  65. package/resources/ledger-accounts.mjs.map +1 -1
  66. package/resources/ledger-entries.d.ts.map +1 -1
  67. package/resources/ledger-event-handlers.d.ts +4 -0
  68. package/resources/ledger-event-handlers.d.ts.map +1 -1
  69. package/resources/ledger-event-handlers.js.map +1 -1
  70. package/resources/ledger-event-handlers.mjs.map +1 -1
  71. package/resources/ledger-transactions/ledger-transactions.d.ts +8 -3
  72. package/resources/ledger-transactions/ledger-transactions.d.ts.map +1 -1
  73. package/resources/ledger-transactions/ledger-transactions.js.map +1 -1
  74. package/resources/ledger-transactions/ledger-transactions.mjs.map +1 -1
  75. package/resources/ledger-transactions/versions.d.ts.map +1 -1
  76. package/resources/ledgerable-events.d.ts +0 -16
  77. package/resources/ledgerable-events.d.ts.map +1 -1
  78. package/resources/ledgerable-events.js.map +1 -1
  79. package/resources/ledgerable-events.mjs.map +1 -1
  80. package/resources/ledgers.d.ts.map +1 -1
  81. package/resources/line-items.d.ts.map +1 -1
  82. package/resources/paper-items.d.ts.map +1 -1
  83. package/resources/payment-flows.d.ts.map +1 -1
  84. package/resources/payment-orders/payment-orders.d.ts +32 -6
  85. package/resources/payment-orders/payment-orders.d.ts.map +1 -1
  86. package/resources/payment-orders/payment-orders.js.map +1 -1
  87. package/resources/payment-orders/payment-orders.mjs.map +1 -1
  88. package/resources/payment-orders/reversals.d.ts +8 -3
  89. package/resources/payment-orders/reversals.d.ts.map +1 -1
  90. package/resources/payment-orders/reversals.js.map +1 -1
  91. package/resources/payment-orders/reversals.mjs.map +1 -1
  92. package/resources/payment-references.d.ts.map +1 -1
  93. package/resources/returns.d.ts.map +1 -1
  94. package/resources/routing-details.d.ts.map +1 -1
  95. package/resources/top-level.d.ts.map +1 -1
  96. package/resources/transactions/line-items.d.ts.map +1 -1
  97. package/resources/transactions/transactions.d.ts.map +1 -1
  98. package/resources/transactions/transactions.js.map +1 -1
  99. package/resources/validations.d.ts.map +1 -1
  100. package/resources/virtual-accounts.d.ts +59 -3
  101. package/resources/virtual-accounts.d.ts.map +1 -1
  102. package/resources/virtual-accounts.js +1 -4
  103. package/resources/virtual-accounts.js.map +1 -1
  104. package/resources/virtual-accounts.mjs +1 -4
  105. package/resources/virtual-accounts.mjs.map +1 -1
  106. package/src/_shims/fetch.deno.ts +23 -0
  107. package/src/_shims/fetch.js +1 -1
  108. package/src/_shims/fileFromPath.node.ts +1 -1
  109. package/src/_shims/fileFromPath.ts +1 -1
  110. package/src/_shims/formdata.deno.ts +16 -0
  111. package/src/_shims/formdata.node.d.ts +1 -0
  112. package/src/_shims/getMultipartRequestOptions.node.ts +1 -1
  113. package/src/_shims/getMultipartRequestOptions.ts +1 -1
  114. package/src/core.ts +123 -34
  115. package/src/error.ts +19 -1
  116. package/src/index.ts +47 -28
  117. package/src/resources/account-collection-flows.ts +19 -19
  118. package/src/resources/account-details.ts +6 -6
  119. package/src/resources/connections.ts +5 -5
  120. package/src/resources/counterparties.ts +8 -8
  121. package/src/resources/documents.ts +9 -18
  122. package/src/resources/events.ts +5 -5
  123. package/src/resources/expected-payments.ts +6 -6
  124. package/src/resources/external-accounts.ts +8 -8
  125. package/src/resources/incoming-payment-details.ts +7 -7
  126. package/src/resources/index.ts +2 -2
  127. package/src/resources/internal-accounts/balance-reports.ts +6 -6
  128. package/src/resources/internal-accounts/internal-accounts.ts +15 -14
  129. package/src/resources/invoices/invoices.ts +121 -13
  130. package/src/resources/invoices/line-items.ts +51 -6
  131. package/src/resources/ledger-account-categories.ts +5 -5
  132. package/src/resources/ledger-account-payouts.ts +5 -5
  133. package/src/resources/ledger-account-statements.ts +3 -3
  134. package/src/resources/ledger-accounts.ts +29 -21
  135. package/src/resources/ledger-entries.ts +5 -5
  136. package/src/resources/ledger-event-handlers.ts +10 -5
  137. package/src/resources/ledger-transactions/ledger-transactions.ts +15 -9
  138. package/src/resources/ledger-transactions/versions.ts +5 -5
  139. package/src/resources/ledgerable-events.ts +3 -23
  140. package/src/resources/ledgers.ts +5 -5
  141. package/src/resources/line-items.ts +5 -5
  142. package/src/resources/paper-items.ts +6 -6
  143. package/src/resources/payment-flows.ts +5 -5
  144. package/src/resources/payment-orders/payment-orders.ts +45 -15
  145. package/src/resources/payment-orders/reversals.ts +14 -8
  146. package/src/resources/payment-references.ts +5 -5
  147. package/src/resources/returns.ts +6 -6
  148. package/src/resources/routing-details.ts +6 -6
  149. package/src/resources/top-level.ts +1 -1
  150. package/src/resources/transactions/line-items.ts +5 -5
  151. package/src/resources/transactions/transactions.ts +6 -6
  152. package/src/resources/validations.ts +3 -3
  153. package/src/resources/virtual-accounts.ts +72 -14
  154. package/src/resources/webhooks.ts +3 -3
  155. package/src/uploads.ts +16 -14
  156. package/src/version.ts +1 -1
  157. package/uploads.d.ts +6 -5
  158. package/uploads.d.ts.map +1 -1
  159. package/uploads.js +4 -3
  160. package/uploads.js.map +1 -1
  161. package/uploads.mjs +4 -3
  162. package/uploads.mjs.map +1 -1
  163. package/version.d.ts +1 -1
  164. package/version.js +1 -1
  165. package/version.mjs +1 -1
  166. package/src/streaming.ts +0 -204
  167. package/streaming.d.ts +0 -14
  168. package/streaming.d.ts.map +0 -1
  169. package/streaming.js +0 -155
  170. package/streaming.js.map +0 -1
  171. package/streaming.mjs +0 -151
  172. package/streaming.mjs.map +0 -1
package/src/index.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as qs from 'qs';
4
3
  import * as Core from './core';
5
4
  import * as Pagination from './pagination';
6
5
  import * as API from './resources/index';
7
6
  import * as Errors from './error';
8
- import type { Agent } from 'modern-treasury/_shims/agent';
7
+ import type { Agent } from './_shims/agent';
9
8
  import * as Uploads from './uploads';
9
+ import * as qs from 'qs';
10
10
 
11
- type Config = {
11
+ export interface ClientOptions {
12
12
  /**
13
13
  * Defaults to process.env["MODERN_TREASURY_API_KEY"].
14
14
  */
@@ -36,6 +36,14 @@ type Config = {
36
36
  */
37
37
  httpAgent?: Agent;
38
38
 
39
+ /**
40
+ * Specify a custom `fetch` function implementation.
41
+ *
42
+ * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
43
+ * defined globally.
44
+ */
45
+ fetch?: Core.Fetch | undefined;
46
+
39
47
  /**
40
48
  * The maximum number of times that the client will retry a request in case of a
41
49
  * temporary failure, like a network error or a 5XX error from the server.
@@ -60,10 +68,10 @@ type Config = {
60
68
  */
61
69
  defaultQuery?: Core.DefaultQuery;
62
70
 
63
- organizationId?: string | null;
71
+ organizationId?: string;
64
72
 
65
73
  webhookKey?: string | null;
66
- };
74
+ }
67
75
 
68
76
  /** Instantiate the API Client. */
69
77
  export class ModernTreasury extends Core.APIClient {
@@ -71,39 +79,46 @@ export class ModernTreasury extends Core.APIClient {
71
79
  organizationId: string;
72
80
  webhookKey?: string | null;
73
81
 
74
- private _options: Config;
82
+ private _options: ClientOptions;
75
83
 
76
- constructor(config: Config) {
77
- const options: Config = {
78
- apiKey: typeof process === 'undefined' ? '' : process.env['MODERN_TREASURY_API_KEY'] || '',
79
- baseURL: 'https://app.moderntreasury.com',
80
- ...config,
81
- };
82
-
83
- if (!options.apiKey && options.apiKey !== null) {
84
+ constructor({
85
+ apiKey = Core.readEnv('MODERN_TREASURY_API_KEY'),
86
+ organizationId = Core.readEnv('MODERN_TREASURY_ORGANIZATION_ID'),
87
+ webhookKey = Core.readEnv('MODERN_TREASURY_WEBHOOK_KEY') ?? null,
88
+ ...opts
89
+ }: ClientOptions = {}) {
90
+ if (apiKey === undefined) {
91
+ throw new Error(
92
+ '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: undefined }).',
93
+ );
94
+ }
95
+ if (organizationId === undefined) {
84
96
  throw new Error(
85
- "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 api key' }).",
97
+ "The MODERN_TREASURY_ORGANIZATION_ID environment variable is missing or empty; either provide it, or instantiate the ModernTreasury client with an organizationId option, like new ModernTreasury({ organizationId: 'my-organization-ID' }).",
86
98
  );
87
99
  }
88
100
 
101
+ const options: ClientOptions = {
102
+ apiKey,
103
+ organizationId,
104
+ webhookKey,
105
+ baseURL: `https://app.moderntreasury.com`,
106
+ ...opts,
107
+ };
108
+
89
109
  super({
90
110
  baseURL: options.baseURL!,
91
111
  timeout: options.timeout,
92
112
  httpAgent: options.httpAgent,
93
113
  maxRetries: options.maxRetries,
114
+ fetch: options.fetch,
94
115
  });
95
- this.apiKey = options.apiKey;
96
116
  this._options = options;
97
117
  this.idempotencyHeader = 'Idempotency-Key';
98
118
 
99
- const organizationId = config.organizationId || process.env['MODERN_TREASURY_ORGANIZATION_ID'];
100
- if (!organizationId) {
101
- throw new Error(
102
- "The MODERN_TREASURY_ORGANIZATION_ID environment variable is missing or empty; either provide it, or instantiate the ModernTreasury client with an organizationId option, like new ModernTreasury({ organizationId: 'my-organization-ID' }).",
103
- );
104
- }
119
+ this.apiKey = apiKey;
105
120
  this.organizationId = organizationId;
106
- this.webhookKey = config.webhookKey || process.env['MODERN_TREASURY_WEBHOOK_KEY'] || null;
121
+ this.webhookKey = webhookKey;
107
122
  }
108
123
 
109
124
  connections: API.Connections = new API.Connections(this);
@@ -159,17 +174,20 @@ export class ModernTreasury extends Core.APIClient {
159
174
 
160
175
  protected override authHeaders(): Core.Headers {
161
176
  const credentials = `${this.organizationId}:${this.apiKey}`;
162
- const Authorization = `Basic ${Buffer.from(credentials).toString('base64')}`;
177
+ const Authorization = `Basic ${Core.toBase64(credentials)}`;
163
178
  return { Authorization };
164
179
  }
165
180
 
166
- protected override qsOptions(): qs.IStringifyOptions {
167
- return { arrayFormat: 'repeat' };
181
+ protected override stringifyQuery(query: Record<string, unknown>): string {
182
+ return qs.stringify(query, { arrayFormat: 'repeat' });
168
183
  }
169
184
 
185
+ static ModernTreasury = this;
186
+
170
187
  static APIError = Errors.APIError;
171
188
  static APIConnectionError = Errors.APIConnectionError;
172
189
  static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
190
+ static APIUserAbortError = Errors.APIUserAbortError;
173
191
  static NotFoundError = Errors.NotFoundError;
174
192
  static ConflictError = Errors.ConflictError;
175
193
  static RateLimitError = Errors.RateLimitError;
@@ -184,6 +202,7 @@ export const {
184
202
  APIError,
185
203
  APIConnectionError,
186
204
  APIConnectionTimeoutError,
205
+ APIUserAbortError,
187
206
  NotFoundError,
188
207
  ConflictError,
189
208
  RateLimitError,
@@ -266,8 +285,8 @@ export namespace ModernTreasury {
266
285
  export import DocumentListParams = API.DocumentListParams;
267
286
 
268
287
  export import AccountCollectionFlows = API.AccountCollectionFlows;
269
- export import AccountConnectionFlow = API.AccountConnectionFlow;
270
- export import AccountConnectionFlowsPage = API.AccountConnectionFlowsPage;
288
+ export import AccountCollectionFlow = API.AccountCollectionFlow;
289
+ export import AccountCollectionFlowsPage = API.AccountCollectionFlowsPage;
271
290
  export import AccountCollectionFlowCreateParams = API.AccountCollectionFlowCreateParams;
272
291
  export import AccountCollectionFlowRetrieveParams = API.AccountCollectionFlowRetrieveParams;
273
292
  export import AccountCollectionFlowUpdateParams = API.AccountCollectionFlowUpdateParams;
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as API from './';
7
- import { Page, PageParams } from 'modern-treasury/pagination';
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';
8
8
 
9
9
  export class AccountCollectionFlows extends APIResource {
10
10
  /**
@@ -13,7 +13,7 @@ export class AccountCollectionFlows extends APIResource {
13
13
  create(
14
14
  params: AccountCollectionFlowCreateParams,
15
15
  options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<AccountConnectionFlow>> {
16
+ ): Promise<Core.APIResponse<AccountCollectionFlow>> {
17
17
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
18
  return this.post('/api/account_collection_flows', {
19
19
  body,
@@ -29,13 +29,13 @@ export class AccountCollectionFlows extends APIResource {
29
29
  id: string,
30
30
  query?: AccountCollectionFlowRetrieveParams,
31
31
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<AccountConnectionFlow>>;
33
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<AccountConnectionFlow>>;
32
+ ): Promise<Core.APIResponse<AccountCollectionFlow>>;
33
+ retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<AccountCollectionFlow>>;
34
34
  retrieve(
35
35
  id: string,
36
36
  query: AccountCollectionFlowRetrieveParams | Core.RequestOptions = {},
37
37
  options?: Core.RequestOptions,
38
- ): Promise<Core.APIResponse<AccountConnectionFlow>> {
38
+ ): Promise<Core.APIResponse<AccountCollectionFlow>> {
39
39
  if (isRequestOptions(query)) {
40
40
  return this.retrieve(id, {}, query);
41
41
  }
@@ -53,7 +53,7 @@ export class AccountCollectionFlows extends APIResource {
53
53
  id: string,
54
54
  params: AccountCollectionFlowUpdateParams,
55
55
  options?: Core.RequestOptions,
56
- ): Promise<Core.APIResponse<AccountConnectionFlow>> {
56
+ ): Promise<Core.APIResponse<AccountCollectionFlow>> {
57
57
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
58
58
  return this.patch(`/api/account_collection_flows/${id}`, {
59
59
  body,
@@ -68,27 +68,27 @@ export class AccountCollectionFlows extends APIResource {
68
68
  list(
69
69
  query?: AccountCollectionFlowListParams,
70
70
  options?: Core.RequestOptions,
71
- ): Core.PagePromise<AccountConnectionFlowsPage>;
72
- list(options?: Core.RequestOptions): Core.PagePromise<AccountConnectionFlowsPage>;
71
+ ): Core.PagePromise<AccountCollectionFlowsPage>;
72
+ list(options?: Core.RequestOptions): Core.PagePromise<AccountCollectionFlowsPage>;
73
73
  list(
74
74
  query: AccountCollectionFlowListParams | Core.RequestOptions = {},
75
75
  options?: Core.RequestOptions,
76
- ): Core.PagePromise<AccountConnectionFlowsPage> {
76
+ ): Core.PagePromise<AccountCollectionFlowsPage> {
77
77
  if (isRequestOptions(query)) {
78
78
  return this.list({}, query);
79
79
  }
80
- return this.getAPIList('/api/account_collection_flows', AccountConnectionFlowsPage, {
80
+ return this.getAPIList('/api/account_collection_flows', AccountCollectionFlowsPage, {
81
81
  query,
82
82
  ...options,
83
83
  });
84
84
  }
85
85
  }
86
86
 
87
- export class AccountConnectionFlowsPage extends Page<AccountConnectionFlow> {}
87
+ export class AccountCollectionFlowsPage extends Page<AccountCollectionFlow> {}
88
88
  // alias so we can export it in the namespace
89
- type _AccountConnectionFlowsPage = AccountConnectionFlowsPage;
89
+ type _AccountCollectionFlowsPage = AccountCollectionFlowsPage;
90
90
 
91
- export interface AccountConnectionFlow {
91
+ export interface AccountCollectionFlow {
92
92
  /**
93
93
  * The ID of a counterparty. An external account created with this flow will be
94
94
  * associated with this counterparty.
@@ -179,8 +179,8 @@ export interface AccountCollectionFlowListParams extends PageParams {
179
179
  }
180
180
 
181
181
  export namespace AccountCollectionFlows {
182
- export import AccountConnectionFlow = API.AccountConnectionFlow;
183
- export type AccountConnectionFlowsPage = _AccountConnectionFlowsPage;
182
+ export import AccountCollectionFlow = API.AccountCollectionFlow;
183
+ export type AccountCollectionFlowsPage = _AccountCollectionFlowsPage;
184
184
  export import AccountCollectionFlowCreateParams = API.AccountCollectionFlowCreateParams;
185
185
  export import AccountCollectionFlowRetrieveParams = API.AccountCollectionFlowRetrieveParams;
186
186
  export import AccountCollectionFlowUpdateParams = API.AccountCollectionFlowUpdateParams;
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as Shared from 'modern-treasury/resources/shared';
7
- import * as API from './';
8
- import { Page, PageParams } from 'modern-treasury/pagination';
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';
9
9
 
10
10
  export class AccountDetails extends APIResource {
11
11
  /**
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as API from './';
7
- import { Page, PageParams } from 'modern-treasury/pagination';
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';
8
8
 
9
9
  export class Connections extends APIResource {
10
10
  /**
@@ -1,13 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as ExternalAccounts from 'modern-treasury/resources/external-accounts';
7
- import * as AccountDetails from 'modern-treasury/resources/account-details';
8
- import * as RoutingDetails from 'modern-treasury/resources/routing-details';
9
- import * as API from './';
10
- import { Page, PageParams } from 'modern-treasury/pagination';
3
+ import * as Core from '../core';
4
+ import { APIResource } from '../resource';
5
+ import { isRequestOptions } from '../core';
6
+ import * as ExternalAccounts from './external-accounts';
7
+ import * as AccountDetails from './account-details';
8
+ import * as RoutingDetails from './routing-details';
9
+ import * as API from './index';
10
+ import { Page, PageParams } from '../pagination';
11
11
 
12
12
  export class Counterparties extends APIResource {
13
13
  /**
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as API from './';
7
- import { type Uploadable, multipartFormRequestOptions } from 'modern-treasury/core';
8
- import { Page, PageParams } from 'modern-treasury/pagination';
3
+ import * as Core from '../core';
4
+ import { APIResource } from '../resource';
5
+ import { isRequestOptions } from '../core';
6
+ import * as API from './index';
7
+ import { type Uploadable, multipartFormRequestOptions } from '../core';
8
+ import { Page, PageParams } from '../pagination';
9
9
 
10
10
  export class Documents extends APIResource {
11
11
  /**
@@ -15,16 +15,10 @@ export class Documents extends APIResource {
15
15
  params: DocumentCreateParams,
16
16
  options?: Core.RequestOptions,
17
17
  ): Promise<Core.APIResponse<Document>> {
18
- const {
19
- documentable_id: documentableId,
20
- documentable_type: documentableType,
21
- 'Idempotency-Key': idempotencyKey,
22
- ...body
23
- } = params;
18
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
24
19
  return this.post(
25
20
  '/api/documents',
26
21
  await multipartFormRequestOptions({
27
- query: { documentable_id: documentableId, documentable_type: documentableType },
28
22
  body,
29
23
  ...options,
30
24
  headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
@@ -157,15 +151,12 @@ export namespace Document {
157
151
 
158
152
  export interface DocumentCreateParams {
159
153
  /**
160
- * Query param: The unique identifier for the associated object.
154
+ * Body param: The unique identifier for the associated object.
161
155
  */
162
156
  documentable_id: string;
163
157
 
164
158
  /**
165
- * Query param: The type of the associated object. Currently can be one of
166
- * `payment_order`, `transaction`, `paper_item`, `expected_payment`,
167
- * `counterparty`, `organization`, `case`, `internal_account`, `decision`, or
168
- * `external_account`.
159
+ * Body param:
169
160
  */
170
161
  documentable_type:
171
162
  | 'cases'
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as API from './';
7
- import { Page, PageParams } from 'modern-treasury/pagination';
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';
8
8
 
9
9
  export class Events extends APIResource {
10
10
  /**
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as Shared from 'modern-treasury/resources/shared';
7
- import * as API from './';
8
- import { Page, PageParams } from 'modern-treasury/pagination';
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';
9
9
 
10
10
  export class ExpectedPayments extends APIResource {
11
11
  /**
@@ -1,13 +1,13 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as AccountDetails from 'modern-treasury/resources/account-details';
7
- import * as RoutingDetails from 'modern-treasury/resources/routing-details';
8
- import * as Shared from 'modern-treasury/resources/shared';
9
- import * as API from './';
10
- import { Page, PageParams } from 'modern-treasury/pagination';
3
+ import * as Core from '../core';
4
+ import { APIResource } from '../resource';
5
+ import { isRequestOptions } from '../core';
6
+ import * as AccountDetails from './account-details';
7
+ import * as RoutingDetails from './routing-details';
8
+ import * as Shared from './shared';
9
+ import * as API from './index';
10
+ import { Page, PageParams } from '../pagination';
11
11
 
12
12
  export class ExternalAccounts extends APIResource {
13
13
  /**
@@ -1,12 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as VirtualAccounts from 'modern-treasury/resources/virtual-accounts';
7
- import * as Shared from 'modern-treasury/resources/shared';
8
- import * as API from './';
9
- import { Page, PageParams } from 'modern-treasury/pagination';
3
+ import * as Core from '../core';
4
+ import { APIResource } from '../resource';
5
+ import { isRequestOptions } from '../core';
6
+ import * as VirtualAccounts from './virtual-accounts';
7
+ import * as Shared from './shared';
8
+ import * as API from './index';
9
+ import { Page, PageParams } from '../pagination';
10
10
 
11
11
  export class IncomingPaymentDetails extends APIResource {
12
12
  /**
@@ -2,12 +2,12 @@
2
2
 
3
3
  export * from './shared';
4
4
  export {
5
- AccountConnectionFlow,
5
+ AccountCollectionFlow,
6
6
  AccountCollectionFlowCreateParams,
7
7
  AccountCollectionFlowRetrieveParams,
8
8
  AccountCollectionFlowUpdateParams,
9
9
  AccountCollectionFlowListParams,
10
- AccountConnectionFlowsPage,
10
+ AccountCollectionFlowsPage,
11
11
  AccountCollectionFlows,
12
12
  } from './account-collection-flows';
13
13
  export {
@@ -1,11 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as Shared from 'modern-treasury/resources/shared';
7
- import * as API from './';
8
- import { Page, PageParams } from 'modern-treasury/pagination';
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';
9
9
 
10
10
  export class BalanceReports extends APIResource {
11
11
  /**
@@ -1,15 +1,15 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from 'modern-treasury/core';
4
- import { APIResource } from 'modern-treasury/resource';
5
- import { isRequestOptions } from 'modern-treasury/core';
6
- import * as AccountDetails from 'modern-treasury/resources/account-details';
7
- import * as RoutingDetails from 'modern-treasury/resources/routing-details';
8
- import * as Connections from 'modern-treasury/resources/connections';
9
- import * as Shared from 'modern-treasury/resources/shared';
3
+ import * as Core from '../../core';
4
+ import { APIResource } from '../../resource';
5
+ import { isRequestOptions } from '../../core';
6
+ import * as AccountDetails from '../account-details';
7
+ import * as RoutingDetails from '../routing-details';
8
+ import * as Connections from '../connections';
9
+ import * as Shared from '../shared';
10
10
  import { BalanceReports } from './balance-reports';
11
- import * as API from './';
12
- import { Page, PageParams } from 'modern-treasury/pagination';
11
+ import * as API from './index';
12
+ import { Page, PageParams } from '../../pagination';
13
13
 
14
14
  export class InternalAccounts extends APIResource {
15
15
  balanceReports: BalanceReports = new BalanceReports(this.client);
@@ -234,11 +234,6 @@ export interface InternalAccountCreateParams {
234
234
  */
235
235
  counterparty_id?: string;
236
236
 
237
- /**
238
- * Body param: The identifier of the entity at Increase which owns the account.
239
- */
240
- entity_id?: string;
241
-
242
237
  /**
243
238
  * Body param: The parent internal account of this new account.
244
239
  */
@@ -249,6 +244,12 @@ export interface InternalAccountCreateParams {
249
244
  */
250
245
  party_address?: InternalAccountCreateParams.PartyAddress;
251
246
 
247
+ /**
248
+ * Body param: A hash of vendor specific attributes that will be used when creating
249
+ * the account at the vendor specified by the given connection.
250
+ */
251
+ vendor_attributes?: Record<string, string>;
252
+
252
253
  /**
253
254
  * Header param: This key should be something unique, preferably something like an
254
255
  * UUID.