export type GetApiRecipientsRecipientIdWithdrawalsArgs = {recipient_id: string, status?: string | undefined, created_since?: string | undefined, created_until?: string | undefined}; export type GetApiRecipientsRecipientIdWithdrawalsOptions = {baseUrl?: string | undefined, sec0?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Listar saques * * GET /recipients/{recipient_id}/withdrawals */ export const getApiRecipientsRecipientIdWithdrawals = async (args: GetApiRecipientsRecipientIdWithdrawalsArgs, options?: GetApiRecipientsRecipientIdWithdrawalsOptions) => { const {baseUrl = "https://api.mundipagg.com/core/v1", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.status != null) query.append("status", String(args.status)) if (args.created_since != null) query.append("created_since", String(args.created_since)) if (args.created_until != null) query.append("created_until", String(args.created_until)) if (sec0 !== undefined) headers.set('authorization', `Basic ${btoa(`${sec0.username}:${sec0.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/recipients/${encodeURIComponent(String(args.recipient_id))}/withdrawals${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 (await res.json()) as unknown };