/* 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 { AlertConfig } from '../models';
/**
 * AlertConfigApi - axios parameter creator
 * @export
 */
export const AlertConfigApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get alert config
         * @param {string} orgName name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertConfig: async (orgName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getAlertConfig', 'orgName', orgName)
            const localVarPath = `/api/v1/organizations/{orgName}/alerts/config`
                .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)


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Set alert config
         * @param {string} orgName name of the Org
         * @param {AlertConfig} [alertConfig] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertConfig: async (orgName: string, alertConfig?: AlertConfig, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('setAlertConfig', 'orgName', orgName)
            const localVarPath = `/api/v1/organizations/{orgName}/alerts/config`
                .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: '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(alertConfig, localVarRequestOptions, configuration)

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

/**
 * AlertConfigApi - functional programming interface
 * @export
 */
export const AlertConfigApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertConfigApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get alert config
         * @param {string} orgName name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAlertConfig(orgName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAlertConfig(orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertConfigApi.getAlertConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Set alert config
         * @param {string} orgName name of the Org
         * @param {AlertConfig} [alertConfig] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async setAlertConfig(orgName: string, alertConfig?: AlertConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.setAlertConfig(orgName, alertConfig, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertConfigApi.setAlertConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertConfigApi - factory interface
 * @export
 */
export const AlertConfigApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertConfigApiFp(configuration)
    return {
        /**
         * 
         * @summary Get alert config
         * @param {AlertConfigApiGetAlertConfigRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertConfig(requestParameters: AlertConfigApiGetAlertConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig> {
            return localVarFp.getAlertConfig(requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Set alert config
         * @param {AlertConfigApiSetAlertConfigRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertConfig(requestParameters: AlertConfigApiSetAlertConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig> {
            return localVarFp.setAlertConfig(requestParameters.orgName, requestParameters.alertConfig, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertConfigApi - interface
 * @export
 * @interface AlertConfigApi
 */
export interface AlertConfigApiInterface {
    /**
     * 
     * @summary Get alert config
     * @param {AlertConfigApiGetAlertConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApiInterface
     */
    getAlertConfig(requestParameters: AlertConfigApiGetAlertConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig>;

    /**
     * 
     * @summary Set alert config
     * @param {AlertConfigApiSetAlertConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApiInterface
     */
    setAlertConfig(requestParameters: AlertConfigApiSetAlertConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig>;

}

/**
 * Request parameters for getAlertConfig operation in AlertConfigApi.
 * @export
 * @interface AlertConfigApiGetAlertConfigRequest
 */
export interface AlertConfigApiGetAlertConfigRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof AlertConfigApiGetAlertConfig
     */
    readonly orgName: string
}

/**
 * Request parameters for setAlertConfig operation in AlertConfigApi.
 * @export
 * @interface AlertConfigApiSetAlertConfigRequest
 */
export interface AlertConfigApiSetAlertConfigRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof AlertConfigApiSetAlertConfig
     */
    readonly orgName: string

    /**
     * 
     * @type {AlertConfig}
     * @memberof AlertConfigApiSetAlertConfig
     */
    readonly alertConfig?: AlertConfig
}

/**
 * AlertConfigApi - object-oriented interface
 * @export
 * @class AlertConfigApi
 * @extends {BaseAPI}
 */
export class AlertConfigApi extends BaseAPI implements AlertConfigApiInterface {
    /**
     * 
     * @summary Get alert config
     * @param {AlertConfigApiGetAlertConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApi
     */
    public getAlertConfig(requestParameters: AlertConfigApiGetAlertConfigRequest, options?: RawAxiosRequestConfig) {
        return AlertConfigApiFp(this.configuration).getAlertConfig(requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Set alert config
     * @param {AlertConfigApiSetAlertConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApi
     */
    public setAlertConfig(requestParameters: AlertConfigApiSetAlertConfigRequest, options?: RawAxiosRequestConfig) {
        return AlertConfigApiFp(this.configuration).setAlertConfig(requestParameters.orgName, requestParameters.alertConfig, options).then((request) => request(this.axios, this.basePath));
    }
}

