export type CreateApiBankingTransfersArgs = {body: {id?: string | undefined, destination_account_id?: string | undefined, account_id?: string | undefined, provider?: ({account_id?: string | undefined, transfer_id?: string | undefined}) | undefined, status?: ('PENDING' | 'COMPLETED') | undefined, direction?: 'INCOMING' | undefined, sender?: ({account_number_last_4?: string | undefined, routing_number?: string | undefined, account_name?: string | undefined, bank_name?: string | undefined}) | undefined, amount?: ({value?: number | undefined, currency?: string | undefined}) | undefined, payment_rail?: ('ACH_STANDARD' | 'ACH_SAME_DAY' | 'WIRE' | 'RTP' | 'FPS' | 'CHAPS' | 'BACS' | 'NPP' | 'PAYTO' | 'BPAY') | undefined, description?: string | undefined, created_at?: string | undefined, updated_at?: string | undefined}}; export type CreateApiBankingTransfersOptions = {baseUrl?: string | undefined, publicApiKey?: string | undefined, privateSecretKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Webhook Notifications * * POST /banking/transfers */ export const createApiBankingTransfers = async (args: CreateApiBankingTransfersArgs, options?: CreateApiBankingTransfersOptions) => { const {baseUrl = "https://api-sandbox.y.uno/v1", fetch: fetchFn = fetch, publicApiKey, privateSecretKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (publicApiKey !== undefined) headers.set("PUBLIC-API-KEY", publicApiKey) if (privateSecretKey !== undefined) headers.set("PRIVATE-SECRET-KEY", privateSecretKey) const url = `${baseUrl.replace(/\/+$/, '')}/banking/transfers${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };