export type GetApiUsersIdWithdrawalsDownloadArgs = {id: string, user_id?: string | undefined, 'Encoded-Data-Message'?: string | undefined, 'Encoded-Data-Signature'?: string | undefined}; export type GetApiUsersIdWithdrawalsDownloadOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Downloads the USDC withdrawals the user has made as a CSV file * * GET /users/{id}/withdrawals/download */ export const getApiUsersIdWithdrawalsDownload = async (args: GetApiUsersIdWithdrawalsDownloadArgs, options: GetApiUsersIdWithdrawalsDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.user_id != null) query.append("user_id", String(args.user_id)) if (args['Encoded-Data-Message'] != null) headers.set("Encoded-Data-Message", String(args['Encoded-Data-Message'])) if (args['Encoded-Data-Signature'] != null) headers.set("Encoded-Data-Signature", String(args['Encoded-Data-Signature'])) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/users/${encodeURIComponent(String(args.id))}/withdrawals/download${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 };