modern-treasury 2.2.0 → 2.3.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 (210) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +41 -15
  3. package/_shims/ReadableStream.d.ts +38 -0
  4. package/_shims/ReadableStream.js +5 -0
  5. package/_shims/ReadableStream.mjs +7 -0
  6. package/_shims/ReadableStream.node.d.ts +6 -0
  7. package/_shims/ReadableStream.node.d.ts.map +1 -0
  8. package/_shims/ReadableStream.node.js +14 -0
  9. package/_shims/ReadableStream.node.js.map +1 -0
  10. package/_shims/ReadableStream.node.mjs +3 -0
  11. package/_shims/ReadableStream.node.mjs.map +1 -0
  12. package/_shims/fetch.d.ts +8 -1
  13. package/_shims/fetch.node.d.ts +11 -1
  14. package/core.d.ts +78 -29
  15. package/core.d.ts.map +1 -1
  16. package/core.js +185 -61
  17. package/core.js.map +1 -1
  18. package/core.mjs +179 -61
  19. package/core.mjs.map +1 -1
  20. package/index.d.mts +1 -2
  21. package/index.d.ts +1 -2
  22. package/index.d.ts.map +1 -1
  23. package/index.js +4 -4
  24. package/index.js.map +1 -1
  25. package/index.mjs +4 -4
  26. package/index.mjs.map +1 -1
  27. package/package.json +1 -1
  28. package/pagination.d.ts +2 -2
  29. package/pagination.d.ts.map +1 -1
  30. package/pagination.js +5 -5
  31. package/pagination.js.map +1 -1
  32. package/pagination.mjs +5 -5
  33. package/pagination.mjs.map +1 -1
  34. package/resources/account-collection-flows.d.ts +6 -6
  35. package/resources/account-collection-flows.d.ts.map +1 -1
  36. package/resources/account-details.d.ts +5 -5
  37. package/resources/account-details.d.ts.map +1 -1
  38. package/resources/connections.d.ts +5 -2
  39. package/resources/connections.d.ts.map +1 -1
  40. package/resources/connections.js.map +1 -1
  41. package/resources/connections.mjs.map +1 -1
  42. package/resources/counterparties.d.ts +11 -11
  43. package/resources/counterparties.d.ts.map +1 -1
  44. package/resources/counterparties.js.map +1 -1
  45. package/resources/counterparties.mjs.map +1 -1
  46. package/resources/documents.d.ts +4 -4
  47. package/resources/documents.d.ts.map +1 -1
  48. package/resources/documents.js +2 -2
  49. package/resources/documents.js.map +1 -1
  50. package/resources/documents.mjs +2 -2
  51. package/resources/documents.mjs.map +1 -1
  52. package/resources/events.d.ts +3 -3
  53. package/resources/events.d.ts.map +1 -1
  54. package/resources/expected-payments.d.ts +7 -7
  55. package/resources/expected-payments.d.ts.map +1 -1
  56. package/resources/external-accounts.d.ts +10 -10
  57. package/resources/external-accounts.d.ts.map +1 -1
  58. package/resources/incoming-payment-details.d.ts +11 -7
  59. package/resources/incoming-payment-details.d.ts.map +1 -1
  60. package/resources/incoming-payment-details.js.map +1 -1
  61. package/resources/incoming-payment-details.mjs.map +1 -1
  62. package/resources/index.d.ts +0 -1
  63. package/resources/index.d.ts.map +1 -1
  64. package/resources/index.js.map +1 -1
  65. package/resources/index.mjs.map +1 -1
  66. package/resources/internal-accounts/balance-reports.d.ts +6 -3
  67. package/resources/internal-accounts/balance-reports.d.ts.map +1 -1
  68. package/resources/internal-accounts/balance-reports.js.map +1 -1
  69. package/resources/internal-accounts/balance-reports.mjs.map +1 -1
  70. package/resources/internal-accounts/internal-accounts.d.ts +6 -6
  71. package/resources/internal-accounts/internal-accounts.d.ts.map +1 -1
  72. package/resources/invoices/invoices.d.ts +46 -13
  73. package/resources/invoices/invoices.d.ts.map +1 -1
  74. package/resources/invoices/invoices.js.map +1 -1
  75. package/resources/invoices/invoices.mjs.map +1 -1
  76. package/resources/invoices/line-items.d.ts +23 -171
  77. package/resources/invoices/line-items.d.ts.map +1 -1
  78. package/resources/invoices/line-items.js.map +1 -1
  79. package/resources/invoices/line-items.mjs.map +1 -1
  80. package/resources/ledger-account-categories.d.ts +39 -74
  81. package/resources/ledger-account-categories.d.ts.map +1 -1
  82. package/resources/ledger-account-categories.js +11 -13
  83. package/resources/ledger-account-categories.js.map +1 -1
  84. package/resources/ledger-account-categories.mjs +11 -13
  85. package/resources/ledger-account-categories.mjs.map +1 -1
  86. package/resources/ledger-account-payouts.d.ts +22 -6
  87. package/resources/ledger-account-payouts.d.ts.map +1 -1
  88. package/resources/ledger-account-payouts.js.map +1 -1
  89. package/resources/ledger-account-payouts.mjs.map +1 -1
  90. package/resources/ledger-account-statements.d.ts +2 -2
  91. package/resources/ledger-account-statements.d.ts.map +1 -1
  92. package/resources/ledger-accounts.d.ts +17 -12
  93. package/resources/ledger-accounts.d.ts.map +1 -1
  94. package/resources/ledger-accounts.js.map +1 -1
  95. package/resources/ledger-accounts.mjs.map +1 -1
  96. package/resources/ledger-entries.d.ts +20 -6
  97. package/resources/ledger-entries.d.ts.map +1 -1
  98. package/resources/ledger-entries.js.map +1 -1
  99. package/resources/ledger-entries.mjs.map +1 -1
  100. package/resources/ledger-event-handlers.d.ts +7 -8
  101. package/resources/ledger-event-handlers.d.ts.map +1 -1
  102. package/resources/ledger-event-handlers.js.map +1 -1
  103. package/resources/ledger-event-handlers.mjs.map +1 -1
  104. package/resources/ledger-transactions/ledger-transactions.d.ts +35 -18
  105. package/resources/ledger-transactions/ledger-transactions.d.ts.map +1 -1
  106. package/resources/ledger-transactions/ledger-transactions.js +3 -3
  107. package/resources/ledger-transactions/ledger-transactions.js.map +1 -1
  108. package/resources/ledger-transactions/ledger-transactions.mjs +3 -3
  109. package/resources/ledger-transactions/ledger-transactions.mjs.map +1 -1
  110. package/resources/ledger-transactions/versions.d.ts +4 -2
  111. package/resources/ledger-transactions/versions.d.ts.map +1 -1
  112. package/resources/ledger-transactions/versions.js.map +1 -1
  113. package/resources/ledger-transactions/versions.mjs.map +1 -1
  114. package/resources/ledgerable-events.d.ts +2 -2
  115. package/resources/ledgerable-events.d.ts.map +1 -1
  116. package/resources/ledgers.d.ts +12 -11
  117. package/resources/ledgers.d.ts.map +1 -1
  118. package/resources/ledgers.js.map +1 -1
  119. package/resources/ledgers.mjs.map +1 -1
  120. package/resources/line-items.d.ts +5 -5
  121. package/resources/line-items.d.ts.map +1 -1
  122. package/resources/paper-items.d.ts +6 -3
  123. package/resources/paper-items.d.ts.map +1 -1
  124. package/resources/paper-items.js.map +1 -1
  125. package/resources/paper-items.mjs.map +1 -1
  126. package/resources/payment-flows.d.ts +9 -9
  127. package/resources/payment-flows.d.ts.map +1 -1
  128. package/resources/payment-flows.js.map +1 -1
  129. package/resources/payment-flows.mjs.map +1 -1
  130. package/resources/payment-orders/payment-orders.d.ts +30 -24
  131. package/resources/payment-orders/payment-orders.d.ts.map +1 -1
  132. package/resources/payment-orders/payment-orders.js +3 -5
  133. package/resources/payment-orders/payment-orders.js.map +1 -1
  134. package/resources/payment-orders/payment-orders.mjs +3 -5
  135. package/resources/payment-orders/payment-orders.mjs.map +1 -1
  136. package/resources/payment-orders/reversals.d.ts +14 -9
  137. package/resources/payment-orders/reversals.d.ts.map +1 -1
  138. package/resources/payment-orders/reversals.js.map +1 -1
  139. package/resources/payment-orders/reversals.mjs.map +1 -1
  140. package/resources/payment-references.d.ts +3 -3
  141. package/resources/payment-references.d.ts.map +1 -1
  142. package/resources/returns.d.ts +7 -4
  143. package/resources/returns.d.ts.map +1 -1
  144. package/resources/returns.js.map +1 -1
  145. package/resources/returns.mjs.map +1 -1
  146. package/resources/routing-details.d.ts +5 -5
  147. package/resources/routing-details.d.ts.map +1 -1
  148. package/resources/transactions/line-items.d.ts +5 -2
  149. package/resources/transactions/line-items.d.ts.map +1 -1
  150. package/resources/transactions/line-items.js.map +1 -1
  151. package/resources/transactions/line-items.mjs.map +1 -1
  152. package/resources/transactions/transactions.d.ts +8 -5
  153. package/resources/transactions/transactions.d.ts.map +1 -1
  154. package/resources/transactions/transactions.js.map +1 -1
  155. package/resources/transactions/transactions.mjs.map +1 -1
  156. package/resources/validations.d.ts +1 -1
  157. package/resources/validations.d.ts.map +1 -1
  158. package/resources/virtual-accounts.d.ts +7 -10
  159. package/resources/virtual-accounts.d.ts.map +1 -1
  160. package/resources/virtual-accounts.js.map +1 -1
  161. package/resources/virtual-accounts.mjs.map +1 -1
  162. package/src/_shims/ReadableStream.d.ts +38 -0
  163. package/src/_shims/ReadableStream.js +5 -0
  164. package/src/_shims/ReadableStream.mjs +7 -0
  165. package/src/_shims/ReadableStream.node.ts +6 -0
  166. package/src/_shims/fetch.d.ts +8 -1
  167. package/src/_shims/fetch.node.d.ts +11 -1
  168. package/src/core.ts +244 -79
  169. package/src/index.ts +4 -5
  170. package/src/pagination.ts +6 -6
  171. package/src/resources/account-collection-flows.ts +8 -8
  172. package/src/resources/account-details.ts +6 -6
  173. package/src/resources/connections.ts +6 -3
  174. package/src/resources/counterparties.ts +13 -13
  175. package/src/resources/documents.ts +6 -9
  176. package/src/resources/events.ts +4 -4
  177. package/src/resources/expected-payments.ts +9 -9
  178. package/src/resources/external-accounts.ts +13 -13
  179. package/src/resources/incoming-payment-details.ts +15 -10
  180. package/src/resources/index.ts +0 -1
  181. package/src/resources/internal-accounts/balance-reports.ts +7 -4
  182. package/src/resources/internal-accounts/internal-accounts.ts +8 -8
  183. package/src/resources/invoices/invoices.ts +55 -15
  184. package/src/resources/invoices/line-items.ts +25 -207
  185. package/src/resources/ledger-account-categories.ts +47 -91
  186. package/src/resources/ledger-account-payouts.ts +27 -8
  187. package/src/resources/ledger-account-statements.ts +2 -2
  188. package/src/resources/ledger-accounts.ts +21 -15
  189. package/src/resources/ledger-entries.ts +24 -8
  190. package/src/resources/ledger-event-handlers.ts +8 -12
  191. package/src/resources/ledger-transactions/ledger-transactions.ts +46 -25
  192. package/src/resources/ledger-transactions/versions.ts +5 -3
  193. package/src/resources/ledgerable-events.ts +2 -2
  194. package/src/resources/ledgers.ts +15 -13
  195. package/src/resources/line-items.ts +7 -7
  196. package/src/resources/paper-items.ts +7 -4
  197. package/src/resources/payment-flows.ts +11 -11
  198. package/src/resources/payment-orders/payment-orders.ts +39 -36
  199. package/src/resources/payment-orders/reversals.ts +17 -11
  200. package/src/resources/payment-references.ts +4 -4
  201. package/src/resources/returns.ts +8 -5
  202. package/src/resources/routing-details.ts +6 -6
  203. package/src/resources/transactions/line-items.ts +6 -3
  204. package/src/resources/transactions/transactions.ts +10 -7
  205. package/src/resources/validations.ts +1 -1
  206. package/src/resources/virtual-accounts.ts +9 -12
  207. package/src/version.ts +1 -1
  208. package/version.d.ts +1 -1
  209. package/version.js +1 -1
  210. package/version.mjs +1 -1
@@ -17,7 +17,7 @@ export class LedgerTransactions extends APIResource {
17
17
  create(
18
18
  params: LedgerTransactionCreateParams,
19
19
  options?: Core.RequestOptions,
20
- ): Promise<Core.APIResponse<LedgerTransaction>> {
20
+ ): Core.APIPromise<LedgerTransaction> {
21
21
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
22
22
  return this.post('/api/ledger_transactions', {
23
23
  body,
@@ -29,7 +29,7 @@ export class LedgerTransactions extends APIResource {
29
29
  /**
30
30
  * Get details on a single ledger transaction.
31
31
  */
32
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerTransaction>> {
32
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerTransaction> {
33
33
  return this.get(`/api/ledger_transactions/${id}`, options);
34
34
  }
35
35
 
@@ -40,13 +40,13 @@ export class LedgerTransactions extends APIResource {
40
40
  id: string,
41
41
  body?: LedgerTransactionUpdateParams,
42
42
  options?: Core.RequestOptions,
43
- ): Promise<Core.APIResponse<LedgerTransaction>>;
44
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerTransaction>>;
43
+ ): Core.APIPromise<LedgerTransaction>;
44
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerTransaction>;
45
45
  update(
46
46
  id: string,
47
47
  body: LedgerTransactionUpdateParams | Core.RequestOptions = {},
48
48
  options?: Core.RequestOptions,
49
- ): Promise<Core.APIResponse<LedgerTransaction>> {
49
+ ): Core.APIPromise<LedgerTransaction> {
50
50
  if (isRequestOptions(body)) {
51
51
  return this.update(id, {}, body);
52
52
  }
@@ -59,12 +59,12 @@ export class LedgerTransactions extends APIResource {
59
59
  list(
60
60
  query?: LedgerTransactionListParams,
61
61
  options?: Core.RequestOptions,
62
- ): Core.PagePromise<LedgerTransactionsPage>;
63
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerTransactionsPage>;
62
+ ): Core.PagePromise<LedgerTransactionsPage, LedgerTransaction>;
63
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgerTransactionsPage, LedgerTransaction>;
64
64
  list(
65
65
  query: LedgerTransactionListParams | Core.RequestOptions = {},
66
66
  options?: Core.RequestOptions,
67
- ): Core.PagePromise<LedgerTransactionsPage> {
67
+ ): Core.PagePromise<LedgerTransactionsPage, LedgerTransaction> {
68
68
  if (isRequestOptions(query)) {
69
69
  return this.list({}, query);
70
70
  }
@@ -75,23 +75,20 @@ export class LedgerTransactions extends APIResource {
75
75
  * Create a ledger transaction reversal.
76
76
  */
77
77
  createReversal(
78
- ledgerTransactionId: string,
78
+ id: string,
79
79
  body?: LedgerTransactionCreateReversalParams,
80
80
  options?: Core.RequestOptions,
81
- ): Promise<Core.APIResponse<LedgerTransaction>>;
82
- createReversal(
83
- ledgerTransactionId: string,
84
- options?: Core.RequestOptions,
85
- ): Promise<Core.APIResponse<LedgerTransaction>>;
81
+ ): Core.APIPromise<LedgerTransaction>;
82
+ createReversal(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerTransaction>;
86
83
  createReversal(
87
- ledgerTransactionId: string,
84
+ id: string,
88
85
  body: LedgerTransactionCreateReversalParams | Core.RequestOptions = {},
89
86
  options?: Core.RequestOptions,
90
- ): Promise<Core.APIResponse<LedgerTransaction>> {
87
+ ): Core.APIPromise<LedgerTransaction> {
91
88
  if (isRequestOptions(body)) {
92
- return this.createReversal(ledgerTransactionId, {}, body);
89
+ return this.createReversal(id, {}, body);
93
90
  }
94
- return this.post(`/api/ledger_transactions/${ledgerTransactionId}/reversal`, { body, ...options });
91
+ return this.post(`/api/ledger_transactions/${id}/reversal`, { body, ...options });
95
92
  }
96
93
  }
97
94
 
@@ -195,12 +192,6 @@ export interface LedgerTransaction {
195
192
  }
196
193
 
197
194
  export interface LedgerTransactionCreateParams {
198
- /**
199
- * Body param: The timestamp (ISO8601 format) at which the ledger transaction
200
- * happened for reporting purposes.
201
- */
202
- effective_at: string;
203
-
204
195
  /**
205
196
  * Body param: An array of ledger entry objects.
206
197
  */
@@ -211,6 +202,12 @@ export interface LedgerTransactionCreateParams {
211
202
  */
212
203
  description?: string | null;
213
204
 
205
+ /**
206
+ * Body param: The timestamp (ISO8601 format) at which the ledger transaction
207
+ * happened for reporting purposes.
208
+ */
209
+ effective_at?: string;
210
+
214
211
  /**
215
212
  * Body param: The date (YYYY-MM-DD) on which the ledger transaction happened for
216
213
  * reporting purposes.
@@ -301,6 +298,12 @@ export namespace LedgerTransactionCreateParams {
301
298
  */
302
299
  lock_version?: number | null;
303
300
 
301
+ /**
302
+ * Additional data represented as key-value pairs. Both the key and value must be
303
+ * strings.
304
+ */
305
+ metadata?: Record<string, string>;
306
+
304
307
  /**
305
308
  * Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
306
309
  * account’s pending balance. If any of these conditions would be false after the
@@ -329,6 +332,12 @@ export interface LedgerTransactionUpdateParams {
329
332
  */
330
333
  description?: string | null;
331
334
 
335
+ /**
336
+ * The timestamp (ISO8601 format) at which the ledger transaction happened for
337
+ * reporting purposes.
338
+ */
339
+ effective_at?: string;
340
+
332
341
  /**
333
342
  * An array of ledger entry objects.
334
343
  */
@@ -382,6 +391,12 @@ export namespace LedgerTransactionUpdateParams {
382
391
  */
383
392
  lock_version?: number | null;
384
393
 
394
+ /**
395
+ * Additional data represented as key-value pairs. Both the key and value must be
396
+ * strings.
397
+ */
398
+ metadata?: Record<string, string>;
399
+
385
400
  /**
386
401
  * Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
387
402
  * account’s pending balance. If any of these conditions would be false after the
@@ -405,7 +420,11 @@ export namespace LedgerTransactionUpdateParams {
405
420
  }
406
421
 
407
422
  export interface LedgerTransactionListParams extends PageParams {
408
- id?: Record<string, string>;
423
+ /**
424
+ * If you have specific IDs to retrieve in bulk, you can pass them as query
425
+ * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
426
+ */
427
+ id?: Array<string>;
409
428
 
410
429
  /**
411
430
  * Use "gt" (>), "gte" (>=), "lt" (<), "lte" (<=), or "eq" (=) to filter by
@@ -427,6 +446,8 @@ export interface LedgerTransactionListParams extends PageParams {
427
446
 
428
447
  ledger_account_id?: string;
429
448
 
449
+ ledger_account_payout_id?: string;
450
+
430
451
  ledger_id?: string;
431
452
 
432
453
  ledgerable_id?: string;
@@ -13,12 +13,14 @@ export class Versions extends APIResource {
13
13
  list(
14
14
  query?: VersionListParams,
15
15
  options?: Core.RequestOptions,
16
- ): Core.PagePromise<LedgerTransactionVersionsPage>;
17
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerTransactionVersionsPage>;
16
+ ): Core.PagePromise<LedgerTransactionVersionsPage, LedgerTransactionVersion>;
17
+ list(
18
+ options?: Core.RequestOptions,
19
+ ): Core.PagePromise<LedgerTransactionVersionsPage, LedgerTransactionVersion>;
18
20
  list(
19
21
  query: VersionListParams | Core.RequestOptions = {},
20
22
  options?: Core.RequestOptions,
21
- ): Core.PagePromise<LedgerTransactionVersionsPage> {
23
+ ): Core.PagePromise<LedgerTransactionVersionsPage, LedgerTransactionVersion> {
22
24
  if (isRequestOptions(query)) {
23
25
  return this.list({}, query);
24
26
  }
@@ -12,7 +12,7 @@ export class LedgerableEvents extends APIResource {
12
12
  create(
13
13
  params: LedgerableEventCreateParams,
14
14
  options?: Core.RequestOptions,
15
- ): Promise<Core.APIResponse<LedgerableEvent>> {
15
+ ): Core.APIPromise<LedgerableEvent> {
16
16
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
17
17
  return this.post('/api/ledgerable_events', {
18
18
  body,
@@ -24,7 +24,7 @@ export class LedgerableEvents extends APIResource {
24
24
  /**
25
25
  * Get details on a single ledgerable event.
26
26
  */
27
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerableEvent>> {
27
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerableEvent> {
28
28
  return this.get(`/api/ledgerable_events/${id}`, options);
29
29
  }
30
30
  }
@@ -10,7 +10,7 @@ export class Ledgers extends APIResource {
10
10
  /**
11
11
  * Create a ledger.
12
12
  */
13
- create(params: LedgerCreateParams, options?: Core.RequestOptions): Promise<Core.APIResponse<Ledger>> {
13
+ create(params: LedgerCreateParams, options?: Core.RequestOptions): Core.APIPromise<Ledger> {
14
14
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
15
15
  return this.post('/api/ledgers', {
16
16
  body,
@@ -22,24 +22,20 @@ export class Ledgers extends APIResource {
22
22
  /**
23
23
  * Get details on a single ledger.
24
24
  */
25
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Ledger>> {
25
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Ledger> {
26
26
  return this.get(`/api/ledgers/${id}`, options);
27
27
  }
28
28
 
29
29
  /**
30
30
  * Update the details of a ledger.
31
31
  */
32
- update(
33
- id: string,
34
- body?: LedgerUpdateParams,
35
- options?: Core.RequestOptions,
36
- ): Promise<Core.APIResponse<Ledger>>;
37
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Ledger>>;
32
+ update(id: string, body?: LedgerUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Ledger>;
33
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<Ledger>;
38
34
  update(
39
35
  id: string,
40
36
  body: LedgerUpdateParams | Core.RequestOptions = {},
41
37
  options?: Core.RequestOptions,
42
- ): Promise<Core.APIResponse<Ledger>> {
38
+ ): Core.APIPromise<Ledger> {
43
39
  if (isRequestOptions(body)) {
44
40
  return this.update(id, {}, body);
45
41
  }
@@ -49,12 +45,12 @@ export class Ledgers extends APIResource {
49
45
  /**
50
46
  * Get a list of ledgers.
51
47
  */
52
- list(query?: LedgerListParams, options?: Core.RequestOptions): Core.PagePromise<LedgersPage>;
53
- list(options?: Core.RequestOptions): Core.PagePromise<LedgersPage>;
48
+ list(query?: LedgerListParams, options?: Core.RequestOptions): Core.PagePromise<LedgersPage, Ledger>;
49
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgersPage, Ledger>;
54
50
  list(
55
51
  query: LedgerListParams | Core.RequestOptions = {},
56
52
  options?: Core.RequestOptions,
57
- ): Core.PagePromise<LedgersPage> {
53
+ ): Core.PagePromise<LedgersPage, Ledger> {
58
54
  if (isRequestOptions(query)) {
59
55
  return this.list({}, query);
60
56
  }
@@ -64,7 +60,7 @@ export class Ledgers extends APIResource {
64
60
  /**
65
61
  * Delete a ledger.
66
62
  */
67
- del(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Ledger>> {
63
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<Ledger> {
68
64
  return this.delete(`/api/ledgers/${id}`, options);
69
65
  }
70
66
  }
@@ -151,6 +147,12 @@ export interface LedgerUpdateParams {
151
147
  }
152
148
 
153
149
  export interface LedgerListParams extends PageParams {
150
+ /**
151
+ * If you have specific IDs to retrieve in bulk, you can pass them as query
152
+ * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
153
+ */
154
+ id?: Array<string>;
155
+
154
156
  /**
155
157
  * For example, if you want to query for records with metadata key `Type` and value
156
158
  * `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
@@ -15,7 +15,7 @@ export class LineItems extends APIResource {
15
15
  itemizableId: string,
16
16
  id: string,
17
17
  options?: Core.RequestOptions,
18
- ): Promise<Core.APIResponse<LineItem>> {
18
+ ): Core.APIPromise<LineItem> {
19
19
  return this.get(`/api/${itemizableType}/${itemizableId}/line_items/${id}`, options);
20
20
  }
21
21
 
@@ -28,20 +28,20 @@ export class LineItems extends APIResource {
28
28
  id: string,
29
29
  body?: LineItemUpdateParams,
30
30
  options?: Core.RequestOptions,
31
- ): Promise<Core.APIResponse<LineItem>>;
31
+ ): Core.APIPromise<LineItem>;
32
32
  update(
33
33
  itemizableType: 'expected_payments' | 'payment_orders',
34
34
  itemizableId: string,
35
35
  id: string,
36
36
  options?: Core.RequestOptions,
37
- ): Promise<Core.APIResponse<LineItem>>;
37
+ ): Core.APIPromise<LineItem>;
38
38
  update(
39
39
  itemizableType: 'expected_payments' | 'payment_orders',
40
40
  itemizableId: string,
41
41
  id: string,
42
42
  body: LineItemUpdateParams | Core.RequestOptions = {},
43
43
  options?: Core.RequestOptions,
44
- ): Promise<Core.APIResponse<LineItem>> {
44
+ ): Core.APIPromise<LineItem> {
45
45
  if (isRequestOptions(body)) {
46
46
  return this.update(itemizableType, itemizableId, id, {}, body);
47
47
  }
@@ -56,18 +56,18 @@ export class LineItems extends APIResource {
56
56
  itemizableId: string,
57
57
  query?: LineItemListParams,
58
58
  options?: Core.RequestOptions,
59
- ): Core.PagePromise<LineItemsPage>;
59
+ ): Core.PagePromise<LineItemsPage, LineItem>;
60
60
  list(
61
61
  itemizableType: 'expected_payments' | 'payment_orders',
62
62
  itemizableId: string,
63
63
  options?: Core.RequestOptions,
64
- ): Core.PagePromise<LineItemsPage>;
64
+ ): Core.PagePromise<LineItemsPage, LineItem>;
65
65
  list(
66
66
  itemizableType: 'expected_payments' | 'payment_orders',
67
67
  itemizableId: string,
68
68
  query: LineItemListParams | Core.RequestOptions = {},
69
69
  options?: Core.RequestOptions,
70
- ): Core.PagePromise<LineItemsPage> {
70
+ ): Core.PagePromise<LineItemsPage, LineItem> {
71
71
  if (isRequestOptions(query)) {
72
72
  return this.list(itemizableType, itemizableId, {}, query);
73
73
  }
@@ -11,19 +11,22 @@ export class PaperItems extends APIResource {
11
11
  /**
12
12
  * Get details on a single paper item.
13
13
  */
14
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<PaperItem>> {
14
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<PaperItem> {
15
15
  return this.get(`/api/paper_items/${id}`, options);
16
16
  }
17
17
 
18
18
  /**
19
19
  * Get a list of all paper items.
20
20
  */
21
- list(query?: PaperItemListParams, options?: Core.RequestOptions): Core.PagePromise<PaperItemsPage>;
22
- list(options?: Core.RequestOptions): Core.PagePromise<PaperItemsPage>;
21
+ list(
22
+ query?: PaperItemListParams,
23
+ options?: Core.RequestOptions,
24
+ ): Core.PagePromise<PaperItemsPage, PaperItem>;
25
+ list(options?: Core.RequestOptions): Core.PagePromise<PaperItemsPage, PaperItem>;
23
26
  list(
24
27
  query: PaperItemListParams | Core.RequestOptions = {},
25
28
  options?: Core.RequestOptions,
26
- ): Core.PagePromise<PaperItemsPage> {
29
+ ): Core.PagePromise<PaperItemsPage, PaperItem> {
27
30
  if (isRequestOptions(query)) {
28
31
  return this.list({}, query);
29
32
  }
@@ -10,10 +10,7 @@ export class PaymentFlows extends APIResource {
10
10
  /**
11
11
  * create payment_flow
12
12
  */
13
- create(
14
- params: PaymentFlowCreateParams,
15
- options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<PaymentFlow>> {
13
+ create(params: PaymentFlowCreateParams, options?: Core.RequestOptions): Core.APIPromise<PaymentFlow> {
17
14
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
15
  return this.post('/api/payment_flows', {
19
16
  body,
@@ -29,13 +26,13 @@ export class PaymentFlows extends APIResource {
29
26
  id: string,
30
27
  query?: PaymentFlowRetrieveParams,
31
28
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<PaymentFlow>>;
33
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<PaymentFlow>>;
29
+ ): Core.APIPromise<PaymentFlow>;
30
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<PaymentFlow>;
34
31
  retrieve(
35
32
  id: string,
36
33
  query: PaymentFlowRetrieveParams | Core.RequestOptions = {},
37
34
  options?: Core.RequestOptions,
38
- ): Promise<Core.APIResponse<PaymentFlow>> {
35
+ ): Core.APIPromise<PaymentFlow> {
39
36
  if (isRequestOptions(query)) {
40
37
  return this.retrieve(id, {}, query);
41
38
  }
@@ -53,7 +50,7 @@ export class PaymentFlows extends APIResource {
53
50
  id: string,
54
51
  params: PaymentFlowUpdateParams,
55
52
  options?: Core.RequestOptions,
56
- ): Promise<Core.APIResponse<PaymentFlow>> {
53
+ ): Core.APIPromise<PaymentFlow> {
57
54
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
58
55
  return this.patch(`/api/payment_flows/${id}`, {
59
56
  body,
@@ -65,12 +62,15 @@ export class PaymentFlows extends APIResource {
65
62
  /**
66
63
  * list payment_flows
67
64
  */
68
- list(query?: PaymentFlowListParams, options?: Core.RequestOptions): Core.PagePromise<PaymentFlowsPage>;
69
- list(options?: Core.RequestOptions): Core.PagePromise<PaymentFlowsPage>;
65
+ list(
66
+ query?: PaymentFlowListParams,
67
+ options?: Core.RequestOptions,
68
+ ): Core.PagePromise<PaymentFlowsPage, PaymentFlow>;
69
+ list(options?: Core.RequestOptions): Core.PagePromise<PaymentFlowsPage, PaymentFlow>;
70
70
  list(
71
71
  query: PaymentFlowListParams | Core.RequestOptions = {},
72
72
  options?: Core.RequestOptions,
73
- ): Core.PagePromise<PaymentFlowsPage> {
73
+ ): Core.PagePromise<PaymentFlowsPage, PaymentFlow> {
74
74
  if (isRequestOptions(query)) {
75
75
  return this.list({}, query);
76
76
  }
@@ -17,21 +17,14 @@ export class PaymentOrders extends APIResource {
17
17
  /**
18
18
  * Create a new Payment Order
19
19
  */
20
- async create(
21
- params: PaymentOrderCreateParams,
22
- options?: Core.RequestOptions,
23
- ): Promise<Core.APIResponse<PaymentOrder>> {
24
- const { 'Content-Type': contentType, 'Idempotency-Key': idempotencyKey, ...body } = params;
20
+ create(params: PaymentOrderCreateParams, options?: Core.RequestOptions): Core.APIPromise<PaymentOrder> {
21
+ const { 'Idempotency-Key': idempotencyKey, ...body } = params;
25
22
  return this.post(
26
23
  '/api/payment_orders',
27
- await maybeMultipartFormRequestOptions({
24
+ maybeMultipartFormRequestOptions({
28
25
  body,
29
26
  ...options,
30
- headers: {
31
- 'Content-Type': contentType?.toString() || '',
32
- 'Idempotency-Key': idempotencyKey || '',
33
- ...options?.headers,
34
- },
27
+ headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
35
28
  }),
36
29
  );
37
30
  }
@@ -39,7 +32,7 @@ export class PaymentOrders extends APIResource {
39
32
  /**
40
33
  * Get details on a single payment order
41
34
  */
42
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<PaymentOrder>> {
35
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<PaymentOrder> {
43
36
  return this.get(`/api/payment_orders/${id}`, options);
44
37
  }
45
38
 
@@ -50,13 +43,13 @@ export class PaymentOrders extends APIResource {
50
43
  id: string,
51
44
  body?: PaymentOrderUpdateParams,
52
45
  options?: Core.RequestOptions,
53
- ): Promise<Core.APIResponse<PaymentOrder>>;
54
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<PaymentOrder>>;
46
+ ): Core.APIPromise<PaymentOrder>;
47
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<PaymentOrder>;
55
48
  update(
56
49
  id: string,
57
50
  body: PaymentOrderUpdateParams | Core.RequestOptions = {},
58
51
  options?: Core.RequestOptions,
59
- ): Promise<Core.APIResponse<PaymentOrder>> {
52
+ ): Core.APIPromise<PaymentOrder> {
60
53
  if (isRequestOptions(body)) {
61
54
  return this.update(id, {}, body);
62
55
  }
@@ -66,12 +59,15 @@ export class PaymentOrders extends APIResource {
66
59
  /**
67
60
  * Get a list of all payment orders
68
61
  */
69
- list(query?: PaymentOrderListParams, options?: Core.RequestOptions): Core.PagePromise<PaymentOrdersPage>;
70
- list(options?: Core.RequestOptions): Core.PagePromise<PaymentOrdersPage>;
62
+ list(
63
+ query?: PaymentOrderListParams,
64
+ options?: Core.RequestOptions,
65
+ ): Core.PagePromise<PaymentOrdersPage, PaymentOrder>;
66
+ list(options?: Core.RequestOptions): Core.PagePromise<PaymentOrdersPage, PaymentOrder>;
71
67
  list(
72
68
  query: PaymentOrderListParams | Core.RequestOptions = {},
73
69
  options?: Core.RequestOptions,
74
- ): Core.PagePromise<PaymentOrdersPage> {
70
+ ): Core.PagePromise<PaymentOrdersPage, PaymentOrder> {
75
71
  if (isRequestOptions(query)) {
76
72
  return this.list({}, query);
77
73
  }
@@ -84,7 +80,7 @@ export class PaymentOrders extends APIResource {
84
80
  createAsync(
85
81
  params: PaymentOrderCreateAsyncParams,
86
82
  options?: Core.RequestOptions,
87
- ): Promise<Core.APIResponse<Shared.AsyncResponse>> {
83
+ ): Core.APIPromise<Shared.AsyncResponse> {
88
84
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
89
85
  return this.post('/api/payment_orders/create_async', {
90
86
  body,
@@ -711,11 +707,6 @@ export interface PaymentOrderCreateParams {
711
707
  */
712
708
  ultimate_receiving_party_name?: string | null;
713
709
 
714
- /**
715
- * Header param:
716
- */
717
- 'Content-Type'?: 'application/json' | 'multipart/form-data';
718
-
719
710
  /**
720
711
  * Header param: This key should be something unique, preferably something like an
721
712
  * UUID.
@@ -773,12 +764,6 @@ export namespace PaymentOrderCreateParams {
773
764
  * the payment order.
774
765
  */
775
766
  export interface LedgerTransaction {
776
- /**
777
- * The timestamp (ISO8601 format) at which the ledger transaction happened for
778
- * reporting purposes.
779
- */
780
- effective_at: string;
781
-
782
767
  /**
783
768
  * An array of ledger entry objects.
784
769
  */
@@ -789,6 +774,12 @@ export namespace PaymentOrderCreateParams {
789
774
  */
790
775
  description?: string | null;
791
776
 
777
+ /**
778
+ * The timestamp (ISO8601 format) at which the ledger transaction happened for
779
+ * reporting purposes.
780
+ */
781
+ effective_at?: string;
782
+
792
783
  /**
793
784
  * The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
794
785
  * purposes.
@@ -872,6 +863,12 @@ export namespace PaymentOrderCreateParams {
872
863
  */
873
864
  lock_version?: number | null;
874
865
 
866
+ /**
867
+ * Additional data represented as key-value pairs. Both the key and value must be
868
+ * strings.
869
+ */
870
+ metadata?: Record<string, string>;
871
+
875
872
  /**
876
873
  * Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
877
874
  * account’s pending balance. If any of these conditions would be false after the
@@ -1903,12 +1900,6 @@ export namespace PaymentOrderCreateAsyncParams {
1903
1900
  * the payment order.
1904
1901
  */
1905
1902
  export interface LedgerTransaction {
1906
- /**
1907
- * The timestamp (ISO8601 format) at which the ledger transaction happened for
1908
- * reporting purposes.
1909
- */
1910
- effective_at: string;
1911
-
1912
1903
  /**
1913
1904
  * An array of ledger entry objects.
1914
1905
  */
@@ -1919,6 +1910,12 @@ export namespace PaymentOrderCreateAsyncParams {
1919
1910
  */
1920
1911
  description?: string | null;
1921
1912
 
1913
+ /**
1914
+ * The timestamp (ISO8601 format) at which the ledger transaction happened for
1915
+ * reporting purposes.
1916
+ */
1917
+ effective_at?: string;
1918
+
1922
1919
  /**
1923
1920
  * The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
1924
1921
  * purposes.
@@ -2002,6 +1999,12 @@ export namespace PaymentOrderCreateAsyncParams {
2002
1999
  */
2003
2000
  lock_version?: number | null;
2004
2001
 
2002
+ /**
2003
+ * Additional data represented as key-value pairs. Both the key and value must be
2004
+ * strings.
2005
+ */
2006
+ metadata?: Record<string, string>;
2007
+
2005
2008
  /**
2006
2009
  * Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
2007
2010
  * account’s pending balance. If any of these conditions would be false after the
@@ -14,7 +14,7 @@ export class Reversals extends APIResource {
14
14
  paymentOrderId: string,
15
15
  params: ReversalCreateParams,
16
16
  options?: Core.RequestOptions,
17
- ): Promise<Core.APIResponse<Reversal>> {
17
+ ): Core.APIPromise<Reversal> {
18
18
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
19
19
  return this.post(`/api/payment_orders/${paymentOrderId}/reversals`, {
20
20
  body,
@@ -30,7 +30,7 @@ export class Reversals extends APIResource {
30
30
  paymentOrderId: string,
31
31
  reversalId: string,
32
32
  options?: Core.RequestOptions,
33
- ): Promise<Core.APIResponse<Reversal>> {
33
+ ): Core.APIPromise<Reversal> {
34
34
  return this.get(`/api/payment_orders/${paymentOrderId}/reversals/${reversalId}`, options);
35
35
  }
36
36
 
@@ -41,13 +41,13 @@ export class Reversals extends APIResource {
41
41
  paymentOrderId: string,
42
42
  query?: ReversalListParams,
43
43
  options?: Core.RequestOptions,
44
- ): Core.PagePromise<ReversalsPage>;
45
- list(paymentOrderId: string, options?: Core.RequestOptions): Core.PagePromise<ReversalsPage>;
44
+ ): Core.PagePromise<ReversalsPage, Reversal>;
45
+ list(paymentOrderId: string, options?: Core.RequestOptions): Core.PagePromise<ReversalsPage, Reversal>;
46
46
  list(
47
47
  paymentOrderId: string,
48
48
  query: ReversalListParams | Core.RequestOptions = {},
49
49
  options?: Core.RequestOptions,
50
- ): Core.PagePromise<ReversalsPage> {
50
+ ): Core.PagePromise<ReversalsPage, Reversal> {
51
51
  if (isRequestOptions(query)) {
52
52
  return this.list(paymentOrderId, {}, query);
53
53
  }
@@ -145,12 +145,6 @@ export namespace ReversalCreateParams {
145
145
  * The resulting ledger transaction will mirror the status of the reversal.
146
146
  */
147
147
  export interface LedgerTransaction {
148
- /**
149
- * The timestamp (ISO8601 format) at which the ledger transaction happened for
150
- * reporting purposes.
151
- */
152
- effective_at: string;
153
-
154
148
  /**
155
149
  * An array of ledger entry objects.
156
150
  */
@@ -161,6 +155,12 @@ export namespace ReversalCreateParams {
161
155
  */
162
156
  description?: string | null;
163
157
 
158
+ /**
159
+ * The timestamp (ISO8601 format) at which the ledger transaction happened for
160
+ * reporting purposes.
161
+ */
162
+ effective_at?: string;
163
+
164
164
  /**
165
165
  * The date (YYYY-MM-DD) on which the ledger transaction happened for reporting
166
166
  * purposes.
@@ -244,6 +244,12 @@ export namespace ReversalCreateParams {
244
244
  */
245
245
  lock_version?: number | null;
246
246
 
247
+ /**
248
+ * Additional data represented as key-value pairs. Both the key and value must be
249
+ * strings.
250
+ */
251
+ metadata?: Record<string, string>;
252
+
247
253
  /**
248
254
  * Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to lock on the
249
255
  * account’s pending balance. If any of these conditions would be false after the