export type PatchApiApiV1InvoicesIdSendArgs = {id: string, body: {email?: ({to: Array, cc?: (Array | null) | undefined, bcc?: (Array | null) | undefined, subject: string, body: string}) | undefined} | {printer?: ({id?: string | undefined} | {name?: string | undefined}) | undefined}}; export type PatchApiApiV1InvoicesIdSendOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send invoice * * PATCH /api/v1/invoices/{id}/send */ export const patchApiApiV1InvoicesIdSend = async (args: PatchApiApiV1InvoicesIdSendArgs, options?: PatchApiApiV1InvoicesIdSendOptions) => { const {baseUrl = "https://xentral.xentral.biz", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/invoices/${encodeURIComponent(String(args.id))}/send${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };