export type Task = {task_id?: string | undefined, task_type_id: string, task_state_id: string, customer_id: string, task_note?: string | undefined, task_title: string, task_priority: 1 | 2 | 3 | 4, due_date?: string | undefined, created_at?: string | undefined, state?: (0 | 1 | 2) | undefined}; export type UpdateApiTasksTaskIdArgs = {'Accept-Language'?: string | undefined, task_id: string, body: {task: Task}}; export type UpdateApiTasksTaskIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a task * * PUT /tasks/{task_id} * * Also accepts auth: basicAuth */ export const updateApiTasksTaskId = async (args: UpdateApiTasksTaskIdArgs, options?: UpdateApiTasksTaskIdOptions) => { const {baseUrl = "https://sandbox.crmcarecloud.com/webservice/rest-api/enterprise-interface/v1.0", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/tasks/${encodeURIComponent(String(args.task_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 };