export type WorkspaceRunStatus = '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' | 'init_error' | 'plan_success' | 'plan_error' | 'apply_error' | 'apply_success' | 'blocked' | 'Acknowledged' | 'plan_no_changes' | 'apply_no_changes' | 'runner_failure'; export type WorkspaceRunError = {type: string, description: string, activity?: string | undefined, temporalWorkflowId: string, cause?: string | undefined}; export type UpdateWorkspaceRunRequest = {status?: WorkspaceRunStatus | undefined, AccountId?: string | undefined, workspaceId?: string | undefined, workspaceRunId: string, error?: WorkspaceRunError | undefined}; export type PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsArgs = {accountId: string, workspaceId: string, body: UpdateWorkspaceRunRequest}; export type PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a workspace run status and error (self-hosted) * * PATCH /self-hosted/{accountId}/workspaces/{workspaceId}/runs */ export const patchApiSelfHostedAccountIdWorkspacesWorkspaceIdRuns = async (args: PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsArgs, options?: PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdRunsOptions) => { const {baseUrl = "https://api.firefly.ai/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/self-hosted/${encodeURIComponent(String(args.accountId))}/workspaces/${encodeURIComponent(String(args.workspaceId))}/runs${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 };