/* 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 { AlertObject } from '../models';
// @ts-ignore
import type { AlertObjectList } from '../models';
/**
 * AlertObjectApi - axios parameter creator
 * @export
 */
export const AlertObjectApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List alert objects
         * @param {string} orgName name of the Org
         * @param {number} [page] page number
         * @param {number} [pageSize] page size
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertObjects: async (orgName: string, page?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listAlertObjects', 'orgName', orgName)
            const localVarPath = `/api/v1/organizations/{orgName}/alerts/objects`
                .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 (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }

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


    
            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 object status
         * @param {string} orgName name of the Org
         * @param {string} alertId alert id
         * @param {string} status 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertObjectStatus: async (orgName: string, alertId: string, status: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('setAlertObjectStatus', 'orgName', orgName)
            // verify required parameter 'alertId' is not null or undefined
            assertParamExists('setAlertObjectStatus', 'alertId', alertId)
            // verify required parameter 'status' is not null or undefined
            assertParamExists('setAlertObjectStatus', 'status', status)
            const localVarPath = `/api/v1/organizations/{orgName}/alerts/objects/{alertId}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"alertId"}}`, encodeURIComponent(String(alertId)));
            // 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)

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


    
            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 objects status
         * @param {string} orgName name of the Org
         * @param {string} status 
         * @param {Array<AlertObject>} [alertObject] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertObjectsStatus: async (orgName: string, status: string, alertObject?: Array<AlertObject>, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('setAlertObjectsStatus', 'orgName', orgName)
            // verify required parameter 'status' is not null or undefined
            assertParamExists('setAlertObjectsStatus', 'status', status)
            const localVarPath = `/api/v1/organizations/{orgName}/alerts/objects`
                .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)

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


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

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

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

/**
 * AlertObjectApi - functional programming interface
 * @export
 */
export const AlertObjectApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertObjectApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary List alert objects
         * @param {string} orgName name of the Org
         * @param {number} [page] page number
         * @param {number} [pageSize] page size
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAlertObjects(orgName: string, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertObjectList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAlertObjects(orgName, page, pageSize, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertObjectApi.listAlertObjects']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Set alert object status
         * @param {string} orgName name of the Org
         * @param {string} alertId alert id
         * @param {string} status 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async setAlertObjectStatus(orgName: string, alertId: string, status: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertObject>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.setAlertObjectStatus(orgName, alertId, status, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertObjectApi.setAlertObjectStatus']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Set alert objects status
         * @param {string} orgName name of the Org
         * @param {string} status 
         * @param {Array<AlertObject>} [alertObject] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async setAlertObjectsStatus(orgName: string, status: string, alertObject?: Array<AlertObject>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertObjectList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.setAlertObjectsStatus(orgName, status, alertObject, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertObjectApi.setAlertObjectsStatus']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertObjectApi - factory interface
 * @export
 */
export const AlertObjectApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertObjectApiFp(configuration)
    return {
        /**
         * 
         * @summary List alert objects
         * @param {AlertObjectApiListAlertObjectsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertObjects(requestParameters: AlertObjectApiListAlertObjectsRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertObjectList> {
            return localVarFp.listAlertObjects(requestParameters.orgName, requestParameters.page, requestParameters.pageSize, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Set alert object status
         * @param {AlertObjectApiSetAlertObjectStatusRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertObjectStatus(requestParameters: AlertObjectApiSetAlertObjectStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertObject> {
            return localVarFp.setAlertObjectStatus(requestParameters.orgName, requestParameters.alertId, requestParameters.status, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Set alert objects status
         * @param {AlertObjectApiSetAlertObjectsStatusRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertObjectsStatus(requestParameters: AlertObjectApiSetAlertObjectsStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertObjectList> {
            return localVarFp.setAlertObjectsStatus(requestParameters.orgName, requestParameters.status, requestParameters.alertObject, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertObjectApi - interface
 * @export
 * @interface AlertObjectApi
 */
export interface AlertObjectApiInterface {
    /**
     * 
     * @summary List alert objects
     * @param {AlertObjectApiListAlertObjectsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertObjectApiInterface
     */
    listAlertObjects(requestParameters: AlertObjectApiListAlertObjectsRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertObjectList>;

    /**
     * 
     * @summary Set alert object status
     * @param {AlertObjectApiSetAlertObjectStatusRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertObjectApiInterface
     */
    setAlertObjectStatus(requestParameters: AlertObjectApiSetAlertObjectStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertObject>;

    /**
     * 
     * @summary Set alert objects status
     * @param {AlertObjectApiSetAlertObjectsStatusRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertObjectApiInterface
     */
    setAlertObjectsStatus(requestParameters: AlertObjectApiSetAlertObjectsStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertObjectList>;

}

/**
 * Request parameters for listAlertObjects operation in AlertObjectApi.
 * @export
 * @interface AlertObjectApiListAlertObjectsRequest
 */
export interface AlertObjectApiListAlertObjectsRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof AlertObjectApiListAlertObjects
     */
    readonly orgName: string

    /**
     * page number
     * @type {number}
     * @memberof AlertObjectApiListAlertObjects
     */
    readonly page?: number

    /**
     * page size
     * @type {number}
     * @memberof AlertObjectApiListAlertObjects
     */
    readonly pageSize?: number
}

/**
 * Request parameters for setAlertObjectStatus operation in AlertObjectApi.
 * @export
 * @interface AlertObjectApiSetAlertObjectStatusRequest
 */
export interface AlertObjectApiSetAlertObjectStatusRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof AlertObjectApiSetAlertObjectStatus
     */
    readonly orgName: string

    /**
     * alert id
     * @type {string}
     * @memberof AlertObjectApiSetAlertObjectStatus
     */
    readonly alertId: string

    /**
     * 
     * @type {string}
     * @memberof AlertObjectApiSetAlertObjectStatus
     */
    readonly status: string
}

/**
 * Request parameters for setAlertObjectsStatus operation in AlertObjectApi.
 * @export
 * @interface AlertObjectApiSetAlertObjectsStatusRequest
 */
export interface AlertObjectApiSetAlertObjectsStatusRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof AlertObjectApiSetAlertObjectsStatus
     */
    readonly orgName: string

    /**
     * 
     * @type {string}
     * @memberof AlertObjectApiSetAlertObjectsStatus
     */
    readonly status: string

    /**
     * 
     * @type {Array<AlertObject>}
     * @memberof AlertObjectApiSetAlertObjectsStatus
     */
    readonly alertObject?: Array<AlertObject>
}

/**
 * AlertObjectApi - object-oriented interface
 * @export
 * @class AlertObjectApi
 * @extends {BaseAPI}
 */
export class AlertObjectApi extends BaseAPI implements AlertObjectApiInterface {
    /**
     * 
     * @summary List alert objects
     * @param {AlertObjectApiListAlertObjectsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertObjectApi
     */
    public listAlertObjects(requestParameters: AlertObjectApiListAlertObjectsRequest, options?: RawAxiosRequestConfig) {
        return AlertObjectApiFp(this.configuration).listAlertObjects(requestParameters.orgName, requestParameters.page, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Set alert object status
     * @param {AlertObjectApiSetAlertObjectStatusRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertObjectApi
     */
    public setAlertObjectStatus(requestParameters: AlertObjectApiSetAlertObjectStatusRequest, options?: RawAxiosRequestConfig) {
        return AlertObjectApiFp(this.configuration).setAlertObjectStatus(requestParameters.orgName, requestParameters.alertId, requestParameters.status, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Set alert objects status
     * @param {AlertObjectApiSetAlertObjectsStatusRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertObjectApi
     */
    public setAlertObjectsStatus(requestParameters: AlertObjectApiSetAlertObjectsStatusRequest, options?: RawAxiosRequestConfig) {
        return AlertObjectApiFp(this.configuration).setAlertObjectsStatus(requestParameters.orgName, requestParameters.status, requestParameters.alertObject, options).then((request) => request(this.axios, this.basePath));
    }
}

