export type PatchApiApiV2InvoicesIdActionsSendArgs = {id: string, body: {email?: ({to: string, cc?: (Array | null) | undefined, bcc?: (Array | null) | undefined, subject: string, body: string}) | undefined} | {printer?: ({id?: string | undefined} | {name?: string | undefined}) | undefined} | {markAsSent?: boolean | undefined}}; export type PatchApiApiV2InvoicesIdActionsSendOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send invoice V2 * * PATCH /api/v2/invoices/{id}/actions/send */ export const patchApiApiV2InvoicesIdActionsSend = async (args: PatchApiApiV2InvoicesIdActionsSendArgs, options?: PatchApiApiV2InvoicesIdActionsSendOptions) => { 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/v2/invoices/${encodeURIComponent(String(args.id))}/actions/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 };