export type CreateApiApiV1InvoicesBulkArgs = {'X-API-TOKEN': string, 'X-Requested-With': string, index?: string | undefined, body: {email_type?: string | undefined, action?: string | undefined, ids?: Array | undefined}}; export type CreateApiApiV1InvoicesBulkOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk invoice actions * * POST /api/v1/invoices/bulk */ export const createApiApiV1InvoicesBulk = async (args: CreateApiApiV1InvoicesBulkArgs, options?: CreateApiApiV1InvoicesBulkOptions) => { const {baseUrl = "https://demo.invoiceninja.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-API-TOKEN'] != null) headers.set("X-API-TOKEN", String(args['X-API-TOKEN'])) if (args['X-Requested-With'] != null) headers.set("X-Requested-With", String(args['X-Requested-With'])) if (args.index != null) query.append("index", String(args.index)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/invoices/bulk${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 };