export type GitLabCheckRunUpdate = {projectId?: number | undefined, prId?: number | undefined, headSha?: string | undefined}; export type UpdateCheckRunRequest = {checkRunId: string, commitId: string, update: 'queued' | 'in_progress' | 'success' | 'failure' | 'blocked', gitlab?: GitLabCheckRunUpdate | undefined}; export type PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdTasksTaskIdCheckRunArgs = {accountId: string, workspaceId: string, taskId: string, body: UpdateCheckRunRequest}; export type PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdTasksTaskIdCheckRunOptions = {baseUrl?: string | undefined, RunnerPoolAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a check run (self-hosted) * * PATCH /self-hosted/{accountId}/workspaces/{workspaceId}/tasks/{taskId}/check-run */ export const patchApiSelfHostedAccountIdWorkspacesWorkspaceIdTasksTaskIdCheckRun = async (args: PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdTasksTaskIdCheckRunArgs, options?: PatchApiSelfHostedAccountIdWorkspacesWorkspaceIdTasksTaskIdCheckRunOptions) => { 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))}/workspaces/${encodeURIComponent(String(args.workspaceId))}/tasks/${encodeURIComponent(String(args.taskId))}/check-run${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 };