export type UpdateApiV1FinanceInvoicesInvoiceIdCreateDocumentArgs = {'Customer-Id': number, invoiceId: number}; export type UpdateApiV1FinanceInvoicesInvoiceIdCreateDocumentOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create an invoice document pdf * * PUT /v1/finance/invoices/{invoiceId}/createDocument */ export const updateApiV1FinanceInvoicesInvoiceIdCreateDocument = async (args: UpdateApiV1FinanceInvoicesInvoiceIdCreateDocumentArgs, options?: UpdateApiV1FinanceInvoicesInvoiceIdCreateDocumentOptions) => { const {baseUrl = "https://api.bigchange.com", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Customer-Id'] != null) headers.set("Customer-Id", String(args['Customer-Id'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/finance/invoices/${encodeURIComponent(String(args.invoiceId))}/createDocument${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };