/* 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 { AlertStatistic } from '../models';
// @ts-ignore
import type { URLCheck } from '../models';
/**
 * AlertApi - axios parameter creator
 * @export
 */
export const AlertApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * alert statistic
         * @summary alert statistic
         * @param {string} [orgName] name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        alertStatistic: async (orgName?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/alerts/statistic`;
            // 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 (orgName !== undefined) {
                localVarQueryParameter['orgName'] = orgName;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Tests multiple URLs for connectivity in parallel
         * @summary Batch check URLs connectivity
         * @param {URLCheck} uRLCheck 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchCheckURLConnectivity: async (uRLCheck: URLCheck, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'uRLCheck' is not null or undefined
            assertParamExists('batchCheckURLConnectivity', 'uRLCheck', uRLCheck)
            const localVarPath = `/api/v1/alerts/checkURL`;
            // 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(uRLCheck, localVarRequestOptions, configuration)

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

/**
 * AlertApi - functional programming interface
 * @export
 */
export const AlertApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertApiAxiosParamCreator(configuration)
    return {
        /**
         * alert statistic
         * @summary alert statistic
         * @param {string} [orgName] name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async alertStatistic(orgName?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertStatistic>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.alertStatistic(orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertApi.alertStatistic']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Tests multiple URLs for connectivity in parallel
         * @summary Batch check URLs connectivity
         * @param {URLCheck} uRLCheck 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async batchCheckURLConnectivity(uRLCheck: URLCheck, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<URLCheck>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.batchCheckURLConnectivity(uRLCheck, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertApi.batchCheckURLConnectivity']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertApi - factory interface
 * @export
 */
export const AlertApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertApiFp(configuration)
    return {
        /**
         * alert statistic
         * @summary alert statistic
         * @param {AlertApiAlertStatisticRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        alertStatistic(requestParameters: AlertApiAlertStatisticRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<AlertStatistic> {
            return localVarFp.alertStatistic(requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
        /**
         * Tests multiple URLs for connectivity in parallel
         * @summary Batch check URLs connectivity
         * @param {AlertApiBatchCheckURLConnectivityRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        batchCheckURLConnectivity(requestParameters: AlertApiBatchCheckURLConnectivityRequest, options?: RawAxiosRequestConfig): AxiosPromise<URLCheck> {
            return localVarFp.batchCheckURLConnectivity(requestParameters.uRLCheck, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertApi - interface
 * @export
 * @interface AlertApi
 */
export interface AlertApiInterface {
    /**
     * alert statistic
     * @summary alert statistic
     * @param {AlertApiAlertStatisticRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertApiInterface
     */
    alertStatistic(requestParameters?: AlertApiAlertStatisticRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertStatistic>;

    /**
     * Tests multiple URLs for connectivity in parallel
     * @summary Batch check URLs connectivity
     * @param {AlertApiBatchCheckURLConnectivityRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertApiInterface
     */
    batchCheckURLConnectivity(requestParameters: AlertApiBatchCheckURLConnectivityRequest, options?: RawAxiosRequestConfig): AxiosPromise<URLCheck>;

}

/**
 * Request parameters for alertStatistic operation in AlertApi.
 * @export
 * @interface AlertApiAlertStatisticRequest
 */
export interface AlertApiAlertStatisticRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof AlertApiAlertStatistic
     */
    readonly orgName?: string
}

/**
 * Request parameters for batchCheckURLConnectivity operation in AlertApi.
 * @export
 * @interface AlertApiBatchCheckURLConnectivityRequest
 */
export interface AlertApiBatchCheckURLConnectivityRequest {
    /**
     * 
     * @type {URLCheck}
     * @memberof AlertApiBatchCheckURLConnectivity
     */
    readonly uRLCheck: URLCheck
}

/**
 * AlertApi - object-oriented interface
 * @export
 * @class AlertApi
 * @extends {BaseAPI}
 */
export class AlertApi extends BaseAPI implements AlertApiInterface {
    /**
     * alert statistic
     * @summary alert statistic
     * @param {AlertApiAlertStatisticRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertApi
     */
    public alertStatistic(requestParameters: AlertApiAlertStatisticRequest = {}, options?: RawAxiosRequestConfig) {
        return AlertApiFp(this.configuration).alertStatistic(requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Tests multiple URLs for connectivity in parallel
     * @summary Batch check URLs connectivity
     * @param {AlertApiBatchCheckURLConnectivityRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertApi
     */
    public batchCheckURLConnectivity(requestParameters: AlertApiBatchCheckURLConnectivityRequest, options?: RawAxiosRequestConfig) {
        return AlertApiFp(this.configuration).batchCheckURLConnectivity(requestParameters.uRLCheck, options).then((request) => request(this.axios, this.basePath));
    }
}

