export type DeleteApiTasksTaskIdArgs = {taskId: number}; export type DeleteApiTasksTaskIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Soft-delete a task * * DELETE /tasks/{taskId} * * Also accepts auth: PersonalAccessToken */ export const deleteApiTasksTaskId = async (args: DeleteApiTasksTaskIdArgs, options?: DeleteApiTasksTaskIdOptions) => { const {baseUrl = "https://api.fergus.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/tasks/${encodeURIComponent(String(args.taskId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };