export type GetApibulkPaymentsBulkPaymentIdErrorsArgs = {bulkPaymentId?: string | undefined, Accept?: string | undefined, Authorization?: string | undefined}; export type GetApibulkPaymentsBulkPaymentIdErrorsOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Get failed bulk payments * * GET bulk-payments/{bulkPaymentId}/errors */ export const getApibulkPaymentsBulkPaymentIdErrors = async (args: GetApibulkPaymentsBulkPaymentIdErrorsArgs, options?: GetApibulkPaymentsBulkPaymentIdErrorsOptions) => { const {baseUrl = "https://payments.air-pay.io", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}bulk-payments/${encodeURIComponent(String(args.bulkPaymentId))}/errors${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 };