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
package/src/index.ts CHANGED
@@ -89,7 +89,7 @@ export class ModernTreasury extends Core.APIClient {
89
89
  }: ClientOptions = {}) {
90
90
  if (apiKey === undefined) {
91
91
  throw new Error(
92
- 'The MODERN_TREASURY_API_KEY environment variable is missing or empty; either provide it, or instantiate the ModernTreasury client with an apiKey option, like new ModernTreasury({ apiKey: undefined }).',
92
+ "The MODERN_TREASURY_API_KEY environment variable is missing or empty; either provide it, or instantiate the ModernTreasury client with an apiKey option, like new ModernTreasury({ apiKey: 'my apiKey' }).",
93
93
  );
94
94
  }
95
95
  if (organizationId === undefined) {
@@ -108,7 +108,7 @@ export class ModernTreasury extends Core.APIClient {
108
108
 
109
109
  super({
110
110
  baseURL: options.baseURL!,
111
- timeout: options.timeout,
111
+ timeout: options.timeout ?? 60000 /* 1 minute */,
112
112
  httpAgent: options.httpAgent,
113
113
  maxRetries: options.maxRetries,
114
114
  fetch: options.fetch,
@@ -157,7 +157,7 @@ export class ModernTreasury extends Core.APIClient {
157
157
  * A test endpoint often used to confirm credentials and headers are being passed
158
158
  * in correctly.
159
159
  */
160
- ping(options?: Core.RequestOptions): Promise<Core.APIResponse<ModernTreasury.PingResponse>> {
160
+ ping(options?: Core.RequestOptions): Core.APIPromise<ModernTreasury.PingResponse> {
161
161
  return this.get('/api/ping', options);
162
162
  }
163
163
 
@@ -179,7 +179,7 @@ export class ModernTreasury extends Core.APIClient {
179
179
  }
180
180
 
181
181
  protected override stringifyQuery(query: Record<string, unknown>): string {
182
- return qs.stringify(query, { arrayFormat: 'repeat' });
182
+ return qs.stringify(query, { arrayFormat: 'brackets' });
183
183
  }
184
184
 
185
185
  static ModernTreasury = this;
@@ -329,7 +329,6 @@ export namespace ModernTreasury {
329
329
  export import LedgerAccountCategoryRetrieveParams = API.LedgerAccountCategoryRetrieveParams;
330
330
  export import LedgerAccountCategoryUpdateParams = API.LedgerAccountCategoryUpdateParams;
331
331
  export import LedgerAccountCategoryListParams = API.LedgerAccountCategoryListParams;
332
- export import LedgerAccountCategoryDeleteParams = API.LedgerAccountCategoryDeleteParams;
333
332
 
334
333
  export import LedgerAccounts = API.LedgerAccounts;
335
334
  export import LedgerAccount = API.LedgerAccount;
package/src/pagination.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import { AbstractPage, APIResponse, APIClient, FinalRequestOptions, coerceInteger, PageInfo } from './core';
3
+ import { AbstractPage, Response, APIClient, FinalRequestOptions, coerceInteger, PageInfo } from './core';
4
4
 
5
5
  export type PageResponse<Item> = Item[];
6
6
 
@@ -17,12 +17,12 @@ export class Page<Item> extends AbstractPage<Item> {
17
17
 
18
18
  after_cursor: string | null;
19
19
 
20
- constructor(client: APIClient, response: APIResponse<PageResponse<Item>>, options: FinalRequestOptions) {
21
- super(client, response, options);
20
+ constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions) {
21
+ super(client, response, body, options);
22
22
 
23
- this.items = response || [];
24
- this.per_page = coerceInteger(response.responseHeaders['x-per-page'] || null);
25
- this.after_cursor = response.responseHeaders['x-after-cursor'] || null;
23
+ this.items = body || [];
24
+ this.per_page = coerceInteger(this.response.headers.get('x-per-page') || null);
25
+ this.after_cursor = this.response.headers.get('x-after-cursor') || null;
26
26
  }
27
27
 
28
28
  getPaginatedItems(): Item[] {
@@ -13,7 +13,7 @@ export class AccountCollectionFlows extends APIResource {
13
13
  create(
14
14
  params: AccountCollectionFlowCreateParams,
15
15
  options?: Core.RequestOptions,
16
- ): Promise<Core.APIResponse<AccountCollectionFlow>> {
16
+ ): Core.APIPromise<AccountCollectionFlow> {
17
17
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
18
18
  return this.post('/api/account_collection_flows', {
19
19
  body,
@@ -29,13 +29,13 @@ export class AccountCollectionFlows extends APIResource {
29
29
  id: string,
30
30
  query?: AccountCollectionFlowRetrieveParams,
31
31
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<AccountCollectionFlow>>;
33
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<AccountCollectionFlow>>;
32
+ ): Core.APIPromise<AccountCollectionFlow>;
33
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<AccountCollectionFlow>;
34
34
  retrieve(
35
35
  id: string,
36
36
  query: AccountCollectionFlowRetrieveParams | Core.RequestOptions = {},
37
37
  options?: Core.RequestOptions,
38
- ): Promise<Core.APIResponse<AccountCollectionFlow>> {
38
+ ): Core.APIPromise<AccountCollectionFlow> {
39
39
  if (isRequestOptions(query)) {
40
40
  return this.retrieve(id, {}, query);
41
41
  }
@@ -53,7 +53,7 @@ export class AccountCollectionFlows extends APIResource {
53
53
  id: string,
54
54
  params: AccountCollectionFlowUpdateParams,
55
55
  options?: Core.RequestOptions,
56
- ): Promise<Core.APIResponse<AccountCollectionFlow>> {
56
+ ): Core.APIPromise<AccountCollectionFlow> {
57
57
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
58
58
  return this.patch(`/api/account_collection_flows/${id}`, {
59
59
  body,
@@ -68,12 +68,12 @@ export class AccountCollectionFlows extends APIResource {
68
68
  list(
69
69
  query?: AccountCollectionFlowListParams,
70
70
  options?: Core.RequestOptions,
71
- ): Core.PagePromise<AccountCollectionFlowsPage>;
72
- list(options?: Core.RequestOptions): Core.PagePromise<AccountCollectionFlowsPage>;
71
+ ): Core.PagePromise<AccountCollectionFlowsPage, AccountCollectionFlow>;
72
+ list(options?: Core.RequestOptions): Core.PagePromise<AccountCollectionFlowsPage, AccountCollectionFlow>;
73
73
  list(
74
74
  query: AccountCollectionFlowListParams | Core.RequestOptions = {},
75
75
  options?: Core.RequestOptions,
76
- ): Core.PagePromise<AccountCollectionFlowsPage> {
76
+ ): Core.PagePromise<AccountCollectionFlowsPage, AccountCollectionFlow> {
77
77
  if (isRequestOptions(query)) {
78
78
  return this.list({}, query);
79
79
  }
@@ -16,7 +16,7 @@ export class AccountDetails extends APIResource {
16
16
  accountId: string,
17
17
  params: AccountDetailCreateParams,
18
18
  options?: Core.RequestOptions,
19
- ): Promise<Core.APIResponse<AccountDetail>> {
19
+ ): Core.APIPromise<AccountDetail> {
20
20
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
21
21
  return this.post(`/api/${accountsType}/${accountId}/account_details`, {
22
22
  body,
@@ -33,7 +33,7 @@ export class AccountDetails extends APIResource {
33
33
  accountId: string,
34
34
  id: string,
35
35
  options?: Core.RequestOptions,
36
- ): Promise<Core.APIResponse<AccountDetail>> {
36
+ ): Core.APIPromise<AccountDetail> {
37
37
  return this.get(`/api/${accountsType}/${accountId}/account_details/${id}`, options);
38
38
  }
39
39
 
@@ -45,18 +45,18 @@ export class AccountDetails extends APIResource {
45
45
  accountId: string,
46
46
  query?: AccountDetailListParams,
47
47
  options?: Core.RequestOptions,
48
- ): Core.PagePromise<AccountDetailsPage>;
48
+ ): Core.PagePromise<AccountDetailsPage, AccountDetail>;
49
49
  list(
50
50
  accountsType: Shared.AccountsType,
51
51
  accountId: string,
52
52
  options?: Core.RequestOptions,
53
- ): Core.PagePromise<AccountDetailsPage>;
53
+ ): Core.PagePromise<AccountDetailsPage, AccountDetail>;
54
54
  list(
55
55
  accountsType: Shared.AccountsType,
56
56
  accountId: string,
57
57
  query: AccountDetailListParams | Core.RequestOptions = {},
58
58
  options?: Core.RequestOptions,
59
- ): Core.PagePromise<AccountDetailsPage> {
59
+ ): Core.PagePromise<AccountDetailsPage, AccountDetail> {
60
60
  if (isRequestOptions(query)) {
61
61
  return this.list(accountsType, accountId, {}, query);
62
62
  }
@@ -74,7 +74,7 @@ export class AccountDetails extends APIResource {
74
74
  accountId: string,
75
75
  id: string,
76
76
  options?: Core.RequestOptions,
77
- ): Promise<Core.APIResponse<void>> {
77
+ ): Core.APIPromise<void> {
78
78
  return this.delete(`/api/${accountsType}/${accountId}/account_details/${id}`, {
79
79
  ...options,
80
80
  headers: { Accept: '', ...options?.headers },
@@ -10,12 +10,15 @@ export class Connections extends APIResource {
10
10
  /**
11
11
  * Get a list of all connections.
12
12
  */
13
- list(query?: ConnectionListParams, options?: Core.RequestOptions): Core.PagePromise<ConnectionsPage>;
14
- list(options?: Core.RequestOptions): Core.PagePromise<ConnectionsPage>;
13
+ list(
14
+ query?: ConnectionListParams,
15
+ options?: Core.RequestOptions,
16
+ ): Core.PagePromise<ConnectionsPage, Connection>;
17
+ list(options?: Core.RequestOptions): Core.PagePromise<ConnectionsPage, Connection>;
15
18
  list(
16
19
  query: ConnectionListParams | Core.RequestOptions = {},
17
20
  options?: Core.RequestOptions,
18
- ): Core.PagePromise<ConnectionsPage> {
21
+ ): Core.PagePromise<ConnectionsPage, Connection> {
19
22
  if (isRequestOptions(query)) {
20
23
  return this.list({}, query);
21
24
  }
@@ -13,10 +13,7 @@ export class Counterparties extends APIResource {
13
13
  /**
14
14
  * Create a new counterparty.
15
15
  */
16
- create(
17
- params: CounterpartyCreateParams,
18
- options?: Core.RequestOptions,
19
- ): Promise<Core.APIResponse<Counterparty>> {
16
+ create(params: CounterpartyCreateParams, options?: Core.RequestOptions): Core.APIPromise<Counterparty> {
20
17
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
21
18
  return this.post('/api/counterparties', {
22
19
  body,
@@ -28,7 +25,7 @@ export class Counterparties extends APIResource {
28
25
  /**
29
26
  * Get details on a single counterparty.
30
27
  */
31
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Counterparty>> {
28
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Counterparty> {
32
29
  return this.get(`/api/counterparties/${id}`, options);
33
30
  }
34
31
 
@@ -39,13 +36,13 @@ export class Counterparties extends APIResource {
39
36
  id: string,
40
37
  body?: CounterpartyUpdateParams,
41
38
  options?: Core.RequestOptions,
42
- ): Promise<Core.APIResponse<Counterparty>>;
43
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Counterparty>>;
39
+ ): Core.APIPromise<Counterparty>;
40
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<Counterparty>;
44
41
  update(
45
42
  id: string,
46
43
  body: CounterpartyUpdateParams | Core.RequestOptions = {},
47
44
  options?: Core.RequestOptions,
48
- ): Promise<Core.APIResponse<Counterparty>> {
45
+ ): Core.APIPromise<Counterparty> {
49
46
  if (isRequestOptions(body)) {
50
47
  return this.update(id, {}, body);
51
48
  }
@@ -55,12 +52,15 @@ export class Counterparties extends APIResource {
55
52
  /**
56
53
  * Get a paginated list of all counterparties.
57
54
  */
58
- list(query?: CounterpartyListParams, options?: Core.RequestOptions): Core.PagePromise<CounterpartiesPage>;
59
- list(options?: Core.RequestOptions): Core.PagePromise<CounterpartiesPage>;
55
+ list(
56
+ query?: CounterpartyListParams,
57
+ options?: Core.RequestOptions,
58
+ ): Core.PagePromise<CounterpartiesPage, Counterparty>;
59
+ list(options?: Core.RequestOptions): Core.PagePromise<CounterpartiesPage, Counterparty>;
60
60
  list(
61
61
  query: CounterpartyListParams | Core.RequestOptions = {},
62
62
  options?: Core.RequestOptions,
63
- ): Core.PagePromise<CounterpartiesPage> {
63
+ ): Core.PagePromise<CounterpartiesPage, Counterparty> {
64
64
  if (isRequestOptions(query)) {
65
65
  return this.list({}, query);
66
66
  }
@@ -70,7 +70,7 @@ export class Counterparties extends APIResource {
70
70
  /**
71
71
  * Deletes a given counterparty.
72
72
  */
73
- del(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<void>> {
73
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
74
74
  return this.delete(`/api/counterparties/${id}`, {
75
75
  ...options,
76
76
  headers: { Accept: '', ...options?.headers },
@@ -84,7 +84,7 @@ export class Counterparties extends APIResource {
84
84
  id: string,
85
85
  params: CounterpartyCollectAccountParams,
86
86
  options?: Core.RequestOptions,
87
- ): Promise<Core.APIResponse<CounterpartyCollectAccountResponse>> {
87
+ ): Core.APIPromise<CounterpartyCollectAccountResponse> {
88
88
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
89
89
  return this.post(`/api/counterparties/${id}/collect_account`, {
90
90
  body,
@@ -11,14 +11,11 @@ export class Documents extends APIResource {
11
11
  /**
12
12
  * Create a document.
13
13
  */
14
- async create(
15
- params: DocumentCreateParams,
16
- options?: Core.RequestOptions,
17
- ): Promise<Core.APIResponse<Document>> {
14
+ create(params: DocumentCreateParams, options?: Core.RequestOptions): Core.APIPromise<Document> {
18
15
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
19
16
  return this.post(
20
17
  '/api/documents',
21
- await multipartFormRequestOptions({
18
+ multipartFormRequestOptions({
22
19
  body,
23
20
  ...options,
24
21
  headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
@@ -29,19 +26,19 @@ export class Documents extends APIResource {
29
26
  /**
30
27
  * Get an existing document.
31
28
  */
32
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Document>> {
29
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Document> {
33
30
  return this.get(`/api/documents/${id}`, options);
34
31
  }
35
32
 
36
33
  /**
37
34
  * Get a list of documents.
38
35
  */
39
- list(query?: DocumentListParams, options?: Core.RequestOptions): Core.PagePromise<DocumentsPage>;
40
- list(options?: Core.RequestOptions): Core.PagePromise<DocumentsPage>;
36
+ list(query?: DocumentListParams, options?: Core.RequestOptions): Core.PagePromise<DocumentsPage, Document>;
37
+ list(options?: Core.RequestOptions): Core.PagePromise<DocumentsPage, Document>;
41
38
  list(
42
39
  query: DocumentListParams | Core.RequestOptions = {},
43
40
  options?: Core.RequestOptions,
44
- ): Core.PagePromise<DocumentsPage> {
41
+ ): Core.PagePromise<DocumentsPage, Document> {
45
42
  if (isRequestOptions(query)) {
46
43
  return this.list({}, query);
47
44
  }
@@ -10,19 +10,19 @@ export class Events extends APIResource {
10
10
  /**
11
11
  * get event
12
12
  */
13
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Event>> {
13
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Event> {
14
14
  return this.get(`/api/events/${id}`, options);
15
15
  }
16
16
 
17
17
  /**
18
18
  * list events
19
19
  */
20
- list(query?: EventListParams, options?: Core.RequestOptions): Core.PagePromise<EventsPage>;
21
- list(options?: Core.RequestOptions): Core.PagePromise<EventsPage>;
20
+ list(query?: EventListParams, options?: Core.RequestOptions): Core.PagePromise<EventsPage, Event>;
21
+ list(options?: Core.RequestOptions): Core.PagePromise<EventsPage, Event>;
22
22
  list(
23
23
  query: EventListParams | Core.RequestOptions = {},
24
24
  options?: Core.RequestOptions,
25
- ): Core.PagePromise<EventsPage> {
25
+ ): Core.PagePromise<EventsPage, Event> {
26
26
  if (isRequestOptions(query)) {
27
27
  return this.list({}, query);
28
28
  }
@@ -14,7 +14,7 @@ export class ExpectedPayments extends APIResource {
14
14
  create(
15
15
  params: ExpectedPaymentCreateParams,
16
16
  options?: Core.RequestOptions,
17
- ): Promise<Core.APIResponse<ExpectedPayment>> {
17
+ ): Core.APIPromise<ExpectedPayment> {
18
18
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
19
19
  return this.post('/api/expected_payments', {
20
20
  body,
@@ -26,7 +26,7 @@ export class ExpectedPayments extends APIResource {
26
26
  /**
27
27
  * get expected payment
28
28
  */
29
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<ExpectedPayment>> {
29
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<ExpectedPayment> {
30
30
  return this.get(`/api/expected_payments/${id}`, options);
31
31
  }
32
32
 
@@ -37,13 +37,13 @@ export class ExpectedPayments extends APIResource {
37
37
  id: string,
38
38
  body?: ExpectedPaymentUpdateParams,
39
39
  options?: Core.RequestOptions,
40
- ): Promise<Core.APIResponse<ExpectedPayment>>;
41
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<ExpectedPayment>>;
40
+ ): Core.APIPromise<ExpectedPayment>;
41
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<ExpectedPayment>;
42
42
  update(
43
43
  id: string,
44
44
  body: ExpectedPaymentUpdateParams | Core.RequestOptions = {},
45
45
  options?: Core.RequestOptions,
46
- ): Promise<Core.APIResponse<ExpectedPayment>> {
46
+ ): Core.APIPromise<ExpectedPayment> {
47
47
  if (isRequestOptions(body)) {
48
48
  return this.update(id, {}, body);
49
49
  }
@@ -56,12 +56,12 @@ export class ExpectedPayments extends APIResource {
56
56
  list(
57
57
  query?: ExpectedPaymentListParams,
58
58
  options?: Core.RequestOptions,
59
- ): Core.PagePromise<ExpectedPaymentsPage>;
60
- list(options?: Core.RequestOptions): Core.PagePromise<ExpectedPaymentsPage>;
59
+ ): Core.PagePromise<ExpectedPaymentsPage, ExpectedPayment>;
60
+ list(options?: Core.RequestOptions): Core.PagePromise<ExpectedPaymentsPage, ExpectedPayment>;
61
61
  list(
62
62
  query: ExpectedPaymentListParams | Core.RequestOptions = {},
63
63
  options?: Core.RequestOptions,
64
- ): Core.PagePromise<ExpectedPaymentsPage> {
64
+ ): Core.PagePromise<ExpectedPaymentsPage, ExpectedPayment> {
65
65
  if (isRequestOptions(query)) {
66
66
  return this.list({}, query);
67
67
  }
@@ -71,7 +71,7 @@ export class ExpectedPayments extends APIResource {
71
71
  /**
72
72
  * delete expected payment
73
73
  */
74
- del(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<ExpectedPayment>> {
74
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<ExpectedPayment> {
75
75
  return this.delete(`/api/expected_payments/${id}`, options);
76
76
  }
77
77
  }
@@ -16,7 +16,7 @@ export class ExternalAccounts extends APIResource {
16
16
  create(
17
17
  params: ExternalAccountCreateParams,
18
18
  options?: Core.RequestOptions,
19
- ): Promise<Core.APIResponse<ExternalAccount>> {
19
+ ): Core.APIPromise<ExternalAccount> {
20
20
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
21
21
  return this.post('/api/external_accounts', {
22
22
  body,
@@ -28,7 +28,7 @@ export class ExternalAccounts extends APIResource {
28
28
  /**
29
29
  * show external account
30
30
  */
31
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<ExternalAccount>> {
31
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<ExternalAccount> {
32
32
  return this.get(`/api/external_accounts/${id}`, options);
33
33
  }
34
34
 
@@ -39,13 +39,13 @@ export class ExternalAccounts extends APIResource {
39
39
  id: string,
40
40
  body?: ExternalAccountUpdateParams,
41
41
  options?: Core.RequestOptions,
42
- ): Promise<Core.APIResponse<ExternalAccount>>;
43
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<ExternalAccount>>;
42
+ ): Core.APIPromise<ExternalAccount>;
43
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<ExternalAccount>;
44
44
  update(
45
45
  id: string,
46
46
  body: ExternalAccountUpdateParams | Core.RequestOptions = {},
47
47
  options?: Core.RequestOptions,
48
- ): Promise<Core.APIResponse<ExternalAccount>> {
48
+ ): Core.APIPromise<ExternalAccount> {
49
49
  if (isRequestOptions(body)) {
50
50
  return this.update(id, {}, body);
51
51
  }
@@ -58,12 +58,12 @@ export class ExternalAccounts extends APIResource {
58
58
  list(
59
59
  query?: ExternalAccountListParams,
60
60
  options?: Core.RequestOptions,
61
- ): Core.PagePromise<ExternalAccountsPage>;
62
- list(options?: Core.RequestOptions): Core.PagePromise<ExternalAccountsPage>;
61
+ ): Core.PagePromise<ExternalAccountsPage, ExternalAccount>;
62
+ list(options?: Core.RequestOptions): Core.PagePromise<ExternalAccountsPage, ExternalAccount>;
63
63
  list(
64
64
  query: ExternalAccountListParams | Core.RequestOptions = {},
65
65
  options?: Core.RequestOptions,
66
- ): Core.PagePromise<ExternalAccountsPage> {
66
+ ): Core.PagePromise<ExternalAccountsPage, ExternalAccount> {
67
67
  if (isRequestOptions(query)) {
68
68
  return this.list({}, query);
69
69
  }
@@ -73,7 +73,7 @@ export class ExternalAccounts extends APIResource {
73
73
  /**
74
74
  * delete external account
75
75
  */
76
- del(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<void>> {
76
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
77
77
  return this.delete(`/api/external_accounts/${id}`, {
78
78
  ...options,
79
79
  headers: { Accept: '', ...options?.headers },
@@ -87,13 +87,13 @@ export class ExternalAccounts extends APIResource {
87
87
  id: string,
88
88
  params?: ExternalAccountCompleteVerificationParams,
89
89
  options?: Core.RequestOptions,
90
- ): Promise<Core.APIResponse<ExternalAccount>>;
91
- completeVerification(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<ExternalAccount>>;
90
+ ): Core.APIPromise<ExternalAccount>;
91
+ completeVerification(id: string, options?: Core.RequestOptions): Core.APIPromise<ExternalAccount>;
92
92
  completeVerification(
93
93
  id: string,
94
94
  params: ExternalAccountCompleteVerificationParams | Core.RequestOptions = {},
95
95
  options?: Core.RequestOptions,
96
- ): Promise<Core.APIResponse<ExternalAccount>> {
96
+ ): Core.APIPromise<ExternalAccount> {
97
97
  if (isRequestOptions(params)) {
98
98
  return this.completeVerification(id, {}, params);
99
99
  }
@@ -112,7 +112,7 @@ export class ExternalAccounts extends APIResource {
112
112
  id: string,
113
113
  params: ExternalAccountVerifyParams,
114
114
  options?: Core.RequestOptions,
115
- ): Promise<Core.APIResponse<ExternalAccount>> {
115
+ ): Core.APIPromise<ExternalAccount> {
116
116
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
117
117
  return this.post(`/api/external_accounts/${id}/verify`, {
118
118
  body,
@@ -12,7 +12,7 @@ export class IncomingPaymentDetails extends APIResource {
12
12
  /**
13
13
  * Get an existing Incoming Payment Detail.
14
14
  */
15
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<IncomingPaymentDetail>> {
15
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<IncomingPaymentDetail> {
16
16
  return this.get(`/api/incoming_payment_details/${id}`, options);
17
17
  }
18
18
 
@@ -23,13 +23,13 @@ export class IncomingPaymentDetails extends APIResource {
23
23
  id: string,
24
24
  body?: IncomingPaymentDetailUpdateParams,
25
25
  options?: Core.RequestOptions,
26
- ): Promise<Core.APIResponse<IncomingPaymentDetail>>;
27
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<IncomingPaymentDetail>>;
26
+ ): Core.APIPromise<IncomingPaymentDetail>;
27
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<IncomingPaymentDetail>;
28
28
  update(
29
29
  id: string,
30
30
  body: IncomingPaymentDetailUpdateParams | Core.RequestOptions = {},
31
31
  options?: Core.RequestOptions,
32
- ): Promise<Core.APIResponse<IncomingPaymentDetail>> {
32
+ ): Core.APIPromise<IncomingPaymentDetail> {
33
33
  if (isRequestOptions(body)) {
34
34
  return this.update(id, {}, body);
35
35
  }
@@ -42,12 +42,12 @@ export class IncomingPaymentDetails extends APIResource {
42
42
  list(
43
43
  query?: IncomingPaymentDetailListParams,
44
44
  options?: Core.RequestOptions,
45
- ): Core.PagePromise<IncomingPaymentDetailsPage>;
46
- list(options?: Core.RequestOptions): Core.PagePromise<IncomingPaymentDetailsPage>;
45
+ ): Core.PagePromise<IncomingPaymentDetailsPage, IncomingPaymentDetail>;
46
+ list(options?: Core.RequestOptions): Core.PagePromise<IncomingPaymentDetailsPage, IncomingPaymentDetail>;
47
47
  list(
48
48
  query: IncomingPaymentDetailListParams | Core.RequestOptions = {},
49
49
  options?: Core.RequestOptions,
50
- ): Core.PagePromise<IncomingPaymentDetailsPage> {
50
+ ): Core.PagePromise<IncomingPaymentDetailsPage, IncomingPaymentDetail> {
51
51
  if (isRequestOptions(query)) {
52
52
  return this.list({}, query);
53
53
  }
@@ -63,12 +63,12 @@ export class IncomingPaymentDetails extends APIResource {
63
63
  createAsync(
64
64
  params?: IncomingPaymentDetailCreateAsyncParams,
65
65
  options?: Core.RequestOptions,
66
- ): Promise<Core.APIResponse<Shared.AsyncResponse>>;
67
- createAsync(options?: Core.RequestOptions): Promise<Core.APIResponse<Shared.AsyncResponse>>;
66
+ ): Core.APIPromise<Shared.AsyncResponse>;
67
+ createAsync(options?: Core.RequestOptions): Core.APIPromise<Shared.AsyncResponse>;
68
68
  createAsync(
69
69
  params: IncomingPaymentDetailCreateAsyncParams | Core.RequestOptions = {},
70
70
  options?: Core.RequestOptions,
71
- ): Promise<Core.APIResponse<Shared.AsyncResponse>> {
71
+ ): Core.APIPromise<Shared.AsyncResponse> {
72
72
  if (isRequestOptions(params)) {
73
73
  return this.createAsync({}, params);
74
74
  }
@@ -290,6 +290,11 @@ export interface IncomingPaymentDetailCreateAsyncParams {
290
290
  */
291
291
  currency?: Shared.Currency | null;
292
292
 
293
+ /**
294
+ * Body param: Defaults to a random description.
295
+ */
296
+ description?: string | null;
297
+
293
298
  /**
294
299
  * Body param: One of `credit`, `debit`.
295
300
  */
@@ -97,7 +97,6 @@ export {
97
97
  LedgerAccountCategoryRetrieveParams,
98
98
  LedgerAccountCategoryUpdateParams,
99
99
  LedgerAccountCategoryListParams,
100
- LedgerAccountCategoryDeleteParams,
101
100
  LedgerAccountCategoriesPage,
102
101
  LedgerAccountCategories,
103
102
  } from './ledger-account-categories';
@@ -15,7 +15,7 @@ export class BalanceReports extends APIResource {
15
15
  internalAccountId: string,
16
16
  id: string,
17
17
  options?: Core.RequestOptions,
18
- ): Promise<Core.APIResponse<BalanceReport>> {
18
+ ): Core.APIPromise<BalanceReport> {
19
19
  return this.get(`/api/internal_accounts/${internalAccountId}/balance_reports/${id}`, options);
20
20
  }
21
21
 
@@ -26,13 +26,16 @@ export class BalanceReports extends APIResource {
26
26
  internalAccountId: string,
27
27
  query?: BalanceReportListParams,
28
28
  options?: Core.RequestOptions,
29
- ): Core.PagePromise<BalanceReportsPage>;
30
- list(internalAccountId: string, options?: Core.RequestOptions): Core.PagePromise<BalanceReportsPage>;
29
+ ): Core.PagePromise<BalanceReportsPage, BalanceReport>;
30
+ list(
31
+ internalAccountId: string,
32
+ options?: Core.RequestOptions,
33
+ ): Core.PagePromise<BalanceReportsPage, BalanceReport>;
31
34
  list(
32
35
  internalAccountId: string,
33
36
  query: BalanceReportListParams | Core.RequestOptions = {},
34
37
  options?: Core.RequestOptions,
35
- ): Core.PagePromise<BalanceReportsPage> {
38
+ ): Core.PagePromise<BalanceReportsPage, BalanceReport> {
36
39
  if (isRequestOptions(query)) {
37
40
  return this.list(internalAccountId, {}, query);
38
41
  }
@@ -20,7 +20,7 @@ export class InternalAccounts extends APIResource {
20
20
  create(
21
21
  params: InternalAccountCreateParams,
22
22
  options?: Core.RequestOptions,
23
- ): Promise<Core.APIResponse<InternalAccount>> {
23
+ ): Core.APIPromise<InternalAccount> {
24
24
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
25
25
  return this.post('/api/internal_accounts', {
26
26
  body,
@@ -32,7 +32,7 @@ export class InternalAccounts extends APIResource {
32
32
  /**
33
33
  * get internal account
34
34
  */
35
- retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<InternalAccount>> {
35
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<InternalAccount> {
36
36
  return this.get(`/api/internal_accounts/${id}`, options);
37
37
  }
38
38
 
@@ -43,13 +43,13 @@ export class InternalAccounts extends APIResource {
43
43
  id: string,
44
44
  body?: InternalAccountUpdateParams,
45
45
  options?: Core.RequestOptions,
46
- ): Promise<Core.APIResponse<InternalAccount>>;
47
- update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<InternalAccount>>;
46
+ ): Core.APIPromise<InternalAccount>;
47
+ update(id: string, options?: Core.RequestOptions): Core.APIPromise<InternalAccount>;
48
48
  update(
49
49
  id: string,
50
50
  body: InternalAccountUpdateParams | Core.RequestOptions = {},
51
51
  options?: Core.RequestOptions,
52
- ): Promise<Core.APIResponse<InternalAccount>> {
52
+ ): Core.APIPromise<InternalAccount> {
53
53
  if (isRequestOptions(body)) {
54
54
  return this.update(id, {}, body);
55
55
  }
@@ -62,12 +62,12 @@ export class InternalAccounts extends APIResource {
62
62
  list(
63
63
  query?: InternalAccountListParams,
64
64
  options?: Core.RequestOptions,
65
- ): Core.PagePromise<InternalAccountsPage>;
66
- list(options?: Core.RequestOptions): Core.PagePromise<InternalAccountsPage>;
65
+ ): Core.PagePromise<InternalAccountsPage, InternalAccount>;
66
+ list(options?: Core.RequestOptions): Core.PagePromise<InternalAccountsPage, InternalAccount>;
67
67
  list(
68
68
  query: InternalAccountListParams | Core.RequestOptions = {},
69
69
  options?: Core.RequestOptions,
70
- ): Core.PagePromise<InternalAccountsPage> {
70
+ ): Core.PagePromise<InternalAccountsPage, InternalAccount> {
71
71
  if (isRequestOptions(query)) {
72
72
  return this.list({}, query);
73
73
  }