modern-treasury 2.7.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +5 -8
  3. package/_shims/auto/types.d.ts +3 -1
  4. package/_shims/index.d.ts +2 -0
  5. package/_shims/node-runtime.d.ts.map +1 -1
  6. package/_shims/node-runtime.js +3 -0
  7. package/_shims/node-runtime.js.map +1 -1
  8. package/_shims/node-runtime.mjs +2 -0
  9. package/_shims/node-runtime.mjs.map +1 -1
  10. package/_shims/node-types.d.ts +1 -1
  11. package/_shims/registry.d.ts +2 -0
  12. package/_shims/registry.d.ts.map +1 -1
  13. package/_shims/registry.js +3 -1
  14. package/_shims/registry.js.map +1 -1
  15. package/_shims/registry.mjs +2 -0
  16. package/_shims/registry.mjs.map +1 -1
  17. package/_shims/web-runtime.d.ts.map +1 -1
  18. package/_shims/web-runtime.js +8 -0
  19. package/_shims/web-runtime.js.map +1 -1
  20. package/_shims/web-runtime.mjs +8 -0
  21. package/_shims/web-runtime.mjs.map +1 -1
  22. package/_shims/web-types.d.ts +2 -1
  23. package/core.d.ts +1 -1
  24. package/core.d.ts.map +1 -1
  25. package/core.js +38 -23
  26. package/core.js.map +1 -1
  27. package/core.mjs +36 -21
  28. package/core.mjs.map +1 -1
  29. package/error.d.ts.map +1 -1
  30. package/error.js +14 -4
  31. package/error.js.map +1 -1
  32. package/error.mjs +14 -4
  33. package/error.mjs.map +1 -1
  34. package/index.d.mts +20 -14
  35. package/index.d.ts +20 -14
  36. package/index.d.ts.map +1 -1
  37. package/index.js +6 -6
  38. package/index.js.map +1 -1
  39. package/index.mjs +6 -6
  40. package/index.mjs.map +1 -1
  41. package/package.json +3 -2
  42. package/resources/account-collection-flows.d.ts +9 -11
  43. package/resources/account-collection-flows.d.ts.map +1 -1
  44. package/resources/account-collection-flows.js +25 -0
  45. package/resources/account-collection-flows.js.map +1 -1
  46. package/resources/account-collection-flows.mjs +2 -0
  47. package/resources/account-collection-flows.mjs.map +1 -1
  48. package/resources/account-details.d.ts +6 -8
  49. package/resources/account-details.d.ts.map +1 -1
  50. package/resources/account-details.js +25 -0
  51. package/resources/account-details.js.map +1 -1
  52. package/resources/account-details.mjs +2 -0
  53. package/resources/account-details.mjs.map +1 -1
  54. package/resources/connections.d.ts +5 -7
  55. package/resources/connections.d.ts.map +1 -1
  56. package/resources/connections.js +25 -0
  57. package/resources/connections.js.map +1 -1
  58. package/resources/connections.mjs +2 -0
  59. package/resources/connections.mjs.map +1 -1
  60. package/resources/counterparties.d.ts +22 -23
  61. package/resources/counterparties.d.ts.map +1 -1
  62. package/resources/counterparties.js +25 -0
  63. package/resources/counterparties.js.map +1 -1
  64. package/resources/counterparties.mjs +2 -0
  65. package/resources/counterparties.mjs.map +1 -1
  66. package/resources/documents.d.ts +9 -11
  67. package/resources/documents.d.ts.map +1 -1
  68. package/resources/documents.js +25 -0
  69. package/resources/documents.js.map +1 -1
  70. package/resources/documents.mjs +2 -0
  71. package/resources/documents.mjs.map +1 -1
  72. package/resources/events.d.ts +5 -7
  73. package/resources/events.d.ts.map +1 -1
  74. package/resources/events.js +25 -0
  75. package/resources/events.js.map +1 -1
  76. package/resources/events.mjs +2 -0
  77. package/resources/events.mjs.map +1 -1
  78. package/resources/expected-payments.d.ts +26 -16
  79. package/resources/expected-payments.d.ts.map +1 -1
  80. package/resources/expected-payments.js +25 -0
  81. package/resources/expected-payments.js.map +1 -1
  82. package/resources/expected-payments.mjs +2 -0
  83. package/resources/expected-payments.mjs.map +1 -1
  84. package/resources/external-accounts.d.ts +18 -20
  85. package/resources/external-accounts.d.ts.map +1 -1
  86. package/resources/external-accounts.js +25 -0
  87. package/resources/external-accounts.js.map +1 -1
  88. package/resources/external-accounts.mjs +2 -0
  89. package/resources/external-accounts.mjs.map +1 -1
  90. package/resources/incoming-payment-details.d.ts +12 -14
  91. package/resources/incoming-payment-details.d.ts.map +1 -1
  92. package/resources/incoming-payment-details.js +25 -0
  93. package/resources/incoming-payment-details.js.map +1 -1
  94. package/resources/incoming-payment-details.mjs +2 -0
  95. package/resources/incoming-payment-details.mjs.map +1 -1
  96. package/resources/index.d.ts +1 -1
  97. package/resources/index.d.ts.map +1 -1
  98. package/resources/index.js +2 -2
  99. package/resources/index.js.map +1 -1
  100. package/resources/index.mjs +1 -1
  101. package/resources/index.mjs.map +1 -1
  102. package/resources/internal-accounts/balance-reports.d.ts +5 -7
  103. package/resources/internal-accounts/balance-reports.d.ts.map +1 -1
  104. package/resources/internal-accounts/balance-reports.js +25 -0
  105. package/resources/internal-accounts/balance-reports.js.map +1 -1
  106. package/resources/internal-accounts/balance-reports.mjs +2 -0
  107. package/resources/internal-accounts/balance-reports.mjs.map +1 -1
  108. package/resources/internal-accounts/internal-accounts.d.ts +25 -23
  109. package/resources/internal-accounts/internal-accounts.d.ts.map +1 -1
  110. package/resources/internal-accounts/internal-accounts.js +6 -5
  111. package/resources/internal-accounts/internal-accounts.js.map +1 -1
  112. package/resources/internal-accounts/internal-accounts.mjs +6 -5
  113. package/resources/internal-accounts/internal-accounts.mjs.map +1 -1
  114. package/resources/invoices/invoices.d.ts +39 -26
  115. package/resources/invoices/invoices.d.ts.map +1 -1
  116. package/resources/invoices/invoices.js +6 -5
  117. package/resources/invoices/invoices.js.map +1 -1
  118. package/resources/invoices/invoices.mjs +6 -5
  119. package/resources/invoices/invoices.mjs.map +1 -1
  120. package/resources/invoices/line-items.d.ts +7 -9
  121. package/resources/invoices/line-items.d.ts.map +1 -1
  122. package/resources/invoices/line-items.js +25 -0
  123. package/resources/invoices/line-items.js.map +1 -1
  124. package/resources/invoices/line-items.mjs +2 -0
  125. package/resources/invoices/line-items.mjs.map +1 -1
  126. package/resources/ledger-account-balance-monitors.d.ts +7 -9
  127. package/resources/ledger-account-balance-monitors.d.ts.map +1 -1
  128. package/resources/ledger-account-balance-monitors.js +25 -0
  129. package/resources/ledger-account-balance-monitors.js.map +1 -1
  130. package/resources/ledger-account-balance-monitors.mjs +2 -0
  131. package/resources/ledger-account-balance-monitors.mjs.map +1 -1
  132. package/resources/ledger-account-categories.d.ts +11 -12
  133. package/resources/ledger-account-categories.d.ts.map +1 -1
  134. package/resources/ledger-account-categories.js +25 -0
  135. package/resources/ledger-account-categories.js.map +1 -1
  136. package/resources/ledger-account-categories.mjs +2 -0
  137. package/resources/ledger-account-categories.mjs.map +1 -1
  138. package/resources/ledger-account-payouts.d.ts +17 -9
  139. package/resources/ledger-account-payouts.d.ts.map +1 -1
  140. package/resources/ledger-account-payouts.js +25 -0
  141. package/resources/ledger-account-payouts.js.map +1 -1
  142. package/resources/ledger-account-payouts.mjs +2 -0
  143. package/resources/ledger-account-payouts.mjs.map +1 -1
  144. package/resources/ledger-account-statements.d.ts +7 -6
  145. package/resources/ledger-account-statements.d.ts.map +1 -1
  146. package/resources/ledger-account-statements.js.map +1 -1
  147. package/resources/ledger-account-statements.mjs.map +1 -1
  148. package/resources/ledger-accounts.d.ts +11 -12
  149. package/resources/ledger-accounts.d.ts.map +1 -1
  150. package/resources/ledger-accounts.js +25 -0
  151. package/resources/ledger-accounts.js.map +1 -1
  152. package/resources/ledger-accounts.mjs +2 -0
  153. package/resources/ledger-accounts.mjs.map +1 -1
  154. package/resources/ledger-entries.d.ts +9 -10
  155. package/resources/ledger-entries.d.ts.map +1 -1
  156. package/resources/ledger-entries.js +25 -0
  157. package/resources/ledger-entries.js.map +1 -1
  158. package/resources/ledger-entries.mjs +2 -0
  159. package/resources/ledger-entries.mjs.map +1 -1
  160. package/resources/ledger-event-handlers.d.ts +47 -270
  161. package/resources/ledger-event-handlers.d.ts.map +1 -1
  162. package/resources/ledger-event-handlers.js +29 -7
  163. package/resources/ledger-event-handlers.js.map +1 -1
  164. package/resources/ledger-event-handlers.mjs +4 -5
  165. package/resources/ledger-event-handlers.mjs.map +1 -1
  166. package/resources/ledger-transactions/ledger-transactions.d.ts +19 -20
  167. package/resources/ledger-transactions/ledger-transactions.d.ts.map +1 -1
  168. package/resources/ledger-transactions/ledger-transactions.js +6 -5
  169. package/resources/ledger-transactions/ledger-transactions.js.map +1 -1
  170. package/resources/ledger-transactions/ledger-transactions.mjs +6 -5
  171. package/resources/ledger-transactions/ledger-transactions.mjs.map +1 -1
  172. package/resources/ledger-transactions/versions.d.ts +7 -8
  173. package/resources/ledger-transactions/versions.d.ts.map +1 -1
  174. package/resources/ledger-transactions/versions.js +25 -0
  175. package/resources/ledger-transactions/versions.js.map +1 -1
  176. package/resources/ledger-transactions/versions.mjs +2 -0
  177. package/resources/ledger-transactions/versions.mjs.map +1 -1
  178. package/resources/ledgerable-events.d.ts +4 -41
  179. package/resources/ledgerable-events.d.ts.map +1 -1
  180. package/resources/ledgerable-events.js +1 -2
  181. package/resources/ledgerable-events.js.map +1 -1
  182. package/resources/ledgerable-events.mjs +1 -2
  183. package/resources/ledgerable-events.mjs.map +1 -1
  184. package/resources/ledgers.d.ts +7 -9
  185. package/resources/ledgers.d.ts.map +1 -1
  186. package/resources/ledgers.js +25 -0
  187. package/resources/ledgers.js.map +1 -1
  188. package/resources/ledgers.mjs +2 -0
  189. package/resources/ledgers.mjs.map +1 -1
  190. package/resources/line-items.d.ts +6 -8
  191. package/resources/line-items.d.ts.map +1 -1
  192. package/resources/line-items.js +25 -0
  193. package/resources/line-items.js.map +1 -1
  194. package/resources/line-items.mjs +2 -0
  195. package/resources/line-items.mjs.map +1 -1
  196. package/resources/paper-items.d.ts +5 -7
  197. package/resources/paper-items.d.ts.map +1 -1
  198. package/resources/paper-items.js +25 -0
  199. package/resources/paper-items.js.map +1 -1
  200. package/resources/paper-items.mjs +2 -0
  201. package/resources/paper-items.mjs.map +1 -1
  202. package/resources/payment-flows.d.ts +7 -9
  203. package/resources/payment-flows.d.ts.map +1 -1
  204. package/resources/payment-flows.js +25 -0
  205. package/resources/payment-flows.js.map +1 -1
  206. package/resources/payment-flows.mjs +2 -0
  207. package/resources/payment-flows.mjs.map +1 -1
  208. package/resources/payment-orders/payment-orders.d.ts +75 -50
  209. package/resources/payment-orders/payment-orders.d.ts.map +1 -1
  210. package/resources/payment-orders/payment-orders.js +6 -5
  211. package/resources/payment-orders/payment-orders.js.map +1 -1
  212. package/resources/payment-orders/payment-orders.mjs +6 -5
  213. package/resources/payment-orders/payment-orders.mjs.map +1 -1
  214. package/resources/payment-orders/reversals.d.ts +8 -9
  215. package/resources/payment-orders/reversals.d.ts.map +1 -1
  216. package/resources/payment-orders/reversals.js +25 -0
  217. package/resources/payment-orders/reversals.js.map +1 -1
  218. package/resources/payment-orders/reversals.mjs +2 -0
  219. package/resources/payment-orders/reversals.mjs.map +1 -1
  220. package/resources/payment-references.d.ts +5 -7
  221. package/resources/payment-references.d.ts.map +1 -1
  222. package/resources/payment-references.js +25 -0
  223. package/resources/payment-references.js.map +1 -1
  224. package/resources/payment-references.mjs +2 -0
  225. package/resources/payment-references.mjs.map +1 -1
  226. package/resources/returns.d.ts +11 -13
  227. package/resources/returns.d.ts.map +1 -1
  228. package/resources/returns.js +25 -0
  229. package/resources/returns.js.map +1 -1
  230. package/resources/returns.mjs +2 -0
  231. package/resources/returns.mjs.map +1 -1
  232. package/resources/routing-details.d.ts +16 -14
  233. package/resources/routing-details.d.ts.map +1 -1
  234. package/resources/routing-details.js +25 -0
  235. package/resources/routing-details.js.map +1 -1
  236. package/resources/routing-details.mjs +2 -0
  237. package/resources/routing-details.mjs.map +1 -1
  238. package/resources/shared.d.ts +1 -0
  239. package/resources/shared.d.ts.map +1 -1
  240. package/resources/top-level.d.ts +2 -2
  241. package/resources/top-level.d.ts.map +1 -1
  242. package/resources/transactions/line-items.d.ts +10 -7
  243. package/resources/transactions/line-items.d.ts.map +1 -1
  244. package/resources/transactions/line-items.js +25 -0
  245. package/resources/transactions/line-items.js.map +1 -1
  246. package/resources/transactions/line-items.mjs +2 -0
  247. package/resources/transactions/line-items.mjs.map +1 -1
  248. package/resources/transactions/transactions.d.ts +28 -30
  249. package/resources/transactions/transactions.d.ts.map +1 -1
  250. package/resources/transactions/transactions.js +6 -5
  251. package/resources/transactions/transactions.js.map +1 -1
  252. package/resources/transactions/transactions.mjs +6 -5
  253. package/resources/transactions/transactions.mjs.map +1 -1
  254. package/resources/validations.d.ts +14 -14
  255. package/resources/validations.d.ts.map +1 -1
  256. package/resources/validations.js.map +1 -1
  257. package/resources/validations.mjs.map +1 -1
  258. package/resources/virtual-accounts.d.ts +16 -16
  259. package/resources/virtual-accounts.d.ts.map +1 -1
  260. package/resources/virtual-accounts.js +25 -0
  261. package/resources/virtual-accounts.js.map +1 -1
  262. package/resources/virtual-accounts.mjs +2 -0
  263. package/resources/virtual-accounts.mjs.map +1 -1
  264. package/resources/webhooks.d.ts.map +1 -1
  265. package/resources/webhooks.js +2 -2
  266. package/resources/webhooks.js.map +1 -1
  267. package/resources/webhooks.mjs +3 -3
  268. package/resources/webhooks.mjs.map +1 -1
  269. package/shims/node.d.ts +1 -1
  270. package/shims/node.d.ts.map +1 -1
  271. package/shims/web.d.ts +1 -1
  272. package/shims/web.d.ts.map +1 -1
  273. package/src/_shims/auto/types.d.ts +3 -1
  274. package/src/_shims/index.d.ts +3 -1
  275. package/src/_shims/index.mjs +1 -1
  276. package/src/_shims/node-runtime.ts +4 -0
  277. package/src/_shims/node-types.d.ts +1 -1
  278. package/src/_shims/registry.ts +3 -0
  279. package/src/_shims/web-runtime.ts +12 -0
  280. package/src/_shims/web-types.d.ts +2 -1
  281. package/src/core.ts +39 -21
  282. package/src/error.ts +15 -5
  283. package/src/index.ts +23 -17
  284. package/src/resources/account-collection-flows.ts +12 -12
  285. package/src/resources/account-details.ts +10 -12
  286. package/src/resources/connections.ts +8 -10
  287. package/src/resources/counterparties.ts +32 -26
  288. package/src/resources/documents.ts +13 -12
  289. package/src/resources/events.ts +8 -10
  290. package/src/resources/expected-payments.ts +37 -18
  291. package/src/resources/external-accounts.ts +30 -24
  292. package/src/resources/incoming-payment-details.ts +17 -17
  293. package/src/resources/index.ts +3 -5
  294. package/src/resources/internal-accounts/balance-reports.ts +9 -11
  295. package/src/resources/internal-accounts/internal-accounts.ts +32 -27
  296. package/src/resources/invoices/invoices.ts +56 -35
  297. package/src/resources/invoices/line-items.ts +10 -12
  298. package/src/resources/ledger-account-balance-monitors.ts +10 -12
  299. package/src/resources/ledger-account-categories.ts +14 -15
  300. package/src/resources/ledger-account-payouts.ts +23 -12
  301. package/src/resources/ledger-account-statements.ts +9 -8
  302. package/src/resources/ledger-accounts.ts +14 -15
  303. package/src/resources/ledger-entries.ts +12 -13
  304. package/src/resources/ledger-event-handlers.ts +53 -336
  305. package/src/resources/ledger-transactions/ledger-transactions.ts +22 -24
  306. package/src/resources/ledger-transactions/versions.ts +10 -11
  307. package/src/resources/ledgerable-events.ts +6 -51
  308. package/src/resources/ledgers.ts +10 -12
  309. package/src/resources/line-items.ts +9 -11
  310. package/src/resources/paper-items.ts +9 -11
  311. package/src/resources/payment-flows.ts +10 -12
  312. package/src/resources/payment-orders/payment-orders.ts +110 -56
  313. package/src/resources/payment-orders/reversals.ts +11 -12
  314. package/src/resources/payment-references.ts +8 -10
  315. package/src/resources/returns.ts +16 -18
  316. package/src/resources/routing-details.ts +26 -14
  317. package/src/resources/shared.ts +2 -0
  318. package/src/resources/top-level.ts +2 -2
  319. package/src/resources/transactions/line-items.ts +14 -10
  320. package/src/resources/transactions/transactions.ts +35 -35
  321. package/src/resources/validations.ts +19 -13
  322. package/src/resources/virtual-accounts.ts +22 -17
  323. package/src/resources/webhooks.ts +6 -5
  324. package/src/shims/node.ts +1 -1
  325. package/src/shims/web.ts +1 -1
  326. package/src/version.ts +1 -1
  327. package/version.d.ts +1 -1
  328. package/version.js +1 -1
  329. package/version.mjs +1 -1
