/* 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 { AlertSMTPConfig } from '../models';
/**
 * AlertSMTPConfigApi - axios parameter creator
 * @export
 */
export const AlertSMTPConfigApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get alert SMTP config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertSMTPConfig: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alertSMTPConfig`;
            // 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 Update alert SMTP config
         * @param {AlertSMTPConfig} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertSMTPConfig: async (body: AlertSMTPConfig, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('updateAlertSMTPConfig', 'body', body)
            const localVarPath = `/admin/v1/alertSMTPConfig`;
            // 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,
            };
        },
    }
};

/**
 * AlertSMTPConfigApi - functional programming interface
 * @export
 */
export const AlertSMTPConfigApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertSMTPConfigApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get alert SMTP config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAlertSMTPConfig(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertSMTPConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAlertSMTPConfig(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertSMTPConfigApi.getAlertSMTPConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Update alert SMTP config
         * @param {AlertSMTPConfig} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateAlertSMTPConfig(body: AlertSMTPConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertSMTPConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlertSMTPConfig(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertSMTPConfigApi.updateAlertSMTPConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertSMTPConfigApi - factory interface
 * @export
 */
export const AlertSMTPConfigApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertSMTPConfigApiFp(configuration)
    return {
        /**
         * 
         * @summary Get alert SMTP config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertSMTPConfig(options?: RawAxiosRequestConfig): AxiosPromise<AlertSMTPConfig> {
            return localVarFp.getAlertSMTPConfig(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Update alert SMTP config
         * @param {AlertSMTPConfigApiUpdateAlertSMTPConfigRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertSMTPConfig(requestParameters: AlertSMTPConfigApiUpdateAlertSMTPConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertSMTPConfig> {
            return localVarFp.updateAlertSMTPConfig(requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertSMTPConfigApi - interface
 * @export
 * @interface AlertSMTPConfigApi
 */
export interface AlertSMTPConfigApiInterface {
    /**
     * 
     * @summary Get alert SMTP config
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertSMTPConfigApiInterface
     */
    getAlertSMTPConfig(options?: RawAxiosRequestConfig): AxiosPromise<AlertSMTPConfig>;

    /**
     * 
     * @summary Update alert SMTP config
     * @param {AlertSMTPConfigApiUpdateAlertSMTPConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertSMTPConfigApiInterface
     */
    updateAlertSMTPConfig(requestParameters: AlertSMTPConfigApiUpdateAlertSMTPConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertSMTPConfig>;

}

/**
 * Request parameters for updateAlertSMTPConfig operation in AlertSMTPConfigApi.
 * @export
 * @interface AlertSMTPConfigApiUpdateAlertSMTPConfigRequest
 */
export interface AlertSMTPConfigApiUpdateAlertSMTPConfigRequest {
    /**
     * 
     * @type {AlertSMTPConfig}
     * @memberof AlertSMTPConfigApiUpdateAlertSMTPConfig
     */
    readonly body: AlertSMTPConfig
}

/**
 * AlertSMTPConfigApi - object-oriented interface
 * @export
 * @class AlertSMTPConfigApi
 * @extends {BaseAPI}
 */
export class AlertSMTPConfigApi extends BaseAPI implements AlertSMTPConfigApiInterface {
    /**
     * 
     * @summary Get alert SMTP config
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertSMTPConfigApi
     */
    public getAlertSMTPConfig(options?: RawAxiosRequestConfig) {
        return AlertSMTPConfigApiFp(this.configuration).getAlertSMTPConfig(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Update alert SMTP config
     * @param {AlertSMTPConfigApiUpdateAlertSMTPConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertSMTPConfigApi
     */
    public updateAlertSMTPConfig(requestParameters: AlertSMTPConfigApiUpdateAlertSMTPConfigRequest, options?: RawAxiosRequestConfig) {
        return AlertSMTPConfigApiFp(this.configuration).updateAlertSMTPConfig(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

