/* tslint:disable */
/* eslint-disable */
/**
 * Admin API
 * The Admin API is used to manage the ApeCloud platform. 
 *
 * 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 { ParameterHistoryList } from '../models';
// @ts-ignore
import type { ParameterList } from '../models';
/**
 * ParameterApi - axios parameter creator
 * @export
 */
export const ParameterApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List parameter properties of the cluster
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} [component] component type
         * @param {boolean} [rawContent] whether to return the raw template content
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listParameterProps: async (orgName: string, clusterName: string, component?: string, rawContent?: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listParameterProps', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('listParameterProps', 'clusterName', clusterName)
            const localVarPath = `/admin/v1/organizations/{orgName}/clusters/{clusterName}/parameters`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)));
            // 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 (component !== undefined) {
                localVarQueryParameter['component'] = component;
            }

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary List parameters history of the cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {string} component component type
         * @param {string} [parameterName] name of the parameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listParametersHistory: async (orgName: string, clusterName: string, component: string, parameterName?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listParametersHistory', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('listParametersHistory', 'clusterName', clusterName)
            // verify required parameter 'component' is not null or undefined
            assertParamExists('listParametersHistory', 'component', component)
            const localVarPath = `/admin/v1/organizations/{orgName}/clusters/{clusterName}/parameterHistories`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)));
            // 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 (parameterName !== undefined) {
                localVarQueryParameter['parameterName'] = parameterName;
            }

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


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

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

/**
 * ParameterApi - functional programming interface
 * @export
 */
export const ParameterApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ParameterApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary List parameter properties of the cluster
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} [component] component type
         * @param {boolean} [rawContent] whether to return the raw template content
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listParameterProps(orgName: string, clusterName: string, component?: string, rawContent?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ParameterList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listParameterProps(orgName, clusterName, component, rawContent, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ParameterApi.listParameterProps']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List parameters history of the cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {string} component component type
         * @param {string} [parameterName] name of the parameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listParametersHistory(orgName: string, clusterName: string, component: string, parameterName?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ParameterHistoryList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listParametersHistory(orgName, clusterName, component, parameterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ParameterApi.listParametersHistory']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ParameterApi - factory interface
 * @export
 */
export const ParameterApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ParameterApiFp(configuration)
    return {
        /**
         * 
         * @summary List parameter properties of the cluster
         * @param {ParameterApiListParameterPropsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listParameterProps(requestParameters: ParameterApiListParameterPropsRequest, options?: RawAxiosRequestConfig): AxiosPromise<ParameterList> {
            return localVarFp.listParameterProps(requestParameters.orgName, requestParameters.clusterName, requestParameters.component, requestParameters.rawContent, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List parameters history of the cluster
         * @param {ParameterApiListParametersHistoryRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listParametersHistory(requestParameters: ParameterApiListParametersHistoryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ParameterHistoryList> {
            return localVarFp.listParametersHistory(requestParameters.orgName, requestParameters.clusterName, requestParameters.component, requestParameters.parameterName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ParameterApi - interface
 * @export
 * @interface ParameterApi
 */
export interface ParameterApiInterface {
    /**
     * 
     * @summary List parameter properties of the cluster
     * @param {ParameterApiListParameterPropsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ParameterApiInterface
     */
    listParameterProps(requestParameters: ParameterApiListParameterPropsRequest, options?: RawAxiosRequestConfig): AxiosPromise<ParameterList>;

    /**
     * 
     * @summary List parameters history of the cluster
     * @param {ParameterApiListParametersHistoryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ParameterApiInterface
     */
    listParametersHistory(requestParameters: ParameterApiListParametersHistoryRequest, options?: RawAxiosRequestConfig): AxiosPromise<ParameterHistoryList>;

}

/**
 * Request parameters for listParameterProps operation in ParameterApi.
 * @export
 * @interface ParameterApiListParameterPropsRequest
 */
export interface ParameterApiListParameterPropsRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof ParameterApiListParameterProps
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof ParameterApiListParameterProps
     */
    readonly clusterName: string

    /**
     * component type
     * @type {string}
     * @memberof ParameterApiListParameterProps
     */
    readonly component?: string

    /**
     * whether to return the raw template content
     * @type {boolean}
     * @memberof ParameterApiListParameterProps
     */
    readonly rawContent?: boolean
}

/**
 * Request parameters for listParametersHistory operation in ParameterApi.
 * @export
 * @interface ParameterApiListParametersHistoryRequest
 */
export interface ParameterApiListParametersHistoryRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof ParameterApiListParametersHistory
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof ParameterApiListParametersHistory
     */
    readonly clusterName: string

    /**
     * component type
     * @type {string}
     * @memberof ParameterApiListParametersHistory
     */
    readonly component: string

    /**
     * name of the parameter
     * @type {string}
     * @memberof ParameterApiListParametersHistory
     */
    readonly parameterName?: string
}

/**
 * ParameterApi - object-oriented interface
 * @export
 * @class ParameterApi
 * @extends {BaseAPI}
 */
export class ParameterApi extends BaseAPI implements ParameterApiInterface {
    /**
     * 
     * @summary List parameter properties of the cluster
     * @param {ParameterApiListParameterPropsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ParameterApi
     */
    public listParameterProps(requestParameters: ParameterApiListParameterPropsRequest, options?: RawAxiosRequestConfig) {
        return ParameterApiFp(this.configuration).listParameterProps(requestParameters.orgName, requestParameters.clusterName, requestParameters.component, requestParameters.rawContent, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List parameters history of the cluster
     * @param {ParameterApiListParametersHistoryRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ParameterApi
     */
    public listParametersHistory(requestParameters: ParameterApiListParametersHistoryRequest, options?: RawAxiosRequestConfig) {
        return ParameterApiFp(this.configuration).listParametersHistory(requestParameters.orgName, requestParameters.clusterName, requestParameters.component, requestParameters.parameterName, options).then((request) => request(this.axios, this.basePath));
    }
}

