/* 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 { OrgParameter } from '../models';
/**
 * OrganizationParameterApi - axios parameter creator
 * @export
 */
export const OrganizationParameterApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Batch update parameters of an organization
         * @summary Batch update parameters of an organization
         * @param {string} orgName The name of the organization
         * @param {Array<OrgParameter>} orgParameter 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchUpdateOrgParameters: async (orgName: string, orgParameter: Array<OrgParameter>, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('batchUpdateOrgParameters', 'orgName', orgName)
            // verify required parameter 'orgParameter' is not null or undefined
            assertParamExists('batchUpdateOrgParameters', 'orgParameter', orgParameter)
            const localVarPath = `/api/v1/organizations/{orgName}/parameters`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // 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: 'POST', ...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)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get a parameter of an organization
         * @param {string} orgName The name of the organization
         * @param {string} parameterName The name of the parameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getOrgParameter: async (orgName: string, parameterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getOrgParameter', 'orgName', orgName)
            // verify required parameter 'parameterName' is not null or undefined
            assertParamExists('getOrgParameter', 'parameterName', parameterName)
            const localVarPath = `/api/v1/organizations/{orgName}/parameters/{parameterName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"parameterName"}}`, encodeURIComponent(String(parameterName)));
            // 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,
            };
        },
        /**
         * 
         * @summary List parameters of an organization
         * @param {string} orgName The name of the organization
         * @param {string} [category] the category of the parameters
         * @param {string} [name] the name of the parameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listOrgParameters: async (orgName: string, category?: string, name?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listOrgParameters', 'orgName', orgName)
            const localVarPath = `/api/v1/organizations/{orgName}/parameters`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // 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 (category !== undefined) {
                localVarQueryParameter['category'] = category;
            }

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Update a parameter of an organization
         * @summary Update a parameter of an organization
         * @param {string} orgName The name of the organization
         * @param {string} parameterName The name of the parameter
         * @param {OrgParameter} orgParameter 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        patchOrgParameter: async (orgName: string, parameterName: string, orgParameter: OrgParameter, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('patchOrgParameter', 'orgName', orgName)
            // verify required parameter 'parameterName' is not null or undefined
            assertParamExists('patchOrgParameter', 'parameterName', parameterName)
            // verify required parameter 'orgParameter' is not null or undefined
            assertParamExists('patchOrgParameter', 'orgParameter', orgParameter)
            const localVarPath = `/api/v1/organizations/{orgName}/parameters/{parameterName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"parameterName"}}`, encodeURIComponent(String(parameterName)));
            // 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: 'PATCH', ...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)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

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

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

/**
 * OrganizationParameterApi - functional programming interface
 * @export
 */
export const OrganizationParameterApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = OrganizationParameterApiAxiosParamCreator(configuration)
    return {
        /**
         * Batch update parameters of an organization
         * @summary Batch update parameters of an organization
         * @param {string} orgName The name of the organization
         * @param {Array<OrgParameter>} orgParameter 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async batchUpdateOrgParameters(orgName: string, orgParameter: Array<OrgParameter>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<OrgParameter>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.batchUpdateOrgParameters(orgName, orgParameter, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OrganizationParameterApi.batchUpdateOrgParameters']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get a parameter of an organization
         * @param {string} orgName The name of the organization
         * @param {string} parameterName The name of the parameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getOrgParameter(orgName: string, parameterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OrgParameter>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getOrgParameter(orgName, parameterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OrganizationParameterApi.getOrgParameter']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List parameters of an organization
         * @param {string} orgName The name of the organization
         * @param {string} [category] the category of the parameters
         * @param {string} [name] the name of the parameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listOrgParameters(orgName: string, category?: string, name?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<OrgParameter>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listOrgParameters(orgName, category, name, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OrganizationParameterApi.listOrgParameters']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Update a parameter of an organization
         * @summary Update a parameter of an organization
         * @param {string} orgName The name of the organization
         * @param {string} parameterName The name of the parameter
         * @param {OrgParameter} orgParameter 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async patchOrgParameter(orgName: string, parameterName: string, orgParameter: OrgParameter, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OrgParameter>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.patchOrgParameter(orgName, parameterName, orgParameter, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OrganizationParameterApi.patchOrgParameter']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * OrganizationParameterApi - factory interface
 * @export
 */
export const OrganizationParameterApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = OrganizationParameterApiFp(configuration)
    return {
        /**
         * Batch update parameters of an organization
         * @summary Batch update parameters of an organization
         * @param {OrganizationParameterApiBatchUpdateOrgParametersRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchUpdateOrgParameters(requestParameters: OrganizationParameterApiBatchUpdateOrgParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<OrgParameter>> {
            return localVarFp.batchUpdateOrgParameters(requestParameters.orgName, requestParameters.orgParameter, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get a parameter of an organization
         * @param {OrganizationParameterApiGetOrgParameterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getOrgParameter(requestParameters: OrganizationParameterApiGetOrgParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<OrgParameter> {
            return localVarFp.getOrgParameter(requestParameters.orgName, requestParameters.parameterName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List parameters of an organization
         * @param {OrganizationParameterApiListOrgParametersRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listOrgParameters(requestParameters: OrganizationParameterApiListOrgParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<OrgParameter>> {
            return localVarFp.listOrgParameters(requestParameters.orgName, requestParameters.category, requestParameters.name, options).then((request) => request(axios, basePath));
        },
        /**
         * Update a parameter of an organization
         * @summary Update a parameter of an organization
         * @param {OrganizationParameterApiPatchOrgParameterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        patchOrgParameter(requestParameters: OrganizationParameterApiPatchOrgParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<OrgParameter> {
            return localVarFp.patchOrgParameter(requestParameters.orgName, requestParameters.parameterName, requestParameters.orgParameter, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * OrganizationParameterApi - interface
 * @export
 * @interface OrganizationParameterApi
 */
export interface OrganizationParameterApiInterface {
    /**
     * Batch update parameters of an organization
     * @summary Batch update parameters of an organization
     * @param {OrganizationParameterApiBatchUpdateOrgParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApiInterface
     */
    batchUpdateOrgParameters(requestParameters: OrganizationParameterApiBatchUpdateOrgParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<OrgParameter>>;

    /**
     * 
     * @summary Get a parameter of an organization
     * @param {OrganizationParameterApiGetOrgParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApiInterface
     */
    getOrgParameter(requestParameters: OrganizationParameterApiGetOrgParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<OrgParameter>;

    /**
     * 
     * @summary List parameters of an organization
     * @param {OrganizationParameterApiListOrgParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApiInterface
     */
    listOrgParameters(requestParameters: OrganizationParameterApiListOrgParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<OrgParameter>>;

    /**
     * Update a parameter of an organization
     * @summary Update a parameter of an organization
     * @param {OrganizationParameterApiPatchOrgParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApiInterface
     */
    patchOrgParameter(requestParameters: OrganizationParameterApiPatchOrgParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<OrgParameter>;

}

/**
 * Request parameters for batchUpdateOrgParameters operation in OrganizationParameterApi.
 * @export
 * @interface OrganizationParameterApiBatchUpdateOrgParametersRequest
 */
export interface OrganizationParameterApiBatchUpdateOrgParametersRequest {
    /**
     * The name of the organization
     * @type {string}
     * @memberof OrganizationParameterApiBatchUpdateOrgParameters
     */
    readonly orgName: string

    /**
     * 
     * @type {Array<OrgParameter>}
     * @memberof OrganizationParameterApiBatchUpdateOrgParameters
     */
    readonly orgParameter: Array<OrgParameter>
}

/**
 * Request parameters for getOrgParameter operation in OrganizationParameterApi.
 * @export
 * @interface OrganizationParameterApiGetOrgParameterRequest
 */
export interface OrganizationParameterApiGetOrgParameterRequest {
    /**
     * The name of the organization
     * @type {string}
     * @memberof OrganizationParameterApiGetOrgParameter
     */
    readonly orgName: string

    /**
     * The name of the parameter
     * @type {string}
     * @memberof OrganizationParameterApiGetOrgParameter
     */
    readonly parameterName: string
}

/**
 * Request parameters for listOrgParameters operation in OrganizationParameterApi.
 * @export
 * @interface OrganizationParameterApiListOrgParametersRequest
 */
export interface OrganizationParameterApiListOrgParametersRequest {
    /**
     * The name of the organization
     * @type {string}
     * @memberof OrganizationParameterApiListOrgParameters
     */
    readonly orgName: string

    /**
     * the category of the parameters
     * @type {string}
     * @memberof OrganizationParameterApiListOrgParameters
     */
    readonly category?: string

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

/**
 * Request parameters for patchOrgParameter operation in OrganizationParameterApi.
 * @export
 * @interface OrganizationParameterApiPatchOrgParameterRequest
 */
export interface OrganizationParameterApiPatchOrgParameterRequest {
    /**
     * The name of the organization
     * @type {string}
     * @memberof OrganizationParameterApiPatchOrgParameter
     */
    readonly orgName: string

    /**
     * The name of the parameter
     * @type {string}
     * @memberof OrganizationParameterApiPatchOrgParameter
     */
    readonly parameterName: string

    /**
     * 
     * @type {OrgParameter}
     * @memberof OrganizationParameterApiPatchOrgParameter
     */
    readonly orgParameter: OrgParameter
}

/**
 * OrganizationParameterApi - object-oriented interface
 * @export
 * @class OrganizationParameterApi
 * @extends {BaseAPI}
 */
export class OrganizationParameterApi extends BaseAPI implements OrganizationParameterApiInterface {
    /**
     * Batch update parameters of an organization
     * @summary Batch update parameters of an organization
     * @param {OrganizationParameterApiBatchUpdateOrgParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApi
     */
    public batchUpdateOrgParameters(requestParameters: OrganizationParameterApiBatchUpdateOrgParametersRequest, options?: RawAxiosRequestConfig) {
        return OrganizationParameterApiFp(this.configuration).batchUpdateOrgParameters(requestParameters.orgName, requestParameters.orgParameter, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get a parameter of an organization
     * @param {OrganizationParameterApiGetOrgParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApi
     */
    public getOrgParameter(requestParameters: OrganizationParameterApiGetOrgParameterRequest, options?: RawAxiosRequestConfig) {
        return OrganizationParameterApiFp(this.configuration).getOrgParameter(requestParameters.orgName, requestParameters.parameterName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List parameters of an organization
     * @param {OrganizationParameterApiListOrgParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApi
     */
    public listOrgParameters(requestParameters: OrganizationParameterApiListOrgParametersRequest, options?: RawAxiosRequestConfig) {
        return OrganizationParameterApiFp(this.configuration).listOrgParameters(requestParameters.orgName, requestParameters.category, requestParameters.name, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Update a parameter of an organization
     * @summary Update a parameter of an organization
     * @param {OrganizationParameterApiPatchOrgParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OrganizationParameterApi
     */
    public patchOrgParameter(requestParameters: OrganizationParameterApiPatchOrgParameterRequest, options?: RawAxiosRequestConfig) {
        return OrganizationParameterApiFp(this.configuration).patchOrgParameter(requestParameters.orgName, requestParameters.parameterName, requestParameters.orgParameter, options).then((request) => request(this.axios, this.basePath));
    }
}

