diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 898c7258..79ae23c2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.14.0" + ".": "4.15.0" } diff --git a/.stats.yml b/.stats.yml index 6f7fa996..ef93c060 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 167 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/modern-treasury%2Fmodern-treasury-257040c089ce26f92854bb3b6f670346234fadcdb0c5cff409cfef36b29b10b3.yml -openapi_spec_hash: 15e400c236067ffb59f207b5332c8a34 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/modern-treasury%2Fmodern-treasury-e5103cd667934fca2733a92a23accd5ba04207204020f40a4c122b74b8d11e9f.yml +openapi_spec_hash: ce81d5cd341150ac103299e70c5b24b0 config_hash: 55a5583c24314820a65f792e2ebab57b diff --git a/CHANGELOG.md b/CHANGELOG.md index 29ad08a9..cf389590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## 4.15.0 (2026-04-22) + +Full Changelog: [v4.14.0...v4.15.0](https://github.com/Modern-Treasury/modern-treasury-node/compare/v4.14.0...v4.15.0) + +### Features + +* **api:** api update ([9c77617](https://github.com/Modern-Treasury/modern-treasury-node/commit/9c77617d9d2e0fcb4f85cc1318e274191ecc75fb)) +* **api:** api update ([ec856a2](https://github.com/Modern-Treasury/modern-treasury-node/commit/ec856a2a33a6885669408459ad53d153d274f3e7)) +* **api:** api update ([73cda49](https://github.com/Modern-Treasury/modern-treasury-node/commit/73cda499029d2f69cdd9dbff5789cfd7ae1b4e01)) +* **api:** api update ([7bf3477](https://github.com/Modern-Treasury/modern-treasury-node/commit/7bf34774b03a4f840777ae0cd5ee1e7c614ef1de)) +* **api:** api update ([4ab8248](https://github.com/Modern-Treasury/modern-treasury-node/commit/4ab824831573ae58db908285a58d97e60820257f)) +* **api:** api update ([7f7e77a](https://github.com/Modern-Treasury/modern-treasury-node/commit/7f7e77a803548ffcc5740eba4c9106858834013b)) +* **api:** api update ([aac4500](https://github.com/Modern-Treasury/modern-treasury-node/commit/aac450006214bef41fb5f5d41292a5c1ac752643)) +* **api:** api update ([2170dea](https://github.com/Modern-Treasury/modern-treasury-node/commit/2170dea05d4edd055a9e899861ec3129bcd317f2)) +* **api:** api update ([3b6b75d](https://github.com/Modern-Treasury/modern-treasury-node/commit/3b6b75dea5cc8c2b1ce0a3c92c72471cc1cae104)) + + +### Chores + +* fix example snippet imports ([8eafc54](https://github.com/Modern-Treasury/modern-treasury-node/commit/8eafc542749661500fef0036cea34e36c44dbab7)) +* **internal:** codegen related update ([34e49c4](https://github.com/Modern-Treasury/modern-treasury-node/commit/34e49c47f45bdde543e75e5675f65069ca4460b6)) +* **internal:** more robust bootstrap script ([84c2ad9](https://github.com/Modern-Treasury/modern-treasury-node/commit/84c2ad91cccf10965967affabb3121898a229d01)) +* **internal:** show error causes in MCP servers when running in local mode ([397a02b](https://github.com/Modern-Treasury/modern-treasury-node/commit/397a02b787806db4dfd9ea43aa611b74edc87d67)) +* **internal:** update docs ordering ([6055b9a](https://github.com/Modern-Treasury/modern-treasury-node/commit/6055b9a99eed8652ecad6c1acb3097bdb4888723)) + + +### Documentation + +* improve examples ([39b9ec6](https://github.com/Modern-Treasury/modern-treasury-node/commit/39b9ec62eb78e4db89b2d4e5f1206c74fbf6d207)) + ## 4.14.0 (2026-04-08) Full Changelog: [v4.13.0...v4.14.0](https://github.com/Modern-Treasury/modern-treasury-node/compare/v4.13.0...v4.14.0) diff --git a/package.json b/package.json index 4d8d0e57..d8249800 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "modern-treasury", - "version": "4.14.0", + "version": "4.15.0", "description": "The official TypeScript library for the Modern Treasury API", "author": "Modern Treasury ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/manifest.json b/packages/mcp-server/manifest.json index 5d9253e9..19ce6e54 100644 --- a/packages/mcp-server/manifest.json +++ b/packages/mcp-server/manifest.json @@ -1,7 +1,7 @@ { "dxt_version": "0.2", "name": "modern-treasury-mcp", - "version": "4.14.0", + "version": "4.15.0", "description": "The official MCP Server for the Modern Treasury API", "author": { "name": "Modern Treasury", diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 8baa1cdc..8388da5d 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "modern-treasury-mcp", - "version": "4.14.0", + "version": "4.15.0", "description": "The official MCP Server for the Modern Treasury API", "author": "Modern Treasury ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/src/code-tool-worker.ts b/packages/mcp-server/src/code-tool-worker.ts index 6c171e5b..5685ef5f 100644 --- a/packages/mcp-server/src/code-tool-worker.ts +++ b/packages/mcp-server/src/code-tool-worker.ts @@ -352,7 +352,8 @@ function makeSdkProxy(obj: T, { path, isBelievedBad = false }: function parseError(code: string, error: unknown): string | undefined { if (!(error instanceof Error)) return; - const message = error.name ? `${error.name}: ${error.message}` : error.message; + const cause = error.cause instanceof Error ? `: ${error.cause.message}` : ''; + const message = error.name ? `${error.name}: ${error.message}${cause}` : `${error.message}${cause}`; try { // Deno uses V8; the first ":LINE:COLUMN" is the top of stack. const lineNumber = error.stack?.match(/:([0-9]+):[0-9]+/)?.[1]; diff --git a/packages/mcp-server/src/local-docs-search.ts b/packages/mcp-server/src/local-docs-search.ts index 37870361..36329860 100644 --- a/packages/mcp-server/src/local-docs-search.ts +++ b/packages/mcp-server/src/local-docs-search.ts @@ -1312,13 +1312,14 @@ const EMBEDDED_METHODS: MethodEntry[] = [ 'metadata?: object;', 'per_page?: number;', "status?: 'completed' | 'pending' | 'returned';", + 'subtype?: string;', 'type?: string;', 'virtual_account_id?: string;', ], response: - "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", + "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", markdown: - "## list\n\n`client.incomingPaymentDetails.list(after_cursor?: string, as_of_date_end?: string, as_of_date_start?: string, direction?: 'credit' | 'debit', metadata?: object, per_page?: number, status?: 'completed' | 'pending' | 'returned', type?: string, virtual_account_id?: string): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**get** `/api/incoming_payment_details`\n\nGet a list of Incoming Payment Details.\n\n### Parameters\n\n- `after_cursor?: string`\n\n- `as_of_date_end?: string`\n Filters incoming payment details with an as_of_date starting on or before the specified date (YYYY-MM-DD).\n\n- `as_of_date_start?: string`\n Filters incoming payment details with an as_of_date starting on or after the specified date (YYYY-MM-DD).\n\n- `direction?: 'credit' | 'debit'`\n One of `credit` or `debit`.\n\n- `metadata?: object`\n For example, if you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters.\n\n- `per_page?: number`\n\n- `status?: 'completed' | 'pending' | 'returned'`\n The current status of the incoming payment order. One of `pending`, `completed`, or `returned`.\n\n- `type?: string`\n One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`.\n\n- `virtual_account_id?: string`\n If the incoming payment detail is in a virtual account, the ID of the Virtual Account.\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\n// Automatically fetches more pages as needed.\nfor await (const incomingPaymentDetail of client.incomingPaymentDetails.list()) {\n console.log(incomingPaymentDetail);\n}\n```", + "## list\n\n`client.incomingPaymentDetails.list(after_cursor?: string, as_of_date_end?: string, as_of_date_start?: string, direction?: 'credit' | 'debit', metadata?: object, per_page?: number, status?: 'completed' | 'pending' | 'returned', subtype?: string, type?: string, virtual_account_id?: string): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**get** `/api/incoming_payment_details`\n\nGet a list of Incoming Payment Details.\n\n### Parameters\n\n- `after_cursor?: string`\n\n- `as_of_date_end?: string`\n Filters incoming payment details with an as_of_date starting on or before the specified date (YYYY-MM-DD).\n\n- `as_of_date_start?: string`\n Filters incoming payment details with an as_of_date starting on or after the specified date (YYYY-MM-DD).\n\n- `direction?: 'credit' | 'debit'`\n One of `credit` or `debit`.\n\n- `metadata?: object`\n For example, if you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters.\n\n- `per_page?: number`\n\n- `status?: 'completed' | 'pending' | 'returned'`\n The current status of the incoming payment order. One of `pending`, `completed`, or `returned`.\n\n- `subtype?: string`\n An additional layer of classification for the type of incoming payment detail. For example, a `type` of `stablecoin` may have a `subtype` of `ethereum` or `solana`.\n\n- `type?: string`\n One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`.\n\n- `virtual_account_id?: string`\n If the incoming payment detail is in a virtual account, the ID of the Virtual Account.\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `subtype: string`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\n// Automatically fetches more pages as needed.\nfor await (const incomingPaymentDetail of client.incomingPaymentDetails.list()) {\n console.log(incomingPaymentDetail);\n}\n```", perLanguage: { go: { method: 'client.IncomingPaymentDetails.List', @@ -1366,9 +1367,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.incomingPaymentDetails.retrieve', params: ['id: string;'], response: - "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", + "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", markdown: - "## retrieve\n\n`client.incomingPaymentDetails.retrieve(id: string): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**get** `/api/incoming_payment_details/{id}`\n\nGet an existing Incoming Payment Detail.\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst incomingPaymentDetail = await client.incomingPaymentDetails.retrieve('id');\n\nconsole.log(incomingPaymentDetail);\n```", + "## retrieve\n\n`client.incomingPaymentDetails.retrieve(id: string): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**get** `/api/incoming_payment_details/{id}`\n\nGet an existing Incoming Payment Detail.\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `subtype: string`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst incomingPaymentDetail = await client.incomingPaymentDetails.retrieve('id');\n\nconsole.log(incomingPaymentDetail);\n```", perLanguage: { go: { method: 'client.IncomingPaymentDetails.Get', @@ -1416,9 +1417,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.incomingPaymentDetails.update', params: ['id: string;', 'metadata?: object;'], response: - "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", + "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", markdown: - "## update\n\n`client.incomingPaymentDetails.update(id: string, metadata?: object): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**patch** `/api/incoming_payment_details/{id}`\n\nUpdate an existing Incoming Payment Detail.\n\n### Parameters\n\n- `id: string`\n\n- `metadata?: object`\n Additional data in the form of key-value pairs. Pairs can be removed by passing an empty string or `null` as the value.\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst incomingPaymentDetail = await client.incomingPaymentDetails.update('id');\n\nconsole.log(incomingPaymentDetail);\n```", + "## update\n\n`client.incomingPaymentDetails.update(id: string, metadata?: object): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**patch** `/api/incoming_payment_details/{id}`\n\nUpdate an existing Incoming Payment Detail.\n\n### Parameters\n\n- `id: string`\n\n- `metadata?: object`\n Additional data in the form of key-value pairs. Pairs can be removed by passing an empty string or `null` as the value.\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `subtype: string`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst incomingPaymentDetail = await client.incomingPaymentDetails.update('id');\n\nconsole.log(incomingPaymentDetail);\n```", perLanguage: { go: { method: 'client.IncomingPaymentDetails.Update', @@ -1472,13 +1473,14 @@ const EMBEDDED_METHODS: MethodEntry[] = [ 'description?: string;', "direction?: 'credit' | 'debit';", 'internal_account_id?: string;', + 'subtype?: string;', 'type?: string;', 'virtual_account_id?: string;', ], response: - "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", + "{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: object; virtual_account_id: string; originating_account_number?: string; originating_party_address?: object; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }", markdown: - "## create_async\n\n`client.incomingPaymentDetails.createAsync(amount?: number, as_of_date?: string, currency?: string, data?: object, description?: string, direction?: 'credit' | 'debit', internal_account_id?: string, type?: string, virtual_account_id?: string): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**post** `/api/simulations/incoming_payment_details/create_async`\n\nSimulate Incoming Payment Detail\n\n### Parameters\n\n- `amount?: number`\n Value in specified currency's smallest unit. e.g. $10 would be represented as 1000.\n\n- `as_of_date?: string`\n Defaults to today.\n\n- `currency?: string`\n Defaults to the currency of the originating account.\n\n- `data?: object`\n An object passed through to the simulated IPD that could reflect what a vendor would pass.\n\n- `description?: string`\n Defaults to a random description.\n\n- `direction?: 'credit' | 'debit'`\n One of `credit`, `debit`.\n\n- `internal_account_id?: string`\n The ID of one of your internal accounts.\n\n- `type?: string`\n One of `ach`, `wire`, `check`.\n\n- `virtual_account_id?: string`\n An optional parameter to associate the incoming payment detail to a virtual account.\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst incomingPaymentDetail = await client.incomingPaymentDetails.createAsync();\n\nconsole.log(incomingPaymentDetail);\n```", + "## create_async\n\n`client.incomingPaymentDetails.createAsync(amount?: number, as_of_date?: string, currency?: string, data?: object, description?: string, direction?: 'credit' | 'debit', internal_account_id?: string, subtype?: string, type?: string, virtual_account_id?: string): { id: string; amount: number; as_of_date: string; created_at: string; currency: currency; data: object; direction: transaction_direction; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: virtual_account; virtual_account_id: string; originating_account_number?: string; originating_party_address?: address; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n**post** `/api/simulations/incoming_payment_details/create_async`\n\nSimulate Incoming Payment Detail\n\n### Parameters\n\n- `amount?: number`\n Value in specified currency's smallest unit. e.g. $10 would be represented as 1000.\n\n- `as_of_date?: string`\n Defaults to today.\n\n- `currency?: string`\n Defaults to the currency of the originating account.\n\n- `data?: object`\n An object passed through to the simulated IPD that could reflect what a vendor would pass.\n\n- `description?: string`\n Defaults to a random description.\n\n- `direction?: 'credit' | 'debit'`\n One of `credit`, `debit`.\n\n- `internal_account_id?: string`\n The ID of one of your internal accounts.\n\n- `subtype?: string`\n An additional layer of classification for the type of incoming payment detail, e.g. `ethereum` for a `stablecoin` type.\n\n- `type?: string`\n One of `ach`, `wire`, `check`.\n\n- `virtual_account_id?: string`\n An optional parameter to associate the incoming payment detail to a virtual account.\n\n### Returns\n\n- `{ id: string; amount: number; as_of_date: string; created_at: string; currency: string; data: object; direction: 'credit' | 'debit'; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; originating_account_number_safe: string; originating_account_number_type: string; originating_routing_number: string; originating_routing_number_type: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; status: 'completed' | 'pending' | 'returned'; subtype: string; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; vendor_id: string; virtual_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; }; virtual_account_id: string; originating_account_number?: string; originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; originating_party_name?: string; originating_party_vendor_identifier?: string; receiving_account_number?: string; receiving_account_number_safe?: string; }`\n\n - `id: string`\n - `amount: number`\n - `as_of_date: string`\n - `created_at: string`\n - `currency: string`\n - `data: object`\n - `direction: 'credit' | 'debit'`\n - `internal_account_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `originating_account_number_safe: string`\n - `originating_account_number_type: string`\n - `originating_routing_number: string`\n - `originating_routing_number_type: string`\n - `reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'`\n - `status: 'completed' | 'pending' | 'returned'`\n - `subtype: string`\n - `transaction_id: string`\n - `transaction_line_item_id: string`\n - `type: string`\n - `updated_at: string`\n - `vendor_id: string`\n - `virtual_account: { id: string; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; updated_at: string; }`\n - `virtual_account_id: string`\n - `originating_account_number?: string`\n - `originating_party_address?: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `originating_party_name?: string`\n - `originating_party_vendor_identifier?: string`\n - `receiving_account_number?: string`\n - `receiving_account_number_safe?: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst incomingPaymentDetail = await client.incomingPaymentDetails.createAsync();\n\nconsole.log(incomingPaymentDetail);\n```", perLanguage: { go: { method: 'client.IncomingPaymentDetails.NewAsync', @@ -1540,9 +1542,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [ "status?: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided';", ], response: - "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }", + "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }", markdown: - "## list\n\n`client.invoices.list(after_cursor?: string, counterparty_id?: string, created_at_end?: string, created_at_start?: string, due_date_end?: string, due_date_start?: string, expected_payment_id?: string, metadata?: object, number?: string, originating_account_id?: string, payment_order_id?: string, per_page?: number, status?: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n**get** `/api/invoices`\n\nlist invoices\n\n### Parameters\n\n- `after_cursor?: string`\n\n- `counterparty_id?: string`\n\n- `created_at_end?: string`\n An inclusive upper bound for searching created_at\n\n- `created_at_start?: string`\n An inclusive lower bound for searching created_at\n\n- `due_date_end?: string`\n An inclusive upper bound for searching due_date\n\n- `due_date_start?: string`\n An inclusive lower bound for searching due_date\n\n- `expected_payment_id?: string`\n\n- `metadata?: object`\n For example, if you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters.\n\n- `number?: string`\n A unique record number assigned to each invoice that is issued.\n\n- `originating_account_id?: string`\n\n- `payment_order_id?: string`\n\n- `per_page?: number`\n\n- `status?: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\n// Automatically fetches more pages as needed.\nfor await (const invoice of client.invoices.list()) {\n console.log(invoice);\n}\n```", + "## list\n\n`client.invoices.list(after_cursor?: string, counterparty_id?: string, created_at_end?: string, created_at_start?: string, due_date_end?: string, due_date_start?: string, expected_payment_id?: string, metadata?: object, number?: string, originating_account_id?: string, payment_order_id?: string, per_page?: number, status?: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n**get** `/api/invoices`\n\nlist invoices\n\n### Parameters\n\n- `after_cursor?: string`\n\n- `counterparty_id?: string`\n\n- `created_at_end?: string`\n An inclusive upper bound for searching created_at\n\n- `created_at_start?: string`\n An inclusive lower bound for searching created_at\n\n- `due_date_end?: string`\n An inclusive upper bound for searching due_date\n\n- `due_date_start?: string`\n An inclusive lower bound for searching due_date\n\n- `expected_payment_id?: string`\n\n- `metadata?: object`\n For example, if you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters.\n\n- `number?: string`\n A unique record number assigned to each invoice that is issued.\n\n- `originating_account_id?: string`\n\n- `payment_order_id?: string`\n\n- `per_page?: number`\n\n- `status?: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `issued_at: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `paid_at: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n - `voided_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\n// Automatically fetches more pages as needed.\nfor await (const invoice of client.invoices.list()) {\n console.log(invoice);\n}\n```", perLanguage: { go: { method: 'client.Invoices.List', @@ -1615,9 +1617,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [ 'virtual_account_id?: string;', ], response: - "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }", + "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }", markdown: - "## create\n\n`client.invoices.create(counterparty_id: string, due_date: string, originating_account_id: string, auto_advance?: boolean, contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[], counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, currency?: string, description?: string, fallback_payment_method?: string, invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[], invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, invoicer_name?: string, metadata?: object, notification_email_addresses?: string[], notifications_enabled?: boolean, payment_effective_date?: string, payment_method?: 'ui' | 'manual' | 'automatic', payment_type?: string, receiving_account_id?: string, recipient_email?: string, recipient_name?: string, remind_after_overdue_days?: number[], virtual_account_id?: string): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n**post** `/api/invoices`\n\ncreate invoice\n\n### Parameters\n\n- `counterparty_id: string`\n The ID of the counterparty receiving the invoice.\n\n- `due_date: string`\n A future date by when the invoice needs to be paid.\n\n- `originating_account_id: string`\n The ID of the internal account the invoice should be paid to.\n\n- `auto_advance?: boolean`\n When true, the invoice will progress to unpaid automatically and cannot be edited after entering that state. If the invoice fails to progress to unpaid, the errors will be returned and the invoice will not be created.\n\n- `contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n The invoicer's contact details displayed at the top of the invoice.\n\n- `counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's billing address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's shipping address where physical goods should be delivered.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `currency?: string`\n Currency that the invoice is denominated in. Defaults to `USD` if not provided.\n\n- `description?: string`\n A free-form description of the invoice.\n\n- `fallback_payment_method?: string`\n When payment_method is automatic, the fallback payment method to use when an automatic payment fails. One of `manual` or `ui`.\n\n- `invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[]`\n An array of invoice line items. The API supports a maximum of 50 invoice line items per invoice. If a greater number of invoice line items is required, please contact support.\n\n- `invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The invoice issuer's business address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `invoicer_name?: string`\n The name of the issuer for the invoice. Defaults to the name of the Organization.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `notification_email_addresses?: string[]`\n Emails in addition to the counterparty email to send invoice status notifications to. At least one email is required if notifications are enabled and the counterparty doesn't have an email.\n\n- `notifications_enabled?: boolean`\n If true, the invoice will send email notifications to the invoice recipients about invoice status changes.\n\n- `payment_effective_date?: string`\n Date transactions are to be posted to the participants' account. Defaults to the current business day or the next business day if the current day is a bank holiday or weekend. Format: yyyy-mm-dd.\n\n- `payment_method?: 'ui' | 'manual' | 'automatic'`\n The method by which the invoice can be paid. `ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.\\nIf the invoice amount is positive, the automatically initiated payment order's direction will be debit. If the invoice amount is negative, the automatically initiated payment order's direction will be credit. One of `manual`, `ui`, or `automatic`.\n\n- `payment_type?: string`\n One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`.\n\n- `receiving_account_id?: string`\n The receiving account ID. Can be an `external_account`.\n\n- `recipient_email?: string`\n The email of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `recipient_name?: string`\n The name of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `remind_after_overdue_days?: number[]`\n Number of days after due date when overdue reminder emails will be sent out to invoice recipients.\n\n- `virtual_account_id?: string`\n The ID of the virtual account the invoice should be paid to.\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst invoice = await client.invoices.create({\n counterparty_id: 'counterparty_id',\n due_date: '2019-12-27T18:11:19.117Z',\n originating_account_id: 'originating_account_id',\n});\n\nconsole.log(invoice);\n```", + "## create\n\n`client.invoices.create(counterparty_id: string, due_date: string, originating_account_id: string, auto_advance?: boolean, contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[], counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, currency?: string, description?: string, fallback_payment_method?: string, invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[], invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, invoicer_name?: string, metadata?: object, notification_email_addresses?: string[], notifications_enabled?: boolean, payment_effective_date?: string, payment_method?: 'ui' | 'manual' | 'automatic', payment_type?: string, receiving_account_id?: string, recipient_email?: string, recipient_name?: string, remind_after_overdue_days?: number[], virtual_account_id?: string): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n**post** `/api/invoices`\n\ncreate invoice\n\n### Parameters\n\n- `counterparty_id: string`\n The ID of the counterparty receiving the invoice.\n\n- `due_date: string`\n A future date by when the invoice needs to be paid.\n\n- `originating_account_id: string`\n The ID of the internal account the invoice should be paid to.\n\n- `auto_advance?: boolean`\n When true, the invoice will progress to unpaid automatically and cannot be edited after entering that state. If the invoice fails to progress to unpaid, the errors will be returned and the invoice will not be created.\n\n- `contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n The invoicer's contact details displayed at the top of the invoice.\n\n- `counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's billing address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's shipping address where physical goods should be delivered.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `currency?: string`\n Currency that the invoice is denominated in. Defaults to `USD` if not provided.\n\n- `description?: string`\n A free-form description of the invoice.\n\n- `fallback_payment_method?: string`\n When payment_method is automatic, the fallback payment method to use when an automatic payment fails. One of `manual` or `ui`.\n\n- `invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[]`\n An array of invoice line items. The API supports a maximum of 50 invoice line items per invoice. If a greater number of invoice line items is required, please contact support.\n\n- `invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The invoice issuer's business address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `invoicer_name?: string`\n The name of the issuer for the invoice. Defaults to the name of the Organization.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `notification_email_addresses?: string[]`\n Emails in addition to the counterparty email to send invoice status notifications to. At least one email is required if notifications are enabled and the counterparty doesn't have an email.\n\n- `notifications_enabled?: boolean`\n If true, the invoice will send email notifications to the invoice recipients about invoice status changes.\n\n- `payment_effective_date?: string`\n Date transactions are to be posted to the participants' account. Defaults to the current business day or the next business day if the current day is a bank holiday or weekend. Format: yyyy-mm-dd.\n\n- `payment_method?: 'ui' | 'manual' | 'automatic'`\n The method by which the invoice can be paid. `ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.\\nIf the invoice amount is positive, the automatically initiated payment order's direction will be debit. If the invoice amount is negative, the automatically initiated payment order's direction will be credit. One of `manual`, `ui`, or `automatic`.\n\n- `payment_type?: string`\n One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`.\n\n- `receiving_account_id?: string`\n The receiving account ID. Can be an `external_account`.\n\n- `recipient_email?: string`\n The email of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `recipient_name?: string`\n The name of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `remind_after_overdue_days?: number[]`\n Number of days after due date when overdue reminder emails will be sent out to invoice recipients.\n\n- `virtual_account_id?: string`\n The ID of the virtual account the invoice should be paid to.\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `issued_at: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `paid_at: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n - `voided_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst invoice = await client.invoices.create({\n counterparty_id: 'counterparty_id',\n due_date: '2019-12-27T18:11:19.117Z',\n originating_account_id: 'originating_account_id',\n});\n\nconsole.log(invoice);\n```", perLanguage: { go: { method: 'client.Invoices.New', @@ -1665,9 +1667,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.invoices.retrieve', params: ['id: string;'], response: - "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }", + "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }", markdown: - "## retrieve\n\n`client.invoices.retrieve(id: string): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n**get** `/api/invoices/{id}`\n\nget invoice\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst invoice = await client.invoices.retrieve('id');\n\nconsole.log(invoice);\n```", + "## retrieve\n\n`client.invoices.retrieve(id: string): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n**get** `/api/invoices/{id}`\n\nget invoice\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `issued_at: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `paid_at: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n - `voided_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst invoice = await client.invoices.retrieve('id');\n\nconsole.log(invoice);\n```", perLanguage: { go: { method: 'client.Invoices.Get', @@ -1741,9 +1743,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [ 'virtual_account_id?: string;', ], response: - "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }", + "{ id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }", markdown: - "## update\n\n`client.invoices.update(id: string, contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[], counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, counterparty_id?: string, counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, currency?: string, description?: string, due_date?: string, fallback_payment_method?: string, invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[], invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, invoicer_name?: string, metadata?: object, notification_email_addresses?: string[], notifications_enabled?: boolean, originating_account_id?: string, payment_effective_date?: string, payment_method?: 'ui' | 'manual' | 'automatic', payment_type?: string, receiving_account_id?: string, recipient_email?: string, recipient_name?: string, remind_after_overdue_days?: number[], status?: string, virtual_account_id?: string): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n**patch** `/api/invoices/{id}`\n\nupdate invoice\n\n### Parameters\n\n- `id: string`\n\n- `contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n The invoicer's contact details displayed at the top of the invoice.\n\n- `counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's billing address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `counterparty_id?: string`\n The ID of the counterparty receiving the invoice.\n\n- `counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's shipping address where physical goods should be delivered.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `currency?: string`\n Currency that the invoice is denominated in. Defaults to `USD` if not provided.\n\n- `description?: string`\n A free-form description of the invoice.\n\n- `due_date?: string`\n A future date by when the invoice needs to be paid.\n\n- `fallback_payment_method?: string`\n When payment_method is automatic, the fallback payment method to use when an automatic payment fails. One of `manual` or `ui`.\n\n- `invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[]`\n An array of invoice line items. The API supports a maximum of 50 invoice line items per invoice. If a greater number of invoice line items is required, please contact support.\n\n- `invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The invoice issuer's business address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `invoicer_name?: string`\n The name of the issuer for the invoice. Defaults to the name of the Organization.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `notification_email_addresses?: string[]`\n Emails in addition to the counterparty email to send invoice status notifications to. At least one email is required if notifications are enabled and the counterparty doesn't have an email.\n\n- `notifications_enabled?: boolean`\n If true, the invoice will send email notifications to the invoice recipients about invoice status changes.\n\n- `originating_account_id?: string`\n The ID of the internal account the invoice should be paid to.\n\n- `payment_effective_date?: string`\n Date transactions are to be posted to the participants' account. Defaults to the current business day or the next business day if the current day is a bank holiday or weekend. Format: yyyy-mm-dd.\n\n- `payment_method?: 'ui' | 'manual' | 'automatic'`\n The method by which the invoice can be paid. `ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.\\nIf the invoice amount is positive, the automatically initiated payment order's direction will be debit. If the invoice amount is negative, the automatically initiated payment order's direction will be credit. One of `manual`, `ui`, or `automatic`.\n\n- `payment_type?: string`\n One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`.\n\n- `receiving_account_id?: string`\n The receiving account ID. Can be an `external_account`.\n\n- `recipient_email?: string`\n The email of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `recipient_name?: string`\n The name of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `remind_after_overdue_days?: number[]`\n Number of days after due date when overdue reminder emails will be sent out to invoice recipients.\n\n- `status?: string`\n Invoice status must be updated in a `PATCH` request that does not modify any other invoice attributes. Valid state transitions are `draft` to `unpaid`, `draft` or `unpaid` to `voided`, and `draft` or `unpaid` to `paid`.\n\n- `virtual_account_id?: string`\n The ID of the virtual account the invoice should be paid to.\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst invoice = await client.invoices.update('id');\n\nconsole.log(invoice);\n```", + "## update\n\n`client.invoices.update(id: string, contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[], counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, counterparty_id?: string, counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, currency?: string, description?: string, due_date?: string, fallback_payment_method?: string, invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[], invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, invoicer_name?: string, metadata?: object, notification_email_addresses?: string[], notifications_enabled?: boolean, originating_account_id?: string, payment_effective_date?: string, payment_method?: 'ui' | 'manual' | 'automatic', payment_type?: string, receiving_account_id?: string, recipient_email?: string, recipient_name?: string, remind_after_overdue_days?: number[], status?: string, virtual_account_id?: string): { id: string; amount_paid: number; amount_remaining: number; contact_details: contact_detail[]; counterparty_billing_address: object; counterparty_id: string; counterparty_shipping_address: object; created_at: string; currency: currency; description: string; due_date: string; expected_payments: expected_payment[]; fallback_payment_method: string; hosted_url: string; invoicer_address: object; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: payment_order[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n**patch** `/api/invoices/{id}`\n\nupdate invoice\n\n### Parameters\n\n- `id: string`\n\n- `contact_details?: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n The invoicer's contact details displayed at the top of the invoice.\n\n- `counterparty_billing_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's billing address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `counterparty_id?: string`\n The ID of the counterparty receiving the invoice.\n\n- `counterparty_shipping_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The counterparty's shipping address where physical goods should be delivered.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `currency?: string`\n Currency that the invoice is denominated in. Defaults to `USD` if not provided.\n\n- `description?: string`\n A free-form description of the invoice.\n\n- `due_date?: string`\n A future date by when the invoice needs to be paid.\n\n- `fallback_payment_method?: string`\n When payment_method is automatic, the fallback payment method to use when an automatic payment fails. One of `manual` or `ui`.\n\n- `invoice_line_items?: { name: string; unit_amount: number; description?: string; direction?: string; metadata?: object; quantity?: number; unit_amount_decimal?: string; }[]`\n An array of invoice line items. The API supports a maximum of 50 invoice line items per invoice. If a greater number of invoice line items is required, please contact support.\n\n- `invoicer_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The invoice issuer's business address.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `invoicer_name?: string`\n The name of the issuer for the invoice. Defaults to the name of the Organization.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `notification_email_addresses?: string[]`\n Emails in addition to the counterparty email to send invoice status notifications to. At least one email is required if notifications are enabled and the counterparty doesn't have an email.\n\n- `notifications_enabled?: boolean`\n If true, the invoice will send email notifications to the invoice recipients about invoice status changes.\n\n- `originating_account_id?: string`\n The ID of the internal account the invoice should be paid to.\n\n- `payment_effective_date?: string`\n Date transactions are to be posted to the participants' account. Defaults to the current business day or the next business day if the current day is a bank holiday or weekend. Format: yyyy-mm-dd.\n\n- `payment_method?: 'ui' | 'manual' | 'automatic'`\n The method by which the invoice can be paid. `ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.\\nIf the invoice amount is positive, the automatically initiated payment order's direction will be debit. If the invoice amount is negative, the automatically initiated payment order's direction will be credit. One of `manual`, `ui`, or `automatic`.\n\n- `payment_type?: string`\n One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`.\n\n- `receiving_account_id?: string`\n The receiving account ID. Can be an `external_account`.\n\n- `recipient_email?: string`\n The email of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `recipient_name?: string`\n The name of the recipient of the invoice. Leaving this value as null will fallback to using the counterparty's name.\n\n- `remind_after_overdue_days?: number[]`\n Number of days after due date when overdue reminder emails will be sent out to invoice recipients.\n\n- `status?: string`\n Invoice status must be updated in a `PATCH` request that does not modify any other invoice attributes. Valid state transitions are `draft` to `unpaid`, `draft` or `unpaid` to `voided`, and `draft` or `unpaid` to `paid`.\n\n- `virtual_account_id?: string`\n The ID of the virtual account the invoice should be paid to.\n\n### Returns\n\n- `{ id: string; amount_paid: number; amount_remaining: number; contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]; counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; counterparty_id: string; counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; created_at: string; currency: string; description: string; due_date: string; expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: currency; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: reconciliation_rule[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: expected_payment_type; updated_at: string; }[]; fallback_payment_method: string; hosted_url: string; invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }; invoicer_name: string; issued_at: string; ledger_account_settlement_id: string; live_mode: boolean; metadata: object; notification_email_addresses: string[]; notifications_enabled: boolean; number: string; object: string; originating_account_id: string; paid_at: string; payment_effective_date: string; payment_method: 'ui' | 'manual' | 'automatic'; payment_orders: { id: string; accounting: object; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: currency; current_hold: object; current_return: return_object; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: foreign_exchange_rate; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: payment_order_subtype; transaction_ids: string[]; type: payment_order_type; ultimate_originating_account: virtual_account | internal_account; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]; payment_type: 'eft' | 'ach'; pdf_url: string; receiving_account_id: string; recipient_email: string; recipient_name: string; remind_after_overdue_days: number[]; status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'; total_amount: number; transaction_line_item_ids: string[]; updated_at: string; virtual_account_id: string; voided_at: string; }`\n\n - `id: string`\n - `amount_paid: number`\n - `amount_remaining: number`\n - `contact_details: { id: string; contact_identifier: string; contact_identifier_type: 'email' | 'phone_number' | 'website'; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; }[]`\n - `counterparty_billing_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `counterparty_id: string`\n - `counterparty_shipping_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `created_at: string`\n - `currency: string`\n - `description: string`\n - `due_date: string`\n - `expected_payments: { id: string; amount_lower_bound: number; amount_reconciled: number; amount_reconciled_direction: 'credit' | 'debit'; amount_unreconciled: number; amount_unreconciled_direction: 'credit' | 'debit'; amount_upper_bound: number; counterparty_id: string; created_at: string; currency: string; date_lower_bound: string; date_upper_bound: string; description: string; direction: 'credit' | 'debit'; external_id: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; reconciliation_filters: object; reconciliation_groups: object; reconciliation_method: 'automatic' | 'manual'; reconciliation_rule_variables: { amount_lower_bound: number; amount_upper_bound: number; direction: 'credit' | 'debit'; internal_account_id: string; counterparty_id?: string; currency?: currency; custom_identifiers?: object; date_lower_bound?: string; date_upper_bound?: string; type?: string; }[]; remittance_information: string; statement_descriptor: string; status: 'archived' | 'partially_reconciled' | 'reconciled' | 'unreconciled'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; }[]`\n - `fallback_payment_method: string`\n - `hosted_url: string`\n - `invoicer_address: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n - `invoicer_name: string`\n - `issued_at: string`\n - `ledger_account_settlement_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `notification_email_addresses: string[]`\n - `notifications_enabled: boolean`\n - `number: string`\n - `object: string`\n - `originating_account_id: string`\n - `paid_at: string`\n - `payment_effective_date: string`\n - `payment_method: 'ui' | 'manual' | 'automatic'`\n - `payment_orders: { id: string; accounting: { account_id?: string; class_id?: string; }; accounting_category_id: string; accounting_ledger_class_id: string; amount: number; batch_id: string; charge_bearer: 'shared' | 'sender' | 'receiver'; counterparty_id: string; created_at: string; currency: string; current_hold: { id: string; created_at: string; object: 'hold'; status: 'active' | 'resolved'; target_id: string; target_type: 'payment_order'; updated_at: string; live_mode?: boolean; metadata?: object; reason?: string; resolution?: string; resolved_at?: string; }; current_return: { id: string; amount: number; code: string; corrections: object; created_at: string; currency: currency; current_return: return_object; date_of_death: string; discarded_at: string; failure_reason: string; internal_account_id: string; ledger_transaction_id: string; live_mode: boolean; object: string; reason: string; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: object[]; returnable_id: string; returnable_type: 'incoming_payment_detail' | 'payment_order' | 'return' | 'reversal'; role: 'originating' | 'receiving'; status: 'cancelled' | 'completed' | 'failed' | 'pending' | 'processing' | 'returned' | 'sent'; transaction_id: string; transaction_line_item_id: string; type: string; updated_at: string; additional_information?: string; data?: object; }; description: string; direction: 'credit' | 'debit'; effective_date: string; expires_at: string; external_id: string; foreign_exchange_contract: string; foreign_exchange_indicator: 'fixed_to_variable' | 'variable_to_fixed'; foreign_exchange_rate: { base_amount: number; base_currency: currency; exponent: number; rate_string: string; target_amount: number; target_currency: currency; value: number; }; ledger_transaction_id: string; live_mode: boolean; metadata: object; nsf_protected: boolean; object: string; originating_account_id: string; originating_party_name: string; priority: 'high' | 'normal'; process_after: string; purpose: string; receiving_account_id: string; receiving_account_type: 'internal_account' | 'external_account'; reconciliation_status: 'unreconciled' | 'tentatively_reconciled' | 'reconciled'; reference_numbers: { id: string; created_at: string; live_mode: boolean; object: string; reference_number: string; reference_number_type: string; updated_at: string; }[]; remittance_information: string; send_remittance_advice: boolean; statement_descriptor: string; status: string; subtype: string; transaction_ids: string[]; type: string; ultimate_originating_account: { id: string; account_details: account_detail[]; counterparty_id: string; created_at: string; credit_ledger_account_id: string; debit_ledger_account_id: string; description: string; discarded_at: string; internal_account_id: string; ledger_account_id: string; live_mode: boolean; metadata: object; name: string; object: string; routing_details: routing_detail[]; updated_at: string; } | { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }; ultimate_originating_account_id: string; ultimate_originating_account_type: 'internal_account' | 'virtual_account'; ultimate_originating_party_identifier: string; ultimate_originating_party_name: string; ultimate_receiving_party_identifier: string; ultimate_receiving_party_name: string; updated_at: string; vendor_attributes: object; vendor_failure_reason: string; }[]`\n - `payment_type: 'eft' | 'ach'`\n - `pdf_url: string`\n - `receiving_account_id: string`\n - `recipient_email: string`\n - `recipient_name: string`\n - `remind_after_overdue_days: number[]`\n - `status: 'draft' | 'paid' | 'partially_paid' | 'payment_pending' | 'unpaid' | 'voided'`\n - `total_amount: number`\n - `transaction_line_item_ids: string[]`\n - `updated_at: string`\n - `virtual_account_id: string`\n - `voided_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst invoice = await client.invoices.update('id');\n\nconsole.log(invoice);\n```", perLanguage: { go: { method: 'client.Invoices.Update', @@ -2149,7 +2151,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ typescript: { method: 'client.documents.create', example: - "import ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst document = await client.documents.create({ file: fs.createReadStream('path/to/file') });\n\nconsole.log(document.id);", + "import fs from 'fs';\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst document = await client.documents.create({ file: fs.createReadStream('path/to/file') });\n\nconsole.log(document.id);", }, }, }, @@ -2961,7 +2963,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.internalAccounts.create', params: [ 'connection_id: string;', - "currency: 'USD' | 'CAD';", + "currency: 'USD' | 'CAD' | 'USDC' | 'USDG' | 'PYUSD';", 'name: string;', 'party_name: string;', "account_capabilities?: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[];", @@ -2977,7 +2979,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ response: "{ id: string; account_capabilities: { id: string; created_at: string; direction: transaction_direction; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]; account_details: object[]; account_type: string; connection: object; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: string; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: object; party_name: string; party_type: 'business' | 'individual'; routing_details: object[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }", markdown: - "## create\n\n`client.internalAccounts.create(connection_id: string, currency: 'USD' | 'CAD', name: string, party_name: string, account_capabilities?: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[], account_type?: string, counterparty_id?: string, external_id?: string, legal_entity_id?: string, metadata?: object, parent_account_id?: string, party_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, vendor_attributes?: object): { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }`\n\n**post** `/api/internal_accounts`\n\ncreate internal account\n\n### Parameters\n\n- `connection_id: string`\n The identifier of the financial institution the account belongs to.\n\n- `currency: 'USD' | 'CAD'`\n Either \"USD\" or \"CAD\". Internal accounts created at Increase only supports \"USD\".\n\n- `name: string`\n The nickname of the account.\n\n- `party_name: string`\n The legal name of the entity which owns the account.\n\n- `account_capabilities?: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]`\n An array of AccountCapability objects that list the originating abilities of the internal account and any relevant information for them.\n\n- `account_type?: string`\n The account type, used to provision the appropriate account at the financial institution.\n\n- `counterparty_id?: string`\n The Counterparty associated to this account.\n\n- `external_id?: string`\n An optional user-defined 180 character unique identifier.\n\n- `legal_entity_id?: string`\n The LegalEntity associated to this account.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `parent_account_id?: string`\n The parent internal account of this new account.\n\n- `party_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The address associated with the owner or null.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `vendor_attributes?: object`\n A hash of vendor specific attributes that will be used when creating the account at the vendor specified by the given connection.\n\n### Returns\n\n- `{ id: string; account_capabilities: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; account_type: string; connection: { id: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; vendor_customer_id: string; vendor_id: string; vendor_name: string; }; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: string; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; party_name: string; party_type: 'business' | 'individual'; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }`\n\n - `id: string`\n - `account_capabilities: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]`\n - `account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]`\n - `account_type: string`\n - `connection: { id: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; vendor_customer_id: string; vendor_id: string; vendor_name: string; }`\n - `contra_ledger_account_id: string`\n - `counterparty_id: string`\n - `created_at: string`\n - `currency: string`\n - `external_id: string`\n - `ledger_account_id: string`\n - `legal_entity_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `name: string`\n - `object: string`\n - `parent_account_id: string`\n - `party_address: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `party_name: string`\n - `party_type: 'business' | 'individual'`\n - `routing_details: { id: string; bank_address: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]`\n - `status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'`\n - `updated_at: string`\n - `vendor_id: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst internalAccount = await client.internalAccounts.create({\n connection_id: 'connection_id',\n currency: 'USD',\n name: 'name',\n party_name: 'party_name',\n});\n\nconsole.log(internalAccount);\n```", + "## create\n\n`client.internalAccounts.create(connection_id: string, currency: 'USD' | 'CAD' | 'USDC' | 'USDG' | 'PYUSD', name: string, party_name: string, account_capabilities?: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[], account_type?: string, counterparty_id?: string, external_id?: string, legal_entity_id?: string, metadata?: object, parent_account_id?: string, party_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }, vendor_attributes?: object): { id: string; account_capabilities: object[]; account_details: account_detail[]; account_type: string; connection: connection; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: currency; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: address; party_name: string; party_type: 'business' | 'individual'; routing_details: routing_detail[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }`\n\n**post** `/api/internal_accounts`\n\ncreate internal account\n\n### Parameters\n\n- `connection_id: string`\n The identifier of the financial institution the account belongs to.\n\n- `currency: 'USD' | 'CAD' | 'USDC' | 'USDG' | 'PYUSD'`\n The currency of the internal account. Supports \"USD\" and \"CAD\" for fiat, and \"USDC\", \"USDG\", and \"PYUSD\" for stablecoin accounts.\n\n- `name: string`\n The nickname of the account.\n\n- `party_name: string`\n The legal name of the entity which owns the account.\n\n- `account_capabilities?: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]`\n An array of AccountCapability objects that list the originating abilities of the internal account and any relevant information for them.\n\n- `account_type?: string`\n The account type, used to provision the appropriate account at the financial institution.\n\n- `counterparty_id?: string`\n The Counterparty associated to this account.\n\n- `external_id?: string`\n An optional user-defined 180 character unique identifier.\n\n- `legal_entity_id?: string`\n The LegalEntity associated to this account.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `parent_account_id?: string`\n The parent internal account of this new account.\n\n- `party_address?: { country: string; line1: string; locality: string; postal_code: string; region: string; line2?: string; }`\n The address associated with the owner or null.\n - `country: string`\n Country code conforms to [ISO 3166-1 alpha-2]\n - `line1: string`\n - `locality: string`\n Locality or City.\n - `postal_code: string`\n The postal code of the address.\n - `region: string`\n Region or State.\n - `line2?: string`\n\n- `vendor_attributes?: object`\n A hash of vendor specific attributes that will be used when creating the account at the vendor specified by the given connection.\n\n### Returns\n\n- `{ id: string; account_capabilities: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]; account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]; account_type: string; connection: { id: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; vendor_customer_id: string; vendor_id: string; vendor_name: string; }; contra_ledger_account_id: string; counterparty_id: string; created_at: string; currency: string; external_id: string; ledger_account_id: string; legal_entity_id: string; live_mode: boolean; metadata: object; name: string; object: string; parent_account_id: string; party_address: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; party_name: string; party_type: 'business' | 'individual'; routing_details: { id: string; bank_address: address; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]; status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'; updated_at: string; vendor_id: string; }`\n\n - `id: string`\n - `account_capabilities: { id: string; created_at: string; direction: 'credit' | 'debit'; discarded_at: string; identifier: string; live_mode: boolean; object: string; payment_type: string; updated_at: string; }[]`\n - `account_details: { id: string; account_number_safe: string; account_number_type: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; account_number?: string; }[]`\n - `account_type: string`\n - `connection: { id: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; updated_at: string; vendor_customer_id: string; vendor_id: string; vendor_name: string; }`\n - `contra_ledger_account_id: string`\n - `counterparty_id: string`\n - `created_at: string`\n - `currency: string`\n - `external_id: string`\n - `ledger_account_id: string`\n - `legal_entity_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `name: string`\n - `object: string`\n - `parent_account_id: string`\n - `party_address: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }`\n - `party_name: string`\n - `party_type: 'business' | 'individual'`\n - `routing_details: { id: string; bank_address: { id: string; country: string; created_at: string; line1: string; line2: string; live_mode: boolean; locality: string; object: string; postal_code: string; region: string; updated_at: string; }; bank_name: string; created_at: string; discarded_at: string; live_mode: boolean; object: string; payment_type: string; routing_number: string; routing_number_type: string; updated_at: string; }[]`\n - `status: 'active' | 'closed' | 'pending_activation' | 'pending_closure' | 'suspended'`\n - `updated_at: string`\n - `vendor_id: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst internalAccount = await client.internalAccounts.create({\n connection_id: 'connection_id',\n currency: 'USD',\n name: 'name',\n party_name: 'party_name',\n});\n\nconsole.log(internalAccount);\n```", perLanguage: { go: { method: 'client.InternalAccounts.New', @@ -3292,7 +3294,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ response: "{ id: string; as_of_date: string; as_of_time: string; balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'; balances: { id: string; amount: number; as_of_date: string; as_of_time: string; balance_type: string; created_at: string; currency: string; live_mode: boolean; object: string; updated_at: string; value_date: string; vendor_code: string; vendor_code_type: string; }[]; created_at: string; internal_account_id: string; live_mode: boolean; object: string; updated_at: string; }", markdown: - "## retrieve\n\n`client.internalAccounts.balanceReports.retrieve(internal_account_id: string, id: string | 'latest'): { id: string; as_of_date: string; as_of_time: string; balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'; balances: object[]; created_at: string; internal_account_id: string; live_mode: boolean; object: string; updated_at: string; }`\n\n**get** `/api/internal_accounts/{internal_account_id}/balance_reports/{id}`\n\nGet a single balance report for a given internal account.\n\n### Parameters\n\n- `internal_account_id: string`\n\n- `id: string | 'latest'`\n\n### Returns\n\n- `{ id: string; as_of_date: string; as_of_time: string; balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'; balances: { id: string; amount: number; as_of_date: string; as_of_time: string; balance_type: string; created_at: string; currency: string; live_mode: boolean; object: string; updated_at: string; value_date: string; vendor_code: string; vendor_code_type: string; }[]; created_at: string; internal_account_id: string; live_mode: boolean; object: string; updated_at: string; }`\n\n - `id: string`\n - `as_of_date: string`\n - `as_of_time: string`\n - `balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'`\n - `balances: { id: string; amount: number; as_of_date: string; as_of_time: string; balance_type: string; created_at: string; currency: string; live_mode: boolean; object: string; updated_at: string; value_date: string; vendor_code: string; vendor_code_type: string; }[]`\n - `created_at: string`\n - `internal_account_id: string`\n - `live_mode: boolean`\n - `object: string`\n - `updated_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst balanceReport = await client.internalAccounts.balanceReports.retrieve('string', { internal_account_id: 'internal_account_id' });\n\nconsole.log(balanceReport);\n```", + "## retrieve\n\n`client.internalAccounts.balanceReports.retrieve(internal_account_id: string, id: string | 'latest'): { id: string; as_of_date: string; as_of_time: string; balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'; balances: object[]; created_at: string; internal_account_id: string; live_mode: boolean; object: string; updated_at: string; }`\n\n**get** `/api/internal_accounts/{internal_account_id}/balance_reports/{id}`\n\nGet a single balance report for a given internal account.\n\n### Parameters\n\n- `internal_account_id: string`\n\n- `id: string | 'latest'`\n\n### Returns\n\n- `{ id: string; as_of_date: string; as_of_time: string; balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'; balances: { id: string; amount: number; as_of_date: string; as_of_time: string; balance_type: string; created_at: string; currency: string; live_mode: boolean; object: string; updated_at: string; value_date: string; vendor_code: string; vendor_code_type: string; }[]; created_at: string; internal_account_id: string; live_mode: boolean; object: string; updated_at: string; }`\n\n - `id: string`\n - `as_of_date: string`\n - `as_of_time: string`\n - `balance_report_type: 'intraday' | 'other' | 'previous_day' | 'real_time'`\n - `balances: { id: string; amount: number; as_of_date: string; as_of_time: string; balance_type: string; created_at: string; currency: string; live_mode: boolean; object: string; updated_at: string; value_date: string; vendor_code: string; vendor_code_type: string; }[]`\n - `created_at: string`\n - `internal_account_id: string`\n - `live_mode: boolean`\n - `object: string`\n - `updated_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst balanceReport = await client.internalAccounts.balanceReports.retrieve('latest', { internal_account_id: 'internal_account_id' });\n\nconsole.log(balanceReport);\n```", perLanguage: { go: { method: 'client.InternalAccounts.BalanceReports.Get', @@ -3316,7 +3318,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ python: { method: 'internal_accounts.balance_reports.retrieve', example: - 'import os\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n)\nbalance_report = client.internal_accounts.balance_reports.retrieve(\n id="string",\n internal_account_id="internal_account_id",\n)\nprint(balance_report.id)', + 'import os\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n)\nbalance_report = client.internal_accounts.balance_reports.retrieve(\n id="latest",\n internal_account_id="internal_account_id",\n)\nprint(balance_report.id)', }, ruby: { method: 'internal_accounts.balance_reports.retrieve', @@ -3326,7 +3328,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ typescript: { method: 'client.internalAccounts.balanceReports.retrieve', example: - "import ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst balanceReport = await client.internalAccounts.balanceReports.retrieve('string', {\n internal_account_id: 'internal_account_id',\n});\n\nconsole.log(balanceReport.id);", + "import ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst balanceReport = await client.internalAccounts.balanceReports.retrieve('latest', {\n internal_account_id: 'internal_account_id',\n});\n\nconsole.log(balanceReport.id);", }, }, }, @@ -7885,11 +7887,17 @@ const EMBEDDED_METHODS: MethodEntry[] = [ description: 'Update the details of a ledger account settlement.', stainlessPath: '(resource) ledger_account_settlements > (method) update', qualified: 'client.ledgerAccountSettlements.update', - params: ['id: string;', 'description?: string;', 'metadata?: object;', "status?: 'posted' | 'archived';"], + params: [ + 'id: string;', + 'description?: string;', + 'metadata?: object;', + 'skip_settlement_ledger_transaction?: boolean;', + "status?: 'posted' | 'archived';", + ], response: "{ id: string; amount: number; contra_ledger_account_id: string; created_at: string; currency: string; currency_exponent: number; description: string; effective_at_upper_bound: string; ledger_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; settled_ledger_account_id: string; settlement_entry_direction: string; status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'; updated_at: string; }", markdown: - "## update\n\n`client.ledgerAccountSettlements.update(id: string, description?: string, metadata?: object, status?: 'posted' | 'archived'): { id: string; amount: number; contra_ledger_account_id: string; created_at: string; currency: string; currency_exponent: number; description: string; effective_at_upper_bound: string; ledger_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; settled_ledger_account_id: string; settlement_entry_direction: string; status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'; updated_at: string; }`\n\n**patch** `/api/ledger_account_settlements/{id}`\n\nUpdate the details of a ledger account settlement.\n\n### Parameters\n\n- `id: string`\n\n- `description?: string`\n The description of the ledger account settlement.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `status?: 'posted' | 'archived'`\n To post a pending ledger account settlement, use `posted`. To archive a pending ledger transaction, use `archived`.\n\n### Returns\n\n- `{ id: string; amount: number; contra_ledger_account_id: string; created_at: string; currency: string; currency_exponent: number; description: string; effective_at_upper_bound: string; ledger_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; settled_ledger_account_id: string; settlement_entry_direction: string; status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'; updated_at: string; }`\n\n - `id: string`\n - `amount: number`\n - `contra_ledger_account_id: string`\n - `created_at: string`\n - `currency: string`\n - `currency_exponent: number`\n - `description: string`\n - `effective_at_upper_bound: string`\n - `ledger_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `settled_ledger_account_id: string`\n - `settlement_entry_direction: string`\n - `status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'`\n - `updated_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst ledgerAccountSettlement = await client.ledgerAccountSettlements.update('id');\n\nconsole.log(ledgerAccountSettlement);\n```", + "## update\n\n`client.ledgerAccountSettlements.update(id: string, description?: string, metadata?: object, skip_settlement_ledger_transaction?: boolean, status?: 'posted' | 'archived'): { id: string; amount: number; contra_ledger_account_id: string; created_at: string; currency: string; currency_exponent: number; description: string; effective_at_upper_bound: string; ledger_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; settled_ledger_account_id: string; settlement_entry_direction: string; status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'; updated_at: string; }`\n\n**patch** `/api/ledger_account_settlements/{id}`\n\nUpdate the details of a ledger account settlement.\n\n### Parameters\n\n- `id: string`\n\n- `description?: string`\n The description of the ledger account settlement.\n\n- `metadata?: object`\n Additional data represented as key-value pairs. Both the key and value must be strings.\n\n- `skip_settlement_ledger_transaction?: boolean`\n It is set to `false` by default. It should be set to `true` when migrating existing settlements.\n\n- `status?: 'posted' | 'archived'`\n To post a pending ledger account settlement, use `posted`. To archive a pending ledger transaction, use `archived`.\n\n### Returns\n\n- `{ id: string; amount: number; contra_ledger_account_id: string; created_at: string; currency: string; currency_exponent: number; description: string; effective_at_upper_bound: string; ledger_id: string; ledger_transaction_id: string; live_mode: boolean; metadata: object; object: string; settled_ledger_account_id: string; settlement_entry_direction: string; status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'; updated_at: string; }`\n\n - `id: string`\n - `amount: number`\n - `contra_ledger_account_id: string`\n - `created_at: string`\n - `currency: string`\n - `currency_exponent: number`\n - `description: string`\n - `effective_at_upper_bound: string`\n - `ledger_id: string`\n - `ledger_transaction_id: string`\n - `live_mode: boolean`\n - `metadata: object`\n - `object: string`\n - `settled_ledger_account_id: string`\n - `settlement_entry_direction: string`\n - `status: 'archived' | 'archiving' | 'drafting' | 'pending' | 'posted' | 'processing'`\n - `updated_at: string`\n\n### Example\n\n```typescript\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\nconst ledgerAccountSettlement = await client.ledgerAccountSettlements.update('id');\n\nconsole.log(ledgerAccountSettlement);\n```", perLanguage: { go: { method: 'client.LedgerAccountSettlements.Update', @@ -9360,24 +9368,24 @@ const EMBEDDED_METHODS: MethodEntry[] = [ const EMBEDDED_READMES: { language: string; content: string }[] = [ { - language: 'python', + language: 'go', content: - '# Modern Treasury Python API library\n\n\n[![PyPI version](https://img.shields.io/pypi/v/modern-treasury.svg?label=pypi%20(stable))](https://pypi.org/project/modern-treasury/)\n\nThe Modern Treasury Python library provides convenient access to the Modern Treasury REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\nhttps://user-images.githubusercontent.com/704302/216504942-09ed8dd7-7f44-40a6-a580-3764e91f11b4.mov\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install modern-treasury\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n)\n\ncounterparty = client.counterparties.create(\n name="my first counterparty",\n)\nprint(counterparty.id)\n```\n\nWhile you can provide a `organization_id` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `MODERN_TREASURY_ORGANIZATION_ID="my-organization-ID"` to your `.env` file\nso that your Organization ID is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncModernTreasury` instead of `ModernTreasury` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom modern_treasury import AsyncModernTreasury\n\nclient = AsyncModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n counterparty = await client.counterparties.create(\n name="my first counterparty",\n )\n print(counterparty.id)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install modern-treasury[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom modern_treasury import DefaultAioHttpClient\nfrom modern_treasury import AsyncModernTreasury\n\nasync def main() -> None:\n async with AsyncModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n counterparty = await client.counterparties.create(\n name="my first counterparty",\n )\n print(counterparty.id)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Modern Treasury API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\n\nall_counterparties = []\n# Automatically fetches more pages as needed.\nfor counterparty in client.counterparties.list():\n # Do something with counterparty here\n all_counterparties.append(counterparty)\nprint(all_counterparties)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom modern_treasury import AsyncModernTreasury\n\nclient = AsyncModernTreasury()\n\nasync def main() -> None:\n all_counterparties = []\n # Iterate through items across all pages, issuing requests as needed.\n async for counterparty in client.counterparties.list():\n all_counterparties.append(counterparty)\n print(all_counterparties)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.counterparties.list()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.items)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.counterparties.list()\n\nprint(f"next page cursor: {first_page.after_cursor}") # => "next page cursor: ..."\nfor counterparty in first_page.items:\n print(counterparty.id)\n\n# Remove `await` for non-async usage.\n```\n\n\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\n\nclient.documents.create(\n file=Path("my/file.txt"),\n documentable_id="24c6b7a3-02...",\n documentable_type="counterparties",\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `modern_treasury.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `modern_treasury.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `modern_treasury.APIError`.\n\n```python\nimport modern_treasury\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\n\ntry:\n client.external_accounts.create(\n counterparty_id="missing",\n )\nexcept modern_treasury.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept modern_treasury.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept modern_treasury.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom modern_treasury import ModernTreasury\n\n# Configure the default for all requests:\nclient = ModernTreasury(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).counterparties.create(\n name="my first counterparty",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom modern_treasury import ModernTreasury\n\n# Configure the default for all requests:\nclient = ModernTreasury(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = ModernTreasury(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).counterparties.create(\n name="my first counterparty",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `MODERN_TREASURY_LOG` to `info`.\n\n```shell\n$ export MODERN_TREASURY_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\nresponse = client.counterparties.with_raw_response.create(\n name="my first counterparty",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\ncounterparty = response.parse() # get the object that `counterparties.create()` would have returned\nprint(counterparty.id)\n```\n\nThese methods return a [`LegacyAPIResponse`](https://github.com/Modern-Treasury/modern-treasury-python/tree/main/src/modern_treasury/_legacy_response.py) object. This is a legacy class as we\'re changing it slightly in the next major version.\n\nFor the sync client this will mostly be the same with the exception\nof `content` & `text` will be methods instead of properties. In the\nasync client, all methods will be async.\n\nA migration script will be provided & the migration in general should\nbe smooth.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\nAs such, `.with_streaming_response` methods return a different [`APIResponse`](https://github.com/Modern-Treasury/modern-treasury-python/tree/main/src/modern_treasury/_response.py) object, and the async client returns an [`AsyncAPIResponse`](https://github.com/Modern-Treasury/modern-treasury-python/tree/main/src/modern_treasury/_response.py) object.\n\n```python\nwith client.counterparties.with_streaming_response.create(\n name="my first counterparty",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom modern_treasury import ModernTreasury, DefaultHttpxClient\n\nclient = ModernTreasury(\n # Or use the `MODERN_TREASURY_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom modern_treasury import ModernTreasury\n\nwith ModernTreasury() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport modern_treasury\nprint(modern_treasury.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Modern Treasury Go API Library\n\nGo Reference\n\nThe Modern Treasury Go library provides convenient access to the [Modern Treasury REST API](https://docs.moderntreasury.com)\nfrom applications written in Go.\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n\n\n```go\nimport (\n\t"github.com/Modern-Treasury/modern-treasury-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/Modern-Treasury/modern-treasury-go@v0.0.1\'\n```\n\n\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/Modern-Treasury/modern-treasury-go"\n\t"github.com/Modern-Treasury/modern-treasury-go/option"\n)\n\nfunc main() {\n\tclient := moderntreasury.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("MODERN_TREASURY_API_KEY")\n\t\toption.WithOrganizationID("my-organization-ID"), // defaults to os.LookupEnv("MODERN_TREASURY_ORGANIZATION_ID")\n\t)\n\tcounterparty, err := client.Counterparties.New(context.TODO(), moderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", counterparty.ID)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Counterparties.New(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/Modern-Treasury/modern-treasury-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Counterparties.ListAutoPaging(context.TODO(), moderntreasury.CounterpartyListParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\tcounterparty := iter.Current()\n\tfmt.Printf("%+v\\n", counterparty)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Counterparties.List(context.TODO(), moderntreasury.CounterpartyListParams{})\nfor page != nil {\n\tfor _, counterparty := range page.Items {\n\t\tfmt.Printf("%+v\\n", counterparty)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.ExternalAccounts.New(context.TODO(), moderntreasury.ExternalAccountNewParams{\n\tCounterpartyID: moderntreasury.F("missing"),\n})\nif err != nil {\n\tvar apierr *moderntreasury.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/api/external_accounts": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Counterparties.New(\n\tctx,\n\tmoderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("my/file.txt")\nmoderntreasury.DocumentNewParams{\n\tFile: moderntreasury.F[io.Reader](file),\n\tDocumentableID: moderntreasury.F("24c6b7a3-02..."),\n\tDocumentableType: moderntreasury.F(moderntreasury.DocumentNewParamsDocumentableTypeCounterparties),\n}\n\n// A file from a string\nmoderntreasury.DocumentNewParams{\n\tFile: moderntreasury.F[io.Reader](strings.NewReader("my file contents")),\n\tDocumentableID: moderntreasury.F("24c6b7a3-02..."),\n\tDocumentableType: moderntreasury.F(moderntreasury.DocumentNewParamsDocumentableTypeCounterparties),\n}\n\n// With a custom filename and contentType\nmoderntreasury.DocumentNewParams{\n\tFile: moderntreasury.FileParam(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n\tDocumentableID: moderntreasury.F("24c6b7a3-02..."),\n\tDocumentableType: moderntreasury.F(moderntreasury.DocumentNewParamsDocumentableTypeCounterparties),\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := moderntreasury.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Counterparties.New(\n\tcontext.TODO(),\n\tmoderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\ncounterparty, err := client.Counterparties.New(\n\tcontext.TODO(),\n\tmoderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", counterparty)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { - language: 'go', + language: 'java', content: - '# Modern Treasury Go API Library\n\nGo Reference\n\nThe Modern Treasury Go library provides convenient access to the [Modern Treasury REST API](https://docs.moderntreasury.com)\nfrom applications written in Go.\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n\n\n```go\nimport (\n\t"github.com/Modern-Treasury/modern-treasury-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/Modern-Treasury/modern-treasury-go@v0.0.1\'\n```\n\n\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/Modern-Treasury/modern-treasury-go"\n\t"github.com/Modern-Treasury/modern-treasury-go/option"\n)\n\nfunc main() {\n\tclient := moderntreasury.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("MODERN_TREASURY_API_KEY")\n\t\toption.WithOrganizationID("my-organization-ID"), // defaults to os.LookupEnv("MODERN_TREASURY_ORGANIZATION_ID")\n\t)\n\tcounterparty, err := client.Counterparties.New(context.TODO(), moderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", counterparty.ID)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Counterparties.New(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/Modern-Treasury/modern-treasury-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Counterparties.ListAutoPaging(context.TODO(), moderntreasury.CounterpartyListParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\tcounterparty := iter.Current()\n\tfmt.Printf("%+v\\n", counterparty)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Counterparties.List(context.TODO(), moderntreasury.CounterpartyListParams{})\nfor page != nil {\n\tfor _, counterparty := range page.Items {\n\t\tfmt.Printf("%+v\\n", counterparty)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.ExternalAccounts.New(context.TODO(), moderntreasury.ExternalAccountNewParams{\n\tCounterpartyID: moderntreasury.F("missing"),\n})\nif err != nil {\n\tvar apierr *moderntreasury.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/api/external_accounts": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Counterparties.New(\n\tctx,\n\tmoderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("my/file.txt")\nmoderntreasury.DocumentNewParams{\n\tFile: moderntreasury.F[io.Reader](file),\n\tDocumentableID: moderntreasury.F("24c6b7a3-02..."),\n\tDocumentableType: moderntreasury.F(moderntreasury.DocumentNewParamsDocumentableTypeCounterparties),\n}\n\n// A file from a string\nmoderntreasury.DocumentNewParams{\n\tFile: moderntreasury.F[io.Reader](strings.NewReader("my file contents")),\n\tDocumentableID: moderntreasury.F("24c6b7a3-02..."),\n\tDocumentableType: moderntreasury.F(moderntreasury.DocumentNewParamsDocumentableTypeCounterparties),\n}\n\n// With a custom filename and contentType\nmoderntreasury.DocumentNewParams{\n\tFile: moderntreasury.FileParam(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n\tDocumentableID: moderntreasury.F("24c6b7a3-02..."),\n\tDocumentableType: moderntreasury.F(moderntreasury.DocumentNewParamsDocumentableTypeCounterparties),\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := moderntreasury.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Counterparties.New(\n\tcontext.TODO(),\n\tmoderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\ncounterparty, err := client.Counterparties.New(\n\tcontext.TODO(),\n\tmoderntreasury.CounterpartyNewParams{\n\t\tName: moderntreasury.F("my first counterparty"),\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", counterparty)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Modern Treasury Java API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.moderntreasury.api/modern-treasury-java)](https://central.sonatype.com/artifact/com.moderntreasury.api/modern-treasury-java/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.moderntreasury.api/modern-treasury-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-java/0.0.1)\n\n\nThe Modern Treasury Java SDK provides convenient access to the [Modern Treasury REST API](https://docs.moderntreasury.com) from applications written in Java.\n\nThe Modern Treasury Java SDK is similar to the Modern Treasury Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions.\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-java/0.0.1).\n\n\n\n## Installation\n\n\n\n### Gradle\n\n~~~kotlin\nimplementation("com.moderntreasury:modern-treasury-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.moderntreasury\n modern-treasury-java\n 0.0.1\n\n~~~\n\n\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClient client = ModernTreasuryOkHttpClient.fromEnv();\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nCounterparty counterparty = client.counterparties().create(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClient client = ModernTreasuryOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .apiKey("My API Key")\n .organizationId("my-organization-ID")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n // Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n // Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| ---------------- | ------------------------------- | --------------------------------- | -------- | ---------------------------------- |\n| `apiKey` | `moderntreasury.apiKey` | `MODERN_TREASURY_API_KEY` | true | - |\n| `organizationId` | `moderntreasury.organizationId` | `MODERN_TREASURY_ORGANIZATION_ID` | true | - |\n| `webhookKey` | `moderntreasury.webhookKey` | `MODERN_TREASURY_WEBHOOK_KEY` | false | - |\n| `baseUrl` | `moderntreasury.baseUrl` | `MODERN_TREASURY_BASE_URL` | true | `"https://app.moderntreasury.com"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\n\nModernTreasuryClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Modern Treasury API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.counterparties().create(...)` should be called with an instance of `CounterpartyCreateParams`, and it will return an instance of `Counterparty`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClient client = ModernTreasuryOkHttpClient.fromEnv();\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nCompletableFuture counterparty = client.async().counterparties().create(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClientAsync;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClientAsync client = ModernTreasuryOkHttpClientAsync.fromEnv();\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nCompletableFuture counterparty = client.counterparties().create(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\nimport java.nio.file.Paths;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(Paths.get("my/file.txt"))\n .build();\nDocument document = client.documents().create(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\nimport java.net.URL;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(new URL("https://example.com/my/file.txt").openStream())\n .build();\nDocument document = client.documents().create(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file("content".getBytes())\n .build();\nDocument document = client.documents().create(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```java\nimport com.moderntreasury.api.core.MultipartField;\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\nimport java.io.InputStream;\nimport java.net.URL;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(MultipartField.builder()\n .value(new URL("https://example.com/my/file.txt").openStream())\n .filename("my/file.txt")\n .build())\n .build();\nDocument document = client.documents().create(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.moderntreasury.api.core.http.Headers;\nimport com.moderntreasury.api.core.http.HttpResponseFor;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nHttpResponseFor counterparty = client.counterparties().withRawResponse().create(params);\n\nint statusCode = counterparty.statusCode();\nHeaders headers = counterparty.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty parsedCounterparty = counterparty.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ModernTreasuryServiceException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ModernTreasuryIoException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryIoException.kt): I/O networking errors.\n\n- [`ModernTreasuryRetryableException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ModernTreasuryInvalidDataException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ModernTreasuryException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyListPage;\n\nCounterpartyListPage page = client.counterparties().list();\n\n// Process as an Iterable\nfor (Counterparty counterparty : page.autoPager()) {\n System.out.println(counterparty);\n}\n\n// Process as a Stream\npage.autoPager()\n .stream()\n .limit(50)\n .forEach(counterparty -> System.out.println(counterparty));\n```\n\nWhen using the asynchronous client, the method returns an [`AsyncStreamResponse`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/http/AsyncStreamResponse.kt):\n\n```java\nimport com.moderntreasury.api.core.http.AsyncStreamResponse;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyListPageAsync;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\n\nCompletableFuture pageFuture = client.async().counterparties().list();\n\npageFuture.thenRun(page -> page.autoPager().subscribe(counterparty -> {\n System.out.println(counterparty);\n}));\n\n// If you need to handle errors or completion of the stream\npageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {\n @Override\n public void onNext(Counterparty counterparty) {\n System.out.println(counterparty);\n }\n\n @Override\n public void onComplete(Optional error) {\n if (error.isPresent()) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error.get());\n } else {\n System.out.println("No more!");\n }\n }\n}));\n\n// Or use futures\npageFuture.thenRun(page -> page.autoPager()\n .subscribe(counterparty -> {\n System.out.println(counterparty);\n })\n .onCompleteFuture()\n .whenComplete((unused, error) -> {\n if (error != null) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error);\n } else {\n System.out.println("No more!");\n }\n }));\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyListPage;\n\nCounterpartyListPage page = client.counterparties().list();\nwhile (true) {\n for (Counterparty counterparty : page.items()) {\n System.out.println(counterparty);\n }\n\n if (!page.hasNextPage()) {\n break;\n }\n\n page = page.nextPage();\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `MODERN_TREASURY_LOG` environment variable to `info`:\n\n```sh\nexport MODERN_TREASURY_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport MODERN_TREASURY_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `modern-treasury-java-core` is published with a [configuration file](modern-treasury-java-core/src/main/resources/META-INF/proguard/modern-treasury-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty counterparty = client.counterparties().create(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport java.time.Duration;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport java.time.Duration;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `modern-treasury-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryClient`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClient.kt), [`ModernTreasuryClientAsync`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsync.kt), [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt), and [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), all of which can work with any HTTP client\n- `modern-treasury-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) and [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), which provide a way to construct [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) and [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), respectively, using OkHttp\n- `modern-treasury-java`\n - Depends on and exposes the APIs of both `modern-treasury-java-core` and `modern-treasury-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`modern-treasury-java` dependency](#installation) with `modern-treasury-java-core`\n2. Copy `modern-treasury-java-client-okhttp`\'s [`OkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`modern-treasury-java` dependency](#installation) with `modern-treasury-java-core`\n2. Write a class that implements the [`HttpClient`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/http/HttpClient.kt) interface\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) object to its setter:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name(JsonValue.from(42))\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```java\nimport com.moderntreasury.api.core.JsonMissing;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport java.util.Map;\n\nMap additionalProperties = client.counterparties().create(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.moderntreasury.api.core.JsonField;\nimport java.util.Optional;\n\nJsonField name = client.counterparties().create(params)._name();\n\nif (name.isMissing()) {\n // The property is absent from the JSON response\n} else if (name.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional jsonString = name.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = name.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ModernTreasuryInvalidDataException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty counterparty = client.counterparties().create(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty counterparty = client.counterparties().create(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-java/issues) with questions, bugs, or suggestions.\n', }, { - language: 'terraform', + language: 'kotlin', content: - '# Modern Treasury Terraform Provider\n\nThe [Modern Treasury Terraform provider](https://registry.terraform.io/providers/stainless-sdks/modern-treasury/latest/docs) provides convenient access to\nthe [Modern Treasury REST API](https://docs.moderntreasury.com) from Terraform.\n\n\n\n## Requirements\n\nThis provider requires Terraform CLI 1.0 or later. You can [install it for your system](https://developer.hashicorp.com/terraform/install)\non Hashicorp\'s website.\n\n## Usage\n\nAdd the following to your `main.tf` file:\n\n\n\n```hcl\n# Declare the provider and version\nterraform {\n required_providers {\n SDK_ProviderTypeName = {\n source = "stainless-sdks/modern-treasury"\n version = "~> 0.0.1"\n }\n }\n}\n\n# Initialize the provider\nprovider "modern-treasury" {\n api_key = "My API Key" # or set MODERN_TREASURY_API_KEY env variable\n organization_id = "my-organization-ID" # or set MODERN_TREASURY_ORGANIZATION_ID env variable\n webhook_key = "My Webhook Key" # or set MODERN_TREASURY_WEBHOOK_KEY env variable\n}\n\n# Configure a resource\n\n```\n\n\n\nInitialize your project by running `terraform init` in the directory.\n\nAdditional examples can be found in the [./examples](./examples) folder within this repository, and you can\nrefer to the full documentation on [the Terraform Registry](https://registry.terraform.io/providers/stainless-sdks/modern-treasury/latest/docs).\n\n### Provider Options\nWhen you initialize the provider, the following options are supported. It is recommended to use environment variables for sensitive values like access tokens.\nIf an environment variable is provided, then the option does not need to be set in the terraform source.\n\n| Property | Environment variable | Required | Default value |\n| --------------- | --------------------------------- | -------- | ------------- |\n| organization_id | `MODERN_TREASURY_ORGANIZATION_ID` | true | — |\n| api_key | `MODERN_TREASURY_API_KEY` | true | — |\n| webhook_key | `MODERN_TREASURY_WEBHOOK_KEY` | false | — |\n\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/modern-treasury-terraform/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Modern Treasury Kotlin API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.moderntreasury.api/modern-treasury-kotlin)](https://central.sonatype.com/artifact/com.moderntreasury.api/modern-treasury-kotlin/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.moderntreasury.api/modern-treasury-kotlin/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-kotlin/0.0.1)\n\n\nThe Modern Treasury Kotlin SDK provides convenient access to the [Modern Treasury REST API](https://docs.moderntreasury.com) from applications written in Kotlin.\n\nThe Modern Treasury Kotlin SDK is similar to the Modern Treasury Java SDK but with minor differences that make it more ergonomic for use in Kotlin, such as nullable values instead of `Optional`, `Sequence` instead of `Stream`, and suspend functions instead of `CompletableFuture`.\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). KDocs are available on [javadoc.io](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-kotlin/0.0.1).\n\n\n\n## Installation\n\n\n\n### Gradle\n\n~~~kotlin\nimplementation("com.moderntreasury:modern-treasury-kotlin:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.moderntreasury\n modern-treasury-kotlin\n 0.0.1\n\n~~~\n\n\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.fromEnv()\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: Counterparty = client.counterparties().create(params)\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.fromEnv()\n```\n\nOr manually:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .apiKey("My API Key")\n .organizationId("my-organization-ID")\n .build()\n```\n\nOr using a combination of the two approaches:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n // Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n // Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build()\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| ---------------- | ------------------------------- | --------------------------------- | -------- | ---------------------------------- |\n| `apiKey` | `moderntreasury.apiKey` | `MODERN_TREASURY_API_KEY` | true | - |\n| `organizationId` | `moderntreasury.organizationId` | `MODERN_TREASURY_ORGANIZATION_ID` | true | - |\n| `webhookKey` | `moderntreasury.webhookKey` | `MODERN_TREASURY_WEBHOOK_KEY` | false | - |\n| `baseUrl` | `moderntreasury.baseUrl` | `MODERN_TREASURY_BASE_URL` | true | `"https://app.moderntreasury.com"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\n\nval clientWithOptions: ModernTreasuryClient = client.withOptions {\n it.baseUrl("https://example.com")\n it.maxRetries(42)\n}\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Modern Treasury API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Kotlin class.\n\nFor example, `client.counterparties().create(...)` should be called with an instance of `CounterpartyCreateParams`, and it will return an instance of `Counterparty`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.fromEnv()\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: Counterparty = client.async().counterparties().create(params)\n```\n\nOr create an asynchronous client from the beginning:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClientAsync\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClientAsync = ModernTreasuryOkHttpClientAsync.fromEnv()\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: Counterparty = client.counterparties().create(params)\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods are [suspending](https://kotlinlang.org/docs/coroutines-guide.html).\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```kotlin\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\nimport java.nio.file.Paths\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(Paths.get("my/file.txt"))\n .build()\nval document: Document = client.documents().create(params)\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```kotlin\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\nimport java.net.URL\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(URL("https://example.com/my/file.txt").openStream())\n .build()\nval document: Document = client.documents().create(params)\n```\n\nOr a `ByteArray`:\n\n```kotlin\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file("content".toByteArray())\n .build()\nval document: Document = client.documents().create(params)\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```kotlin\nimport com.moderntreasury.api.core.MultipartField\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\nimport java.io.InputStream\nimport java.net.URL\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(MultipartField.builder()\n .value(URL("https://example.com/my/file.txt").openStream())\n .filename("my/file.txt")\n .build())\n .build()\nval document: Document = client.documents().create(params)\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Kotlin classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```kotlin\nimport com.moderntreasury.api.core.http.Headers\nimport com.moderntreasury.api.core.http.HttpResponseFor\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: HttpResponseFor = client.counterparties().withRawResponse().create(params)\n\nval statusCode: Int = counterparty.statusCode()\nval headers: Headers = counterparty.headers()\n```\n\nYou can still deserialize the response into an instance of a Kotlin class if needed:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval parsedCounterparty: Counterparty = counterparty.parse()\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ModernTreasuryServiceException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ModernTreasuryIoException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryIoException.kt): I/O networking errors.\n\n- [`ModernTreasuryRetryableException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ModernTreasuryInvalidDataException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ModernTreasuryException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns a [`Sequence`](https://kotlinlang.org/docs/sequences.html)\n\n```kotlin\nimport com.moderntreasury.api.models.CounterpartyListPage\n\nval page: CounterpartyListPage = client.counterparties().list()\npage.autoPager()\n .take(50)\n .forEach { counterparty -> println(counterparty) }\n```\n\nWhen using the asynchronous client, the method returns a [`Flow`](https://kotlinlang.org/docs/flow.html):\n\n```kotlin\nimport com.moderntreasury.api.models.CounterpartyListPageAsync\n\nval page: CounterpartyListPageAsync = client.async().counterparties().list()\npage.autoPager()\n .take(50)\n .forEach { counterparty -> println(counterparty) }\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyListPage\n\nval page: CounterpartyListPage = client.counterparties().list()\nwhile (true) {\n for (counterparty in page.items()) {\n println(counterparty)\n }\n\n if (!page.hasNextPage()) {\n break\n }\n\n page = page.nextPage()\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `MODERN_TREASURY_LOG` environment variable to `info`:\n\n```sh\nexport MODERN_TREASURY_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport MODERN_TREASURY_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `modern-treasury-kotlin-core` is published with a [configuration file](modern-treasury-kotlin-core/src/main/resources/META-INF/proguard/modern-treasury-kotlin-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build()\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval counterparty: Counterparty = client.counterparties().create(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n)\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport java.time.Duration\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build()\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport java.net.InetSocketAddress\nimport java.net.Proxy\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .proxy(Proxy(\n Proxy.Type.HTTP, InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build()\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport java.time.Duration\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build()\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build()\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `modern-treasury-kotlin-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryClient`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClient.kt), [`ModernTreasuryClientAsync`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsync.kt), [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt), and [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), all of which can work with any HTTP client\n- `modern-treasury-kotlin-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) and [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), which provide a way to construct [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) and [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), respectively, using OkHttp\n- `modern-treasury-kotlin`\n - Depends on and exposes the APIs of both `modern-treasury-kotlin-core` and `modern-treasury-kotlin-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`modern-treasury-kotlin` dependency](#installation) with `modern-treasury-kotlin-core`\n2. Copy `modern-treasury-kotlin-client-okhttp`\'s [`OkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`modern-treasury-kotlin` dependency](#installation) with `modern-treasury-kotlin-core`\n2. Write a class that implements the [`HttpClient`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/http/HttpClient.kt) interface\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonValue\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build()\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) object to its setter:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonValue\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name(JsonValue.from(42))\n .build()\n```\n\nThe most straightforward way to create a [`JsonValue`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) is using its `from(...)` method:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonValue\n\n// Create primitive JSON values\nval nullValue: JsonValue = JsonValue.from(null)\nval booleanValue: JsonValue = JsonValue.from(true)\nval numberValue: JsonValue = JsonValue.from(42)\nval stringValue: JsonValue = JsonValue.from("Hello World!")\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nval arrayValue: JsonValue = JsonValue.from(listOf(\n "Hello", "World"\n))\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nval objectValue: JsonValue = JsonValue.from(mapOf(\n "a" to 1, "b" to 2\n))\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nval complexValue: JsonValue = JsonValue.from(mapOf(\n "a" to listOf(\n 1, 2\n ), "b" to listOf(\n 3, 4\n )\n))\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```kotlin\nimport com.moderntreasury.api.core.JsonMissing\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name(JsonMissing.of())\n .build()\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonBoolean\nimport com.moderntreasury.api.core.JsonNull\nimport com.moderntreasury.api.core.JsonNumber\nimport com.moderntreasury.api.core.JsonValue\n\nval additionalProperties: Map = client.counterparties().create(params)._additionalProperties()\nval secretPropertyValue: JsonValue = additionalProperties.get("secretProperty")\n\nval result = when (secretPropertyValue) {\n is JsonNull -> "It\'s null!"\n is JsonBoolean -> "It\'s a boolean!"\n is JsonNumber -> "It\'s a number!"\n // Other types include `JsonMissing`, `JsonString`, `JsonArray`, and `JsonObject`\n else -> "It\'s something else!"\n}\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonField\n\nval name: JsonField = client.counterparties().create(params)._name()\n\nif (name.isMissing()) {\n // The property is absent from the JSON response\n} else if (name.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n val jsonString: String? = name.asString();\n\n // Try to deserialize into a custom type\n val myObject: MyClass = name.asUnknown()!!.convert(MyClass::class.java)\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ModernTreasuryInvalidDataException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval counterparty: Counterparty = client.counterparties().create(params).validate()\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval counterparty: Counterparty = client.counterparties().create(\n params, RequestOptions.builder().responseValidation(true).build()\n)\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build()\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nKotlin `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-kotlin/issues) with questions, bugs, or suggestions.\n', }, { - language: 'typescript', + language: 'python', content: - "# Modern Treasury TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/modern-treasury.svg?label=npm%20(stable))](https://npmjs.org/package/modern-treasury) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/modern-treasury)\n\nThis library provides convenient access to the Modern Treasury REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). The full API of this library can be found in [api.md](api.md).\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install modern-treasury\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\n```js\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst counterparty = await client.counterparties.create({ name: 'my first counterparty' });\n\nconsole.log(counterparty.id);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst params: ModernTreasury.CounterpartyCreateParams = { name: 'my first counterparty' };\nconst counterparty: ModernTreasury.Counterparty = await client.counterparties.create(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport ModernTreasury, { toFile } from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.documents.create({\n file: fs.createReadStream('my/file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.documents.create({\n file: new File(['my bytes'], 'file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n\n// You can also pass a `fetch` `Response`:\nawait client.documents.create({\n file: await fetch('https://somesite/file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.documents.create({\n file: await toFile(Buffer.from('my bytes'), 'file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\nawait client.documents.create({\n file: await toFile(new Uint8Array([0, 1, 2]), 'file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\n```ts\nconst externalAccount = await client.externalAccounts\n .create({ counterparty_id: 'missing' })\n .catch(async (err) => {\n if (err instanceof ModernTreasury.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\n```js\n// Configure the default for all requests:\nconst client = new ModernTreasury({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.counterparties.create({ name: 'my first counterparty' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\n```ts\n// Configure the default for all requests:\nconst client = new ModernTreasury({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.counterparties.create({ name: 'my first counterparty' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the ModernTreasury API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllCounterparties(params) {\n const allCounterparties = [];\n // Automatically fetches more pages as needed.\n for await (const counterparty of client.counterparties.list()) {\n allCounterparties.push(counterparty);\n }\n return allCounterparties;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.counterparties.list();\nfor (const counterparty of page.items) {\n console.log(counterparty);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\n```ts\nconst client = new ModernTreasury();\n\nconst response = await client.counterparties.create({ name: 'my first counterparty' }).asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: counterparty, response: raw } = await client.counterparties\n .create({ name: 'my first counterparty' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(counterparty.id);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `MODERN_TREASURY_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport ModernTreasury from 'modern-treasury';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new ModernTreasury({\n logger: logger.child({ name: 'ModernTreasury' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.counterparties.create({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport ModernTreasury from 'modern-treasury';\nimport fetch from 'my-fetch';\n\nconst client = new ModernTreasury({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\n\n```ts\nimport ModernTreasury from 'modern-treasury';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new ModernTreasury({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n **Bun** [[docs](https://bun.sh/guides/http/proxy)]\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\n\n```ts\nimport ModernTreasury from 'npm:modern-treasury';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new ModernTreasury({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-node/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n", + '# Modern Treasury Python API library\n\n\n[![PyPI version](https://img.shields.io/pypi/v/modern-treasury.svg?label=pypi%20(stable))](https://pypi.org/project/modern-treasury/)\n\nThe Modern Treasury Python library provides convenient access to the Modern Treasury REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\nhttps://user-images.githubusercontent.com/704302/216504942-09ed8dd7-7f44-40a6-a580-3764e91f11b4.mov\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install modern-treasury\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n)\n\ncounterparty = client.counterparties.create(\n name="my first counterparty",\n)\nprint(counterparty.id)\n```\n\nWhile you can provide a `organization_id` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `MODERN_TREASURY_ORGANIZATION_ID="my-organization-ID"` to your `.env` file\nso that your Organization ID is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncModernTreasury` instead of `ModernTreasury` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom modern_treasury import AsyncModernTreasury\n\nclient = AsyncModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n counterparty = await client.counterparties.create(\n name="my first counterparty",\n )\n print(counterparty.id)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install modern-treasury[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom modern_treasury import DefaultAioHttpClient\nfrom modern_treasury import AsyncModernTreasury\n\nasync def main() -> None:\n async with AsyncModernTreasury(\n organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"), # This is the default and can be omitted\n api_key=os.environ.get("MODERN_TREASURY_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n counterparty = await client.counterparties.create(\n name="my first counterparty",\n )\n print(counterparty.id)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Modern Treasury API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\n\nall_counterparties = []\n# Automatically fetches more pages as needed.\nfor counterparty in client.counterparties.list():\n # Do something with counterparty here\n all_counterparties.append(counterparty)\nprint(all_counterparties)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom modern_treasury import AsyncModernTreasury\n\nclient = AsyncModernTreasury()\n\nasync def main() -> None:\n all_counterparties = []\n # Iterate through items across all pages, issuing requests as needed.\n async for counterparty in client.counterparties.list():\n all_counterparties.append(counterparty)\n print(all_counterparties)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.counterparties.list()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.items)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.counterparties.list()\n\nprint(f"next page cursor: {first_page.after_cursor}") # => "next page cursor: ..."\nfor counterparty in first_page.items:\n print(counterparty.id)\n\n# Remove `await` for non-async usage.\n```\n\n\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\n\nclient.documents.create(\n file=Path("my/file.txt"),\n documentable_id="24c6b7a3-02...",\n documentable_type="counterparties",\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `modern_treasury.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `modern_treasury.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `modern_treasury.APIError`.\n\n```python\nimport modern_treasury\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\n\ntry:\n client.external_accounts.create(\n counterparty_id="missing",\n )\nexcept modern_treasury.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept modern_treasury.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept modern_treasury.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom modern_treasury import ModernTreasury\n\n# Configure the default for all requests:\nclient = ModernTreasury(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).counterparties.create(\n name="my first counterparty",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom modern_treasury import ModernTreasury\n\n# Configure the default for all requests:\nclient = ModernTreasury(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = ModernTreasury(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).counterparties.create(\n name="my first counterparty",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `MODERN_TREASURY_LOG` to `info`.\n\n```shell\n$ export MODERN_TREASURY_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom modern_treasury import ModernTreasury\n\nclient = ModernTreasury()\nresponse = client.counterparties.with_raw_response.create(\n name="my first counterparty",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\ncounterparty = response.parse() # get the object that `counterparties.create()` would have returned\nprint(counterparty.id)\n```\n\nThese methods return a [`LegacyAPIResponse`](https://github.com/Modern-Treasury/modern-treasury-python/tree/main/src/modern_treasury/_legacy_response.py) object. This is a legacy class as we\'re changing it slightly in the next major version.\n\nFor the sync client this will mostly be the same with the exception\nof `content` & `text` will be methods instead of properties. In the\nasync client, all methods will be async.\n\nA migration script will be provided & the migration in general should\nbe smooth.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\nAs such, `.with_streaming_response` methods return a different [`APIResponse`](https://github.com/Modern-Treasury/modern-treasury-python/tree/main/src/modern_treasury/_response.py) object, and the async client returns an [`AsyncAPIResponse`](https://github.com/Modern-Treasury/modern-treasury-python/tree/main/src/modern_treasury/_response.py) object.\n\n```python\nwith client.counterparties.with_streaming_response.create(\n name="my first counterparty",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom modern_treasury import ModernTreasury, DefaultHttpxClient\n\nclient = ModernTreasury(\n # Or use the `MODERN_TREASURY_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom modern_treasury import ModernTreasury\n\nwith ModernTreasury() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport modern_treasury\nprint(modern_treasury.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { language: 'ruby', @@ -9385,14 +9393,14 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ '# Modern Treasury Ruby API library\n\nThe Modern Treasury Ruby library provides convenient access to the Modern Treasury REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/Modern-Treasury/modern-treasury-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/modern_treasury).\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n\n\n```ruby\ngem "modern_treasury", "~> 0.0.1"\n```\n\n\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "modern_treasury"\n\nmodern_treasury = ModernTreasury::Client.new(\n api_key: ENV["MODERN_TREASURY_API_KEY"], # This is the default and can be omitted\n organization_id: ENV["MODERN_TREASURY_ORGANIZATION_ID"] # This is the default and can be omitted\n)\n\ncounterparty = modern_treasury.counterparties.create(name: "my first counterparty")\n\nputs(counterparty.id)\n```\n\n\n\n### Pagination\n\nList methods in the Modern Treasury API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```ruby\npage = modern_treasury.counterparties.list\n\n# Fetch single item from page.\ncounterparty = page.items[0]\nputs(counterparty.id)\n\n# Automatically fetches more pages as needed.\npage.auto_paging_each do |counterparty|\n puts(counterparty.id)\nend\n```\n\nAlternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.\n\n```ruby\nif page.next_page?\n new_page = page.next_page\n puts(new_page.items[0].id)\nend\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\ndocument = modern_treasury.documents.create(\n file: Pathname("my/file.txt"),\n documentable_id: "24c6b7a3-02...",\n documentable_type: "counterparties"\n)\n\n# Alternatively, pass file contents or a `StringIO` directly:\ndocument = modern_treasury.documents.create(\n file: File.read("my/file.txt"),\n documentable_id: "24c6b7a3-02...",\n documentable_type: "counterparties"\n)\n\n# Or, to control the filename and/or content type:\nfile = ModernTreasury::FilePart.new(File.read("my/file.txt"), filename: "my/file.txt", content_type: "…")\ndocument = modern_treasury.documents.create(\n file: file,\n documentable_id: "24c6b7a3-02...",\n documentable_type: "counterparties"\n)\n\nputs(document.id)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `ModernTreasury::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n external_account = modern_treasury.external_accounts.create(counterparty_id: "missing")\nrescue ModernTreasury::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue ModernTreasury::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue ModernTreasury::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nmodern_treasury = ModernTreasury::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\nmodern_treasury.counterparties.create(name: "my first counterparty", request_options: {max_retries: 5})\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nmodern_treasury = ModernTreasury::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\nmodern_treasury.counterparties.create(name: "my first counterparty", request_options: {timeout: 5})\n```\n\nOn timeout, `ModernTreasury::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `ModernTreasury::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\ncounterparty =\n modern_treasury.counterparties.create(\n name: "my first counterparty",\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(counterparty[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `ModernTreasury::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `ModernTreasury::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nmodern_treasury.counterparties.create(name: "my first counterparty")\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nmodern_treasury.counterparties.create(name: "my first counterparty")\n\n# You can also splat a full Params class:\nparams = ModernTreasury::CounterpartyCreateParams.new(name: "my first counterparty")\nmodern_treasury.counterparties.create(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :credit\nputs(ModernTreasury::TransactionDirection::CREDIT)\n\n# Revealed type: `T.all(ModernTreasury::TransactionDirection, Symbol)`\nT.reveal_type(ModernTreasury::TransactionDirection::CREDIT)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nmodern_treasury.counterparties.collect_account(\n direction: ModernTreasury::TransactionDirection::CREDIT,\n # …\n)\n\n# Literal values are also permissible:\nmodern_treasury.counterparties.collect_account(\n direction: :credit,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/Modern-Treasury/modern-treasury-ruby/tree/main/CONTRIBUTING.md).\n', }, { - language: 'java', + language: 'terraform', content: - '# Modern Treasury Java API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.moderntreasury.api/modern-treasury-java)](https://central.sonatype.com/artifact/com.moderntreasury.api/modern-treasury-java/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.moderntreasury.api/modern-treasury-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-java/0.0.1)\n\n\nThe Modern Treasury Java SDK provides convenient access to the [Modern Treasury REST API](https://docs.moderntreasury.com) from applications written in Java.\n\nThe Modern Treasury Java SDK is similar to the Modern Treasury Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions.\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-java/0.0.1).\n\n\n\n## Installation\n\n\n\n### Gradle\n\n~~~kotlin\nimplementation("com.moderntreasury:modern-treasury-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.moderntreasury\n modern-treasury-java\n 0.0.1\n\n~~~\n\n\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClient client = ModernTreasuryOkHttpClient.fromEnv();\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nCounterparty counterparty = client.counterparties().create(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClient client = ModernTreasuryOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .apiKey("My API Key")\n .organizationId("my-organization-ID")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n // Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n // Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| ---------------- | ------------------------------- | --------------------------------- | -------- | ---------------------------------- |\n| `apiKey` | `moderntreasury.apiKey` | `MODERN_TREASURY_API_KEY` | true | - |\n| `organizationId` | `moderntreasury.organizationId` | `MODERN_TREASURY_ORGANIZATION_ID` | true | - |\n| `webhookKey` | `moderntreasury.webhookKey` | `MODERN_TREASURY_WEBHOOK_KEY` | false | - |\n| `baseUrl` | `moderntreasury.baseUrl` | `MODERN_TREASURY_BASE_URL` | true | `"https://app.moderntreasury.com"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\n\nModernTreasuryClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Modern Treasury API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.counterparties().create(...)` should be called with an instance of `CounterpartyCreateParams`, and it will return an instance of `Counterparty`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClient client = ModernTreasuryOkHttpClient.fromEnv();\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nCompletableFuture counterparty = client.async().counterparties().create(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClientAsync;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nModernTreasuryClientAsync client = ModernTreasuryOkHttpClientAsync.fromEnv();\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nCompletableFuture counterparty = client.counterparties().create(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\nimport java.nio.file.Paths;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(Paths.get("my/file.txt"))\n .build();\nDocument document = client.documents().create(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\nimport java.net.URL;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(new URL("https://example.com/my/file.txt").openStream())\n .build();\nDocument document = client.documents().create(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file("content".getBytes())\n .build();\nDocument document = client.documents().create(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```java\nimport com.moderntreasury.api.core.MultipartField;\nimport com.moderntreasury.api.models.Document;\nimport com.moderntreasury.api.models.DocumentCreateParams;\nimport java.io.InputStream;\nimport java.net.URL;\n\nDocumentCreateParams params = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(MultipartField.builder()\n .value(new URL("https://example.com/my/file.txt").openStream())\n .filename("my/file.txt")\n .build())\n .build();\nDocument document = client.documents().create(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.moderntreasury.api.core.http.Headers;\nimport com.moderntreasury.api.core.http.HttpResponseFor;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build();\nHttpResponseFor counterparty = client.counterparties().withRawResponse().create(params);\n\nint statusCode = counterparty.statusCode();\nHeaders headers = counterparty.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty parsedCounterparty = counterparty.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ModernTreasuryServiceException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ModernTreasuryIoException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryIoException.kt): I/O networking errors.\n\n- [`ModernTreasuryRetryableException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ModernTreasuryInvalidDataException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ModernTreasuryException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyListPage;\n\nCounterpartyListPage page = client.counterparties().list();\n\n// Process as an Iterable\nfor (Counterparty counterparty : page.autoPager()) {\n System.out.println(counterparty);\n}\n\n// Process as a Stream\npage.autoPager()\n .stream()\n .limit(50)\n .forEach(counterparty -> System.out.println(counterparty));\n```\n\nWhen using the asynchronous client, the method returns an [`AsyncStreamResponse`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/http/AsyncStreamResponse.kt):\n\n```java\nimport com.moderntreasury.api.core.http.AsyncStreamResponse;\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyListPageAsync;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\n\nCompletableFuture pageFuture = client.async().counterparties().list();\n\npageFuture.thenRun(page -> page.autoPager().subscribe(counterparty -> {\n System.out.println(counterparty);\n}));\n\n// If you need to handle errors or completion of the stream\npageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {\n @Override\n public void onNext(Counterparty counterparty) {\n System.out.println(counterparty);\n }\n\n @Override\n public void onComplete(Optional error) {\n if (error.isPresent()) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error.get());\n } else {\n System.out.println("No more!");\n }\n }\n}));\n\n// Or use futures\npageFuture.thenRun(page -> page.autoPager()\n .subscribe(counterparty -> {\n System.out.println(counterparty);\n })\n .onCompleteFuture()\n .whenComplete((unused, error) -> {\n if (error != null) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error);\n } else {\n System.out.println("No more!");\n }\n }));\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\nimport com.moderntreasury.api.models.CounterpartyListPage;\n\nCounterpartyListPage page = client.counterparties().list();\nwhile (true) {\n for (Counterparty counterparty : page.items()) {\n System.out.println(counterparty);\n }\n\n if (!page.hasNextPage()) {\n break;\n }\n\n page = page.nextPage();\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `MODERN_TREASURY_LOG` environment variable to `info`:\n\n```sh\nexport MODERN_TREASURY_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport MODERN_TREASURY_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `modern-treasury-java-core` is published with a [configuration file](modern-treasury-java-core/src/main/resources/META-INF/proguard/modern-treasury-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty counterparty = client.counterparties().create(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport java.time.Duration;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\nimport java.time.Duration;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `modern-treasury-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryClient`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClient.kt), [`ModernTreasuryClientAsync`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsync.kt), [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt), and [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), all of which can work with any HTTP client\n- `modern-treasury-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) and [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), which provide a way to construct [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) and [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), respectively, using OkHttp\n- `modern-treasury-java`\n - Depends on and exposes the APIs of both `modern-treasury-java-core` and `modern-treasury-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`modern-treasury-java` dependency](#installation) with `modern-treasury-java-core`\n2. Copy `modern-treasury-java-client-okhttp`\'s [`OkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`modern-treasury-java` dependency](#installation) with `modern-treasury-java-core`\n2. Write a class that implements the [`HttpClient`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/http/HttpClient.kt) interface\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-java-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) object to its setter:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name(JsonValue.from(42))\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```java\nimport com.moderntreasury.api.core.JsonMissing;\nimport com.moderntreasury.api.models.CounterpartyCreateParams;\n\nCounterpartyCreateParams params = CounterpartyCreateParams.builder()\n .name(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.moderntreasury.api.core.JsonValue;\nimport java.util.Map;\n\nMap additionalProperties = client.counterparties().create(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.moderntreasury.api.core.JsonField;\nimport java.util.Optional;\n\nJsonField name = client.counterparties().create(params)._name();\n\nif (name.isMissing()) {\n // The property is absent from the JSON response\n} else if (name.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional jsonString = name.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = name.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ModernTreasuryInvalidDataException`](modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty counterparty = client.counterparties().create(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.moderntreasury.api.models.Counterparty;\n\nCounterparty counterparty = client.counterparties().create(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.moderntreasury.api.client.ModernTreasuryClient;\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient;\n\nModernTreasuryClient client = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-java/issues) with questions, bugs, or suggestions.\n', + '# Modern Treasury Terraform Provider\n\nThe [Modern Treasury Terraform provider](https://registry.terraform.io/providers/stainless-sdks/modern-treasury/latest/docs) provides convenient access to\nthe [Modern Treasury REST API](https://docs.moderntreasury.com) from Terraform.\n\n\n\n## Requirements\n\nThis provider requires Terraform CLI 1.0 or later. You can [install it for your system](https://developer.hashicorp.com/terraform/install)\non Hashicorp\'s website.\n\n## Usage\n\nAdd the following to your `main.tf` file:\n\n\n\n```hcl\n# Declare the provider and version\nterraform {\n required_providers {\n SDK_ProviderTypeName = {\n source = "stainless-sdks/modern-treasury"\n version = "~> 0.0.1"\n }\n }\n}\n\n# Initialize the provider\nprovider "modern-treasury" {\n api_key = "My API Key" # or set MODERN_TREASURY_API_KEY env variable\n organization_id = "my-organization-ID" # or set MODERN_TREASURY_ORGANIZATION_ID env variable\n webhook_key = "My Webhook Key" # or set MODERN_TREASURY_WEBHOOK_KEY env variable\n}\n\n# Configure a resource\n\n```\n\n\n\nInitialize your project by running `terraform init` in the directory.\n\nAdditional examples can be found in the [./examples](./examples) folder within this repository, and you can\nrefer to the full documentation on [the Terraform Registry](https://registry.terraform.io/providers/stainless-sdks/modern-treasury/latest/docs).\n\n### Provider Options\nWhen you initialize the provider, the following options are supported. It is recommended to use environment variables for sensitive values like access tokens.\nIf an environment variable is provided, then the option does not need to be set in the terraform source.\n\n| Property | Environment variable | Required | Default value |\n| --------------- | --------------------------------- | -------- | ------------- |\n| organization_id | `MODERN_TREASURY_ORGANIZATION_ID` | true | — |\n| api_key | `MODERN_TREASURY_API_KEY` | true | — |\n| webhook_key | `MODERN_TREASURY_WEBHOOK_KEY` | false | — |\n\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/modern-treasury-terraform/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { - language: 'kotlin', + language: 'typescript', content: - '# Modern Treasury Kotlin API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.moderntreasury.api/modern-treasury-kotlin)](https://central.sonatype.com/artifact/com.moderntreasury.api/modern-treasury-kotlin/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.moderntreasury.api/modern-treasury-kotlin/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-kotlin/0.0.1)\n\n\nThe Modern Treasury Kotlin SDK provides convenient access to the [Modern Treasury REST API](https://docs.moderntreasury.com) from applications written in Kotlin.\n\nThe Modern Treasury Kotlin SDK is similar to the Modern Treasury Java SDK but with minor differences that make it more ergonomic for use in Kotlin, such as nullable values instead of `Optional`, `Sequence` instead of `Stream`, and suspend functions instead of `CompletableFuture`.\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). KDocs are available on [javadoc.io](https://javadoc.io/doc/com.moderntreasury.api/modern-treasury-kotlin/0.0.1).\n\n\n\n## Installation\n\n\n\n### Gradle\n\n~~~kotlin\nimplementation("com.moderntreasury:modern-treasury-kotlin:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.moderntreasury\n modern-treasury-kotlin\n 0.0.1\n\n~~~\n\n\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.fromEnv()\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: Counterparty = client.counterparties().create(params)\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.fromEnv()\n```\n\nOr manually:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .apiKey("My API Key")\n .organizationId("my-organization-ID")\n .build()\n```\n\nOr using a combination of the two approaches:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n // Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n // Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build()\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| ---------------- | ------------------------------- | --------------------------------- | -------- | ---------------------------------- |\n| `apiKey` | `moderntreasury.apiKey` | `MODERN_TREASURY_API_KEY` | true | - |\n| `organizationId` | `moderntreasury.organizationId` | `MODERN_TREASURY_ORGANIZATION_ID` | true | - |\n| `webhookKey` | `moderntreasury.webhookKey` | `MODERN_TREASURY_WEBHOOK_KEY` | false | - |\n| `baseUrl` | `moderntreasury.baseUrl` | `MODERN_TREASURY_BASE_URL` | true | `"https://app.moderntreasury.com"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\n\nval clientWithOptions: ModernTreasuryClient = client.withOptions {\n it.baseUrl("https://example.com")\n it.maxRetries(42)\n}\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Modern Treasury API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Kotlin class.\n\nFor example, `client.counterparties().create(...)` should be called with an instance of `CounterpartyCreateParams`, and it will return an instance of `Counterparty`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.fromEnv()\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: Counterparty = client.async().counterparties().create(params)\n```\n\nOr create an asynchronous client from the beginning:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClientAsync\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\n// Configures using the `moderntreasury.apiKey`, `moderntreasury.organizationId`, `moderntreasury.webhookKey` and `moderntreasury.baseUrl` system properties\n// Or configures using the `MODERN_TREASURY_API_KEY`, `MODERN_TREASURY_ORGANIZATION_ID`, `MODERN_TREASURY_WEBHOOK_KEY` and `MODERN_TREASURY_BASE_URL` environment variables\nval client: ModernTreasuryClientAsync = ModernTreasuryOkHttpClientAsync.fromEnv()\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: Counterparty = client.counterparties().create(params)\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods are [suspending](https://kotlinlang.org/docs/coroutines-guide.html).\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```kotlin\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\nimport java.nio.file.Paths\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(Paths.get("my/file.txt"))\n .build()\nval document: Document = client.documents().create(params)\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```kotlin\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\nimport java.net.URL\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(URL("https://example.com/my/file.txt").openStream())\n .build()\nval document: Document = client.documents().create(params)\n```\n\nOr a `ByteArray`:\n\n```kotlin\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file("content".toByteArray())\n .build()\nval document: Document = client.documents().create(params)\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```kotlin\nimport com.moderntreasury.api.core.MultipartField\nimport com.moderntreasury.api.models.Document\nimport com.moderntreasury.api.models.DocumentCreateParams\nimport java.io.InputStream\nimport java.net.URL\n\nval params: DocumentCreateParams = DocumentCreateParams.builder()\n .documentableId("24c6b7a3-02...")\n .documentableType(DocumentCreateParams.DocumentableType.COUNTERPARTIES)\n .file(MultipartField.builder()\n .value(URL("https://example.com/my/file.txt").openStream())\n .filename("my/file.txt")\n .build())\n .build()\nval document: Document = client.documents().create(params)\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Kotlin classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```kotlin\nimport com.moderntreasury.api.core.http.Headers\nimport com.moderntreasury.api.core.http.HttpResponseFor\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name("my first counterparty")\n .build()\nval counterparty: HttpResponseFor = client.counterparties().withRawResponse().create(params)\n\nval statusCode: Int = counterparty.statusCode()\nval headers: Headers = counterparty.headers()\n```\n\nYou can still deserialize the response into an instance of a Kotlin class if needed:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval parsedCounterparty: Counterparty = counterparty.parse()\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ModernTreasuryServiceException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ModernTreasuryIoException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryIoException.kt): I/O networking errors.\n\n- [`ModernTreasuryRetryableException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ModernTreasuryInvalidDataException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ModernTreasuryException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns a [`Sequence`](https://kotlinlang.org/docs/sequences.html)\n\n```kotlin\nimport com.moderntreasury.api.models.CounterpartyListPage\n\nval page: CounterpartyListPage = client.counterparties().list()\npage.autoPager()\n .take(50)\n .forEach { counterparty -> println(counterparty) }\n```\n\nWhen using the asynchronous client, the method returns a [`Flow`](https://kotlinlang.org/docs/flow.html):\n\n```kotlin\nimport com.moderntreasury.api.models.CounterpartyListPageAsync\n\nval page: CounterpartyListPageAsync = client.async().counterparties().list()\npage.autoPager()\n .take(50)\n .forEach { counterparty -> println(counterparty) }\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\nimport com.moderntreasury.api.models.CounterpartyListPage\n\nval page: CounterpartyListPage = client.counterparties().list()\nwhile (true) {\n for (counterparty in page.items()) {\n println(counterparty)\n }\n\n if (!page.hasNextPage()) {\n break\n }\n\n page = page.nextPage()\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `MODERN_TREASURY_LOG` environment variable to `info`:\n\n```sh\nexport MODERN_TREASURY_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport MODERN_TREASURY_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `modern-treasury-kotlin-core` is published with a [configuration file](modern-treasury-kotlin-core/src/main/resources/META-INF/proguard/modern-treasury-kotlin-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build()\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval counterparty: Counterparty = client.counterparties().create(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n)\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport java.time.Duration\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build()\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport java.net.InetSocketAddress\nimport java.net.Proxy\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .proxy(Proxy(\n Proxy.Type.HTTP, InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build()\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\nimport java.time.Duration\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build()\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build()\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `modern-treasury-kotlin-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryClient`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClient.kt), [`ModernTreasuryClientAsync`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsync.kt), [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt), and [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), all of which can work with any HTTP client\n- `modern-treasury-kotlin-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) and [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), which provide a way to construct [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) and [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), respectively, using OkHttp\n- `modern-treasury-kotlin`\n - Depends on and exposes the APIs of both `modern-treasury-kotlin-core` and `modern-treasury-kotlin-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`modern-treasury-kotlin` dependency](#installation) with `modern-treasury-kotlin-core`\n2. Copy `modern-treasury-kotlin-client-okhttp`\'s [`OkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`modern-treasury-kotlin` dependency](#installation) with `modern-treasury-kotlin-core`\n2. Write a class that implements the [`HttpClient`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/http/HttpClient.kt) interface\n3. Construct [`ModernTreasuryClientImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientImpl.kt) or [`ModernTreasuryClientAsyncImpl`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/client/ModernTreasuryClientAsyncImpl.kt), similarly to [`ModernTreasuryOkHttpClient`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClient.kt) or [`ModernTreasuryOkHttpClientAsync`](modern-treasury-kotlin-client-okhttp/src/main/kotlin/com/moderntreasury/api/client/okhttp/ModernTreasuryOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonValue\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build()\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) object to its setter:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonValue\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name(JsonValue.from(42))\n .build()\n```\n\nThe most straightforward way to create a [`JsonValue`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt) is using its `from(...)` method:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonValue\n\n// Create primitive JSON values\nval nullValue: JsonValue = JsonValue.from(null)\nval booleanValue: JsonValue = JsonValue.from(true)\nval numberValue: JsonValue = JsonValue.from(42)\nval stringValue: JsonValue = JsonValue.from("Hello World!")\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nval arrayValue: JsonValue = JsonValue.from(listOf(\n "Hello", "World"\n))\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nval objectValue: JsonValue = JsonValue.from(mapOf(\n "a" to 1, "b" to 2\n))\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nval complexValue: JsonValue = JsonValue.from(mapOf(\n "a" to listOf(\n 1, 2\n ), "b" to listOf(\n 3, 4\n )\n))\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/core/Values.kt):\n\n```kotlin\nimport com.moderntreasury.api.core.JsonMissing\nimport com.moderntreasury.api.models.CounterpartyCreateParams\n\nval params: CounterpartyCreateParams = CounterpartyCreateParams.builder()\n .name(JsonMissing.of())\n .build()\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonBoolean\nimport com.moderntreasury.api.core.JsonNull\nimport com.moderntreasury.api.core.JsonNumber\nimport com.moderntreasury.api.core.JsonValue\n\nval additionalProperties: Map = client.counterparties().create(params)._additionalProperties()\nval secretPropertyValue: JsonValue = additionalProperties.get("secretProperty")\n\nval result = when (secretPropertyValue) {\n is JsonNull -> "It\'s null!"\n is JsonBoolean -> "It\'s a boolean!"\n is JsonNumber -> "It\'s a number!"\n // Other types include `JsonMissing`, `JsonString`, `JsonArray`, and `JsonObject`\n else -> "It\'s something else!"\n}\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```kotlin\nimport com.moderntreasury.api.core.JsonField\n\nval name: JsonField = client.counterparties().create(params)._name()\n\nif (name.isMissing()) {\n // The property is absent from the JSON response\n} else if (name.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n val jsonString: String? = name.asString();\n\n // Try to deserialize into a custom type\n val myObject: MyClass = name.asUnknown()!!.convert(MyClass::class.java)\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ModernTreasuryInvalidDataException`](modern-treasury-kotlin-core/src/main/kotlin/com/moderntreasury/api/errors/ModernTreasuryInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval counterparty: Counterparty = client.counterparties().create(params).validate()\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```kotlin\nimport com.moderntreasury.api.models.Counterparty\n\nval counterparty: Counterparty = client.counterparties().create(\n params, RequestOptions.builder().responseValidation(true).build()\n)\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.moderntreasury.api.client.ModernTreasuryClient\nimport com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient\n\nval client: ModernTreasuryClient = ModernTreasuryOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build()\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nKotlin `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-kotlin/issues) with questions, bugs, or suggestions.\n', + "# Modern Treasury TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/modern-treasury.svg?label=npm%20(stable))](https://npmjs.org/package/modern-treasury) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/modern-treasury)\n\nThis library provides convenient access to the Modern Treasury REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [docs.moderntreasury.com](https://docs.moderntreasury.com). The full API of this library can be found in [api.md](api.md).\n\n\n\n## MCP Server\n\nUse the Modern Treasury MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=modern-treasury-mcp&config=eyJuYW1lIjoibW9kZXJuLXRyZWFzdXJ5LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL21vZGVybi10cmVhc3VyeS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW1vZGVybi10cmVhc3VyeS1vcmdhbml6YXRpb24taWQiOiJteS1vcmdhbml6YXRpb24tSUQiLCJ4LW1vZGVybi10cmVhc3VyeS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22modern-treasury-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmodern-treasury.stlmcp.com%22%2C%22headers%22%3A%7B%22x-modern-treasury-organization-id%22%3A%22my-organization-ID%22%2C%22x-modern-treasury-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install modern-treasury\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\n```js\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst counterparty = await client.counterparties.create({ name: 'my first counterparty' });\n\nconsole.log(counterparty.id);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n organizationID: process.env['MODERN_TREASURY_ORGANIZATION_ID'], // This is the default and can be omitted\n apiKey: process.env['MODERN_TREASURY_API_KEY'], // This is the default and can be omitted\n});\n\nconst params: ModernTreasury.CounterpartyCreateParams = { name: 'my first counterparty' };\nconst counterparty: ModernTreasury.Counterparty = await client.counterparties.create(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport ModernTreasury, { toFile } from 'modern-treasury';\n\nconst client = new ModernTreasury();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.documents.create({\n file: fs.createReadStream('my/file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.documents.create({\n file: new File(['my bytes'], 'file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n\n// You can also pass a `fetch` `Response`:\nawait client.documents.create({\n file: await fetch('https://somesite/file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.documents.create({\n file: await toFile(Buffer.from('my bytes'), 'file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\nawait client.documents.create({\n file: await toFile(new Uint8Array([0, 1, 2]), 'file.txt'),\n documentable_id: '24c6b7a3-02...',\n documentable_type: 'counterparties',\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\n```ts\nconst externalAccount = await client.externalAccounts\n .create({ counterparty_id: 'missing' })\n .catch(async (err) => {\n if (err instanceof ModernTreasury.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\n```js\n// Configure the default for all requests:\nconst client = new ModernTreasury({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.counterparties.create({ name: 'my first counterparty' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\n```ts\n// Configure the default for all requests:\nconst client = new ModernTreasury({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.counterparties.create({ name: 'my first counterparty' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the ModernTreasury API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllCounterparties(params) {\n const allCounterparties = [];\n // Automatically fetches more pages as needed.\n for await (const counterparty of client.counterparties.list()) {\n allCounterparties.push(counterparty);\n }\n return allCounterparties;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.counterparties.list();\nfor (const counterparty of page.items) {\n console.log(counterparty);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\n```ts\nconst client = new ModernTreasury();\n\nconst response = await client.counterparties.create({ name: 'my first counterparty' }).asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: counterparty, response: raw } = await client.counterparties\n .create({ name: 'my first counterparty' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(counterparty.id);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `MODERN_TREASURY_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport ModernTreasury from 'modern-treasury';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new ModernTreasury({\n logger: logger.child({ name: 'ModernTreasury' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.counterparties.create({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport ModernTreasury from 'modern-treasury';\nimport fetch from 'my-fetch';\n\nconst client = new ModernTreasury({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\n\n```ts\nimport ModernTreasury from 'modern-treasury';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new ModernTreasury({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n **Bun** [[docs](https://bun.sh/guides/http/proxy)]\n\n```ts\nimport ModernTreasury from 'modern-treasury';\n\nconst client = new ModernTreasury({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\n\n```ts\nimport ModernTreasury from 'npm:modern-treasury';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new ModernTreasury({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/Modern-Treasury/modern-treasury-node/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n", }, ]; diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index 595b965b..c80d2a98 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -28,7 +28,7 @@ export const newMcpServer = async ({ new McpServer( { name: 'modern_treasury_api', - version: '4.14.0', + version: '4.15.0', }, { instructions: await getInstructions({ stainlessApiKey, customInstructionsPath }), diff --git a/scripts/bootstrap b/scripts/bootstrap index a8b69ff3..2e315f53 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { echo -n "==> Install Homebrew dependencies? (y/N): " read -r response diff --git a/src/resources/bulk-requests.ts b/src/resources/bulk-requests.ts index 8fc2833e..d4eb3bdb 100644 --- a/src/resources/bulk-requests.ts +++ b/src/resources/bulk-requests.ts @@ -594,7 +594,6 @@ export namespace BulkRequestCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -602,7 +601,6 @@ export namespace BulkRequestCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -612,7 +610,6 @@ export namespace BulkRequestCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -623,7 +620,6 @@ export namespace BulkRequestCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -881,7 +877,6 @@ export namespace BulkRequestCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -889,7 +884,6 @@ export namespace BulkRequestCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -899,7 +893,6 @@ export namespace BulkRequestCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -910,7 +903,6 @@ export namespace BulkRequestCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' @@ -1349,7 +1341,6 @@ export namespace BulkRequestCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -1357,7 +1348,6 @@ export namespace BulkRequestCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -1367,7 +1357,6 @@ export namespace BulkRequestCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1378,7 +1367,6 @@ export namespace BulkRequestCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/counterparties.ts b/src/resources/counterparties.ts index 131e21c1..57a57217 100644 --- a/src/resources/counterparties.ts +++ b/src/resources/counterparties.ts @@ -457,7 +457,6 @@ export namespace CounterpartyCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -465,7 +464,6 @@ export namespace CounterpartyCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -475,7 +473,6 @@ export namespace CounterpartyCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -486,7 +483,6 @@ export namespace CounterpartyCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/expected-payments.ts b/src/resources/expected-payments.ts index d5bcee65..4b18b093 100644 --- a/src/resources/expected-payments.ts +++ b/src/resources/expected-payments.ts @@ -258,7 +258,6 @@ export type ExpectedPaymentType = | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -266,7 +265,6 @@ export type ExpectedPaymentType = | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -276,7 +274,6 @@ export type ExpectedPaymentType = | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -287,7 +284,6 @@ export type ExpectedPaymentType = | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' @@ -350,7 +346,6 @@ export interface ReconciliationRule { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -358,7 +353,6 @@ export interface ReconciliationRule { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -368,7 +362,6 @@ export interface ReconciliationRule { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -379,7 +372,6 @@ export interface ReconciliationRule { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' @@ -727,7 +719,6 @@ export interface ExpectedPaymentListParams extends PageParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -735,7 +726,6 @@ export interface ExpectedPaymentListParams extends PageParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -745,7 +735,6 @@ export interface ExpectedPaymentListParams extends PageParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -756,7 +745,6 @@ export interface ExpectedPaymentListParams extends PageParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/external-accounts.ts b/src/resources/external-accounts.ts index b3763230..579b05f5 100644 --- a/src/resources/external-accounts.ts +++ b/src/resources/external-accounts.ts @@ -260,7 +260,6 @@ export namespace ExternalAccountVerifyResponse { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -268,7 +267,6 @@ export namespace ExternalAccountVerifyResponse { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -278,7 +276,6 @@ export namespace ExternalAccountVerifyResponse { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -289,7 +286,6 @@ export namespace ExternalAccountVerifyResponse { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -426,7 +422,6 @@ export namespace ExternalAccountCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -434,7 +429,6 @@ export namespace ExternalAccountCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -444,7 +438,6 @@ export namespace ExternalAccountCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -455,7 +448,6 @@ export namespace ExternalAccountCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -534,7 +526,6 @@ export interface ExternalAccountVerifyParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -542,7 +533,6 @@ export interface ExternalAccountVerifyParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -552,7 +542,6 @@ export interface ExternalAccountVerifyParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -563,7 +552,6 @@ export interface ExternalAccountVerifyParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/incoming-payment-details.ts b/src/resources/incoming-payment-details.ts index dd9730f9..b71c53be 100644 --- a/src/resources/incoming-payment-details.ts +++ b/src/resources/incoming-payment-details.ts @@ -181,6 +181,13 @@ export interface IncomingPaymentDetail { */ status: 'completed' | 'pending' | 'returned'; + /** + * An additional layer of classification for the type of incoming payment detail. + * For example, a `type` of `stablecoin` may have a `subtype` of `ethereum` or + * `solana`. + */ + subtype: string | null; + /** * The ID of the reconciled Transaction or `null`. */ @@ -199,19 +206,16 @@ export interface IncomingPaymentDetail { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'check' | 'eft' - | 'ethereum' | 'interac' | 'neft' | 'nz_becs' - | 'polygon' | 'rtp' | 'sepa' | 'signet' - | 'solana' + | 'stablecoin' | 'wire' | 'zengin'; @@ -307,6 +311,13 @@ export interface IncomingPaymentDetailListParams extends PageParams { */ status?: 'completed' | 'pending' | 'returned'; + /** + * An additional layer of classification for the type of incoming payment detail. + * For example, a `type` of `stablecoin` may have a `subtype` of `ethereum` or + * `solana`. + */ + subtype?: string; + /** * One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or * `wire`. @@ -315,19 +326,16 @@ export interface IncomingPaymentDetailListParams extends PageParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'check' | 'eft' - | 'ethereum' | 'interac' | 'neft' | 'nz_becs' - | 'polygon' | 'rtp' | 'sepa' | 'signet' - | 'solana' + | 'stablecoin' | 'wire' | 'zengin'; @@ -376,6 +384,12 @@ export interface IncomingPaymentDetailCreateAsyncParams { */ internal_account_id?: string; + /** + * An additional layer of classification for the type of incoming payment detail, + * e.g. `ethereum` for a `stablecoin` type. + */ + subtype?: string | null; + /** * One of `ach`, `wire`, `check`. */ @@ -383,19 +397,16 @@ export interface IncomingPaymentDetailCreateAsyncParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'check' | 'eft' - | 'ethereum' | 'interac' | 'neft' | 'nz_becs' - | 'polygon' | 'rtp' | 'sepa' | 'signet' - | 'solana' + | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/internal-accounts/balance-reports.ts b/src/resources/internal-accounts/balance-reports.ts index da7b140a..234f43c7 100644 --- a/src/resources/internal-accounts/balance-reports.ts +++ b/src/resources/internal-accounts/balance-reports.ts @@ -51,7 +51,7 @@ export class BalanceReports extends APIResource { * ```ts * const balanceReport = * await client.internalAccounts.balanceReports.retrieve( - * 'string', + * 'latest', * { internal_account_id: 'internal_account_id' }, * ); * ``` diff --git a/src/resources/internal-accounts/internal-accounts.ts b/src/resources/internal-accounts/internal-accounts.ts index d106dfd5..daf16d69 100644 --- a/src/resources/internal-accounts/internal-accounts.ts +++ b/src/resources/internal-accounts/internal-accounts.ts @@ -297,7 +297,6 @@ export namespace InternalAccount { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -305,7 +304,6 @@ export namespace InternalAccount { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -315,7 +313,6 @@ export namespace InternalAccount { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -326,7 +323,6 @@ export namespace InternalAccount { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -372,7 +368,6 @@ export interface InternalAccountUpdateAccountCapabilityResponse { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -380,7 +375,6 @@ export interface InternalAccountUpdateAccountCapabilityResponse { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -390,7 +384,6 @@ export interface InternalAccountUpdateAccountCapabilityResponse { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -401,7 +394,6 @@ export interface InternalAccountUpdateAccountCapabilityResponse { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -418,10 +410,10 @@ export interface InternalAccountCreateParams { connection_id: string; /** - * Either "USD" or "CAD". Internal accounts created at Increase only supports - * "USD". + * The currency of the internal account. Supports "USD" and "CAD" for fiat, and + * "USDC", "USDG", and "PYUSD" for stablecoin accounts. */ - currency: 'USD' | 'CAD'; + currency: 'USD' | 'CAD' | 'USDC' | 'USDG' | 'PYUSD'; /** * The nickname of the account. @@ -532,7 +524,6 @@ export namespace InternalAccountCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -540,7 +531,6 @@ export namespace InternalAccountCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -550,7 +540,6 @@ export namespace InternalAccountCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -561,7 +550,6 @@ export namespace InternalAccountCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -679,7 +667,6 @@ export interface InternalAccountListParams extends PageParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -687,7 +674,6 @@ export interface InternalAccountListParams extends PageParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -697,7 +683,6 @@ export interface InternalAccountListParams extends PageParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -708,7 +693,6 @@ export interface InternalAccountListParams extends PageParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/invoices/invoices.ts b/src/resources/invoices/invoices.ts index 3a84b9c9..fcbe0df8 100644 --- a/src/resources/invoices/invoices.ts +++ b/src/resources/invoices/invoices.ts @@ -190,6 +190,11 @@ export interface Invoice { */ invoicer_name: string | null; + /** + * Translation missing: en.openapi.descriptions.invoice.schema.issued_at + */ + issued_at: string | null; + /** * @deprecated The ledger account settlement object linked to the invoice. */ @@ -232,6 +237,11 @@ export interface Invoice { */ originating_account_id: string; + /** + * Translation missing: en.openapi.descriptions.invoice.schema.paid_at + */ + paid_at: string | null; + /** * Date transactions are to be posted to the participants' account. Defaults to the * current business day or the next business day if the current day is a bank @@ -306,6 +316,11 @@ export interface Invoice { * The ID of the virtual account the invoice should be paid to. */ virtual_account_id: string | null; + + /** + * Translation missing: en.openapi.descriptions.invoice.schema.voided_at + */ + voided_at: string | null; } export namespace Invoice { diff --git a/src/resources/ledger-account-settlements/ledger-account-settlements.ts b/src/resources/ledger-account-settlements/ledger-account-settlements.ts index 6533bd1b..f95963ca 100644 --- a/src/resources/ledger-account-settlements/ledger-account-settlements.ts +++ b/src/resources/ledger-account-settlements/ledger-account-settlements.ts @@ -231,6 +231,12 @@ export interface LedgerAccountSettlementUpdateParams { */ metadata?: { [key: string]: string }; + /** + * It is set to `false` by default. It should be set to `true` when migrating + * existing settlements. + */ + skip_settlement_ledger_transaction?: boolean | null; + /** * To post a pending ledger account settlement, use `posted`. To archive a pending * ledger transaction, use `archived`. diff --git a/src/resources/payment-orders/payment-orders.ts b/src/resources/payment-orders/payment-orders.ts index 07ea6b52..c1335d5a 100644 --- a/src/resources/payment-orders/payment-orders.ts +++ b/src/resources/payment-orders/payment-orders.ts @@ -529,12 +529,13 @@ export namespace PaymentOrder { | 'bankprov_payment_activity_date' | 'bankprov_payment_id' | 'blockchain_transaction_hash' + | 'blockchain_transaction_index' | 'bnk_dev_prenotification_id' | 'bnk_dev_transfer_id' | 'bny_mellon_transaction_reference_number' | 'bofa_end_to_end_id' + | 'bofa_neft_clearing_reference_number' | 'bofa_transaction_id' - | 'brale_transfer_id' | 'check_number' | 'chips_uid' | 'citibank_reference_number' @@ -581,6 +582,7 @@ export namespace PaymentOrder { | 'lob_check_id' | 'other' | 'partial_swift_mir' + | 'paxos_crypto_withdrawal_id' | 'paxos_fiat_withdrawal_id' | 'paxos_group_id' | 'paxos_orchestration_id' @@ -669,7 +671,6 @@ export type PaymentOrderType = | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -677,7 +678,6 @@ export type PaymentOrderType = | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -687,7 +687,6 @@ export type PaymentOrderType = | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -698,7 +697,6 @@ export type PaymentOrderType = | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -1156,7 +1154,6 @@ export namespace PaymentOrderCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -1164,7 +1161,6 @@ export namespace PaymentOrderCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -1174,7 +1170,6 @@ export namespace PaymentOrderCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1185,7 +1180,6 @@ export namespace PaymentOrderCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -1636,7 +1630,6 @@ export namespace PaymentOrderUpdateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -1644,7 +1637,6 @@ export namespace PaymentOrderUpdateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -1654,7 +1646,6 @@ export namespace PaymentOrderUpdateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1665,7 +1656,6 @@ export namespace PaymentOrderUpdateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -1755,7 +1745,6 @@ export interface PaymentOrderListParams extends PageParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -1763,7 +1752,6 @@ export interface PaymentOrderListParams extends PageParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -1773,7 +1761,6 @@ export interface PaymentOrderListParams extends PageParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1784,7 +1771,6 @@ export interface PaymentOrderListParams extends PageParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; @@ -2210,7 +2196,6 @@ export namespace PaymentOrderCreateAsyncParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -2218,7 +2203,6 @@ export namespace PaymentOrderCreateAsyncParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -2228,7 +2212,6 @@ export namespace PaymentOrderCreateAsyncParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -2239,7 +2222,6 @@ export namespace PaymentOrderCreateAsyncParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin'; diff --git a/src/resources/payment-references.ts b/src/resources/payment-references.ts index 2206f091..1025ef47 100644 --- a/src/resources/payment-references.ts +++ b/src/resources/payment-references.ts @@ -59,12 +59,13 @@ export interface PaymentReference { | 'bankprov_payment_activity_date' | 'bankprov_payment_id' | 'blockchain_transaction_hash' + | 'blockchain_transaction_index' | 'bnk_dev_prenotification_id' | 'bnk_dev_transfer_id' | 'bny_mellon_transaction_reference_number' | 'bofa_end_to_end_id' + | 'bofa_neft_clearing_reference_number' | 'bofa_transaction_id' - | 'brale_transfer_id' | 'check_number' | 'chips_uid' | 'citibank_reference_number' @@ -111,6 +112,7 @@ export interface PaymentReference { | 'lob_check_id' | 'other' | 'partial_swift_mir' + | 'paxos_crypto_withdrawal_id' | 'paxos_fiat_withdrawal_id' | 'paxos_group_id' | 'paxos_orchestration_id' diff --git a/src/resources/returns.ts b/src/resources/returns.ts index 71d5b60b..f081b07c 100644 --- a/src/resources/returns.ts +++ b/src/resources/returns.ts @@ -346,12 +346,13 @@ export namespace ReturnObject { | 'bankprov_payment_activity_date' | 'bankprov_payment_id' | 'blockchain_transaction_hash' + | 'blockchain_transaction_index' | 'bnk_dev_prenotification_id' | 'bnk_dev_transfer_id' | 'bny_mellon_transaction_reference_number' | 'bofa_end_to_end_id' + | 'bofa_neft_clearing_reference_number' | 'bofa_transaction_id' - | 'brale_transfer_id' | 'check_number' | 'chips_uid' | 'citibank_reference_number' @@ -398,6 +399,7 @@ export namespace ReturnObject { | 'lob_check_id' | 'other' | 'partial_swift_mir' + | 'paxos_crypto_withdrawal_id' | 'paxos_fiat_withdrawal_id' | 'paxos_group_id' | 'paxos_orchestration_id' diff --git a/src/resources/routing-details.ts b/src/resources/routing-details.ts index 6a5d942a..278db754 100644 --- a/src/resources/routing-details.ts +++ b/src/resources/routing-details.ts @@ -93,7 +93,6 @@ export interface RoutingDetail { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -101,7 +100,6 @@ export interface RoutingDetail { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -111,7 +109,6 @@ export interface RoutingDetail { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -122,7 +119,6 @@ export interface RoutingDetail { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' @@ -213,7 +209,6 @@ export interface RoutingDetailCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -221,7 +216,6 @@ export interface RoutingDetailCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -231,7 +225,6 @@ export interface RoutingDetailCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -242,7 +235,6 @@ export interface RoutingDetailCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' diff --git a/src/resources/shared.ts b/src/resources/shared.ts index d2cd8809..253c1f4b 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -708,7 +708,6 @@ export type Currency = | 'RUB' | 'RWF' | 'SAR' - | 'SBC' | 'SBD' | 'SCR' | 'SDG' diff --git a/src/resources/transactions/transactions.ts b/src/resources/transactions/transactions.ts index ac774248..bfe77205 100644 --- a/src/resources/transactions/transactions.ts +++ b/src/resources/transactions/transactions.ts @@ -195,7 +195,6 @@ export interface Transaction { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -203,7 +202,6 @@ export interface Transaction { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -213,7 +211,6 @@ export interface Transaction { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -224,7 +221,6 @@ export interface Transaction { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' @@ -249,7 +245,6 @@ export interface Transaction { | 'banking_circle' | 'bankprov' | 'bnk_dev' - | 'brale' | 'cleartouch' | 'coinbase_prime' | 'column' @@ -358,7 +353,6 @@ export interface TransactionCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -366,7 +360,6 @@ export interface TransactionCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -376,7 +369,6 @@ export interface TransactionCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -387,7 +379,6 @@ export interface TransactionCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' diff --git a/src/resources/validations.ts b/src/resources/validations.ts index 98d09165..e9833571 100644 --- a/src/resources/validations.ts +++ b/src/resources/validations.ts @@ -66,7 +66,6 @@ export interface RoutingNumberLookupRequest { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -74,7 +73,6 @@ export interface RoutingNumberLookupRequest { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -84,7 +82,6 @@ export interface RoutingNumberLookupRequest { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -95,7 +92,6 @@ export interface RoutingNumberLookupRequest { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' diff --git a/src/resources/virtual-accounts.ts b/src/resources/virtual-accounts.ts index cd36263e..d6cd464c 100644 --- a/src/resources/virtual-accounts.ts +++ b/src/resources/virtual-accounts.ts @@ -261,7 +261,6 @@ export namespace VirtualAccountCreateParams { | 'ach' | 'au_becs' | 'bacs' - | 'base' | 'book' | 'card' | 'chats' @@ -269,7 +268,6 @@ export namespace VirtualAccountCreateParams { | 'cross_border' | 'dk_nets' | 'eft' - | 'ethereum' | 'gb_fps' | 'hu_ics' | 'interac' @@ -279,7 +277,6 @@ export namespace VirtualAccountCreateParams { | 'nics' | 'nz_becs' | 'pl_elixir' - | 'polygon' | 'provxchange' | 'ro_sent' | 'rtp' @@ -290,7 +287,6 @@ export namespace VirtualAccountCreateParams { | 'sic' | 'signet' | 'sknbi' - | 'solana' | 'stablecoin' | 'wire' | 'zengin' diff --git a/src/version.ts b/src/version.ts index ddc4bbe9..bba5677d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.14.0'; // x-release-please-version +export const VERSION = '4.15.0'; // x-release-please-version diff --git a/tests/api-resources/incoming-payment-details.test.ts b/tests/api-resources/incoming-payment-details.test.ts index 98e55dc4..609b2724 100644 --- a/tests/api-resources/incoming-payment-details.test.ts +++ b/tests/api-resources/incoming-payment-details.test.ts @@ -65,6 +65,7 @@ describe('resource incomingPaymentDetails', () => { metadata: { foo: 'string' }, per_page: 0, status: 'completed', + subtype: 'subtype', type: 'ach', virtual_account_id: 'virtual_account_id', }, @@ -96,6 +97,7 @@ describe('resource incomingPaymentDetails', () => { description: 'description', direction: 'credit', internal_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + subtype: 'subtype', type: 'ach', virtual_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }, diff --git a/tests/api-resources/internal-accounts/balance-reports.test.ts b/tests/api-resources/internal-accounts/balance-reports.test.ts index afef9cc5..a5de37dc 100644 --- a/tests/api-resources/internal-accounts/balance-reports.test.ts +++ b/tests/api-resources/internal-accounts/balance-reports.test.ts @@ -49,7 +49,7 @@ describe('resource balanceReports', () => { }); test('retrieve: only required params', async () => { - const responsePromise = client.internalAccounts.balanceReports.retrieve('string', { + const responsePromise = client.internalAccounts.balanceReports.retrieve('latest', { internal_account_id: 'internal_account_id', }); const rawResponse = await responsePromise.asResponse(); @@ -62,7 +62,7 @@ describe('resource balanceReports', () => { }); test('retrieve: required and optional params', async () => { - const response = await client.internalAccounts.balanceReports.retrieve('string', { + const response = await client.internalAccounts.balanceReports.retrieve('latest', { internal_account_id: 'internal_account_id', }); }); diff --git a/tests/api-resources/ledger-account-settlements/ledger-account-settlements.test.ts b/tests/api-resources/ledger-account-settlements/ledger-account-settlements.test.ts index 62004097..426979f3 100644 --- a/tests/api-resources/ledger-account-settlements/ledger-account-settlements.test.ts +++ b/tests/api-resources/ledger-account-settlements/ledger-account-settlements.test.ts @@ -74,6 +74,7 @@ describe('resource ledgerAccountSettlements', () => { foo: 'bar', modern: 'treasury', }, + skip_settlement_ledger_transaction: true, status: 'posted', }, { path: '/_stainless_unknown_path' }, diff --git a/yarn.lock b/yarn.lock index e5e2a93b..f6eae3cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1220,9 +1220,9 @@ baseline-browser-mapping@^2.9.0: integrity sha512-B0xUquLkiGLgHhpPBqvl7GWegWBUNuujQ6kXd/r1U38ElPT6Ok8KZ8e+FpUGEc2ZoRQUzq/aUnaKFc/svWUGSg== brace-expansion@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.3.tgz#0493338bdd58e319b1039c67cf7ee439892c01d9" - integrity sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA== + version "2.1.0" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.0.tgz#4f41a41190216ee36067ec381526fe9539c4f0ae" + integrity sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w== dependencies: balanced-match "^1.0.0"