export type TaskSchedulerSchema = {paused?: boolean | undefined, repeat_every?: string | undefined, start_from?: number | undefined, job?: string | undefined, date_range?: string | undefined, date_key?: string | undefined, start_date?: string | undefined, end_date?: string | undefined, report_keys?: Array | undefined}; export type UpdateApiApiV1TaskSchedulersIdArgs = {'X-API-SECRET'?: string | undefined, 'X-Requested-With': string, id: unknown, body: TaskSchedulerSchema}; export type UpdateApiApiV1TaskSchedulersIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update task scheduler * * PUT /api/v1/task_schedulers/{id} */ export const updateApiApiV1TaskSchedulersId = async (args: UpdateApiApiV1TaskSchedulersIdArgs, options?: UpdateApiApiV1TaskSchedulersIdOptions) => { 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-SECRET'] != null) headers.set("X-API-SECRET", String(args['X-API-SECRET'])) if (args['X-Requested-With'] != null) headers.set("X-Requested-With", String(args['X-Requested-With'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/task_schedulers/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };