export type TaskStatus = 'pending' | 'running' | 'success' | 'failed' | 'canceled' | 'initializing' | 'queued' | 'planning' | 'planning_destroy' | 'applying' | 'destroying' | 'ready_for_apply' | 'ready_for_destroy' | 'destroyed' | 'destroy_plan_completed' | 'destroy_plan_failed' | 'destroy_failed' | 'discarded' | 'canceling_init' | 'canceling_plan' | 'canceling_planning_destroy' | 'canceling_apply' | 'canceling_destroy' | 'canceled_init' | 'canceled_plan' | 'canceled_planning_destroy' | 'canceled_apply' | 'canceled_destroy'; export type TaskError = {type?: 'UNEXPECTED' | undefined, description?: string | undefined}; export type CurrentStep = 'plan' | 'post_plan' | 'apply' | 'post_apply'; export type UpdateTaskStatusRequest = {status?: TaskStatus | undefined, error?: TaskError | undefined, currentStep?: CurrentStep | undefined, workspaceRunId?: string | undefined}; export type PatchApiSelfHostedAccountIdTasksTaskIdArgs = {accountId: string, taskId: string, body: UpdateTaskStatusRequest}; export type PatchApiSelfHostedAccountIdTasksTaskIdOptions = {baseUrl?: string | undefined, RunnerPoolAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update task status (self-hosted) * * PATCH /self-hosted/{accountId}/tasks/{taskId} */ export const patchApiSelfHostedAccountIdTasksTaskId = async (args: PatchApiSelfHostedAccountIdTasksTaskIdArgs, options?: PatchApiSelfHostedAccountIdTasksTaskIdOptions) => { const {baseUrl = "https://api.firefly.ai/v2", fetch: fetchFn = fetch, RunnerPoolAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (RunnerPoolAuth !== undefined) headers.set('authorization', `Bearer ${RunnerPoolAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/self-hosted/${encodeURIComponent(String(args.accountId))}/tasks/${encodeURIComponent(String(args.taskId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };