/* 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 { MeteringTrackList } from '../models';
/**
 * MeteringApi - axios parameter creator
 * @export
 */
export const MeteringApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List metering tracks in the organization
         * @param {string} orgName Name of organization
         * @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 {string} [clusterID] The ID of the cluster
         * @param {string} [projectName] name of the project
         * @param {string} [environmentName] The name of the environment
         * @param {number} [pageNumber] the pageNumber of the query
         * @param {number} [pageSize] the pageSize of the query
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listOrgMeteringTracks: async (orgName: string, start: number, end: number, clusterID?: string, projectName?: string, environmentName?: string, pageNumber?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listOrgMeteringTracks', 'orgName', orgName)
            // verify required parameter 'start' is not null or undefined
            assertParamExists('listOrgMeteringTracks', 'start', start)
            // verify required parameter 'end' is not null or undefined
            assertParamExists('listOrgMeteringTracks', 'end', end)
            const localVarPath = `/api/v1/organizations/{orgName}/metering/tracks`
                .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 (clusterID !== undefined) {
                localVarQueryParameter['clusterID'] = clusterID;
            }

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

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

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

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

            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,
            };
        },
    }
};

/**
 * MeteringApi - functional programming interface
 * @export
 */
export const MeteringApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = MeteringApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary List metering tracks in the organization
         * @param {string} orgName Name of organization
         * @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 {string} [clusterID] The ID of the cluster
         * @param {string} [projectName] name of the project
         * @param {string} [environmentName] The name of the environment
         * @param {number} [pageNumber] the pageNumber of the query
         * @param {number} [pageSize] the pageSize of the query
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listOrgMeteringTracks(orgName: string, start: number, end: number, clusterID?: string, projectName?: string, environmentName?: string, pageNumber?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<MeteringTrackList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listOrgMeteringTracks(orgName, start, end, clusterID, projectName, environmentName, pageNumber, pageSize, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['MeteringApi.listOrgMeteringTracks']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * MeteringApi - factory interface
 * @export
 */
export const MeteringApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = MeteringApiFp(configuration)
    return {
        /**
         * 
         * @summary List metering tracks in the organization
         * @param {MeteringApiListOrgMeteringTracksRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listOrgMeteringTracks(requestParameters: MeteringApiListOrgMeteringTracksRequest, options?: RawAxiosRequestConfig): AxiosPromise<MeteringTrackList> {
            return localVarFp.listOrgMeteringTracks(requestParameters.orgName, requestParameters.start, requestParameters.end, requestParameters.clusterID, requestParameters.projectName, requestParameters.environmentName, requestParameters.pageNumber, requestParameters.pageSize, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * MeteringApi - interface
 * @export
 * @interface MeteringApi
 */
export interface MeteringApiInterface {
    /**
     * 
     * @summary List metering tracks in the organization
     * @param {MeteringApiListOrgMeteringTracksRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MeteringApiInterface
     */
    listOrgMeteringTracks(requestParameters: MeteringApiListOrgMeteringTracksRequest, options?: RawAxiosRequestConfig): AxiosPromise<MeteringTrackList>;

}

/**
 * Request parameters for listOrgMeteringTracks operation in MeteringApi.
 * @export
 * @interface MeteringApiListOrgMeteringTracksRequest
 */
export interface MeteringApiListOrgMeteringTracksRequest {
    /**
     * Name of organization
     * @type {string}
     * @memberof MeteringApiListOrgMeteringTracks
     */
    readonly orgName: string

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

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

    /**
     * The ID of the cluster
     * @type {string}
     * @memberof MeteringApiListOrgMeteringTracks
     */
    readonly clusterID?: string

    /**
     * name of the project
     * @type {string}
     * @memberof MeteringApiListOrgMeteringTracks
     */
    readonly projectName?: string

    /**
     * The name of the environment
     * @type {string}
     * @memberof MeteringApiListOrgMeteringTracks
     */
    readonly environmentName?: string

    /**
     * the pageNumber of the query
     * @type {number}
     * @memberof MeteringApiListOrgMeteringTracks
     */
    readonly pageNumber?: number

    /**
     * the pageSize of the query
     * @type {number}
     * @memberof MeteringApiListOrgMeteringTracks
     */
    readonly pageSize?: number
}

/**
 * MeteringApi - object-oriented interface
 * @export
 * @class MeteringApi
 * @extends {BaseAPI}
 */
export class MeteringApi extends BaseAPI implements MeteringApiInterface {
    /**
     * 
     * @summary List metering tracks in the organization
     * @param {MeteringApiListOrgMeteringTracksRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MeteringApi
     */
    public listOrgMeteringTracks(requestParameters: MeteringApiListOrgMeteringTracksRequest, options?: RawAxiosRequestConfig) {
        return MeteringApiFp(this.configuration).listOrgMeteringTracks(requestParameters.orgName, requestParameters.start, requestParameters.end, requestParameters.clusterID, requestParameters.projectName, requestParameters.environmentName, requestParameters.pageNumber, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
    }
}

