export type GetApiWorkspacesWorkspaceIdPaymentReceiptsPaymentIdPdfArgs = {workspace_id: number, payment_id: number}; export type GetApiWorkspacesWorkspaceIdPaymentReceiptsPaymentIdPdfOptions = {baseUrl: string, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * PaymentReceipts * * GET /workspaces/{workspace_id}/payment_receipts/{payment_id}.pdf */ export const getApiWorkspacesWorkspaceIdPaymentReceiptsPaymentIdPdf = async (args: GetApiWorkspacesWorkspaceIdPaymentReceiptsPaymentIdPdfArgs, options: GetApiWorkspacesWorkspaceIdPaymentReceiptsPaymentIdPdfOptions) => { const {baseUrl, fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/workspaces/${encodeURIComponent(String(args.workspace_id))}/payment_receipts/${encodeURIComponent(String(args.payment_id))}.pdf${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 res.blob() };