export type OrderInvoiceUri = string; export type GetOrderInvoicePdfFromHtmlInvoiceUrlRequest = {orderInvoiceUri: OrderInvoiceUri}; export type CreateApiV2UserMarketplacesOrdersInvoicesGetPdfInvoiceArgs = {body: GetOrderInvoicePdfFromHtmlInvoiceUrlRequest}; export type CreateApiV2UserMarketplacesOrdersInvoicesGetPdfInvoiceOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns the PDF version of the invoice * * POST /v2/user/marketplaces/orders/invoices/getPdfInvoice */ export const createApiV2UserMarketplacesOrdersInvoicesGetPdfInvoice = async (args: CreateApiV2UserMarketplacesOrdersInvoicesGetPdfInvoiceArgs, options?: CreateApiV2UserMarketplacesOrdersInvoicesGetPdfInvoiceOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/pdf") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/marketplaces/orders/invoices/getPdfInvoice${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };