/* tslint:disable */
/* eslint-disable */
/**
 * KubeBlocks Cloud Internal API
 * The Internal API is using for interaction of ApeCloud platform microservices. 
 *
 * The version of the OpenAPI document: 1.0.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 } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { APIErrorResponse } from '../models';
// @ts-ignore
import type { Engine } from '../models';
/**
 * EngineApi - axios parameter creator
 * @export
 */
export const EngineApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List all engines
         * @param {string} [name] engine name
         * @param {string} [type] engine Type
         * @param {string} [version] engine version
         * @param {string} [provider] engine provider
         * @param {boolean} [all] list all engines include uninstall engines
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAllEngines: async (name?: string, type?: string, version?: string, provider?: string, all?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/internal/v1/engines`;
            // 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 BasicAuth required
            // http basic authentication required
            setBasicAuthToObject(localVarRequestOptions, configuration)

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

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

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

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

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


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

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

/**
 * EngineApi - functional programming interface
 * @export
 */
export const EngineApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = EngineApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary List all engines
         * @param {string} [name] engine name
         * @param {string} [type] engine Type
         * @param {string} [version] engine version
         * @param {string} [provider] engine provider
         * @param {boolean} [all] list all engines include uninstall engines
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAllEngines(name?: string, type?: string, version?: string, provider?: string, all?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Engine>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAllEngines(name, type, version, provider, all, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineApi.listAllEngines']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * EngineApi - factory interface
 * @export
 */
export const EngineApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = EngineApiFp(configuration)
    return {
        /**
         * 
         * @summary List all engines
         * @param {EngineApiListAllEnginesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAllEngines(requestParameters: EngineApiListAllEnginesRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<Array<Engine>> {
            return localVarFp.listAllEngines(requestParameters.name, requestParameters.type, requestParameters.version, requestParameters.provider, requestParameters.all, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * EngineApi - interface
 * @export
 * @interface EngineApi
 */
export interface EngineApiInterface {
    /**
     * 
     * @summary List all engines
     * @param {EngineApiListAllEnginesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineApiInterface
     */
    listAllEngines(requestParameters?: EngineApiListAllEnginesRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<Engine>>;

}

/**
 * Request parameters for listAllEngines operation in EngineApi.
 * @export
 * @interface EngineApiListAllEnginesRequest
 */
export interface EngineApiListAllEnginesRequest {
    /**
     * engine name
     * @type {string}
     * @memberof EngineApiListAllEngines
     */
    readonly name?: string

    /**
     * engine Type
     * @type {string}
     * @memberof EngineApiListAllEngines
     */
    readonly type?: string

    /**
     * engine version
     * @type {string}
     * @memberof EngineApiListAllEngines
     */
    readonly version?: string

    /**
     * engine provider
     * @type {string}
     * @memberof EngineApiListAllEngines
     */
    readonly provider?: string

    /**
     * list all engines include uninstall engines
     * @type {boolean}
     * @memberof EngineApiListAllEngines
     */
    readonly all?: boolean
}

/**
 * EngineApi - object-oriented interface
 * @export
 * @class EngineApi
 * @extends {BaseAPI}
 */
export class EngineApi extends BaseAPI implements EngineApiInterface {
    /**
     * 
     * @summary List all engines
     * @param {EngineApiListAllEnginesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineApi
     */
    public listAllEngines(requestParameters: EngineApiListAllEnginesRequest = {}, options?: RawAxiosRequestConfig) {
        return EngineApiFp(this.configuration).listAllEngines(requestParameters.name, requestParameters.type, requestParameters.version, requestParameters.provider, requestParameters.all, options).then((request) => request(this.axios, this.basePath));
    }
}

