/* 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 { AlertReceiver } from '../models';
// @ts-ignore
import type { AlertReceiverCategory } from '../models';
// @ts-ignore
import type { AlertReceiverList } from '../models';
/**
 * AlertReceiverApi - axios parameter creator
 * @export
 */
export const AlertReceiverApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create alert receiver
         * @param {AlertReceiverCategory} category alert receiver category
         * @param {AlertReceiver} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertReceiver: async (category: AlertReceiverCategory, body: AlertReceiver, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'category' is not null or undefined
            assertParamExists('createAlertReceiver', 'category', category)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('createAlertReceiver', 'body', body)
            const localVarPath = `/admin/v1/alerts/receivers`;
            // 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)

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


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

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete alert receiver
         * @param {string} receiverId receiver id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertReceiver: async (receiverId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'receiverId' is not null or undefined
            assertParamExists('deleteAlertReceiver', 'receiverId', receiverId)
            const localVarPath = `/admin/v1/alerts/receivers/{receiverId}`
                .replace(`{${"receiverId"}}`, encodeURIComponent(String(receiverId)));
            // 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: 'DELETE', ...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 alert receivers
         * @param {AlertReceiverCategory} [category] alert receiver category
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertReceivers: async (category?: AlertReceiverCategory, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alerts/receivers`;
            // 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;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Update alert receiver
         * @param {string} receiverId receiver id
         * @param {AlertReceiver} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertReceiver: async (receiverId: string, body: AlertReceiver, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'receiverId' is not null or undefined
            assertParamExists('updateAlertReceiver', 'receiverId', receiverId)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('updateAlertReceiver', 'body', body)
            const localVarPath = `/admin/v1/alerts/receivers/{receiverId}`
                .replace(`{${"receiverId"}}`, encodeURIComponent(String(receiverId)));
            // 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(body, localVarRequestOptions, configuration)

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

/**
 * AlertReceiverApi - functional programming interface
 * @export
 */
export const AlertReceiverApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertReceiverApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create alert receiver
         * @param {AlertReceiverCategory} category alert receiver category
         * @param {AlertReceiver} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createAlertReceiver(category: AlertReceiverCategory, body: AlertReceiver, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertReceiver>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createAlertReceiver(category, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertReceiverApi.createAlertReceiver']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete alert receiver
         * @param {string} receiverId receiver id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteAlertReceiver(receiverId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteAlertReceiver(receiverId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertReceiverApi.deleteAlertReceiver']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List alert receivers
         * @param {AlertReceiverCategory} [category] alert receiver category
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAlertReceivers(category?: AlertReceiverCategory, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertReceiverList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAlertReceivers(category, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertReceiverApi.listAlertReceivers']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Update alert receiver
         * @param {string} receiverId receiver id
         * @param {AlertReceiver} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateAlertReceiver(receiverId: string, body: AlertReceiver, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertReceiver>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlertReceiver(receiverId, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertReceiverApi.updateAlertReceiver']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertReceiverApi - factory interface
 * @export
 */
export const AlertReceiverApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertReceiverApiFp(configuration)
    return {
        /**
         * 
         * @summary Create alert receiver
         * @param {AlertReceiverApiCreateAlertReceiverRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertReceiver(requestParameters: AlertReceiverApiCreateAlertReceiverRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertReceiver> {
            return localVarFp.createAlertReceiver(requestParameters.category, requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete alert receiver
         * @param {AlertReceiverApiDeleteAlertReceiverRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertReceiver(requestParameters: AlertReceiverApiDeleteAlertReceiverRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteAlertReceiver(requestParameters.receiverId, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List alert receivers
         * @param {AlertReceiverApiListAlertReceiversRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertReceivers(requestParameters: AlertReceiverApiListAlertReceiversRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<AlertReceiverList> {
            return localVarFp.listAlertReceivers(requestParameters.category, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Update alert receiver
         * @param {AlertReceiverApiUpdateAlertReceiverRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertReceiver(requestParameters: AlertReceiverApiUpdateAlertReceiverRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertReceiver> {
            return localVarFp.updateAlertReceiver(requestParameters.receiverId, requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertReceiverApi - interface
 * @export
 * @interface AlertReceiverApi
 */
export interface AlertReceiverApiInterface {
    /**
     * 
     * @summary Create alert receiver
     * @param {AlertReceiverApiCreateAlertReceiverRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApiInterface
     */
    createAlertReceiver(requestParameters: AlertReceiverApiCreateAlertReceiverRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertReceiver>;

    /**
     * 
     * @summary Delete alert receiver
     * @param {AlertReceiverApiDeleteAlertReceiverRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApiInterface
     */
    deleteAlertReceiver(requestParameters: AlertReceiverApiDeleteAlertReceiverRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary List alert receivers
     * @param {AlertReceiverApiListAlertReceiversRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApiInterface
     */
    listAlertReceivers(requestParameters?: AlertReceiverApiListAlertReceiversRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertReceiverList>;

    /**
     * 
     * @summary Update alert receiver
     * @param {AlertReceiverApiUpdateAlertReceiverRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApiInterface
     */
    updateAlertReceiver(requestParameters: AlertReceiverApiUpdateAlertReceiverRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertReceiver>;

}

/**
 * Request parameters for createAlertReceiver operation in AlertReceiverApi.
 * @export
 * @interface AlertReceiverApiCreateAlertReceiverRequest
 */
export interface AlertReceiverApiCreateAlertReceiverRequest {
    /**
     * alert receiver category
     * @type {AlertReceiverCategory}
     * @memberof AlertReceiverApiCreateAlertReceiver
     */
    readonly category: AlertReceiverCategory

    /**
     * 
     * @type {AlertReceiver}
     * @memberof AlertReceiverApiCreateAlertReceiver
     */
    readonly body: AlertReceiver
}

/**
 * Request parameters for deleteAlertReceiver operation in AlertReceiverApi.
 * @export
 * @interface AlertReceiverApiDeleteAlertReceiverRequest
 */
export interface AlertReceiverApiDeleteAlertReceiverRequest {
    /**
     * receiver id
     * @type {string}
     * @memberof AlertReceiverApiDeleteAlertReceiver
     */
    readonly receiverId: string
}

/**
 * Request parameters for listAlertReceivers operation in AlertReceiverApi.
 * @export
 * @interface AlertReceiverApiListAlertReceiversRequest
 */
export interface AlertReceiverApiListAlertReceiversRequest {
    /**
     * alert receiver category
     * @type {AlertReceiverCategory}
     * @memberof AlertReceiverApiListAlertReceivers
     */
    readonly category?: AlertReceiverCategory
}

/**
 * Request parameters for updateAlertReceiver operation in AlertReceiverApi.
 * @export
 * @interface AlertReceiverApiUpdateAlertReceiverRequest
 */
export interface AlertReceiverApiUpdateAlertReceiverRequest {
    /**
     * receiver id
     * @type {string}
     * @memberof AlertReceiverApiUpdateAlertReceiver
     */
    readonly receiverId: string

    /**
     * 
     * @type {AlertReceiver}
     * @memberof AlertReceiverApiUpdateAlertReceiver
     */
    readonly body: AlertReceiver
}

/**
 * AlertReceiverApi - object-oriented interface
 * @export
 * @class AlertReceiverApi
 * @extends {BaseAPI}
 */
export class AlertReceiverApi extends BaseAPI implements AlertReceiverApiInterface {
    /**
     * 
     * @summary Create alert receiver
     * @param {AlertReceiverApiCreateAlertReceiverRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApi
     */
    public createAlertReceiver(requestParameters: AlertReceiverApiCreateAlertReceiverRequest, options?: RawAxiosRequestConfig) {
        return AlertReceiverApiFp(this.configuration).createAlertReceiver(requestParameters.category, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete alert receiver
     * @param {AlertReceiverApiDeleteAlertReceiverRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApi
     */
    public deleteAlertReceiver(requestParameters: AlertReceiverApiDeleteAlertReceiverRequest, options?: RawAxiosRequestConfig) {
        return AlertReceiverApiFp(this.configuration).deleteAlertReceiver(requestParameters.receiverId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List alert receivers
     * @param {AlertReceiverApiListAlertReceiversRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApi
     */
    public listAlertReceivers(requestParameters: AlertReceiverApiListAlertReceiversRequest = {}, options?: RawAxiosRequestConfig) {
        return AlertReceiverApiFp(this.configuration).listAlertReceivers(requestParameters.category, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Update alert receiver
     * @param {AlertReceiverApiUpdateAlertReceiverRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertReceiverApi
     */
    public updateAlertReceiver(requestParameters: AlertReceiverApiUpdateAlertReceiverRequest, options?: RawAxiosRequestConfig) {
        return AlertReceiverApiFp(this.configuration).updateAlertReceiver(requestParameters.receiverId, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

