/* tslint:disable */
/* eslint-disable */
/**
 * KubeBlocks Cloud API
 * KubeBlocks Cloud API is a RESTful API for managing KubeBlocks Cloud resources.  The API is organized around REST.  Our API has predictable resource-oriented URLs, accepts `JSON-encoded` request bodies, returns `JSON-encoded` responses, and uses standard HTTP response codes, authentication, and verbs.  We use standard HTTP authentication and provide API keys to identify who you are. Your API keys carry many privileges, so be sure to keep them secret! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. 
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: support@apecloud.com
 *
 * 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 { EngineOption } from '../models';
// @ts-ignore
import type { EngineOptionList } from '../models';
// @ts-ignore
import type { EngineOptionVersion } from '../models';
/**
 * EngineOptionApi - axios parameter creator
 * @export
 */
export const EngineOptionApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Get a engineOption detail
         * @summary Get engineOption
         * @param {string} engineName Name of the engineOption
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEngineOption: async (engineName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'engineName' is not null or undefined
            assertParamExists('getEngineOption', 'engineName', engineName)
            const localVarPath = `/api/v1/engineOptions/{engineName}`
                .replace(`{${"engineName"}}`, encodeURIComponent(String(engineName)));
            // 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 BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * list all engineOptions
         * @summary List all engineOptions
         * @param {EngineOptionVersion} [version] The version of the engineOption to query, &#x60;current&#x60; from potentially modified data, &#x60;original&#x60; from the json files of the apiserver
         * @param {boolean} [filterLoadBackupFromOfflineInstance] Whether to filter load backup from offline instance
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEngineOptions: async (version?: EngineOptionVersion, filterLoadBackupFromOfflineInstance?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/engineOptions`;
            // 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 BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)

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

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


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

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

/**
 * EngineOptionApi - functional programming interface
 * @export
 */
export const EngineOptionApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = EngineOptionApiAxiosParamCreator(configuration)
    return {
        /**
         * Get a engineOption detail
         * @summary Get engineOption
         * @param {string} engineName Name of the engineOption
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getEngineOption(engineName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EngineOption>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getEngineOption(engineName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineOptionApi.getEngineOption']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * list all engineOptions
         * @summary List all engineOptions
         * @param {EngineOptionVersion} [version] The version of the engineOption to query, &#x60;current&#x60; from potentially modified data, &#x60;original&#x60; from the json files of the apiserver
         * @param {boolean} [filterLoadBackupFromOfflineInstance] Whether to filter load backup from offline instance
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listEngineOptions(version?: EngineOptionVersion, filterLoadBackupFromOfflineInstance?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EngineOptionList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listEngineOptions(version, filterLoadBackupFromOfflineInstance, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineOptionApi.listEngineOptions']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * EngineOptionApi - factory interface
 * @export
 */
export const EngineOptionApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = EngineOptionApiFp(configuration)
    return {
        /**
         * Get a engineOption detail
         * @summary Get engineOption
         * @param {EngineOptionApiGetEngineOptionRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEngineOption(requestParameters: EngineOptionApiGetEngineOptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineOption> {
            return localVarFp.getEngineOption(requestParameters.engineName, options).then((request) => request(axios, basePath));
        },
        /**
         * list all engineOptions
         * @summary List all engineOptions
         * @param {EngineOptionApiListEngineOptionsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEngineOptions(requestParameters: EngineOptionApiListEngineOptionsRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<EngineOptionList> {
            return localVarFp.listEngineOptions(requestParameters.version, requestParameters.filterLoadBackupFromOfflineInstance, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * EngineOptionApi - interface
 * @export
 * @interface EngineOptionApi
 */
export interface EngineOptionApiInterface {
    /**
     * Get a engineOption detail
     * @summary Get engineOption
     * @param {EngineOptionApiGetEngineOptionRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineOptionApiInterface
     */
    getEngineOption(requestParameters: EngineOptionApiGetEngineOptionRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineOption>;

    /**
     * list all engineOptions
     * @summary List all engineOptions
     * @param {EngineOptionApiListEngineOptionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineOptionApiInterface
     */
    listEngineOptions(requestParameters?: EngineOptionApiListEngineOptionsRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineOptionList>;

}

/**
 * Request parameters for getEngineOption operation in EngineOptionApi.
 * @export
 * @interface EngineOptionApiGetEngineOptionRequest
 */
export interface EngineOptionApiGetEngineOptionRequest {
    /**
     * Name of the engineOption
     * @type {string}
     * @memberof EngineOptionApiGetEngineOption
     */
    readonly engineName: string
}

/**
 * Request parameters for listEngineOptions operation in EngineOptionApi.
 * @export
 * @interface EngineOptionApiListEngineOptionsRequest
 */
export interface EngineOptionApiListEngineOptionsRequest {
    /**
     * The version of the engineOption to query, &#x60;current&#x60; from potentially modified data, &#x60;original&#x60; from the json files of the apiserver
     * @type {EngineOptionVersion}
     * @memberof EngineOptionApiListEngineOptions
     */
    readonly version?: EngineOptionVersion

    /**
     * Whether to filter load backup from offline instance
     * @type {boolean}
     * @memberof EngineOptionApiListEngineOptions
     */
    readonly filterLoadBackupFromOfflineInstance?: boolean
}

/**
 * EngineOptionApi - object-oriented interface
 * @export
 * @class EngineOptionApi
 * @extends {BaseAPI}
 */
export class EngineOptionApi extends BaseAPI implements EngineOptionApiInterface {
    /**
     * Get a engineOption detail
     * @summary Get engineOption
     * @param {EngineOptionApiGetEngineOptionRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineOptionApi
     */
    public getEngineOption(requestParameters: EngineOptionApiGetEngineOptionRequest, options?: RawAxiosRequestConfig) {
        return EngineOptionApiFp(this.configuration).getEngineOption(requestParameters.engineName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * list all engineOptions
     * @summary List all engineOptions
     * @param {EngineOptionApiListEngineOptionsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineOptionApi
     */
    public listEngineOptions(requestParameters: EngineOptionApiListEngineOptionsRequest = {}, options?: RawAxiosRequestConfig) {
        return EngineOptionApiFp(this.configuration).listEngineOptions(requestParameters.version, requestParameters.filterLoadBackupFromOfflineInstance, options).then((request) => request(this.axios, this.basePath));
    }
}

