export type CreateApiApiHumanTasksUpdateTaskRefArgs = {workflowId: string, taskRefName: string, complete?: boolean | undefined, iteration?: Array | undefined, body: {[key: string]: Record}}; export type CreateApiApiHumanTasksUpdateTaskRefOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update task output, optionally complete * * POST /api/human/tasks/update/taskRef */ export const createApiApiHumanTasksUpdateTaskRef = async (args: CreateApiApiHumanTasksUpdateTaskRefArgs, options?: CreateApiApiHumanTasksUpdateTaskRefOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.workflowId != null) query.append("workflowId", String(args.workflowId)) if (args.taskRefName != null) query.append("taskRefName", String(args.taskRefName)) if (args.complete != null) query.append("complete", String(args.complete)) for (const item of args.iteration ?? []) query.append("iteration", String(item)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/human/tasks/update/taskRef${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };