/* tslint:disable */
/* eslint-disable */
/**
 * Fabro Run API
 * HTTP API for managing Fabro workflow run executions.
 *
 * The version of the OpenAPI document: 0.2.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 { SandboxInfo } from '../models';
// @ts-ignore
import type { SandboxListResponse } from '../models';
/**
 * SandboxesApi - axios parameter creator
 */
export const SandboxesApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Lists Fabro-managed sandboxes directly from configured sandbox providers.
         * @summary List Sandboxes
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listSandboxes: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/sandboxes`;
            // 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)

            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,
            };
        },
        /**
         * Retrieves a Fabro-managed sandbox by provider-native id by searching all configured sandbox providers.
         * @summary Retrieve Sandbox
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveSandbox: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('retrieveSandbox', 'id', id)
            const localVarPath = `/api/v1/sandboxes/{id}`
                .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)

            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,
            };
        },
    }
};

/**
 * SandboxesApi - functional programming interface
 */
export const SandboxesApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = SandboxesApiAxiosParamCreator(configuration)
    return {
        /**
         * Lists Fabro-managed sandboxes directly from configured sandbox providers.
         * @summary List Sandboxes
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listSandboxes(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SandboxListResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listSandboxes(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['SandboxesApi.listSandboxes']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Retrieves a Fabro-managed sandbox by provider-native id by searching all configured sandbox providers.
         * @summary Retrieve Sandbox
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async retrieveSandbox(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SandboxInfo>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveSandbox(id, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['SandboxesApi.retrieveSandbox']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * SandboxesApi - factory interface
 */
export const SandboxesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = SandboxesApiFp(configuration)
    return {
        /**
         * Lists Fabro-managed sandboxes directly from configured sandbox providers.
         * @summary List Sandboxes
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listSandboxes(options?: RawAxiosRequestConfig): AxiosPromise<SandboxListResponse> {
            return localVarFp.listSandboxes(options).then((request) => request(axios, basePath));
        },
        /**
         * Retrieves a Fabro-managed sandbox by provider-native id by searching all configured sandbox providers.
         * @summary Retrieve Sandbox
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        retrieveSandbox(id: string, options?: RawAxiosRequestConfig): AxiosPromise<SandboxInfo> {
            return localVarFp.retrieveSandbox(id, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * SandboxesApi - object-oriented interface
 */
export class SandboxesApi extends BaseAPI {
    /**
     * Lists Fabro-managed sandboxes directly from configured sandbox providers.
     * @summary List Sandboxes
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public listSandboxes(options?: RawAxiosRequestConfig) {
        return SandboxesApiFp(this.configuration).listSandboxes(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Retrieves a Fabro-managed sandbox by provider-native id by searching all configured sandbox providers.
     * @summary Retrieve Sandbox
     * @param {string} id
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    public retrieveSandbox(id: string, options?: RawAxiosRequestConfig) {
        return SandboxesApiFp(this.configuration).retrieveSandbox(id, options).then((request) => request(this.axios, this.basePath));
    }
}
