export type CreateApiV3CustomersIdInvoicesInvoiceIdAttachmentsArgs = {id: string, invoiceId: string, body: BodyInit}; export type CreateApiV3CustomersIdInvoicesInvoiceIdAttachmentsOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload invoice attachment * * POST /v3/customers/{id}/invoices/{invoiceId}/attachments */ export const createApiV3CustomersIdInvoicesInvoiceIdAttachments = async (args: CreateApiV3CustomersIdInvoicesInvoiceIdAttachmentsArgs, options?: CreateApiV3CustomersIdInvoicesInvoiceIdAttachmentsOptions) => { const {baseUrl = "https://integrators.prod.api.tabsplatform.com", fetch: fetchFn = fetch, customHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (customHeader !== undefined) headers.set("Authorization", customHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v3/customers/${encodeURIComponent(String(args.id))}/invoices/${encodeURIComponent(String(args.invoiceId))}/attachments${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };