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
@@ -13,7 +13,7 @@ export class LedgerAccountCategories extends APIResource {
13
13
  create(
14
14
  params: LedgerAccountCategoryCreateParams,
15
15
  options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<LedgerAccountCategory>> {
16
+ ): Core.APIPromise<LedgerAccountCategory> {
17
17
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
18
  return this.post('/api/ledger_account_categories', {
19
19
  body,
@@ -29,13 +29,13 @@ export class LedgerAccountCategories extends APIResource {
29
29
  id: string,
30
30
  query?: LedgerAccountCategoryRetrieveParams,
31
31
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<LedgerAccountCategory>>;
33
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccountCategory>>;
32
+ ): Core.APIPromise<LedgerAccountCategory>;
33
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccountCategory>;
34
34
  retrieve(
35
35
  id: string,
36
36
  query: LedgerAccountCategoryRetrieveParams | Core.RequestOptions = {},
37
37
  options?: Core.RequestOptions,
38
- ): Promise<Core.APIResponse<LedgerAccountCategory>> {
38
+ ): Core.APIPromise<LedgerAccountCategory> {
39
39
  if (isRequestOptions(query)) {
40
40
  return this.retrieve(id, {}, query);
41
41
  }
@@ -47,20 +47,19 @@ export class LedgerAccountCategories extends APIResource {
47
47
  */
48
48
  update(
49
49
  id: string,
50
- params?: LedgerAccountCategoryUpdateParams,
50
+ body?: LedgerAccountCategoryUpdateParams,
51
51
  options?: Core.RequestOptions,
52
- ): Promise<Core.APIResponse<LedgerAccountCategory>>;
53
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccountCategory>>;
52
+ ): Core.APIPromise<LedgerAccountCategory>;
53
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccountCategory>;
54
54
  update(
55
55
  id: string,
56
- params: LedgerAccountCategoryUpdateParams | Core.RequestOptions = {},
56
+ body: LedgerAccountCategoryUpdateParams | Core.RequestOptions = {},
57
57
  options?: Core.RequestOptions,
58
- ): Promise<Core.APIResponse<LedgerAccountCategory>> {
59
- if (isRequestOptions(params)) {
60
- return this.update(id, {}, params);
58
+ ): Core.APIPromise<LedgerAccountCategory> {
59
+ if (isRequestOptions(body)) {
60
+ return this.update(id, {}, body);
61
61
  }
62
- const { balances, ...body } = params;
63
- return this.patch(`/api/ledger_account_categories/${id}`, { query: { balances }, body, ...options });
62
+ return this.patch(`/api/ledger_account_categories/${id}`, { body, ...options });
64
63
  }
65
64
 
66
65
  /**
@@ -69,12 +68,12 @@ export class LedgerAccountCategories extends APIResource {
69
68
  list(
70
69
  query?: LedgerAccountCategoryListParams,
71
70
  options?: Core.RequestOptions,
72
- ): Core.PagePromise<LedgerAccountCategoriesPage>;
73
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerAccountCategoriesPage>;
71
+ ): Core.PagePromise<LedgerAccountCategoriesPage, LedgerAccountCategory>;
72
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgerAccountCategoriesPage, LedgerAccountCategory>;
74
73
  list(
75
74
  query: LedgerAccountCategoryListParams | Core.RequestOptions = {},
76
75
  options?: Core.RequestOptions,
77
- ): Core.PagePromise<LedgerAccountCategoriesPage> {
76
+ ): Core.PagePromise<LedgerAccountCategoriesPage, LedgerAccountCategory> {
78
77
  if (isRequestOptions(query)) {
79
78
  return this.list({}, query);
80
79
  }
@@ -87,32 +86,18 @@ export class LedgerAccountCategories extends APIResource {
87
86
  /**
88
87
  * Delete a ledger account category.
89
88
  */
90
- del(
91
- id: string,
92
- body?: LedgerAccountCategoryDeleteParams,
93
- options?: Core.RequestOptions,
94
- ): Promise<Core.APIResponse<LedgerAccountCategory>>;
95
- del(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccountCategory>>;
96
- del(
97
- id: string,
98
- body: LedgerAccountCategoryDeleteParams | Core.RequestOptions = {},
99
- options?: Core.RequestOptions,
100
- ): Promise<Core.APIResponse<LedgerAccountCategory>> {
101
- if (isRequestOptions(body)) {
102
- return this.del(id, {}, body);
103
- }
104
- const { balances } = body;
105
- return this.delete(`/api/ledger_account_categories/${id}`, { query: { balances }, ...options });
89
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccountCategory> {
90
+ return this.delete(`/api/ledger_account_categories/${id}`, options);
106
91
  }
107
92
 
108
93
  /**
109
- * Add a ledger account category to an account.
94
+ * Add a ledger account to a ledger account category.
110
95
  */
111
96
  addLedgerAccount(
112
97
  id: string,
113
98
  ledgerAccountId: string,
114
99
  options?: Core.RequestOptions,
115
- ): Promise<Core.APIResponse<void>> {
100
+ ): Core.APIPromise<void> {
116
101
  return this.put(`/api/ledger_account_categories/${id}/ledger_accounts/${ledgerAccountId}`, {
117
102
  ...options,
118
103
  headers: { Accept: '', ...options?.headers },
@@ -122,11 +107,7 @@ export class LedgerAccountCategories extends APIResource {
122
107
  /**
123
108
  * Add a ledger account category to a ledger account category.
124
109
  */
125
- addNestedCategory(
126
- id: string,
127
- subCategoryId: string,
128
- options?: Core.RequestOptions,
129
- ): Promise<Core.APIResponse<void>> {
110
+ addNestedCategory(id: string, subCategoryId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
130
111
  return this.put(`/api/ledger_account_categories/${id}/ledger_account_categories/${subCategoryId}`, {
131
112
  ...options,
132
113
  headers: { Accept: '', ...options?.headers },
@@ -134,13 +115,13 @@ export class LedgerAccountCategories extends APIResource {
134
115
  }
135
116
 
136
117
  /**
137
- * Delete a ledger account category from an account.
118
+ * Remove a ledger account from a ledger account category.
138
119
  */
139
120
  removeLedgerAccount(
140
121
  id: string,
141
122
  ledgerAccountId: string,
142
123
  options?: Core.RequestOptions,
143
- ): Promise<Core.APIResponse<void>> {
124
+ ): Core.APIPromise<void> {
144
125
  return this.delete(`/api/ledger_account_categories/${id}/ledger_accounts/${ledgerAccountId}`, {
145
126
  ...options,
146
127
  headers: { Accept: '', ...options?.headers },
@@ -154,7 +135,7 @@ export class LedgerAccountCategories extends APIResource {
154
135
  id: string,
155
136
  subCategoryId: string,
156
137
  options?: Core.RequestOptions,
157
- ): Promise<Core.APIResponse<void>> {
138
+ ): Core.APIPromise<void> {
158
139
  return this.delete(`/api/ledger_account_categories/${id}/ledger_account_categories/${subCategoryId}`, {
159
140
  ...options,
160
141
  headers: { Accept: '', ...options?.headers },
@@ -362,20 +343,18 @@ export interface LedgerAccountCategoryCreateParams {
362
343
 
363
344
  export interface LedgerAccountCategoryRetrieveParams {
364
345
  /**
365
- * For example, if you want the balances as of a particular effective date
366
- * (YYYY-MM-DD), the encoded query string would be
367
- * balances%5Bas_of_date%5D=2000-12-31. The balances as of a date are exclusive of
368
- * entries with that exact date.
346
+ * For example, if you want the balances as of a particular time (ISO8601), the
347
+ * encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`.
348
+ * The balances as of a time are inclusive of entries with that exact time.
369
349
  */
370
350
  balances?: LedgerAccountCategoryRetrieveParams.Balances;
371
351
  }
372
352
 
373
353
  export namespace LedgerAccountCategoryRetrieveParams {
374
354
  /**
375
- * For example, if you want the balances as of a particular effective date
376
- * (YYYY-MM-DD), the encoded query string would be
377
- * balances%5Bas_of_date%5D=2000-12-31. The balances as of a date are exclusive of
378
- * entries with that exact date.
355
+ * For example, if you want the balances as of a particular time (ISO8601), the
356
+ * encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`.
357
+ * The balances as of a time are inclusive of entries with that exact time.
379
358
  */
380
359
  export interface Balances {
381
360
  as_of_date?: string;
@@ -386,45 +365,36 @@ export namespace LedgerAccountCategoryRetrieveParams {
386
365
 
387
366
  export interface LedgerAccountCategoryUpdateParams {
388
367
  /**
389
- * Query param: For example, if you want the balances as of a particular effective
390
- * date (YYYY-MM-DD), the encoded query string would be
391
- * balances%5Bas_of_date%5D=2000-12-31. The balances as of a date are exclusive of
392
- * entries with that exact date.
393
- */
394
- balances?: LedgerAccountCategoryUpdateParams.Balances;
395
-
396
- /**
397
- * Body param: The description of the ledger account category.
368
+ * The description of the ledger account category.
398
369
  */
399
370
  description?: string | null;
400
371
 
401
372
  /**
402
- * Body param: Additional data represented as key-value pairs. Both the key and
403
- * value must be strings.
373
+ * Additional data represented as key-value pairs. Both the key and value must be
374
+ * strings.
404
375
  */
405
376
  metadata?: Record<string, string>;
406
377
 
407
378
  /**
408
- * Body param: The name of the ledger account category.
379
+ * The name of the ledger account category.
409
380
  */
410
381
  name?: string;
411
382
  }
412
383
 
413
- export namespace LedgerAccountCategoryUpdateParams {
384
+ export interface LedgerAccountCategoryListParams extends PageParams {
414
385
  /**
415
- * For example, if you want the balances as of a particular effective date
416
- * (YYYY-MM-DD), the encoded query string would be
417
- * balances%5Bas_of_date%5D=2000-12-31. The balances as of a date are exclusive of
418
- * entries with that exact date.
386
+ * If you have specific IDs to retrieve in bulk, you can pass them as query
387
+ * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
419
388
  */
420
- export interface Balances {
421
- as_of_date?: string;
389
+ id?: Array<string>;
422
390
 
423
- effective_at?: string;
424
- }
425
- }
391
+ /**
392
+ * For example, if you want the balances as of a particular time (ISO8601), the
393
+ * encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`.
394
+ * The balances as of a time are inclusive of entries with that exact time.
395
+ */
396
+ balances?: LedgerAccountCategoryListParams.Balances;
426
397
 
427
- export interface LedgerAccountCategoryListParams extends PageParams {
428
398
  /**
429
399
  * Query categories which contain a ledger account directly or through child
430
400
  * categories.
@@ -448,26 +418,13 @@ export interface LedgerAccountCategoryListParams extends PageParams {
448
418
  parent_ledger_account_category_id?: string;
449
419
  }
450
420
 
451
- export interface LedgerAccountCategoryDeleteParams {
421
+ export namespace LedgerAccountCategoryListParams {
452
422
  /**
453
- * For example, if you want the balances as of a particular effective date
454
- * (YYYY-MM-DD), the encoded query string would be
455
- * balances%5Bas_of_date%5D=2000-12-31. The balances as of a date are exclusive of
456
- * entries with that exact date.
457
- */
458
- balances?: LedgerAccountCategoryDeleteParams.Balances;
459
- }
460
-
461
- export namespace LedgerAccountCategoryDeleteParams {
462
- /**
463
- * For example, if you want the balances as of a particular effective date
464
- * (YYYY-MM-DD), the encoded query string would be
465
- * balances%5Bas_of_date%5D=2000-12-31. The balances as of a date are exclusive of
466
- * entries with that exact date.
423
+ * For example, if you want the balances as of a particular time (ISO8601), the
424
+ * encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`.
425
+ * The balances as of a time are inclusive of entries with that exact time.
467
426
  */
468
427
  export interface Balances {
469
- as_of_date?: string;
470
-
471
428
  effective_at?: string;
472
429
  }
473
430
  }
@@ -479,5 +436,4 @@ export namespace LedgerAccountCategories {
479
436
  export import LedgerAccountCategoryRetrieveParams = API.LedgerAccountCategoryRetrieveParams;
480
437
  export import LedgerAccountCategoryUpdateParams = API.LedgerAccountCategoryUpdateParams;
481
438
  export import LedgerAccountCategoryListParams = API.LedgerAccountCategoryListParams;
482
- export import LedgerAccountCategoryDeleteParams = API.LedgerAccountCategoryDeleteParams;
483
439
  }
@@ -13,7 +13,7 @@ export class LedgerAccountPayouts extends APIResource {
13
13
  create(
14
14
  params: LedgerAccountPayoutCreateParams,
15
15
  options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<LedgerAccountPayout>> {
16
+ ): Core.APIPromise<LedgerAccountPayout> {
17
17
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
18
  return this.post('/api/ledger_account_payouts', {
19
19
  body,
@@ -29,13 +29,13 @@ export class LedgerAccountPayouts extends APIResource {
29
29
  id: string,
30
30
  body?: LedgerAccountPayoutUpdateParams,
31
31
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<LedgerAccountPayout>>;
33
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccountPayout>>;
32
+ ): Core.APIPromise<LedgerAccountPayout>;
33
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccountPayout>;
34
34
  update(
35
35
  id: string,
36
36
  body: LedgerAccountPayoutUpdateParams | Core.RequestOptions = {},
37
37
  options?: Core.RequestOptions,
38
- ): Promise<Core.APIResponse<LedgerAccountPayout>> {
38
+ ): Core.APIPromise<LedgerAccountPayout> {
39
39
  if (isRequestOptions(body)) {
40
40
  return this.update(id, {}, body);
41
41
  }
@@ -48,12 +48,12 @@ export class LedgerAccountPayouts extends APIResource {
48
48
  list(
49
49
  query?: LedgerAccountPayoutListParams,
50
50
  options?: Core.RequestOptions,
51
- ): Core.PagePromise<LedgerAccountPayoutsPage>;
52
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerAccountPayoutsPage>;
51
+ ): Core.PagePromise<LedgerAccountPayoutsPage, LedgerAccountPayout>;
52
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgerAccountPayoutsPage, LedgerAccountPayout>;
53
53
  list(
54
54
  query: LedgerAccountPayoutListParams | Core.RequestOptions = {},
55
55
  options?: Core.RequestOptions,
56
- ): Core.PagePromise<LedgerAccountPayoutsPage> {
56
+ ): Core.PagePromise<LedgerAccountPayoutsPage, LedgerAccountPayout> {
57
57
  if (isRequestOptions(query)) {
58
58
  return this.list({}, query);
59
59
  }
@@ -63,7 +63,7 @@ export class LedgerAccountPayouts extends APIResource {
63
63
  /**
64
64
  * Get details on a single ledger account payout.
65
65
  */
66
- retireve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccountPayout>> {
66
+ retireve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccountPayout> {
67
67
  return this.get(`/api/ledger_account_payouts/${id}`, options);
68
68
  }
69
69
  }
@@ -180,6 +180,12 @@ export interface LedgerAccountPayoutCreateParams {
180
180
  */
181
181
  metadata?: Record<string, string>;
182
182
 
183
+ /**
184
+ * Body param: It is set to `false` by default. It should be set to `true` when
185
+ * migrating existing payouts.
186
+ */
187
+ skip_payout_ledger_transaction?: boolean | null;
188
+
183
189
  /**
184
190
  * Body param: The status of the ledger account payout. It is set to `pending` by
185
191
  * default. To post a ledger account payout at creation, use `posted`.
@@ -213,6 +219,19 @@ export interface LedgerAccountPayoutUpdateParams {
213
219
  }
214
220
 
215
221
  export interface LedgerAccountPayoutListParams extends PageParams {
222
+ /**
223
+ * If you have specific IDs to retrieve in bulk, you can pass them as query
224
+ * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
225
+ */
226
+ id?: Array<string>;
227
+
228
+ /**
229
+ * For example, if you want to query for records with metadata key `Type` and value
230
+ * `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
231
+ * parameters.
232
+ */
233
+ metadata?: Record<string, string>;
234
+
216
235
  payout_ledger_account_id?: string;
217
236
  }
218
237
 
@@ -11,7 +11,7 @@ export class LedgerAccountStatements extends APIResource {
11
11
  create(
12
12
  params: LedgerAccountStatementCreateParams,
13
13
  options?: Core.RequestOptions,
14
- ): Promise<Core.APIResponse<LedgerAccountStatementCreateResponse>> {
14
+ ): Core.APIPromise<LedgerAccountStatementCreateResponse> {
15
15
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
16
16
  return this.post('/api/ledger_account_statements', {
17
17
  body,
@@ -26,7 +26,7 @@ export class LedgerAccountStatements extends APIResource {
26
26
  retrieve(
27
27
  id: string,
28
28
  options?: Core.RequestOptions,
29
- ): Promise<Core.APIResponse<LedgerAccountStatementRetrieveResponse>> {
29
+ ): Core.APIPromise<LedgerAccountStatementRetrieveResponse> {
30
30
  return this.get(`/api/ledger_account_statements/${id}`, options);
31
31
  }
32
32
  }
@@ -10,10 +10,7 @@ export class LedgerAccounts extends APIResource {
10
10
  /**
11
11
  * Create a ledger account.
12
12
  */
13
- create(
14
- params: LedgerAccountCreateParams,
15
- options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<LedgerAccount>> {
13
+ create(params: LedgerAccountCreateParams, options?: Core.RequestOptions): Core.APIPromise<LedgerAccount> {
17
14
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
15
  return this.post('/api/ledger_accounts', {
19
16
  body,
@@ -29,13 +26,13 @@ export class LedgerAccounts extends APIResource {
29
26
  id: string,
30
27
  query?: LedgerAccountRetrieveParams,
31
28
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<LedgerAccount>>;
33
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccount>>;
29
+ ): Core.APIPromise<LedgerAccount>;
30
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccount>;
34
31
  retrieve(
35
32
  id: string,
36
33
  query: LedgerAccountRetrieveParams | Core.RequestOptions = {},
37
34
  options?: Core.RequestOptions,
38
- ): Promise<Core.APIResponse<LedgerAccount>> {
35
+ ): Core.APIPromise<LedgerAccount> {
39
36
  if (isRequestOptions(query)) {
40
37
  return this.retrieve(id, {}, query);
41
38
  }
@@ -49,13 +46,13 @@ export class LedgerAccounts extends APIResource {
49
46
  id: string,
50
47
  body?: LedgerAccountUpdateParams,
51
48
  options?: Core.RequestOptions,
52
- ): Promise<Core.APIResponse<LedgerAccount>>;
53
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccount>>;
49
+ ): Core.APIPromise<LedgerAccount>;
50
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccount>;
54
51
  update(
55
52
  id: string,
56
53
  body: LedgerAccountUpdateParams | Core.RequestOptions = {},
57
54
  options?: Core.RequestOptions,
58
- ): Promise<Core.APIResponse<LedgerAccount>> {
55
+ ): Core.APIPromise<LedgerAccount> {
59
56
  if (isRequestOptions(body)) {
60
57
  return this.update(id, {}, body);
61
58
  }
@@ -65,12 +62,15 @@ export class LedgerAccounts extends APIResource {
65
62
  /**
66
63
  * Get a list of ledger accounts.
67
64
  */
68
- list(query?: LedgerAccountListParams, options?: Core.RequestOptions): Core.PagePromise<LedgerAccountsPage>;
69
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerAccountsPage>;
65
+ list(
66
+ query?: LedgerAccountListParams,
67
+ options?: Core.RequestOptions,
68
+ ): Core.PagePromise<LedgerAccountsPage, LedgerAccount>;
69
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgerAccountsPage, LedgerAccount>;
70
70
  list(
71
71
  query: LedgerAccountListParams | Core.RequestOptions = {},
72
72
  options?: Core.RequestOptions,
73
- ): Core.PagePromise<LedgerAccountsPage> {
73
+ ): Core.PagePromise<LedgerAccountsPage, LedgerAccount> {
74
74
  if (isRequestOptions(query)) {
75
75
  return this.list({}, query);
76
76
  }
@@ -80,7 +80,7 @@ export class LedgerAccounts extends APIResource {
80
80
  /**
81
81
  * Delete a ledger account.
82
82
  */
83
- del(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerAccount>> {
83
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerAccount> {
84
84
  return this.delete(`/api/ledger_accounts/${id}`, options);
85
85
  }
86
86
  }
@@ -379,7 +379,11 @@ export interface LedgerAccountUpdateParams {
379
379
  }
380
380
 
381
381
  export interface LedgerAccountListParams extends PageParams {
382
- id?: string;
382
+ /**
383
+ * If you have specific IDs to retrieve in bulk, you can pass them as query
384
+ * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
385
+ */
386
+ id?: Array<string>;
383
387
 
384
388
  /**
385
389
  * Use `balances[effective_at_lower_bound]` and
@@ -397,6 +401,8 @@ export interface LedgerAccountListParams extends PageParams {
397
401
  */
398
402
  created_at?: Record<string, string>;
399
403
 
404
+ currency?: string;
405
+
400
406
  ledger_account_category_id?: string;
401
407
 
402
408
  ledger_id?: string;
@@ -14,13 +14,13 @@ export class LedgerEntries extends APIResource {
14
14
  id: string,
15
15
  query?: LedgerEntryRetrieveParams,
16
16
  options?: Core.RequestOptions,
17
- ): Promise<Core.APIResponse<LedgerEntry>>;
18
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<LedgerEntry>>;
17
+ ): Core.APIPromise<LedgerEntry>;
18
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEntry>;
19
19
  retrieve(
20
20
  id: string,
21
21
  query: LedgerEntryRetrieveParams | Core.RequestOptions = {},
22
22
  options?: Core.RequestOptions,
23
- ): Promise<Core.APIResponse<LedgerEntry>> {
23
+ ): Core.APIPromise<LedgerEntry> {
24
24
  if (isRequestOptions(query)) {
25
25
  return this.retrieve(id, {}, query);
26
26
  }
@@ -30,12 +30,15 @@ export class LedgerEntries extends APIResource {
30
30
  /**
31
31
  * Get a list of all ledger entries.
32
32
  */
33
- list(query?: LedgerEntryListParams, options?: Core.RequestOptions): Core.PagePromise<LedgerEntriesPage>;
34
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerEntriesPage>;
33
+ list(
34
+ query?: LedgerEntryListParams,
35
+ options?: Core.RequestOptions,
36
+ ): Core.PagePromise<LedgerEntriesPage, LedgerEntry>;
37
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgerEntriesPage, LedgerEntry>;
35
38
  list(
36
39
  query: LedgerEntryListParams | Core.RequestOptions = {},
37
40
  options?: Core.RequestOptions,
38
- ): Core.PagePromise<LedgerEntriesPage> {
41
+ ): Core.PagePromise<LedgerEntriesPage, LedgerEntry> {
39
42
  if (isRequestOptions(query)) {
40
43
  return this.list({}, query);
41
44
  }
@@ -238,7 +241,11 @@ export interface LedgerEntryRetrieveParams {
238
241
  }
239
242
 
240
243
  export interface LedgerEntryListParams extends PageParams {
241
- id?: Record<string, string>;
244
+ /**
245
+ * If you have specific IDs to retrieve in bulk, you can pass them as query
246
+ * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`.
247
+ */
248
+ id?: Array<string>;
242
249
 
243
250
  /**
244
251
  * Shows all ledger entries that were present on a ledger account at a particular
@@ -254,7 +261,7 @@ export interface LedgerEntryListParams extends PageParams {
254
261
  direction?: 'credit' | 'debit';
255
262
 
256
263
  /**
257
- * Use "gt" (>), "gte" (>=), "lt" (<), "lte" (<=), or "eq" (=) to filter by the
264
+ * Use `gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the
258
265
  * transaction's effective time. Format ISO8601
259
266
  */
260
267
  effective_at?: Record<string, string>;
@@ -281,6 +288,8 @@ export interface LedgerEntryListParams extends PageParams {
281
288
  */
282
289
  ledger_account_lock_version?: Record<string, number>;
283
290
 
291
+ ledger_account_payout_id?: string;
292
+
284
293
  /**
285
294
  * Get all ledger entries that are included in the ledger account statement.
286
295
  */
@@ -288,6 +297,13 @@ export interface LedgerEntryListParams extends PageParams {
288
297
 
289
298
  ledger_transaction_id?: string;
290
299
 
300
+ /**
301
+ * For example, if you want to query for records with metadata key `Type` and value
302
+ * `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
303
+ * parameters.
304
+ */
305
+ metadata?: Record<string, string>;
306
+
291
307
  /**
292
308
  * Order by `created_at` or `effective_at` in `asc` or `desc` order. For example,
293
309
  * to order by `effective_at asc`, use `order_by%5Beffective_at%5D=asc`. Ordering
@@ -13,7 +13,7 @@ export class LedgerEventHandlers extends APIResource {
13
13
  create(
14
14
  params: LedgerEventHandlerCreateParams,
15
15
  options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<LedgerEventHandlerCreateResponse>> {
16
+ ): Core.APIPromise<LedgerEventHandlerCreateResponse> {
17
17
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
18
  return this.post('/api/ledger_event_handlers', {
19
19
  body,
@@ -25,10 +25,7 @@ export class LedgerEventHandlers extends APIResource {
25
25
  /**
26
26
  * Get details on a single ledger event handler.
27
27
  */
28
- retrieve(
29
- id: string,
30
- options?: Core.RequestOptions,
31
- ): Promise<Core.APIResponse<LedgerEventHandlerRetrieveResponse>> {
28
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEventHandlerRetrieveResponse> {
32
29
  return this.get(`/api/ledger_event_handlers/${id}`, options);
33
30
  }
34
31
 
@@ -38,12 +35,14 @@ export class LedgerEventHandlers extends APIResource {
38
35
  list(
39
36
  query?: LedgerEventHandlerListParams,
40
37
  options?: Core.RequestOptions,
41
- ): Core.PagePromise<LedgerEventHandlerListResponsesPage>;
42
- list(options?: Core.RequestOptions): Core.PagePromise<LedgerEventHandlerListResponsesPage>;
38
+ ): Core.PagePromise<LedgerEventHandlerListResponsesPage, LedgerEventHandlerListResponse>;
39
+ list(
40
+ options?: Core.RequestOptions,
41
+ ): Core.PagePromise<LedgerEventHandlerListResponsesPage, LedgerEventHandlerListResponse>;
43
42
  list(
44
43
  query: LedgerEventHandlerListParams | Core.RequestOptions = {},
45
44
  options?: Core.RequestOptions,
46
- ): Core.PagePromise<LedgerEventHandlerListResponsesPage> {
45
+ ): Core.PagePromise<LedgerEventHandlerListResponsesPage, LedgerEventHandlerListResponse> {
47
46
  if (isRequestOptions(query)) {
48
47
  return this.list({}, query);
49
48
  }
@@ -56,10 +55,7 @@ export class LedgerEventHandlers extends APIResource {
56
55
  /**
57
56
  * Archive a ledger event handler.
58
57
  */
59
- del(
60
- id: string,
61
- options?: Core.RequestOptions,
62
- ): Promise<Core.APIResponse<LedgerEventHandlerDeleteResponse>> {
58
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEventHandlerDeleteResponse> {
63
59
  return this.delete(`/api/ledger_event_handlers/${id}`, options);
64
60
  }
65
61
  }