export type CreateApiV1SalesinvoicesSendIdArgs = {id: number, body: Array}; export type CreateApiV1SalesinvoicesSendIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send an invoice * * POST /v1/salesinvoices/send/{id} */ export const createApiV1SalesinvoicesSendId = async (args: CreateApiV1SalesinvoicesSendIdArgs, options?: CreateApiV1SalesinvoicesSendIdOptions) => { const {baseUrl = "https://api.altoviz.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/salesinvoices/send/${encodeURIComponent(String(args.id))}${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 undefined };