modern-treasury 2.3.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.
Files changed (329) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +2 -0
  3. package/_shims/{ReadableStream.node.d.ts → ReadableStream-node.d.ts} +1 -1
  4. package/_shims/ReadableStream-node.d.ts.map +1 -0
  5. package/_shims/{ReadableStream.node.js → ReadableStream-node.js} +1 -1
  6. package/_shims/ReadableStream-node.js.map +1 -0
  7. package/_shims/{ReadableStream.node.mjs → ReadableStream-node.mjs} +1 -1
  8. package/_shims/ReadableStream-node.mjs.map +1 -0
  9. package/_shims/{agent.node.d.ts → agent-node.d.ts} +1 -1
  10. package/_shims/agent-node.d.ts.map +1 -0
  11. package/_shims/{agent.node.js → agent-node.js} +1 -1
  12. package/_shims/{agent.node.js.map → agent-node.js.map} +1 -1
  13. package/_shims/{agent.node.mjs → agent-node.mjs} +1 -1
  14. package/_shims/{agent.node.mjs.map → agent-node.mjs.map} +1 -1
  15. package/_shims/agent.d.ts +1 -1
  16. package/_shims/agent.js +1 -1
  17. package/_shims/agent.mjs +1 -1
  18. package/{src/_shims/fetch.node.d.ts → _shims/fetch-node.d.ts} +1 -0
  19. package/_shims/fetch.d.ts +1 -0
  20. package/_shims/{fileFromPath.node.d.ts → fileFromPath-node.d.ts} +2 -2
  21. package/_shims/{fileFromPath.node.d.ts.map → fileFromPath-node.d.ts.map} +1 -1
  22. package/_shims/{fileFromPath.node.js → fileFromPath-node.js} +1 -1
  23. package/_shims/{fileFromPath.node.js.map → fileFromPath-node.js.map} +1 -1
  24. package/_shims/{fileFromPath.node.mjs → fileFromPath-node.mjs} +1 -1
  25. package/_shims/{fileFromPath.node.mjs.map → fileFromPath-node.mjs.map} +1 -1
  26. package/_shims/fileFromPath.d.ts +2 -2
  27. package/_shims/fileFromPath.d.ts.map +1 -1
  28. package/_shims/fileFromPath.js +1 -1
  29. package/_shims/fileFromPath.mjs +1 -1
  30. package/_shims/form-data.js +17 -0
  31. package/_shims/form-data.mjs +20 -0
  32. package/_shims/{getMultipartRequestOptions.node.d.ts → getMultipartRequestOptions-node.d.ts} +2 -2
  33. package/_shims/getMultipartRequestOptions-node.d.ts.map +1 -0
  34. package/_shims/{getMultipartRequestOptions.node.js → getMultipartRequestOptions-node.js} +1 -1
  35. package/_shims/{getMultipartRequestOptions.node.js.map → getMultipartRequestOptions-node.js.map} +1 -1
  36. package/_shims/{getMultipartRequestOptions.node.mjs → getMultipartRequestOptions-node.mjs} +1 -1
  37. package/_shims/{getMultipartRequestOptions.node.mjs.map → getMultipartRequestOptions-node.mjs.map} +1 -1
  38. package/_shims/getMultipartRequestOptions.d.ts +1 -1
  39. package/_shims/getMultipartRequestOptions.d.ts.map +1 -1
  40. package/_shims/{node-readable.node.d.ts → node-readable-node.d.ts} +1 -1
  41. package/_shims/{node-readable.node.d.ts.map → node-readable-node.d.ts.map} +1 -1
  42. package/_shims/{node-readable.node.js → node-readable-node.js} +1 -1
  43. package/_shims/node-readable-node.js.map +1 -0
  44. package/_shims/{node-readable.node.mjs → node-readable-node.mjs} +1 -1
  45. package/_shims/node-readable-node.mjs.map +1 -0
  46. package/core.d.ts +13 -5
  47. package/core.d.ts.map +1 -1
  48. package/core.js +17 -10
  49. package/core.js.map +1 -1
  50. package/core.mjs +17 -10
  51. package/core.mjs.map +1 -1
  52. package/index.d.mts +18 -5
  53. package/index.d.ts +18 -5
  54. package/index.d.ts.map +1 -1
  55. package/index.js +21 -7
  56. package/index.js.map +1 -1
  57. package/index.mjs +21 -7
  58. package/index.mjs.map +1 -1
  59. package/package.json +32 -9
  60. package/resources/account-collection-flows.d.ts +3 -28
  61. package/resources/account-collection-flows.d.ts.map +1 -1
  62. package/resources/account-collection-flows.js +22 -17
  63. package/resources/account-collection-flows.js.map +1 -1
  64. package/resources/account-collection-flows.mjs +22 -17
  65. package/resources/account-collection-flows.mjs.map +1 -1
  66. package/resources/account-details.d.ts +3 -8
  67. package/resources/account-details.d.ts.map +1 -1
  68. package/resources/account-details.js +10 -4
  69. package/resources/account-details.js.map +1 -1
  70. package/resources/account-details.mjs +10 -4
  71. package/resources/account-details.mjs.map +1 -1
  72. package/resources/connections.js +3 -3
  73. package/resources/connections.mjs +3 -3
  74. package/resources/counterparties.d.ts +26 -40
  75. package/resources/counterparties.d.ts.map +1 -1
  76. package/resources/counterparties.js +17 -5
  77. package/resources/counterparties.js.map +1 -1
  78. package/resources/counterparties.mjs +17 -5
  79. package/resources/counterparties.mjs.map +1 -1
  80. package/resources/documents.d.ts +2 -13
  81. package/resources/documents.d.ts.map +1 -1
  82. package/resources/documents.js +11 -5
  83. package/resources/documents.js.map +1 -1
  84. package/resources/documents.mjs +11 -5
  85. package/resources/documents.mjs.map +1 -1
  86. package/resources/events.js +3 -3
  87. package/resources/events.mjs +3 -3
  88. package/resources/expected-payments.d.ts +23 -32
  89. package/resources/expected-payments.d.ts.map +1 -1
  90. package/resources/expected-payments.js +10 -4
  91. package/resources/expected-payments.js.map +1 -1
  92. package/resources/expected-payments.mjs +10 -4
  93. package/resources/expected-payments.mjs.map +1 -1
  94. package/resources/external-accounts.d.ts +17 -51
  95. package/resources/external-accounts.d.ts.map +1 -1
  96. package/resources/external-accounts.js +24 -6
  97. package/resources/external-accounts.js.map +1 -1
  98. package/resources/external-accounts.mjs +24 -6
  99. package/resources/external-accounts.mjs.map +1 -1
  100. package/resources/incoming-payment-details.d.ts +10 -15
  101. package/resources/incoming-payment-details.d.ts.map +1 -1
  102. package/resources/incoming-payment-details.js +10 -4
  103. package/resources/incoming-payment-details.js.map +1 -1
  104. package/resources/incoming-payment-details.mjs +10 -4
  105. package/resources/incoming-payment-details.mjs.map +1 -1
  106. package/resources/index.d.ts +0 -2
  107. package/resources/index.d.ts.map +1 -1
  108. package/resources/index.js.map +1 -1
  109. package/resources/index.mjs.map +1 -1
  110. package/resources/internal-accounts/balance-reports.js +3 -3
  111. package/resources/internal-accounts/balance-reports.mjs +3 -3
  112. package/resources/internal-accounts/internal-accounts.d.ts +10 -15
  113. package/resources/internal-accounts/internal-accounts.d.ts.map +1 -1
  114. package/resources/internal-accounts/internal-accounts.js +10 -4
  115. package/resources/internal-accounts/internal-accounts.js.map +1 -1
  116. package/resources/internal-accounts/internal-accounts.mjs +10 -4
  117. package/resources/internal-accounts/internal-accounts.mjs.map +1 -1
  118. package/resources/invoices/invoices.d.ts +24 -32
  119. package/resources/invoices/invoices.d.ts.map +1 -1
  120. package/resources/invoices/invoices.js +10 -4
  121. package/resources/invoices/invoices.js.map +1 -1
  122. package/resources/invoices/invoices.mjs +10 -4
  123. package/resources/invoices/invoices.mjs.map +1 -1
  124. package/resources/invoices/line-items.d.ts +9 -14
  125. package/resources/invoices/line-items.d.ts.map +1 -1
  126. package/resources/invoices/line-items.js +10 -4
  127. package/resources/invoices/line-items.js.map +1 -1
  128. package/resources/invoices/line-items.mjs +10 -4
  129. package/resources/invoices/line-items.mjs.map +1 -1
  130. package/resources/ledger-account-categories.d.ts +8 -13
  131. package/resources/ledger-account-categories.d.ts.map +1 -1
  132. package/resources/ledger-account-categories.js +10 -4
  133. package/resources/ledger-account-categories.js.map +1 -1
  134. package/resources/ledger-account-categories.mjs +10 -4
  135. package/resources/ledger-account-categories.mjs.map +1 -1
  136. package/resources/ledger-account-payouts.d.ts +14 -19
  137. package/resources/ledger-account-payouts.d.ts.map +1 -1
  138. package/resources/ledger-account-payouts.js +10 -4
  139. package/resources/ledger-account-payouts.js.map +1 -1
  140. package/resources/ledger-account-payouts.mjs +10 -4
  141. package/resources/ledger-account-payouts.mjs.map +1 -1
  142. package/resources/ledger-account-statements.d.ts +9 -14
  143. package/resources/ledger-account-statements.d.ts.map +1 -1
  144. package/resources/ledger-account-statements.js +8 -2
  145. package/resources/ledger-account-statements.js.map +1 -1
  146. package/resources/ledger-account-statements.mjs +8 -2
  147. package/resources/ledger-account-statements.mjs.map +1 -1
  148. package/resources/ledger-accounts.d.ts +13 -18
  149. package/resources/ledger-accounts.d.ts.map +1 -1
  150. package/resources/ledger-accounts.js +10 -4
  151. package/resources/ledger-accounts.js.map +1 -1
  152. package/resources/ledger-accounts.mjs +10 -4
  153. package/resources/ledger-accounts.mjs.map +1 -1
  154. package/resources/ledger-entries.js +3 -3
  155. package/resources/ledger-entries.mjs +3 -3
  156. package/resources/ledger-event-handlers.d.ts +5 -16
  157. package/resources/ledger-event-handlers.d.ts.map +1 -1
  158. package/resources/ledger-event-handlers.js +10 -4
  159. package/resources/ledger-event-handlers.js.map +1 -1
  160. package/resources/ledger-event-handlers.mjs +10 -4
  161. package/resources/ledger-event-handlers.mjs.map +1 -1
  162. package/resources/ledger-transactions/ledger-transactions.d.ts +16 -22
  163. package/resources/ledger-transactions/ledger-transactions.d.ts.map +1 -1
  164. package/resources/ledger-transactions/ledger-transactions.js +10 -4
  165. package/resources/ledger-transactions/ledger-transactions.js.map +1 -1
  166. package/resources/ledger-transactions/ledger-transactions.mjs +10 -4
  167. package/resources/ledger-transactions/ledger-transactions.mjs.map +1 -1
  168. package/resources/ledger-transactions/versions.js +3 -3
  169. package/resources/ledger-transactions/versions.mjs +3 -3
  170. package/resources/ledgerable-events.d.ts +11 -16
  171. package/resources/ledgerable-events.d.ts.map +1 -1
  172. package/resources/ledgerable-events.js +8 -2
  173. package/resources/ledgerable-events.js.map +1 -1
  174. package/resources/ledgerable-events.mjs +8 -2
  175. package/resources/ledgerable-events.mjs.map +1 -1
  176. package/resources/ledgers.d.ts +4 -9
  177. package/resources/ledgers.d.ts.map +1 -1
  178. package/resources/ledgers.js +10 -4
  179. package/resources/ledgers.js.map +1 -1
  180. package/resources/ledgers.mjs +10 -4
  181. package/resources/ledgers.mjs.map +1 -1
  182. package/resources/line-items.js +3 -3
  183. package/resources/line-items.mjs +3 -3
  184. package/resources/paper-items.js +3 -3
  185. package/resources/paper-items.mjs +3 -3
  186. package/resources/payment-flows.d.ts +10 -34
  187. package/resources/payment-flows.d.ts.map +1 -1
  188. package/resources/payment-flows.js +22 -17
  189. package/resources/payment-flows.js.map +1 -1
  190. package/resources/payment-flows.mjs +22 -17
  191. package/resources/payment-flows.mjs.map +1 -1
  192. package/resources/payment-orders/payment-orders.d.ts +142 -167
  193. package/resources/payment-orders/payment-orders.d.ts.map +1 -1
  194. package/resources/payment-orders/payment-orders.js +18 -6
  195. package/resources/payment-orders/payment-orders.js.map +1 -1
  196. package/resources/payment-orders/payment-orders.mjs +18 -6
  197. package/resources/payment-orders/payment-orders.mjs.map +1 -1
  198. package/resources/payment-orders/reversals.d.ts +7 -13
  199. package/resources/payment-orders/reversals.d.ts.map +1 -1
  200. package/resources/payment-orders/reversals.js +10 -4
  201. package/resources/payment-orders/reversals.js.map +1 -1
  202. package/resources/payment-orders/reversals.mjs +10 -4
  203. package/resources/payment-orders/reversals.mjs.map +1 -1
  204. package/resources/payment-references.js +3 -3
  205. package/resources/payment-references.mjs +3 -3
  206. package/resources/returns.d.ts +9 -15
  207. package/resources/returns.d.ts.map +1 -1
  208. package/resources/returns.js +10 -4
  209. package/resources/returns.js.map +1 -1
  210. package/resources/returns.mjs +10 -4
  211. package/resources/returns.mjs.map +1 -1
  212. package/resources/routing-details.d.ts +4 -10
  213. package/resources/routing-details.d.ts.map +1 -1
  214. package/resources/routing-details.js +10 -4
  215. package/resources/routing-details.js.map +1 -1
  216. package/resources/routing-details.mjs +10 -4
  217. package/resources/routing-details.mjs.map +1 -1
  218. package/resources/transactions/line-items.js +3 -3
  219. package/resources/transactions/line-items.mjs +3 -3
  220. package/resources/transactions/transactions.js +3 -3
  221. package/resources/transactions/transactions.mjs +3 -3
  222. package/resources/validations.js +1 -1
  223. package/resources/validations.mjs +1 -1
  224. package/resources/virtual-accounts.d.ts +12 -18
  225. package/resources/virtual-accounts.d.ts.map +1 -1
  226. package/resources/virtual-accounts.js +10 -4
  227. package/resources/virtual-accounts.js.map +1 -1
  228. package/resources/virtual-accounts.mjs +10 -4
  229. package/resources/virtual-accounts.mjs.map +1 -1
  230. package/resources/webhooks.js +2 -2
  231. package/resources/webhooks.mjs +2 -2
  232. package/src/_shims/ReadableStream.d.ts +5 -5
  233. package/src/_shims/agent.ts +1 -1
  234. package/{_shims/fetch.node.d.ts → src/_shims/fetch-node.d.ts} +9 -8
  235. package/src/_shims/fetch.d.ts +11 -10
  236. package/src/_shims/{fileFromPath.node.ts → fileFromPath-node.ts} +1 -1
  237. package/src/_shims/fileFromPath.ts +2 -2
  238. package/src/_shims/{formdata.node.d.ts → form-data-node.d.ts} +4 -4
  239. package/src/_shims/{formdata.d.ts → form-data.d.ts} +4 -4
  240. package/src/_shims/form-data.js +17 -0
  241. package/src/_shims/form-data.mjs +20 -0
  242. package/src/_shims/{getMultipartRequestOptions.node.ts → getMultipartRequestOptions-node.ts} +3 -3
  243. package/src/_shims/getMultipartRequestOptions.ts +3 -3
  244. package/src/core.ts +35 -22
  245. package/src/error.ts +1 -1
  246. package/src/index.ts +27 -13
  247. package/src/pagination.ts +1 -1
  248. package/src/resource.ts +1 -1
  249. package/src/resources/account-collection-flows.ts +24 -52
  250. package/src/resources/account-details.ts +16 -16
  251. package/src/resources/connections.ts +5 -5
  252. package/src/resources/counterparties.ts +48 -52
  253. package/src/resources/documents.ts +15 -21
  254. package/src/resources/events.ts +5 -5
  255. package/src/resources/expected-payments.ts +36 -40
  256. package/src/resources/external-accounts.ts +46 -65
  257. package/src/resources/incoming-payment-details.ts +24 -24
  258. package/src/resources/index.ts +39 -35
  259. package/src/resources/internal-accounts/balance-reports.ts +6 -6
  260. package/src/resources/internal-accounts/index.ts +2 -2
  261. package/src/resources/internal-accounts/internal-accounts.ts +27 -27
  262. package/src/resources/invoices/index.ts +2 -2
  263. package/src/resources/invoices/invoices.ts +39 -42
  264. package/src/resources/invoices/line-items.ts +21 -21
  265. package/src/resources/ledger-account-categories.ts +20 -20
  266. package/src/resources/ledger-account-payouts.ts +26 -26
  267. package/src/resources/ledger-account-statements.ts +19 -19
  268. package/src/resources/ledger-accounts.ts +25 -25
  269. package/src/resources/ledger-entries.ts +5 -5
  270. package/src/resources/ledger-event-handlers.ts +17 -23
  271. package/src/resources/ledger-transactions/index.ts +2 -2
  272. package/src/resources/ledger-transactions/ledger-transactions.ts +30 -31
  273. package/src/resources/ledger-transactions/versions.ts +5 -5
  274. package/src/resources/ledgerable-events.ts +21 -21
  275. package/src/resources/ledgers.ts +16 -16
  276. package/src/resources/line-items.ts +5 -5
  277. package/src/resources/paper-items.ts +6 -6
  278. package/src/resources/payment-flows.ts +31 -58
  279. package/src/resources/payment-orders/index.ts +2 -2
  280. package/src/resources/payment-orders/payment-orders.ts +166 -181
  281. package/src/resources/payment-orders/reversals.ts +19 -20
  282. package/src/resources/payment-references.ts +5 -5
  283. package/src/resources/returns.ts +22 -23
  284. package/src/resources/routing-details.ts +17 -18
  285. package/src/resources/top-level.ts +1 -1
  286. package/src/resources/transactions/index.ts +7 -2
  287. package/src/resources/transactions/line-items.ts +5 -5
  288. package/src/resources/transactions/transactions.ts +7 -7
  289. package/src/resources/validations.ts +3 -3
  290. package/src/resources/virtual-accounts.ts +26 -27
  291. package/src/resources/webhooks.ts +3 -3
  292. package/src/tsconfig.json +11 -0
  293. package/src/uploads.ts +6 -6
  294. package/src/version.ts +1 -1
  295. package/uploads.d.ts +1 -1
  296. package/uploads.d.ts.map +1 -1
  297. package/uploads.js +7 -7
  298. package/uploads.js.map +1 -1
  299. package/uploads.mjs +4 -4
  300. package/uploads.mjs.map +1 -1
  301. package/version.d.ts +1 -1
  302. package/version.js +1 -1
  303. package/version.mjs +1 -1
  304. package/_shims/ReadableStream.node.d.ts.map +0 -1
  305. package/_shims/ReadableStream.node.js.map +0 -1
  306. package/_shims/ReadableStream.node.mjs.map +0 -1
  307. package/_shims/agent.node.d.ts.map +0 -1
  308. package/_shims/formdata.js +0 -9
  309. package/_shims/formdata.mjs +0 -11
  310. package/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
  311. package/_shims/node-readable.node.js.map +0 -1
  312. package/_shims/node-readable.node.mjs.map +0 -1
  313. package/src/_shims/fetch.deno.ts +0 -23
  314. package/src/_shims/formdata.deno.ts +0 -16
  315. package/src/_shims/formdata.js +0 -9
  316. package/src/_shims/formdata.mjs +0 -11
  317. /package/_shims/{fetch.node.js → fetch-node.js} +0 -0
  318. /package/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
  319. /package/_shims/{formdata.node.d.ts → form-data-node.d.ts} +0 -0
  320. /package/_shims/{formdata.node.js → form-data-node.js} +0 -0
  321. /package/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
  322. /package/_shims/{formdata.d.ts → form-data.d.ts} +0 -0
  323. /package/src/_shims/{ReadableStream.node.ts → ReadableStream-node.ts} +0 -0
  324. /package/src/_shims/{agent.node.ts → agent-node.ts} +0 -0
  325. /package/src/_shims/{fetch.node.js → fetch-node.js} +0 -0
  326. /package/src/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
  327. /package/src/_shims/{formdata.node.js → form-data-node.js} +0 -0
  328. /package/src/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
  329. /package/src/_shims/{node-readable.node.ts → node-readable-node.ts} +0 -0
@@ -1,24 +1,30 @@
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 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';
3
+ import * as Core from '../core.js';
4
+ import { APIResource } from '../resource.js';
5
+ import { isRequestOptions } from '../core.js';
6
+ import * as ExternalAccounts from './external-accounts.js';
7
+ import * as AccountDetails from './account-details.js';
8
+ import * as RoutingDetails from './routing-details.js';
9
+ import * as API from './index.js';
10
+ import { Page, PageParams } from '../pagination.js';
11
11
 
12
12
  export class Counterparties extends APIResource {
13
13
  /**
14
14
  * Create a new counterparty.
15
15
  */
16
16
  create(params: CounterpartyCreateParams, options?: Core.RequestOptions): Core.APIPromise<Counterparty> {
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/counterparties', {
19
25
  body,
20
26
  ...options,
21
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
27
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
22
28
  });
23
29
  }
24
30
 
@@ -85,11 +91,17 @@ export class Counterparties extends APIResource {
85
91
  params: CounterpartyCollectAccountParams,
86
92
  options?: Core.RequestOptions,
87
93
  ): Core.APIPromise<CounterpartyCollectAccountResponse> {
94
+ // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
88
95
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
96
+ if (idempotencyKey) {
97
+ console.warn(
98
+ "The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
99
+ );
100
+ }
89
101
  return this.post(`/api/counterparties/${id}/collect_account`, {
90
102
  body,
91
103
  ...options,
92
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
104
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
93
105
  });
94
106
  }