@@ -1,10 +1,10 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from "../treasury/core";
4
- import { APIResource } from "../treasury/resource";
5
- import { isRequestOptions } from "../treasury/core";
6
- import * as API from './index';
7
- import { Page, PageParams } from "../treasury/pagination";
3
+ import * as Core from "../core";
4
+ import { APIResource } from "../resource";
5
+ import { isRequestOptions } from "../core";
6
+ import * as LedgerEventHandlersAPI from "./ledger-event-handlers";
7
+ import { Page, type PageParams } from "../pagination";
8
8
 
9
9
  export class LedgerEventHandlers extends APIResource {
10
10
  /**
@@ -13,7 +13,7 @@ export class LedgerEventHandlers extends APIResource {
13
13
  create(
14
14
  params: LedgerEventHandlerCreateParams,
15
15
  options?: Core.RequestOptions,
16
- ): Core.APIPromise<LedgerEventHandlerCreateResponse> {
16
+ ): Core.APIPromise<LedgerEventHandler> {
17
17
  // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
18
18
  const { 'Idempotency-Key': idempotencyKey, ...body } = params;
19
19
  if (idempotencyKey) {
@@ -31,7 +31,7 @@ export class LedgerEventHandlers extends APIResource {
31
31
  /**
32
32
  * Get details on a single ledger event handler.
33
33
  */
34
- retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEventHandlerRetrieveResponse> {
34
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEventHandler> {
35
35
  return this.get(`/api/ledger_event_handlers/${id}`, options);
36
36
  }
37
37
 
@@ -41,39 +41,32 @@ export class LedgerEventHandlers extends APIResource {
41
41
  list(
42
42
  query?: LedgerEventHandlerListParams,
43
43
  options?: Core.RequestOptions,
44
- ): Core.PagePromise<LedgerEventHandlerListResponsesPage, LedgerEventHandlerListResponse>;
45
- list(
46
- options?: Core.RequestOptions,
47
- ): Core.PagePromise<LedgerEventHandlerListResponsesPage, LedgerEventHandlerListResponse>;
44
+ ): Core.PagePromise<LedgerEventHandlersPage, LedgerEventHandler>;
45
+ list(options?: Core.RequestOptions): Core.PagePromise<LedgerEventHandlersPage, LedgerEventHandler>;
48
46
  list(
49
47
  query: LedgerEventHandlerListParams | Core.RequestOptions = {},
50
48
  options?: Core.RequestOptions,
51
- ): Core.PagePromise<LedgerEventHandlerListResponsesPage, LedgerEventHandlerListResponse> {
49
+ ): Core.PagePromise<LedgerEventHandlersPage, LedgerEventHandler> {
52
50
  if (isRequestOptions(query)) {
53
51
  return this.list({}, query);
54
52
  }
55
- return this.getAPIList('/api/ledger_event_handlers', LedgerEventHandlerListResponsesPage, {
56
- query,
57
- ...options,
58
- });
53
+ return this.getAPIList('/api/ledger_event_handlers', LedgerEventHandlersPage, { query, ...options });
59
54
  }
60
55
 
61
56
  /**
62
57
  * Archive a ledger event handler.
63
58
  */
64
- del(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEventHandlerDeleteResponse> {
59
+ del(id: string, options?: Core.RequestOptions): Core.APIPromise<LedgerEventHandler> {
65
60
  return this.delete(`/api/ledger_event_handlers/${id}`, options);
66
61
  }
67
62
  }
68
63
 
69
- export class LedgerEventHandlerListResponsesPage extends Page<LedgerEventHandlerListResponse> {}
70
- // alias so we can export it in the namespace
71
- type _LedgerEventHandlerListResponsesPage = LedgerEventHandlerListResponsesPage;
64
+ export class LedgerEventHandlersPage extends Page<LedgerEventHandler> {}
72
65
 
73
- export interface LedgerEventHandlerCreateResponse {
66
+ export interface LedgerEventHandler {
74
67
  id: string;
75
68
 
76
- conditions: LedgerEventHandlerCreateResponse.Conditions | null;
69
+ conditions: LedgerEventHandler.Conditions | null;
77
70
 
78
71
  created_at: string;
79
72
 
@@ -84,109 +77,12 @@ export interface LedgerEventHandlerCreateResponse {
84
77
 
85
78
  discarded_at: string | null;
86
79
 
87
- ledger_transaction_template: LedgerEventHandlerCreateResponse.LedgerTransactionTemplate;
88
-
89
- /**
90
- * This field will be true if this object exists in the live environment or false
91
- * if it exists in the test environment.
92
- */
93
- live_mode: boolean;
94
-
95
- /**
96
- * Additional data represented as key-value pairs. Both the key and value must be
97
- * strings.
98
- */
99
- metadata: Record<string, string> | null;
100
-
101
- /**
102
- * Name of the ledger event handler.
103
- */
104
- name: string;
105
-
106
- object: string;
107
-
108
- updated_at: string;
109
- }
110
-
111
- export namespace LedgerEventHandlerCreateResponse {
112
- export interface Conditions {
113
- /**
114
- * The field you're fetching from the `ledgerable_event`.
115
- */
116
- field: string;
117
-
118
- /**
119
- * What the operator between the `field` and `value` is. Currently only supports
120
- * `equals`.
121
- */
122
- operator: string;
123
-
124
- /**
125
- * What raw string you are comparing the `field` against.
126
- */
127
- value: string;
128
- }
129
-
130
- export interface LedgerTransactionTemplate {
131
- /**
132
- * An optional description for internal use.
133
- */
134
- description: string | null;
135
-
136
- /**
137
- * The timestamp (ISO8601 format) at which the ledger transaction happened for
138
- * reporting purposes.
139
- */
140
- effective_at: string | null;
141
-
142
- /**
143
- * An array of ledger entry objects.
144
- */
145
- ledger_entries: Array<LedgerTransactionTemplate.LedgerEntry>;
146
-
147
- /**
148
- * Additional data represented as key-value pairs. Both the key and value must be
149
- * strings.
150
- */
151
- metadata: Record<string, string> | null;
152
- }
153
-
154
- export namespace LedgerTransactionTemplate {
155
- export interface LedgerEntry {
156
- /**
157
- * The field you're fetching from the `ledgerable_event`.
158
- */
159
- amount: string;
160
-
161
- /**
162
- * What the operator between the `field` and `value` is. Currently only supports
163
- * `equals`.
164
- */
165
- direction: string;
166
-
167
- /**
168
- * What raw string you are comparing the `field` against.
169
- */
170
- ledger_account_id: string;
171
- }
172
- }
173
- }
174
-
175
- export interface LedgerEventHandlerRetrieveResponse {
176
- id: string;
177
-
178
- conditions: LedgerEventHandlerRetrieveResponse.Conditions | null;
179
-
180
- created_at: string;
181
-
182
80
  /**
183
- * An optional description.
81
+ * The id of the ledger that this event handler belongs to.
184
82
  */
185
- description: string | null;
186
-
187
- discarded_at: string | null;
83
+ ledger_id: string | null;
188
84
 
189
- ledger_transaction_template: LedgerEventHandlerRetrieveResponse.LedgerTransactionTemplate;
85
+ ledger_transaction_template: LedgerEventHandler.LedgerTransactionTemplate;
190
86
 
191
87
  /**
192
88
  * This field will be true if this object exists in the live environment or false
@@ -208,125 +104,24 @@ export interface LedgerEventHandlerRetrieveResponse {
208
104
  object: string;
209
105
 
210
106
  updated_at: string;
211
- }
212
107
 
213
- export namespace LedgerEventHandlerRetrieveResponse {
214
- export interface Conditions {
215
- /**
216
- * The field you're fetching from the `ledgerable_event`.
217
- */
218
- field: string;
219
-
220
- /**
221
- * What the operator between the `field` and `value` is. Currently only supports
222
- * `equals`.
223
- */
224
- operator: string;
225
-
226
- /**
227
- * What raw string you are comparing the `field` against.
228
- */
229
- value: string;
230
- }
231
-
232
- export interface LedgerTransactionTemplate {
233
- /**
234
- * An optional description for internal use.
235
- */
236
- description: string | null;
237
-
238
- /**
239
- * The timestamp (ISO8601 format) at which the ledger transaction happened for
240
- * reporting purposes.
241
- */
242
- effective_at: string | null;
243
-
244
- /**
245
- * An array of ledger entry objects.
246
- */
247
- ledger_entries: Array<LedgerTransactionTemplate.LedgerEntry>;
248
-
249
- /**
250
- * Additional data represented as key-value pairs. Both the key and value must be
251
- * strings.
252
- */
253
- metadata: Record<string, string> | null;
254
- }
255
-
256
- export namespace LedgerTransactionTemplate {
257
- export interface LedgerEntry {
258
- /**
259
- * The field you're fetching from the `ledgerable_event`.
260
- */
261
- amount: string;
262
-
263
- /**
264
- * What the operator between the `field` and `value` is. Currently only supports
265
- * `equals`.
266
- */
267
- direction: string;
268
-
269
- /**
270
- * What raw string you are comparing the `field` against.
271
- */
272
- ledger_account_id: string;
273
- }
274
- }
108
+ variables: Record<string, LedgerEventHandlerVariable> | null;
275
109
  }
276
110
 
277
- export interface LedgerEventHandlerListResponse {
278
- id: string;
279
-
280
- conditions: LedgerEventHandlerListResponse.Conditions | null;
281
-
282
- created_at: string;
283
-
284
- /**
285
- * An optional description.
286
- */
287
- description: string | null;
288
-
289
- discarded_at: string | null;
290
-
291
- ledger_transaction_template: LedgerEventHandlerListResponse.LedgerTransactionTemplate;
292
-
293
- /**
294
- * This field will be true if this object exists in the live environment or false
295
- * if it exists in the test environment.
296
- */
297
- live_mode: boolean;
298
-
299
- /**
300
- * Additional data represented as key-value pairs. Both the key and value must be
301
- * strings.
302
- */
303
- metadata: Record<string, string> | null;
304
-
305
- /**
306
- * Name of the ledger event handler.
307
- */
308
- name: string;
309
-
310
- object: string;
311
-
312
- updated_at: string;
313
- }
314
-
315
- export namespace LedgerEventHandlerListResponse {
111
+ export namespace LedgerEventHandler {
316
112
  export interface Conditions {
317
113
  /**
318
- * The field you're fetching from the `ledgerable_event`.
114
+ * The LHS of the conditional.
319
115
  */
320
116
  field: string;
321
117
 
322
118
  /**
323
- * What the operator between the `field` and `value` is. Currently only supports
324
- * `equals`.
119
+ * What the operator between the `field` and `value` is.
325
120
  */
326
121
  operator: string;
327
122
 
328
123
  /**
329
- * What raw string you are comparing the `field` against.
124
+ * The RHS of the conditional.
330
125
  */
331
126
  value: string;
332
127
  }
@@ -349,133 +144,58 @@ export namespace LedgerEventHandlerListResponse {
349
144
  ledger_entries: Array<LedgerTransactionTemplate.LedgerEntry>;
350
145
 
351
146
  /**
352
- * Additional data represented as key-value pairs. Both the key and value must be
353
- * strings.
147
+ * To post a ledger transaction at creation, use `posted`.
354
148
  */
355
- metadata: Record<string, string> | null;
149
+ status: string | null;
356
150
  }
357
151
 
358
152
  export namespace LedgerTransactionTemplate {
359
153
  export interface LedgerEntry {
360
154
  /**
361
- * The field you're fetching from the `ledgerable_event`.
155
+ * The LHS of the conditional.
362
156
  */
363
157
  amount: string;
364
158
 
365
159
  /**
366
- * What the operator between the `field` and `value` is. Currently only supports
367
- * `equals`.
160
+ * What the operator between the `field` and `value` is.
368
161
  */
369
162
  direction: string;
370
163
 
371
164
  /**
372
- * What raw string you are comparing the `field` against.
165
+ * The RHS of the conditional.
373
166
  */
374
167
  ledger_account_id: string;
375
168
  }
376
169
  }
377
170
  }
378
171
 
379
- export interface LedgerEventHandlerDeleteResponse {
380
- id: string;
381
-
382
- conditions: LedgerEventHandlerDeleteResponse.Conditions | null;
383
-
384
- created_at: string;
172
+ export interface LedgerEventHandlerVariable {
173
+ query: LedgerEventHandlerVariable.Query;
385
174
 
386
175
  /**
387
- * An optional description.
176
+ * The type of object this variable is. Currently, only "ledger_account" is
177
+ * supported.
388
178
  */
389
- description: string | null;
390
-
391
- discarded_at: string | null;
392
-
393
- ledger_transaction_template: LedgerEventHandlerDeleteResponse.LedgerTransactionTemplate;
394
-
395
- /**
396
- * This field will be true if this object exists in the live environment or false
397
- * if it exists in the test environment.
398
- */
399
- live_mode: boolean;
400
-
401
- /**
402
- * Additional data represented as key-value pairs. Both the key and value must be
403
- * strings.
404
- */
405
- metadata: Record<string, string> | null;
406
-
407
- /**
408
- * Name of the ledger event handler.
409
- */
410
- name: string;
411
-
412
- object: string;
413
-
414
- updated_at: string;
179
+ type: string;
415
180
  }
416
181
 
417
- export namespace LedgerEventHandlerDeleteResponse {
418
- export interface Conditions {
182
+ export namespace LedgerEventHandlerVariable {
183
+ export interface Query {
419
184
  /**
420
- * The field you're fetching from the `ledgerable_event`.
185
+ * The LHS of the conditional.
421
186
  */
422
187
  field: string;
423
188
 
424
189
  /**
425
- * What the operator between the `field` and `value` is. Currently only supports
426
- * `equals`.
190
+ * What the operator between the `field` and `value` is.
427
191
  */
428
192
  operator: string;
429
193
 
430
194
  /**
431
- * What raw string you are comparing the `field` against.
195
+ * The RHS of the conditional.
432
196
  */
433
197
  value: string;
434
198
  }
435
-
436
- export interface LedgerTransactionTemplate {
437
- /**
438
- * An optional description for internal use.
439
- */
440
- description: string | null;
441
-
442
- /**
443
- * The timestamp (ISO8601 format) at which the ledger transaction happened for
444
- * reporting purposes.
445
- */
446
- effective_at: string | null;
447
-
448
- /**
449
- * An array of ledger entry objects.
450
- */
451
- ledger_entries: Array<LedgerTransactionTemplate.LedgerEntry>;
452
-
453
- /**
454
- * Additional data represented as key-value pairs. Both the key and value must be
455
- * strings.
456
- */
457
- metadata: Record<string, string> | null;
458
- }
459
-
460
- export namespace LedgerTransactionTemplate {
461
- export interface LedgerEntry {
462
- /**
463
- * The field you're fetching from the `ledgerable_event`.
464
- */
465
- amount: string;
466
-
467
- /**
468
- * What the operator between the `field` and `value` is. Currently only supports
469
- * `equals`.
470
- */
471
- direction: string;
472
-
473
- /**
474
- * What raw string you are comparing the `field` against.
475
- */
476
- ledger_account_id: string;
477
- }
478
- }
479
199
  }
480
200
 
481
201
  export interface LedgerEventHandlerCreateParams {
@@ -503,6 +223,8 @@ export interface LedgerEventHandlerCreateParams {
503
223
  * strings.
504
224
  */
505
225
  metadata?: Record<string, string> | null;
226
+
227
+ variables?: Record<string, LedgerEventHandlerVariable> | null;
506
228
  }
507
229
 
508
230
  export namespace LedgerEventHandlerCreateParams {
@@ -524,27 +246,25 @@ export namespace LedgerEventHandlerCreateParams {
524
246
  ledger_entries: Array<LedgerTransactionTemplate.LedgerEntry>;
525
247
 
526
248
  /**
527
- * Additional data represented as key-value pairs. Both the key and value must be
528
- * strings.
249
+ * To post a ledger transaction at creation, use `posted`.
529
250
  */
530
- metadata: Record<string, string> | null;
251
+ status: string | null;
531
252
  }
532
253
 
533
254
  export namespace LedgerTransactionTemplate {
534
255
  export interface LedgerEntry {
535
256
  /**
536
- * The field you're fetching from the `ledgerable_event`.
257
+ * The LHS of the conditional.
537
258
  */
538
259
  amount: string;
539
260
 
540
261
  /**
541
- * What the operator between the `field` and `value` is. Currently only supports
542
- * `equals`.
262
+ * What the operator between the `field` and `value` is.
543
263
  */
544
264
  direction: string;
545
265
 
546
266
  /**
547
- * What raw string you are comparing the `field` against.
267
+ * The RHS of the conditional.
548
268
  */
549
269
  ledger_account_id: string;
550
270
  }
@@ -552,18 +272,17 @@ export namespace LedgerEventHandlerCreateParams {
552
272
 
553
273
  export interface Conditions {
554
274
  /**
555
- * The field you're fetching from the `ledgerable_event`.
275
+ * The LHS of the conditional.
556
276
  */
557
277
  field: string;
558
278
 
559
279
  /**
560
- * What the operator between the `field` and `value` is. Currently only supports
561
- * `equals`.
280
+ * What the operator between the `field` and `value` is.
562
281
  */
563
282
  operator: string;
564
283
 
565
284
  /**
566
- * What raw string you are comparing the `field` against.
285
+ * The RHS of the conditional.
567
286
  */
568
287
  value: string;
569
288
  }
@@ -588,11 +307,9 @@ export interface LedgerEventHandlerListParams extends PageParams {
588
307
  }
589
308
 
590
309
  export namespace LedgerEventHandlers {
591
- export import LedgerEventHandlerCreateResponse = API.LedgerEventHandlerCreateResponse;
592
- export import LedgerEventHandlerRetrieveResponse = API.LedgerEventHandlerRetrieveResponse;
593
- export import LedgerEventHandlerListResponse = API.LedgerEventHandlerListResponse;
594
- export import LedgerEventHandlerDeleteResponse = API.LedgerEventHandlerDeleteResponse;
595
- export type LedgerEventHandlerListResponsesPage = _LedgerEventHandlerListResponsesPage;
596
- export import LedgerEventHandlerCreateParams = API.LedgerEventHandlerCreateParams;
597
- export import LedgerEventHandlerListParams = API.LedgerEventHandlerListParams;
310
+ export import LedgerEventHandler = LedgerEventHandlersAPI.LedgerEventHandler;
311
+ export import LedgerEventHandlerVariable = LedgerEventHandlersAPI.LedgerEventHandlerVariable;
312
+ export import LedgerEventHandlersPage = LedgerEventHandlersAPI.LedgerEventHandlersPage;
313
+ export import LedgerEventHandlerCreateParams = LedgerEventHandlersAPI.LedgerEventHandlerCreateParams;
314
+ export import LedgerEventHandlerListParams = LedgerEventHandlersAPI.LedgerEventHandlerListParams;
598
315
  }
@@ -1,15 +1,16 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from "../../treasury/core";
4
- import { APIResource } from "../../treasury/resource";
5
- import { isRequestOptions } from "../../treasury/core";
6
- import * as LedgerEntries from "../../treasury/resources/ledger-entries";
7
- import { Versions } from './versions';
8
- import * as API from './index';
9
- import { Page, PageParams } from "../../treasury/pagination";
3
+ import * as Core from "../../core";
4
+ import { APIResource } from "../../resource";
5
+ import { isRequestOptions } from "../../core";
6
+ import * as LedgerTransactionsAPI from "./ledger-transactions";
7
+ import * as LedgerEntriesAPI from "../ledger-entries";
8
+ import * as Shared from "../shared";
9
+ import * as VersionsAPI from "./versions";
10
+ import { Page, type PageParams } from "../../pagination";
10
11
 
11
12
  export class LedgerTransactions extends APIResource {
12
- versions: Versions = new Versions(this.client);
13
+ versions: VersionsAPI.Versions = new VersionsAPI.Versions(this.client);
13
14
 
14
15
  /**
15
16
  * Create a ledger transaction.
@@ -99,8 +100,6 @@ export class LedgerTransactions extends APIResource {
99
100
  }
100
101
 
101
102
  export class LedgerTransactionsPage extends Page<LedgerTransaction> {}
102
- // alias so we can export it in the namespace
103
- type _LedgerTransactionsPage = LedgerTransactionsPage;
104
103
 
105
104
  export interface LedgerTransaction {
106
105
  id: string;
@@ -133,7 +132,7 @@ export interface LedgerTransaction {
133
132
  /**
134
133
  * An array of ledger entry objects.
135
134
  */
136
- ledger_entries: Array<LedgerEntries.LedgerEntry>;
135
+ ledger_entries: Array<LedgerEntriesAPI.LedgerEntry>;
137
136
 
138
137
  /**
139
138
  * The ID of the ledger this ledger transaction belongs to.
@@ -275,7 +274,7 @@ export namespace LedgerTransactionCreateParams {
275
274
  * `debit` pulls money from someone else's account to your own. Note that wire,
276
275
  * rtp, and check payments will always be `credit`.
277
276
  */
278
- direction: 'credit' | 'debit';
277
+ direction: Shared.TransactionDirection;
279
278
 
280
279
  /**
281
280
  * The ledger account that this ledger entry is associated with.
@@ -368,7 +367,7 @@ export namespace LedgerTransactionUpdateParams {
368
367
  * `debit` pulls money from someone else's account to your own. Note that wire,
369
368
  * rtp, and check payments will always be `credit`.
370
369
  */
371
- direction: 'credit' | 'debit';
370
+ direction: Shared.TransactionDirection;
372
371
 
373
372
  /**
374
373
  * The ledger account that this ledger entry is associated with.
@@ -564,15 +563,14 @@ export interface LedgerTransactionCreateReversalParams {
564
563
  }
565
564
 
566
565
  export namespace LedgerTransactions {
567
- export import LedgerTransaction = API.LedgerTransaction;
568
- export type LedgerTransactionsPage = _LedgerTransactionsPage;
569
- export import LedgerTransactionCreateParams = API.LedgerTransactionCreateParams;
570
- export import LedgerTransactionUpdateParams = API.LedgerTransactionUpdateParams;
571
- export import LedgerTransactionListParams = API.LedgerTransactionListParams;
572
- export import LedgerTransactionCreateReversalParams = API.LedgerTransactionCreateReversalParams;
573
-
574
- export import Versions = API.Versions;
575
- export import LedgerTransactionVersion = API.LedgerTransactionVersion;
576
- export import LedgerTransactionVersionsPage = API.LedgerTransactionVersionsPage;
577
- export import VersionListParams = API.VersionListParams;
566
+ export import LedgerTransaction = LedgerTransactionsAPI.LedgerTransaction;
567
+ export import LedgerTransactionsPage = LedgerTransactionsAPI.LedgerTransactionsPage;
568
+ export import LedgerTransactionCreateParams = LedgerTransactionsAPI.LedgerTransactionCreateParams;
569
+ export import LedgerTransactionUpdateParams = LedgerTransactionsAPI.LedgerTransactionUpdateParams;
570
+ export import LedgerTransactionListParams = LedgerTransactionsAPI.LedgerTransactionListParams;
571
+ export import LedgerTransactionCreateReversalParams = LedgerTransactionsAPI.LedgerTransactionCreateReversalParams;
572
+ export import Versions = VersionsAPI.Versions;
573
+ export import LedgerTransactionVersion = VersionsAPI.LedgerTransactionVersion;
574
+ export import LedgerTransactionVersionsPage = VersionsAPI.LedgerTransactionVersionsPage;
575
+ export import VersionListParams = VersionsAPI.VersionListParams;
578
576
  }
@@ -1,10 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as Core from "../../treasury/core";
4
- import { APIResource } from "../../treasury/resource";
5
- import { isRequestOptions } from "../../treasury/core";
6
- import * as API from './index';
7
- import { Page, PageParams } from "../../treasury/pagination";
3
+ import * as Core from "../../core";
4
+ import { APIResource } from "../../resource";
5
+ import { isRequestOptions } from "../../core";
6
+ import * as VersionsAPI from "./versions";
7
+ import * as Shared from "../shared";
8
+ import { Page, type PageParams } from "../../pagination";
8
9
 
9
10
  export class Versions extends APIResource {
10
11
  /**
@@ -32,8 +33,6 @@ export class Versions extends APIResource {
32
33
  }
33
34
 
34
35
  export class LedgerTransactionVersionsPage extends Page<LedgerTransactionVersion> {}
35
- // alias so we can export it in the namespace
36
- type _LedgerTransactionVersionsPage = LedgerTransactionVersionsPage;
37
36
 
38
37
  export interface LedgerTransactionVersion {
39
38
  id: string;
@@ -151,7 +150,7 @@ export namespace LedgerTransactionVersion {
151
150
  * `debit` pulls money from someone else's account to your own. Note that wire,
152
151
  * rtp, and check payments will always be `credit`.
153
152
  */
154
- direction: 'credit' | 'debit';
153
+ direction: Shared.TransactionDirection;
155
154
 
156
155
  /**
157
156
  * The currency of the ledger account.
@@ -341,7 +340,7 @@ export interface VersionListParams extends PageParams {
341
340
  }
342
341
 
343
342
  export namespace Versions {
344
- export import LedgerTransactionVersion = API.LedgerTransactionVersion;
345
- export type LedgerTransactionVersionsPage = _LedgerTransactionVersionsPage;
346
- export import VersionListParams = API.VersionListParams;
343
+ export import LedgerTransactionVersion = VersionsAPI.LedgerTransactionVersion;
344
+ export import LedgerTransactionVersionsPage = VersionsAPI.LedgerTransactionVersionsPage;
345
+ export import VersionListParams = VersionsAPI.VersionListParams;
347
346
  }