export type GetApiApiV10AppIdInvoicesInvoicePdfArgs = {invoiceNumber: string, appId: string}; export type GetApiApiV10AppIdInvoicesInvoicePdfOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1.0/{appId}/invoices/InvoicePdf */ export const getApiApiV10AppIdInvoicesInvoicePdf = async (args: GetApiApiV10AppIdInvoicesInvoicePdfArgs, options?: GetApiApiV10AppIdInvoicesInvoicePdfOptions) => { const {baseUrl = "https://api.flipdish.co", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.invoiceNumber != null) query.append("invoiceNumber", String(args.invoiceNumber)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1.0/${encodeURIComponent(String(args.appId))}/invoices/InvoicePdf${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 };