export type CreateApiApiTasksWorkflowIdTaskRefNameStatusArgs = {workflowId: string, taskRefName: string, status: 'IN_PROGRESS' | 'FAILED' | 'FAILED_WITH_TERMINAL_ERROR' | 'COMPLETED' | 'CANCELED', workerid?: string | undefined, body: {[key: string]: Record}}; export type CreateApiApiTasksWorkflowIdTaskRefNameStatusOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a task By Ref Name. The output data is merged if data from a previous API call already exists. * * POST /api/tasks/{workflowId}/{taskRefName}/{status} */ export const createApiApiTasksWorkflowIdTaskRefNameStatus = async (args: CreateApiApiTasksWorkflowIdTaskRefNameStatusArgs, options?: CreateApiApiTasksWorkflowIdTaskRefNameStatusOptions) => { 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") headers.set('accept', "text/plain") if (args.workerid != null) query.append("workerid", String(args.workerid)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/tasks/${encodeURIComponent(String(args.workflowId))}/${encodeURIComponent(String(args.taskRefName))}/${encodeURIComponent(String(args.status))}${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 res.text() };