export type GetApiBillingPaymentRequestInvoiceIdPdfArgs = {id: number}; export type GetApiBillingPaymentRequestInvoiceIdPdfOptions = {baseUrl?: string | undefined, AccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Payment Request Invoice PDF * * GET /billing/payment-request-invoice/{id}/pdf * * Also accepts auth: bearer */ export const getApiBillingPaymentRequestInvoiceIdPdf = async (args: GetApiBillingPaymentRequestInvoiceIdPdfArgs, options?: GetApiBillingPaymentRequestInvoiceIdPdfOptions) => { const {baseUrl = "https://api.bunny.net", fetch: fetchFn = fetch, AccessKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (AccessKey !== undefined) headers.set("AccessKey", AccessKey) const url = `${baseUrl.replace(/\/+$/, '')}/billing/payment-request-invoice/${encodeURIComponent(String(args.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 undefined };