/* 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 { AggregateMetaData } from '../models';
// @ts-ignore
import type { AggregateMetaDataType } from '../models';
/**
 * MetricsApi - axios parameter creator
 * @export
 */
export const MetricsApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Get aggregate meta data including total count and time series
         * @summary Get aggregate meta data
         * @param {AggregateMetaDataType} metaData 
         * @param {number} start The start of the time range for the query, unit is seconds.
         * @param {number} end The end of the time range for the query, unit is seconds.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAggregateMetaData: async (metaData: AggregateMetaDataType, start: number, end: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'metaData' is not null or undefined
            assertParamExists('getAggregateMetaData', 'metaData', metaData)
            // verify required parameter 'start' is not null or undefined
            assertParamExists('getAggregateMetaData', 'start', start)
            // verify required parameter 'end' is not null or undefined
            assertParamExists('getAggregateMetaData', 'end', end)
            const localVarPath = `/admin/v1/metrics/metaData/aggregate`;
            // 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 (metaData !== undefined) {
                localVarQueryParameter['metaData'] = metaData;
            }

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

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


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

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

/**
 * MetricsApi - functional programming interface
 * @export
 */
export const MetricsApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = MetricsApiAxiosParamCreator(configuration)
    return {
        /**
         * Get aggregate meta data including total count and time series
         * @summary Get aggregate meta data
         * @param {AggregateMetaDataType} metaData 
         * @param {number} start The start of the time range for the query, unit is seconds.
         * @param {number} end The end of the time range for the query, unit is seconds.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAggregateMetaData(metaData: AggregateMetaDataType, start: number, end: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AggregateMetaData>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAggregateMetaData(metaData, start, end, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['MetricsApi.getAggregateMetaData']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * MetricsApi - factory interface
 * @export
 */
export const MetricsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = MetricsApiFp(configuration)
    return {
        /**
         * Get aggregate meta data including total count and time series
         * @summary Get aggregate meta data
         * @param {MetricsApiGetAggregateMetaDataRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAggregateMetaData(requestParameters: MetricsApiGetAggregateMetaDataRequest, options?: RawAxiosRequestConfig): AxiosPromise<AggregateMetaData> {
            return localVarFp.getAggregateMetaData(requestParameters.metaData, requestParameters.start, requestParameters.end, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * MetricsApi - interface
 * @export
 * @interface MetricsApi
 */
export interface MetricsApiInterface {
    /**
     * Get aggregate meta data including total count and time series
     * @summary Get aggregate meta data
     * @param {MetricsApiGetAggregateMetaDataRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MetricsApiInterface
     */
    getAggregateMetaData(requestParameters: MetricsApiGetAggregateMetaDataRequest, options?: RawAxiosRequestConfig): AxiosPromise<AggregateMetaData>;

}

/**
 * Request parameters for getAggregateMetaData operation in MetricsApi.
 * @export
 * @interface MetricsApiGetAggregateMetaDataRequest
 */
export interface MetricsApiGetAggregateMetaDataRequest {
    /**
     * 
     * @type {AggregateMetaDataType}
     * @memberof MetricsApiGetAggregateMetaData
     */
    readonly metaData: AggregateMetaDataType

    /**
     * The start of the time range for the query, unit is seconds.
     * @type {number}
     * @memberof MetricsApiGetAggregateMetaData
     */
    readonly start: number

    /**
     * The end of the time range for the query, unit is seconds.
     * @type {number}
     * @memberof MetricsApiGetAggregateMetaData
     */
    readonly end: number
}

/**
 * MetricsApi - object-oriented interface
 * @export
 * @class MetricsApi
 * @extends {BaseAPI}
 */
export class MetricsApi extends BaseAPI implements MetricsApiInterface {
    /**
     * Get aggregate meta data including total count and time series
     * @summary Get aggregate meta data
     * @param {MetricsApiGetAggregateMetaDataRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MetricsApi
     */
    public getAggregateMetaData(requestParameters: MetricsApiGetAggregateMetaDataRequest, options?: RawAxiosRequestConfig) {
        return MetricsApiFp(this.configuration).getAggregateMetaData(requestParameters.metaData, requestParameters.start, requestParameters.end, options).then((request) => request(this.axios, this.basePath));
    }
}

