export type UpdateApiTasksIdArgs = {id: number, body: {assigned_to_id?: number | undefined, description?: string | undefined, priority?: number | undefined, date_due?: string | undefined, is_completed?: boolean | undefined}}; export type UpdateApiTasksIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a task * * PUT /tasks/{id} */ export const updateApiTasksId = async (args: UpdateApiTasksIdArgs, options?: UpdateApiTasksIdOptions) => { const {baseUrl = "https://api.catsone.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/tasks/${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 };