/* tslint:disable */
/* eslint-disable */
/**
 * Fabro Run API
 * HTTP API for managing Fabro workflow run executions.
 *
 * The version of the OpenAPI document: 0.1.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { ErrorResponse } from '../models';
// @ts-ignore
import type { PaginatedApiQuestionList } from '../models';
// @ts-ignore
import type { PreviewUrlRequest } from '../models';
// @ts-ignore
import type { PreviewUrlResponse } from '../models';
// @ts-ignore
import type { SandboxFileListResponse } from '../models';
// @ts-ignore
import type { SshAccessRequest } from '../models';
// @ts-ignore
import type { SshAccessResponse } from '../models';
// @ts-ignore
import type { SubmitAnswerRequest } from '../models';
/**
 * HumanInTheLoopApi - axios parameter creator
 */
export const HumanInTheLoopApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Creates a time-limited SSH command for the run\'s sandbox environment.
         * @summary SSH Access
         * @param {string} id Unique run identifier (ULID).
         * @param {SshAccessRequest} sshAccessRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRunSshAccess: async (id: string, sshAccessRequest: SshAccessRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('createRunSshAccess', 'id', id)
            // verify required parameter 'sshAccessRequest' is not null or undefined
            assertParamExists('createRunSshAccess', 'sshAccessRequest', sshAccessRequest)
            const localVarPath = `/api/v1/runs/{id}/ssh`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            localVarHeaderParameter['Content-Type'] = 'application/json';
            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(sshAccessRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Generates a preview URL for a port exposed by the run\'s sandbox environment.
         * @summary Preview URL
         * @param {string} id Unique run identifier (ULID).
         * @param {PreviewUrlRequest} previewUrlRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        generatePreviewUrl: async (id: string, previewUrlRequest: PreviewUrlRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('generatePreviewUrl', 'id', id)
            // verify required parameter 'previewUrlRequest' is not null or undefined
            assertParamExists('generatePreviewUrl', 'previewUrlRequest', previewUrlRequest)
            const localVarPath = `/api/v1/runs/{id}/preview`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            localVarHeaderParameter['Content-Type'] = 'application/json';
            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(previewUrlRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Downloads a file from the run\'s sandbox environment.
         * @summary Download Sandbox File
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSandboxFile: async (id: string, path: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('getSandboxFile', 'id', id)
            // verify required parameter 'path' is not null or undefined
            assertParamExists('getSandboxFile', 'path', path)
            const localVarPath = `/api/v1/runs/{id}/sandbox/file`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (path !== undefined) {
                localVarQueryParameter['path'] = path;
            }

            localVarHeaderParameter['Accept'] = 'application/octet-stream,application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Returns pending human-in-the-loop questions for a run. Questions are generated when the workflow needs user input to proceed.
         * @summary List Run Questions
         * @param {string} id Unique run identifier (ULID).
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRunQuestions: async (id: string, pageLimit?: number, pageOffset?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('listRunQuestions', 'id', id)
            const localVarPath = `/api/v1/runs/{id}/questions`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (pageLimit !== undefined) {
                localVarQueryParameter['page[limit]'] = pageLimit;
            }

            if (pageOffset !== undefined) {
                localVarQueryParameter['page[offset]'] = pageOffset;
            }

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Lists directory entries from the run\'s sandbox environment.
         * @summary List Sandbox Files
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {number} [depth] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listSandboxFiles: async (id: string, path: string, depth?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('listSandboxFiles', 'id', id)
            // verify required parameter 'path' is not null or undefined
            assertParamExists('listSandboxFiles', 'path', path)
            const localVarPath = `/api/v1/runs/{id}/sandbox/files`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (path !== undefined) {
                localVarQueryParameter['path'] = path;
            }

            if (depth !== undefined) {
                localVarQueryParameter['depth'] = depth;
            }

            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Uploads a file into the run\'s sandbox environment.
         * @summary Upload Sandbox File
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {File} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        putSandboxFile: async (id: string, path: string, body: File, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('putSandboxFile', 'id', id)
            // verify required parameter 'path' is not null or undefined
            assertParamExists('putSandboxFile', 'path', path)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('putSandboxFile', 'body', body)
            const localVarPath = `/api/v1/runs/{id}/sandbox/file`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (path !== undefined) {
                localVarQueryParameter['path'] = path;
            }

            localVarHeaderParameter['Content-Type'] = 'application/octet-stream';
            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Submits an answer to a pending question. The answer can be freeform text or a selected option key, depending on the question type.
         * @summary Submit Run Answer
         * @param {string} id Unique run identifier (ULID).
         * @param {string} qid Unique identifier of a pending question.
         * @param {SubmitAnswerRequest} submitAnswerRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        submitRunAnswer: async (id: string, qid: string, submitAnswerRequest: SubmitAnswerRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('submitRunAnswer', 'id', id)
            // verify required parameter 'qid' is not null or undefined
            assertParamExists('submitRunAnswer', 'qid', qid)
            // verify required parameter 'submitAnswerRequest' is not null or undefined
            assertParamExists('submitRunAnswer', 'submitAnswerRequest', submitAnswerRequest)
            const localVarPath = `/api/v1/runs/{id}/questions/{qid}/answer`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)))
                .replace(`{${"qid"}}`, encodeURIComponent(String(qid)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication SessionCookie required

            // authentication BearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            localVarHeaderParameter['Content-Type'] = 'application/json';
            localVarHeaderParameter['Accept'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(submitAnswerRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * HumanInTheLoopApi - functional programming interface
 */
export const HumanInTheLoopApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = HumanInTheLoopApiAxiosParamCreator(configuration)
    return {
        /**
         * Creates a time-limited SSH command for the run\'s sandbox environment.
         * @summary SSH Access
         * @param {string} id Unique run identifier (ULID).
         * @param {SshAccessRequest} sshAccessRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createRunSshAccess(id: string, sshAccessRequest: SshAccessRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SshAccessResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createRunSshAccess(id, sshAccessRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.createRunSshAccess']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Generates a preview URL for a port exposed by the run\'s sandbox environment.
         * @summary Preview URL
         * @param {string} id Unique run identifier (ULID).
         * @param {PreviewUrlRequest} previewUrlRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async generatePreviewUrl(id: string, previewUrlRequest: PreviewUrlRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PreviewUrlResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.generatePreviewUrl(id, previewUrlRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.generatePreviewUrl']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Downloads a file from the run\'s sandbox environment.
         * @summary Download Sandbox File
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getSandboxFile(id: string, path: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<File>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getSandboxFile(id, path, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.getSandboxFile']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Returns pending human-in-the-loop questions for a run. Questions are generated when the workflow needs user input to proceed.
         * @summary List Run Questions
         * @param {string} id Unique run identifier (ULID).
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listRunQuestions(id: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedApiQuestionList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRunQuestions(id, pageLimit, pageOffset, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.listRunQuestions']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Lists directory entries from the run\'s sandbox environment.
         * @summary List Sandbox Files
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {number} [depth] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listSandboxFiles(id: string, path: string, depth?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SandboxFileListResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listSandboxFiles(id, path, depth, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.listSandboxFiles']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Uploads a file into the run\'s sandbox environment.
         * @summary Upload Sandbox File
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {File} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async putSandboxFile(id: string, path: string, body: File, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.putSandboxFile(id, path, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.putSandboxFile']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Submits an answer to a pending question. The answer can be freeform text or a selected option key, depending on the question type.
         * @summary Submit Run Answer
         * @param {string} id Unique run identifier (ULID).
         * @param {string} qid Unique identifier of a pending question.
         * @param {SubmitAnswerRequest} submitAnswerRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async submitRunAnswer(id: string, qid: string, submitAnswerRequest: SubmitAnswerRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.submitRunAnswer(id, qid, submitAnswerRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HumanInTheLoopApi.submitRunAnswer']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * HumanInTheLoopApi - factory interface
 */
export const HumanInTheLoopApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = HumanInTheLoopApiFp(configuration)
    return {
        /**
         * Creates a time-limited SSH command for the run\'s sandbox environment.
         * @summary SSH Access
         * @param {string} id Unique run identifier (ULID).
         * @param {SshAccessRequest} sshAccessRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRunSshAccess(id: string, sshAccessRequest: SshAccessRequest, options?: RawAxiosRequestConfig): AxiosPromise<SshAccessResponse> {
            return localVarFp.createRunSshAccess(id, sshAccessRequest, options).then((request) => request(axios, basePath));
        },
        /**
         * Generates a preview URL for a port exposed by the run\'s sandbox environment.
         * @summary Preview URL
         * @param {string} id Unique run identifier (ULID).
         * @param {PreviewUrlRequest} previewUrlRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        generatePreviewUrl(id: string, previewUrlRequest: PreviewUrlRequest, options?: RawAxiosRequestConfig): AxiosPromise<PreviewUrlResponse> {
            return localVarFp.generatePreviewUrl(id, previewUrlRequest, options).then((request) => request(axios, basePath));
        },
        /**
         * Downloads a file from the run\'s sandbox environment.
         * @summary Download Sandbox File
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getSandboxFile(id: string, path: string, options?: RawAxiosRequestConfig): AxiosPromise<File> {
            return localVarFp.getSandboxFile(id, path, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns pending human-in-the-loop questions for a run. Questions are generated when the workflow needs user input to proceed.
         * @summary List Run Questions
         * @param {string} id Unique run identifier (ULID).
         * @param {number} [pageLimit] Maximum number of items to return per page.
         * @param {number} [pageOffset] Number of items to skip before returning results.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRunQuestions(id: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig): AxiosPromise<PaginatedApiQuestionList> {
            return localVarFp.listRunQuestions(id, pageLimit, pageOffset, options).then((request) => request(axios, basePath));
        },
        /**
         * Lists directory entries from the run\'s sandbox environment.
         * @summary List Sandbox Files
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {number} [depth] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listSandboxFiles(id: string, path: string, depth?: number, options?: RawAxiosRequestConfig): AxiosPromise<SandboxFileListResponse> {
            return localVarFp.listSandboxFiles(id, path, depth, options).then((request) => request(axios, basePath));
        },
        /**
         * Uploads a file into the run\'s sandbox environment.
         * @summary Upload Sandbox File
         * @param {string} id Unique run identifier (ULID).
         * @param {string} path 
         * @param {File} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        putSandboxFile(id: string, path: string, body: File, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.putSandboxFile(id, path, body, options).then((request) => request(axios, basePath));
        },
        /**
         * Submits an answer to a pending question. The answer can be freeform text or a selected option key, depending on the question type.
         * @summary Submit Run Answer
         * @param {string} id Unique run identifier (ULID).
         * @param {string} qid Unique identifier of a pending question.
         * @param {SubmitAnswerRequest} submitAnswerRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        submitRunAnswer(id: string, qid: string, submitAnswerRequest: SubmitAnswerRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.submitRunAnswer(id, qid, submitAnswerRequest, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * HumanInTheLoopApi - object-oriented interface
 */
export class HumanInTheLoopApi extends BaseAPI {
    /**
     * Creates a time-limited SSH command for the run\'s sandbox environment.
     * @summary SSH Access
     * @param {string} id Unique run identifier (ULID).
     * @param {SshAccessRequest} sshAccessRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public createRunSshAccess(id: string, sshAccessRequest: SshAccessRequest, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).createRunSshAccess(id, sshAccessRequest, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Generates a preview URL for a port exposed by the run\'s sandbox environment.
     * @summary Preview URL
     * @param {string} id Unique run identifier (ULID).
     * @param {PreviewUrlRequest} previewUrlRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public generatePreviewUrl(id: string, previewUrlRequest: PreviewUrlRequest, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).generatePreviewUrl(id, previewUrlRequest, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Downloads a file from the run\'s sandbox environment.
     * @summary Download Sandbox File
     * @param {string} id Unique run identifier (ULID).
     * @param {string} path 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public getSandboxFile(id: string, path: string, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).getSandboxFile(id, path, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Returns pending human-in-the-loop questions for a run. Questions are generated when the workflow needs user input to proceed.
     * @summary List Run Questions
     * @param {string} id Unique run identifier (ULID).
     * @param {number} [pageLimit] Maximum number of items to return per page.
     * @param {number} [pageOffset] Number of items to skip before returning results.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listRunQuestions(id: string, pageLimit?: number, pageOffset?: number, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).listRunQuestions(id, pageLimit, pageOffset, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Lists directory entries from the run\'s sandbox environment.
     * @summary List Sandbox Files
     * @param {string} id Unique run identifier (ULID).
     * @param {string} path 
     * @param {number} [depth] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listSandboxFiles(id: string, path: string, depth?: number, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).listSandboxFiles(id, path, depth, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Uploads a file into the run\'s sandbox environment.
     * @summary Upload Sandbox File
     * @param {string} id Unique run identifier (ULID).
     * @param {string} path 
     * @param {File} body 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public putSandboxFile(id: string, path: string, body: File, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).putSandboxFile(id, path, body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Submits an answer to a pending question. The answer can be freeform text or a selected option key, depending on the question type.
     * @summary Submit Run Answer
     * @param {string} id Unique run identifier (ULID).
     * @param {string} qid Unique identifier of a pending question.
     * @param {SubmitAnswerRequest} submitAnswerRequest 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public submitRunAnswer(id: string, qid: string, submitAnswerRequest: SubmitAnswerRequest, options?: RawAxiosRequestConfig) {
        return HumanInTheLoopApiFp(this.configuration).submitRunAnswer(id, qid, submitAnswerRequest, options).then((request) => request(this.axios, this.basePath));
    }
}

