export type GetApiIncomingPaymentDetailsArgs = {direction?: string | undefined, status?: string | undefined, type?: string | undefined, as_of_date_start?: string | undefined, as_of_date_end?: string | undefined, metadata?: string | undefined, virtual_account_id?: string | undefined, after_cursor?: string | undefined, per_page?: number | undefined}; export type GetApiIncomingPaymentDetailsOptions = {baseUrl?: string | undefined, sec0?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * List Incoming Payment Details * * GET /incoming_payment_details */ export const getApiIncomingPaymentDetails = async (args: GetApiIncomingPaymentDetailsArgs, options?: GetApiIncomingPaymentDetailsOptions) => { const {baseUrl = "https://app.moderntreasury.com/api", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.direction != null) query.append("direction", String(args.direction)) if (args.status != null) query.append("status", String(args.status)) if (args.type != null) query.append("type", String(args.type)) if (args.as_of_date_start != null) query.append("as_of_date_start", String(args.as_of_date_start)) if (args.as_of_date_end != null) query.append("as_of_date_end", String(args.as_of_date_end)) if (args.metadata != null) query.append("metadata", String(args.metadata)) if (args.virtual_account_id != null) query.append("virtual_account_id", String(args.virtual_account_id)) if (args.after_cursor != null) query.append("after_cursor", String(args.after_cursor)) if (args.per_page != null) query.append("per_page", String(args.per_page)) if (sec0 !== undefined) headers.set('authorization', `Basic ${btoa(`${sec0.username}:${sec0.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/incoming_payment_details${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };