export type DeleteApiCmmnRuntimeTasksTaskIdArgs = {taskId: string, cascadeHistory?: string | undefined, deleteReason?: string | undefined}; export type DeleteApiCmmnRuntimeTasksTaskIdOptions = {baseUrl: string, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete a task * * DELETE /cmmn-runtime/tasks/{taskId} */ export const deleteApiCmmnRuntimeTasksTaskId = async (args: DeleteApiCmmnRuntimeTasksTaskIdArgs, options: DeleteApiCmmnRuntimeTasksTaskIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cascadeHistory != null) query.append("cascadeHistory", String(args.cascadeHistory)) if (args.deleteReason != null) query.append("deleteReason", String(args.deleteReason)) if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/cmmn-runtime/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 };