/* 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 { AlertTemplate } from '../models';
// @ts-ignore
import type { AlertTemplateList } from '../models';
/**
 * AlertTemplateApi - axios parameter creator
 * @export
 */
export const AlertTemplateApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create alert template
         * @param {AlertTemplate} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertTemplate: async (body: AlertTemplate, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('createAlertTemplate', 'body', body)
            const localVarPath = `/admin/v1/alertTemplates`;
            // 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(body, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete alert template
         * @param {string} templateId id of the alert tmpl configuration
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertTemplate: async (templateId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'templateId' is not null or undefined
            assertParamExists('deleteAlertTemplate', 'templateId', templateId)
            const localVarPath = `/admin/v1/alertTemplates/{templateId}`
                .replace(`{${"templateId"}}`, encodeURIComponent(String(templateId)));
            // 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 Get alert template
         * @param {string} templateId id of the alert tmpl configuration
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertTemplate: async (templateId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'templateId' is not null or undefined
            assertParamExists('getAlertTemplate', 'templateId', templateId)
            const localVarPath = `/admin/v1/alertTemplates/{templateId}`
                .replace(`{${"templateId"}}`, encodeURIComponent(String(templateId)));
            // 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 alert templates
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertTemplates: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alertTemplates`;
            // 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,
            };
        },
        /**
         * partially update the alert receiver
         * @summary Update alert template
         * @param {string} templateId id of the alert tmpl configuration
         * @param {AlertTemplate} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        patchAlertTemplate: async (templateId: string, body: AlertTemplate, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'templateId' is not null or undefined
            assertParamExists('patchAlertTemplate', 'templateId', templateId)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('patchAlertTemplate', 'body', body)
            const localVarPath = `/admin/v1/alertTemplates/{templateId}`
                .replace(`{${"templateId"}}`, encodeURIComponent(String(templateId)));
            // 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,
            };
        },
    }
};

/**
 * AlertTemplateApi - functional programming interface
 * @export
 */
export const AlertTemplateApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertTemplateApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create alert template
         * @param {AlertTemplate} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createAlertTemplate(body: AlertTemplate, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertTemplate>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createAlertTemplate(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertTemplateApi.createAlertTemplate']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete alert template
         * @param {string} templateId id of the alert tmpl configuration
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteAlertTemplate(templateId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteAlertTemplate(templateId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertTemplateApi.deleteAlertTemplate']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get alert template
         * @param {string} templateId id of the alert tmpl configuration
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAlertTemplate(templateId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertTemplate>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAlertTemplate(templateId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertTemplateApi.getAlertTemplate']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List alert templates
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAlertTemplates(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertTemplateList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAlertTemplates(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertTemplateApi.listAlertTemplates']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * partially update the alert receiver
         * @summary Update alert template
         * @param {string} templateId id of the alert tmpl configuration
         * @param {AlertTemplate} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async patchAlertTemplate(templateId: string, body: AlertTemplate, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertTemplate>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.patchAlertTemplate(templateId, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertTemplateApi.patchAlertTemplate']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertTemplateApi - factory interface
 * @export
 */
export const AlertTemplateApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertTemplateApiFp(configuration)
    return {
        /**
         * 
         * @summary Create alert template
         * @param {AlertTemplateApiCreateAlertTemplateRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertTemplate(requestParameters: AlertTemplateApiCreateAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplate> {
            return localVarFp.createAlertTemplate(requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete alert template
         * @param {AlertTemplateApiDeleteAlertTemplateRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertTemplate(requestParameters: AlertTemplateApiDeleteAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<object> {
            return localVarFp.deleteAlertTemplate(requestParameters.templateId, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get alert template
         * @param {AlertTemplateApiGetAlertTemplateRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertTemplate(requestParameters: AlertTemplateApiGetAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplate> {
            return localVarFp.getAlertTemplate(requestParameters.templateId, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List alert templates
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertTemplates(options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplateList> {
            return localVarFp.listAlertTemplates(options).then((request) => request(axios, basePath));
        },
        /**
         * partially update the alert receiver
         * @summary Update alert template
         * @param {AlertTemplateApiPatchAlertTemplateRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        patchAlertTemplate(requestParameters: AlertTemplateApiPatchAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplate> {
            return localVarFp.patchAlertTemplate(requestParameters.templateId, requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertTemplateApi - interface
 * @export
 * @interface AlertTemplateApi
 */
export interface AlertTemplateApiInterface {
    /**
     * 
     * @summary Create alert template
     * @param {AlertTemplateApiCreateAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApiInterface
     */
    createAlertTemplate(requestParameters: AlertTemplateApiCreateAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplate>;

    /**
     * 
     * @summary Delete alert template
     * @param {AlertTemplateApiDeleteAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApiInterface
     */
    deleteAlertTemplate(requestParameters: AlertTemplateApiDeleteAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<object>;

    /**
     * 
     * @summary Get alert template
     * @param {AlertTemplateApiGetAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApiInterface
     */
    getAlertTemplate(requestParameters: AlertTemplateApiGetAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplate>;

    /**
     * 
     * @summary List alert templates
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApiInterface
     */
    listAlertTemplates(options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplateList>;

    /**
     * partially update the alert receiver
     * @summary Update alert template
     * @param {AlertTemplateApiPatchAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApiInterface
     */
    patchAlertTemplate(requestParameters: AlertTemplateApiPatchAlertTemplateRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertTemplate>;

}

/**
 * Request parameters for createAlertTemplate operation in AlertTemplateApi.
 * @export
 * @interface AlertTemplateApiCreateAlertTemplateRequest
 */
export interface AlertTemplateApiCreateAlertTemplateRequest {
    /**
     * 
     * @type {AlertTemplate}
     * @memberof AlertTemplateApiCreateAlertTemplate
     */
    readonly body: AlertTemplate
}

/**
 * Request parameters for deleteAlertTemplate operation in AlertTemplateApi.
 * @export
 * @interface AlertTemplateApiDeleteAlertTemplateRequest
 */
export interface AlertTemplateApiDeleteAlertTemplateRequest {
    /**
     * id of the alert tmpl configuration
     * @type {string}
     * @memberof AlertTemplateApiDeleteAlertTemplate
     */
    readonly templateId: string
}

/**
 * Request parameters for getAlertTemplate operation in AlertTemplateApi.
 * @export
 * @interface AlertTemplateApiGetAlertTemplateRequest
 */
export interface AlertTemplateApiGetAlertTemplateRequest {
    /**
     * id of the alert tmpl configuration
     * @type {string}
     * @memberof AlertTemplateApiGetAlertTemplate
     */
    readonly templateId: string
}

/**
 * Request parameters for patchAlertTemplate operation in AlertTemplateApi.
 * @export
 * @interface AlertTemplateApiPatchAlertTemplateRequest
 */
export interface AlertTemplateApiPatchAlertTemplateRequest {
    /**
     * id of the alert tmpl configuration
     * @type {string}
     * @memberof AlertTemplateApiPatchAlertTemplate
     */
    readonly templateId: string

    /**
     * 
     * @type {AlertTemplate}
     * @memberof AlertTemplateApiPatchAlertTemplate
     */
    readonly body: AlertTemplate
}

/**
 * AlertTemplateApi - object-oriented interface
 * @export
 * @class AlertTemplateApi
 * @extends {BaseAPI}
 */
export class AlertTemplateApi extends BaseAPI implements AlertTemplateApiInterface {
    /**
     * 
     * @summary Create alert template
     * @param {AlertTemplateApiCreateAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApi
     */
    public createAlertTemplate(requestParameters: AlertTemplateApiCreateAlertTemplateRequest, options?: RawAxiosRequestConfig) {
        return AlertTemplateApiFp(this.configuration).createAlertTemplate(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete alert template
     * @param {AlertTemplateApiDeleteAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApi
     */
    public deleteAlertTemplate(requestParameters: AlertTemplateApiDeleteAlertTemplateRequest, options?: RawAxiosRequestConfig) {
        return AlertTemplateApiFp(this.configuration).deleteAlertTemplate(requestParameters.templateId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get alert template
     * @param {AlertTemplateApiGetAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApi
     */
    public getAlertTemplate(requestParameters: AlertTemplateApiGetAlertTemplateRequest, options?: RawAxiosRequestConfig) {
        return AlertTemplateApiFp(this.configuration).getAlertTemplate(requestParameters.templateId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List alert templates
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApi
     */
    public listAlertTemplates(options?: RawAxiosRequestConfig) {
        return AlertTemplateApiFp(this.configuration).listAlertTemplates(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * partially update the alert receiver
     * @summary Update alert template
     * @param {AlertTemplateApiPatchAlertTemplateRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertTemplateApi
     */
    public patchAlertTemplate(requestParameters: AlertTemplateApiPatchAlertTemplateRequest, options?: RawAxiosRequestConfig) {
        return AlertTemplateApiFp(this.configuration).patchAlertTemplate(requestParameters.templateId, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

