/* 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 { Feature } from '../models';
// @ts-ignore
import type { FeatureList } from '../models';
/**
 * FeatureApi - axios parameter creator
 * @export
 */
export const FeatureApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Get feature list
         * @summary Get feature list
         * @param {string} [group] name of the feature group
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listFeature: async (group?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/features`;
            // 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 (group !== undefined) {
                localVarQueryParameter['group'] = group;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Get feature
         * @summary Get feature
         * @param {string} featureName name of the feature
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readFeature: async (featureName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'featureName' is not null or undefined
            assertParamExists('readFeature', 'featureName', featureName)
            const localVarPath = `/api/v1/features/{featureName}`
                .replace(`{${"featureName"}}`, encodeURIComponent(String(featureName)));
            // 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,
            };
        },
    }
};

/**
 * FeatureApi - functional programming interface
 * @export
 */
export const FeatureApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = FeatureApiAxiosParamCreator(configuration)
    return {
        /**
         * Get feature list
         * @summary Get feature list
         * @param {string} [group] name of the feature group
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listFeature(group?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FeatureList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listFeature(group, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['FeatureApi.listFeature']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Get feature
         * @summary Get feature
         * @param {string} featureName name of the feature
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async readFeature(featureName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Feature>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.readFeature(featureName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['FeatureApi.readFeature']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * FeatureApi - factory interface
 * @export
 */
export const FeatureApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = FeatureApiFp(configuration)
    return {
        /**
         * Get feature list
         * @summary Get feature list
         * @param {FeatureApiListFeatureRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listFeature(requestParameters: FeatureApiListFeatureRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<FeatureList> {
            return localVarFp.listFeature(requestParameters.group, options).then((request) => request(axios, basePath));
        },
        /**
         * Get feature
         * @summary Get feature
         * @param {FeatureApiReadFeatureRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readFeature(requestParameters: FeatureApiReadFeatureRequest, options?: RawAxiosRequestConfig): AxiosPromise<Feature> {
            return localVarFp.readFeature(requestParameters.featureName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * FeatureApi - interface
 * @export
 * @interface FeatureApi
 */
export interface FeatureApiInterface {
    /**
     * Get feature list
     * @summary Get feature list
     * @param {FeatureApiListFeatureRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof FeatureApiInterface
     */
    listFeature(requestParameters?: FeatureApiListFeatureRequest, options?: RawAxiosRequestConfig): AxiosPromise<FeatureList>;

    /**
     * Get feature
     * @summary Get feature
     * @param {FeatureApiReadFeatureRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof FeatureApiInterface
     */
    readFeature(requestParameters: FeatureApiReadFeatureRequest, options?: RawAxiosRequestConfig): AxiosPromise<Feature>;

}

/**
 * Request parameters for listFeature operation in FeatureApi.
 * @export
 * @interface FeatureApiListFeatureRequest
 */
export interface FeatureApiListFeatureRequest {
    /**
     * name of the feature group
     * @type {string}
     * @memberof FeatureApiListFeature
     */
    readonly group?: string
}

/**
 * Request parameters for readFeature operation in FeatureApi.
 * @export
 * @interface FeatureApiReadFeatureRequest
 */
export interface FeatureApiReadFeatureRequest {
    /**
     * name of the feature
     * @type {string}
     * @memberof FeatureApiReadFeature
     */
    readonly featureName: string
}

/**
 * FeatureApi - object-oriented interface
 * @export
 * @class FeatureApi
 * @extends {BaseAPI}
 */
export class FeatureApi extends BaseAPI implements FeatureApiInterface {
    /**
     * Get feature list
     * @summary Get feature list
     * @param {FeatureApiListFeatureRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof FeatureApi
     */
    public listFeature(requestParameters: FeatureApiListFeatureRequest = {}, options?: RawAxiosRequestConfig) {
        return FeatureApiFp(this.configuration).listFeature(requestParameters.group, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Get feature
     * @summary Get feature
     * @param {FeatureApiReadFeatureRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof FeatureApi
     */
    public readFeature(requestParameters: FeatureApiReadFeatureRequest, options?: RawAxiosRequestConfig) {
        return FeatureApiFp(this.configuration).readFeature(requestParameters.featureName, options).then((request) => request(this.axios, this.basePath));
    }
}

