// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class DepositAccounts extends APIResource { /** * Create a new wire transfer deposit account for receiving payments. Only wire * transfer accounts are currently supported. Account numbers are masked in * responses for security. * * @example * ```ts * const depositAccount = * await client.creators.depositAccounts.create({ * accountHolderName: 'John Doe', * accountNumber: '1234567890', * accountType: 'checking', * bank: 'Chase Bank', * name: 'Main Business Account', * routingNumber: '123456789', * type: 'wire', * }); * ``` */ create( body: DepositAccountCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post('/creators/deposit-accounts', { body, ...options }); } /** * Update deposit account information or set it as default. Can update name, bank, * account holder name, SWIFT code, and default status. All fields are optional. * * @example * ```ts * const depositAccount = * await client.creators.depositAccounts.update( * '123e4567-e89b-12d3-a456-426614174000', * ); * ``` */ update( id: string, body: DepositAccountUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/creators/deposit-accounts/${id}`, { body, ...options }); } /** * Get a list of all deposit accounts for the authenticated creator. Account * numbers are masked for security. * * @example * ```ts * const depositAccounts = * await client.creators.depositAccounts.list(); * ``` */ list(options?: RequestOptions): APIPromise { return this._client.get('/creators/deposit-accounts', options); } /** * Delete a deposit account. If the deleted account was the default, another active * account will automatically be set as default. * * @example * ```ts * const depositAccount = * await client.creators.depositAccounts.delete( * '123e4567-e89b-12d3-a456-426614174000', * ); * ``` */ delete(id: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/creators/deposit-accounts/${id}`, options); } } /** * Response schema for creating a deposit account */ export interface DepositAccountCreateResponse { /** * Deposit account information */ data: DepositAccountCreateResponse.Data; /** * Success message */ message: string; /** * Whether the request was successful */ success: boolean; } export namespace DepositAccountCreateResponse { /** * Deposit account information */ export interface Data { /** * Unique identifier for the deposit account */ id: string; /** * Name of the account holder */ accountHolderName: string; /** * Bank account number (masked for security) */ accountNumber: string; /** * Type of bank account */ accountType: 'checking' | 'savings'; /** * Name of the bank */ bank: string; /** * ISO 8601 timestamp of when the account was created */ createdAt: string; /** * Whether this is the default deposit account */ default: boolean; /** * Display name for the deposit account */ name: string; /** * Bank routing number */ routingNumber: string; /** * Status of the deposit account */ status: 'active' | 'inactive'; /** * Type of deposit account */ type: 'wire'; /** * ISO 8601 timestamp of when the account was last updated */ updatedAt: string; /** * SWIFT code for international transfers */ swiftCode?: string; } } /** * Response schema for updating a deposit account */ export interface DepositAccountUpdateResponse { /** * Deposit account information */ data: DepositAccountUpdateResponse.Data; /** * Success message */ message: string; /** * Whether the request was successful */ success: boolean; } export namespace DepositAccountUpdateResponse { /** * Deposit account information */ export interface Data { /** * Unique identifier for the deposit account */ id: string; /** * Name of the account holder */ accountHolderName: string; /** * Bank account number (masked for security) */ accountNumber: string; /** * Type of bank account */ accountType: 'checking' | 'savings'; /** * Name of the bank */ bank: string; /** * ISO 8601 timestamp of when the account was created */ createdAt: string; /** * Whether this is the default deposit account */ default: boolean; /** * Display name for the deposit account */ name: string; /** * Bank routing number */ routingNumber: string; /** * Status of the deposit account */ status: 'active' | 'inactive'; /** * Type of deposit account */ type: 'wire'; /** * ISO 8601 timestamp of when the account was last updated */ updatedAt: string; /** * SWIFT code for international transfers */ swiftCode?: string; } } /** * Response schema for retrieving deposit accounts */ export interface DepositAccountListResponse { /** * List of deposit accounts */ data: Array; /** * Whether the request was successful */ success: boolean; } export namespace DepositAccountListResponse { /** * Deposit account information */ export interface Data { /** * Unique identifier for the deposit account */ id: string; /** * Name of the account holder */ accountHolderName: string; /** * Bank account number (masked for security) */ accountNumber: string; /** * Type of bank account */ accountType: 'checking' | 'savings'; /** * Name of the bank */ bank: string; /** * ISO 8601 timestamp of when the account was created */ createdAt: string; /** * Whether this is the default deposit account */ default: boolean; /** * Display name for the deposit account */ name: string; /** * Bank routing number */ routingNumber: string; /** * Status of the deposit account */ status: 'active' | 'inactive'; /** * Type of deposit account */ type: 'wire'; /** * ISO 8601 timestamp of when the account was last updated */ updatedAt: string; /** * SWIFT code for international transfers */ swiftCode?: string; } } /** * Response schema for deleting a deposit account */ export interface DepositAccountDeleteResponse { data: DepositAccountDeleteResponse.Data; /** * Whether the request was successful */ success: boolean; } export namespace DepositAccountDeleteResponse { export interface Data { /** * ID of the deposit account that was deleted */ deletedId: string; /** * Confirmation message */ message: string; } } export interface DepositAccountCreateParams { /** * Name of the account holder */ accountHolderName: string; /** * Bank account number */ accountNumber: string; /** * Type of bank account */ accountType: 'checking' | 'savings'; /** * Name of the bank */ bank: string; /** * Display name for the deposit account */ name: string; /** * Bank routing number (9 digits) */ routingNumber: string; /** * Type of deposit account (currently only wire supported) */ type: 'wire'; /** * Whether this should be the default deposit account */ default?: boolean; /** * SWIFT code for international transfers (optional) */ swiftCode?: string; } export interface DepositAccountUpdateParams { /** * Name of the account holder */ accountHolderName?: string; /** * Name of the bank */ bank?: string; /** * Whether this should be the default deposit account */ default?: boolean; /** * Display name for the deposit account */ name?: string; /** * SWIFT code for international transfers (optional) */ swiftCode?: string; } export declare namespace DepositAccounts { export { type DepositAccountCreateResponse as DepositAccountCreateResponse, type DepositAccountUpdateResponse as DepositAccountUpdateResponse, type DepositAccountListResponse as DepositAccountListResponse, type DepositAccountDeleteResponse as DepositAccountDeleteResponse, type DepositAccountCreateParams as DepositAccountCreateParams, type DepositAccountUpdateParams as DepositAccountUpdateParams, }; }