export type GetApiOrganizationOrganizationIdInvoiceInvoiceNumberPdfArgs = {organization_id: string, invoice_number: string}; export type GetApiOrganizationOrganizationIdInvoiceInvoiceNumberPdfOptions = {baseUrl?: string | undefined, tokenAuth?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a PDF invoice * * GET /organization/{organization_id}/invoice/{invoice_number}/pdf */ export const getApiOrganizationOrganizationIdInvoiceInvoiceNumberPdf = async (args: GetApiOrganizationOrganizationIdInvoiceInvoiceNumberPdfArgs, options?: GetApiOrganizationOrganizationIdInvoiceInvoiceNumberPdfOptions) => { const {baseUrl = "https://api.aiven.io/v1", fetch: fetchFn = fetch, tokenAuth, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (tokenAuth !== undefined) headers.set('authorization', `Bearer ${tokenAuth}`) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/organization/${encodeURIComponent(String(args.organization_id))}/invoice/${encodeURIComponent(String(args.invoice_number))}/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() };