95
107
  }
@@ -304,58 +316,49 @@ export interface CounterpartyCollectAccountResponse {
304
316
 
305
317
  export interface CounterpartyCreateParams {
306
318
  /**
307
- * Body param: A human friendly name for this counterparty.
319
+ * A human friendly name for this counterparty.
308
320
  */
309
321
  name: string | null;
310
322
 
311
- /**
312
- * Body param:
313
- */
314
323
  accounting?: CounterpartyCreateParams.Accounting;
315
324
 
316
325
  /**
317
- * Body param: The accounts for this counterparty.
326
+ * The accounts for this counterparty.
318
327
  */
319
328
  accounts?: Array<CounterpartyCreateParams.Account>;
320
329
 
321
330
  /**
322
- * Body param: The counterparty's email.
331
+ * The counterparty's email.
323
332
  */
324
333
  email?: string | null;
325
334
 
326
335
  /**
327
- * Body param: An optional type to auto-sync the counterparty to your ledger.
328
- * Either `customer` or `vendor`.
336
+ * An optional type to auto-sync the counterparty to your ledger. Either `customer`
337
+ * or `vendor`.
329
338
  */
330
339
  ledger_type?: 'customer' | 'vendor';
331
340
 
332
341
  /**
333
- * Body param: Additional data represented as key-value pairs. Both the key and
334
- * value must be strings.
342
+ * Additional data represented as key-value pairs. Both the key and value must be
343
+ * strings.
335
344
  */
336
345
  metadata?: Record<string, string>;
337
346
 
338
347
  /**
339
- * Body param: Send an email to the counterparty whenever an associated payment
340
- * order is sent to the bank.
348
+ * Send an email to the counterparty whenever an associated payment order is sent
349
+ * to the bank.
341
350
  */
342
351
  send_remittance_advice?: boolean;
343
352
 
344
353
  /**
345
- * Body param: Either a valid SSN or EIN.
354
+ * Either a valid SSN or EIN.
346
355
  */
347
356
  taxpayer_identifier?: string;
348
357
 
349
358
  /**
350
- * Body param: The verification status of the counterparty.
359
+ * The verification status of the counterparty.
351
360
  */
352
361
  verification_status?: 'denied' | 'needs_approval' | 'unverified' | 'verified';
353
-
354
- /**
355
- * Header param: This key should be something unique, preferably something like an
356
- * UUID.
357
- */
358
- 'Idempotency-Key'?: string;
359
362
  }
360
363
 
361
364
  export namespace CounterpartyCreateParams {
@@ -623,26 +626,25 @@ export interface CounterpartyListParams extends PageParams {
623
626
 
624
627
  export interface CounterpartyCollectAccountParams {
625
628
  /**
626
- * Body param: One of `credit` or `debit`. Use `credit` when you want to pay a
627
- * counterparty. Use `debit` when you need to charge a counterparty. This field
628
- * helps us send a more tailored email to your counterparties."
629
+ * One of `credit` or `debit`. Use `credit` when you want to pay a counterparty.
630
+ * Use `debit` when you need to charge a counterparty. This field helps us send a
631
+ * more tailored email to your counterparties."
629
632
  */
630
633
  direction: 'credit' | 'debit';
631
634
 
632
635
  /**
633
- * Body param: The URL you want your customer to visit upon filling out the form.
634
- * By default, they will be sent to a Modern Treasury landing page. This must be a
635
- * valid HTTPS URL if set.
636
+ * The URL you want your customer to visit upon filling out the form. By default,
637
+ * they will be sent to a Modern Treasury landing page. This must be a valid HTTPS
638
+ * URL if set.
636
639
  */
637
640
  custom_redirect?: string;
638
641
 
639
642
  /**
640
- * Body param: The list of fields you want on the form. This field is optional and
641
- * if it is not set, will default to [\"nameOnAccount\", \"accountType\",
642
- * \"accountNumber\", \"routingNumber\", \"address\"]. The full list of options is
643
- * [\"name\", \"nameOnAccount\", \"taxpayerIdentifier\", \"accountType\",
644
- * \"accountNumber\", \"routingNumber\", \"address\", \"ibanNumber\",
645
- * \"swiftCode\"].
643
+ * The list of fields you want on the form. This field is optional and if it is not
644
+ * set, will default to [\"nameOnAccount\", \"accountType\", \"accountNumber\",
645
+ * \"routingNumber\", \"address\"]. The full list of options is [\"name\",
646
+ * \"nameOnAccount\", \"taxpayerIdentifier\", \"accountType\", \"accountNumber\",
647
+ * \"routingNumber\", \"address\", \"ibanNumber\", \"swiftCode\"].
646
648
  */
647
649
  fields?: Array<
648
650
  | 'name'
@@ -669,18 +671,12 @@ export interface CounterpartyCollectAccountParams {
669
671
  >;
670
672
 
671
673
  /**
672
- * Body param: By default, Modern Treasury will send an email to your counterparty
673
- * that includes a link to the form they must fill out. However, if you would like
674
- * to send the counterparty the link, you can set this parameter to `false`. The
675
- * JSON body will include the link to the secure Modern Treasury form.
674
+ * By default, Modern Treasury will send an email to your counterparty that
675
+ * includes a link to the form they must fill out. However, if you would like to
676
+ * send the counterparty the link, you can set this parameter to `false`. The JSON
677
+ * body will include the link to the secure Modern Treasury form.
676
678
  */
677
679
  send_email?: boolean;
678
-
679
- /**
680
- * Header param: This key should be something unique, preferably something like an
681
- * UUID.
682
- */
683
- 'Idempotency-Key'?: string;
684
680
  }
685
681
 
686
682
  export namespace Counterparties {
@@ -1,24 +1,30 @@
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 { type Uploadable, multipartFormRequestOptions } from '../core';
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 API from './index.js';
7
+ import { type Uploadable, multipartFormRequestOptions } from '../core.js';
8
+ import { Page, PageParams } from '../pagination.js';
9
9
 
10
10
  export class Documents extends APIResource {
11
11
  /**
12
12
  * Create a document.
13
13
  */
14
14
  create(params: DocumentCreateParams, options?: Core.RequestOptions): Core.APIPromise<Document> {
15
+ // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
15
16
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
17
+ if (idempotencyKey) {
18
+ console.warn(
19
+ "The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
20
+ );
21
+ }
16
22
  return this.post(
17
23
  '/api/documents',
18
24
  multipartFormRequestOptions({
19
25
  body,
20
26
  ...options,
21
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
27
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
22
28
  }),
23
29
  );
24
30
  }
@@ -148,13 +154,10 @@ export namespace Document {
148
154
 
149
155
  export interface DocumentCreateParams {
150
156
  /**
151
- * Body param: The unique identifier for the associated object.
157
+ * The unique identifier for the associated object.
152
158
  */
153
159
  documentable_id: string;
154
160
 
155
- /**
156
- * Body param:
157
- */
158
161
  documentable_type:
159
162
  | 'cases'
160
163
  | 'counterparties'
@@ -168,21 +171,12 @@ export interface DocumentCreateParams {
168
171
  | 'decisions'
169
172
  | 'connections';
170
173
 
171
- /**
172
- * Body param:
173
- */
174
174
  file: Uploadable;
175
175
 
176
176
  /**
177
- * Body param: A category given to the document, can be `null`.
177
+ * A category given to the document, can be `null`.
178
178
  */
179
179
  document_type?: string;
180
-
181
- /**
182
- * Header param: This key should be something unique, preferably something like an
183
- * UUID.
184
- */
185
- 'Idempotency-Key'?: string;
186
180
  }
187
181
 
188
182
  export interface DocumentListParams extends PageParams {
@@ -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 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 '../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 ExpectedPayments extends APIResource {
11
11
  /**
@@ -15,11 +15,17 @@ export class ExpectedPayments extends APIResource {
15
15
  params: ExpectedPaymentCreateParams,
16
16
  options?: Core.RequestOptions,
17
17
  ): Core.APIPromise<ExpectedPayment> {
18
+ // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
18
19
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
20
+ if (idempotencyKey) {
21
+ console.warn(
22
+ "The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
23
+ );
24
+ }
19
25
  return this.post('/api/expected_payments', {
20
26
  body,
21
27
  ...options,
22
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
28
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
23
29
  });
24
30
  }
25
31
 
@@ -234,101 +240,91 @@ export type ExpectedPaymentType =
234
240
 
235
241
  export interface ExpectedPaymentCreateParams {
236
242
  /**
237
- * Body param: The lowest amount this expected payment may be equal to. Value in
238
- * specified currency's smallest unit. e.g. $10 would be represented as 1000.
243
+ * The lowest amount this expected payment may be equal to. Value in specified
244
+ * currency's smallest unit. e.g. $10 would be represented as 1000.
239
245
  */
240
246
  amount_lower_bound: number;
241
247
 
242
248
  /**
243
- * Body param: The highest amount this expected payment may be equal to. Value in
244
- * specified currency's smallest unit. e.g. $10 would be represented as 1000.
249
+ * The highest amount this expected payment may be equal to. Value in specified
250
+ * currency's smallest unit. e.g. $10 would be represented as 1000.
245
251
  */
246
252
  amount_upper_bound: number;
247
253
 
248
254
  /**
249
- * Body param: One of credit or debit. When you are receiving money, use credit.
250
- * When you are being charged, use debit.
255
+ * One of credit or debit. When you are receiving money, use credit. When you are
256
+ * being charged, use debit.
251
257
  */
252
258
  direction: 'credit' | 'debit';
253
259
 
254
260
  /**
255
- * Body param: The ID of the Internal Account for the expected payment.
261
+ * The ID of the Internal Account for the expected payment.
256
262
  */
257
263
  internal_account_id: string;
258
264
 
259
265
  /**
260
- * Body param: The ID of the counterparty you expect for this payment.
266
+ * The ID of the counterparty you expect for this payment.
261
267
  */
262
268
  counterparty_id?: string | null;
263
269
 
264
270
  /**
265
- * Body param: Must conform to ISO 4217. Defaults to the currency of the internal
266
- * account.
271
+ * Must conform to ISO 4217. Defaults to the currency of the internal account.
267
272
  */
268
273
  currency?: Shared.Currency | null;
269
274
 
270
275
  /**
271
- * Body param: The earliest date the payment may come in. Format: yyyy-mm-dd
276
+ * The earliest date the payment may come in. Format: yyyy-mm-dd
272
277
  */
273
278
  date_lower_bound?: string | null;
274
279
 
275
280
  /**
276
- * Body param: The latest date the payment may come in. Format: yyyy-mm-dd
281
+ * The latest date the payment may come in. Format: yyyy-mm-dd
277
282
  */
278
283
  date_upper_bound?: string | null;
279
284
 
280
285
  /**
281
- * Body param: An optional description for internal use.
286
+ * An optional description for internal use.
282
287
  */
283
288
  description?: string | null;
284
289
 
285
- /**
286
- * Body param:
287
- */
288
290
  line_items?: Array<ExpectedPaymentCreateParams.LineItem>;
289
291
 
290
292
  /**
291
- * Body param: Additional data represented as key-value pairs. Both the key and
292
- * value must be strings.
293
+ * Additional data represented as key-value pairs. Both the key and value must be
294
+ * strings.
293
295
  */
294
296
  metadata?: Record<string, string>;
295
297
 
296
298
  /**
297
- * Body param: The reconciliation filters you have for this payment.
299
+ * The reconciliation filters you have for this payment.
298
300
  */
299
301
  reconciliation_filters?: unknown | null;
300
302
 
301
303
  /**
302
- * Body param: The reconciliation groups you have for this payment.
304
+ * The reconciliation groups you have for this payment.
303
305
  */
304
306
  reconciliation_groups?: unknown | null;
305
307
 
306
308
  /**
307
- * Body param: For `ach`, this field will be passed through on an addenda record.
308
- * For `wire` payments the field will be passed through as the "Originator to
309
- * Beneficiary Information", also known as OBI or Fedwire tag 6000.
309
+ * For `ach`, this field will be passed through on an addenda record. For `wire`
310
+ * payments the field will be passed through as the "Originator to Beneficiary
311
+ * Information", also known as OBI or Fedwire tag 6000.
310
312
  */
311
313
  remittance_information?: string | null;
312
314
 
313
315
  /**
314
- * Body param: The statement description you expect to see on the transaction. For
315
- * ACH payments, this will be the full line item passed from the bank. For wire
316
+ * The statement description you expect to see on the transaction. For ACH
317
+ * payments, this will be the full line item passed from the bank. For wire
316
318
  * payments, this will be the OBI field on the wire. For check payments, this will
317
319
  * be the memo field.
318
320
  */
319
321
  statement_descriptor?: string | null;
320
322
 
321
323
  /**
322
- * Body param: One of: ach, au_becs, bacs, book, check, eft, interac, provxchange,
323
- * rtp, sen, sepa, signet, wire.
324
+ * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen,
325
+ * sepa, signet, wire.
324
326
  */
325
327
  type?: ExpectedPaymentType | null;
326
-
327
- /**
328
- * Header param: This key should be something unique, preferably something like an
329
- * UUID.
330
- */
331
- 'Idempotency-Key'?: string;
332
328
  }
333
329
 
334
330
  export namespace ExpectedPaymentCreateParams {
@@ -1,13 +1,13 @@
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 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';
3
+ import * as Core from '../core.js';
4
+ import { APIResource } from '../resource.js';
5
+ import { isRequestOptions } from '../core.js';
6
+ import * as AccountDetails from './account-details.js';
7
+ import * as RoutingDetails from './routing-details.js';
8
+ import * as Shared from './shared.js';
9
+ import * as API from './index.js';
10
+ import { Page, PageParams } from '../pagination.js';
11
11
 
12
12
  export class ExternalAccounts extends APIResource {
13
13
  /**
@@ -17,11 +17,17 @@ export class ExternalAccounts extends APIResource {
17
17
  params: ExternalAccountCreateParams,
18
18
  options?: Core.RequestOptions,
19
19
  ): Core.APIPromise<ExternalAccount> {
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/external_accounts', {
22
28
  body,
23
29
  ...options,
24
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
30
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
25
31
  });
26
32
  }
27
33
 
@@ -97,11 +103,17 @@ export class ExternalAccounts extends APIResource {
97
103
  if (isRequestOptions(params)) {
98
104
  return this.completeVerification(id, {}, params);
99
105
  }
106
+ // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
100
107
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
108
+ if (idempotencyKey) {
109
+ console.warn(
110
+ "The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
111
+ );
112
+ }
101
113
  return this.post(`/api/external_accounts/${id}/complete_verification`, {
102
114
  body,
103
115
  ...options,
104
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
116
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
105
117
  });
106
118
  }
107
119
 
@@ -113,11 +125,17 @@ export class ExternalAccounts extends APIResource {
113
125
  params: ExternalAccountVerifyParams,
114
126
  options?: Core.RequestOptions,
115
127
  ): Core.APIPromise<ExternalAccount> {
128
+ // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
116
129
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
130
+ if (idempotencyKey) {
131
+ console.warn(
132
+ "The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
133
+ );
134
+ }
117
135
  return this.post(`/api/external_accounts/${id}/verify`, {
118
136
  body,
119
137
  ...options,
120
- headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
138
+ headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
121
139
  });
122
140
  }
123
141
  }
@@ -272,84 +290,62 @@ export type ExternalAccountType =
272
290
  | 'savings';
273
291
 
274
292
  export interface ExternalAccountCreateParams {
275
- /**
276
- * Body param:
277
- */
278
293
  counterparty_id: string | null;
279
294
 
280
- /**
281
- * Body param:
282
- */
283
295
  account_details?: Array<ExternalAccountCreateParams.AccountDetail>;
284
296
 
285
297
  /**
286
- * Body param: Can be `checking`, `savings` or `other`.
298
+ * Can be `checking`, `savings` or `other`.
287
299
  */
288
300
  account_type?: ExternalAccountType;
289
301
 
290
- /**
291
- * Body param:
292
- */
293
302
  contact_details?: Array<ExternalAccountCreateParams.ContactDetail>;
294
303
 
295
304
  /**
296
- * Body param: Specifies a ledger account object that will be created with the
297
- * external account. The resulting ledger account is linked to the external account
298
- * for auto-ledgering Payment objects. See
305
+ * Specifies a ledger account object that will be created with the external
306
+ * account. The resulting ledger account is linked to the external account for
307
+ * auto-ledgering Payment objects. See
299
308
  * https://docs.moderntreasury.com/docs/linking-to-other-modern-treasury-objects
300
309
  * for more details.
301
310
  */
302
311
  ledger_account?: ExternalAccountCreateParams.LedgerAccount;
303
312
 
304
313
  /**
305
- * Body param: Additional data represented as key-value pairs. Both the key and
306
- * value must be strings.
314
+ * Additional data represented as key-value pairs. Both the key and value must be
315
+ * strings.
307
316
  */
308
317
  metadata?: Record<string, string>;
309
318
 
310
319
  /**
311
- * Body param: A nickname for the external account. This is only for internal usage
312
- * and won't affect any payments
320
+ * A nickname for the external account. This is only for internal usage and won't
321
+ * affect any payments
313
322
  */
314
323
  name?: string | null;
315
324
 
316
325
  /**
317
- * Body param: Required if receiving wire payments.
326
+ * Required if receiving wire payments.
318
327
  */
319
328
  party_address?: ExternalAccountCreateParams.PartyAddress;
320
329
 
321
- /**
322
- * Body param:
323
- */
324
330
  party_identifier?: string;
325
331
 
326
332
  /**
327
- * Body param: If this value isn't provided, it will be inherited from the
328
- * counterparty's name.
333
+ * If this value isn't provided, it will be inherited from the counterparty's name.
329
334
  */
330
335
  party_name?: string;
331
336
 
332
337
  /**
333
- * Body param: Either `individual` or `business`.
338
+ * Either `individual` or `business`.
334
339
  */
335
340
  party_type?: 'business' | 'individual' | null;
336
341
 
337
342
  /**
338
- * Body param: If you've enabled the Modern Treasury + Plaid integration in your
339
- * Plaid account, you can pass the processor token in this field.
343
+ * If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
344
+ * you can pass the processor token in this field.
340
345
  */
341
346
  plaid_processor_token?: string;
342
347
 
343
- /**
344
- * Body param:
345
- */
346
348
  routing_details?: Array<ExternalAccountCreateParams.RoutingDetail>;
347
-
348
- /**
349
- * Header param: This key should be something unique, preferably something like an
350
- * UUID.
351
- */
352
- 'Idempotency-Key'?: string;
353
349
  }
354
350
 
355
351
  export namespace ExternalAccountCreateParams {
@@ -566,27 +562,18 @@ export interface ExternalAccountListParams extends PageParams {
566
562
  }
567
563
 
568
564
  export interface ExternalAccountCompleteVerificationParams {
569
- /**
570
- * Body param:
571
- */
572
565
  amounts?: Array<number>;
573
-
574
- /**
575
- * Header param: This key should be something unique, preferably something like an
576
- * UUID.
577
- */
578
- 'Idempotency-Key'?: string;
579
566
  }
580
567
 
581
568
  export interface ExternalAccountVerifyParams {
582
569
  /**
583
- * Body param: The ID of the internal account where the micro-deposits originate
584
- * from. Both credit and debit capabilities must be enabled.
570
+ * The ID of the internal account where the micro-deposits originate from. Both
571
+ * credit and debit capabilities must be enabled.
585
572
  */
586
573
  originating_account_id: string;
587
574
 
588
575
  /**
589
- * Body param: Both ach and eft are supported payment types.
576
+ * Both ach and eft are supported payment types.
590
577
  */
591
578
  payment_type:
592
579
  | 'ach'
@@ -608,15 +595,9 @@ export interface ExternalAccountVerifyParams {
608
595
  | 'wire';
609
596
 
610
597
  /**
611
- * Body param: Defaults to the currency of the originating account.
598
+ * Defaults to the currency of the originating account.
612
599
  */
613
600
  currency?: Shared.Currency | null;
614
-
615
- /**
616
- * Header param: This key should be something unique, preferably something like an
617
- * UUID.
618
- */
619
- 'Idempotency-Key'?: string;
620
601
  }
621
602
 
622
603
  export namespace ExternalAccounts {