/* 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 { AggregationTimeType } from '../models';
// @ts-ignore
import type { BillList } from '../models';
// @ts-ignore
import type { OrgAggregationGroupType } from '../models';
/**
 * BillingApi - axios parameter creator
 * @export
 */
export const BillingApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List bills in the organization
         * @param {string} orgName name of the organization
         * @param {AggregationTimeType} aggregationTime The type of aggregation time
         * @param {OrgAggregationGroupType} aggregationGroup The type of aggregation group
         * @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} [billID] The ID of the bill
         * @param {string} [clusterID] The ID of the cluster
         * @param {string} [projectName] name of the project
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listOrgBills: async (orgName: string, aggregationTime: AggregationTimeType, aggregationGroup: OrgAggregationGroupType, start: number, end: number, billID?: string, clusterID?: string, projectName?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listOrgBills', 'orgName', orgName)
            // verify required parameter 'aggregationTime' is not null or undefined
            assertParamExists('listOrgBills', 'aggregationTime', aggregationTime)
            // verify required parameter 'aggregationGroup' is not null or undefined
            assertParamExists('listOrgBills', 'aggregationGroup', aggregationGroup)
            // verify required parameter 'start' is not null or undefined
            assertParamExists('listOrgBills', 'start', start)
            // verify required parameter 'end' is not null or undefined
            assertParamExists('listOrgBills', 'end', end)
            const localVarPath = `/api/v1/organizations/{orgName}/bills`
                .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 (billID !== undefined) {
                localVarQueryParameter['billID'] = billID;
            }

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

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

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

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

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

/**
 * BillingApi - functional programming interface
 * @export
 */
export const BillingApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = BillingApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary List bills in the organization
         * @param {string} orgName name of the organization
         * @param {AggregationTimeType} aggregationTime The type of aggregation time
         * @param {OrgAggregationGroupType} aggregationGroup The type of aggregation group
         * @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} [billID] The ID of the bill
         * @param {string} [clusterID] The ID of the cluster
         * @param {string} [projectName] name of the project
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listOrgBills(orgName: string, aggregationTime: AggregationTimeType, aggregationGroup: OrgAggregationGroupType, start: number, end: number, billID?: string, clusterID?: string, projectName?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BillList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listOrgBills(orgName, aggregationTime, aggregationGroup, start, end, billID, clusterID, projectName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['BillingApi.listOrgBills']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * BillingApi - factory interface
 * @export
 */
export const BillingApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = BillingApiFp(configuration)
    return {
        /**
         * 
         * @summary List bills in the organization
         * @param {BillingApiListOrgBillsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listOrgBills(requestParameters: BillingApiListOrgBillsRequest, options?: RawAxiosRequestConfig): AxiosPromise<BillList> {
            return localVarFp.listOrgBills(requestParameters.orgName, requestParameters.aggregationTime, requestParameters.aggregationGroup, requestParameters.start, requestParameters.end, requestParameters.billID, requestParameters.clusterID, requestParameters.projectName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * BillingApi - interface
 * @export
 * @interface BillingApi
 */
export interface BillingApiInterface {
    /**
     * 
     * @summary List bills in the organization
     * @param {BillingApiListOrgBillsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BillingApiInterface
     */
    listOrgBills(requestParameters: BillingApiListOrgBillsRequest, options?: RawAxiosRequestConfig): AxiosPromise<BillList>;

}

/**
 * Request parameters for listOrgBills operation in BillingApi.
 * @export
 * @interface BillingApiListOrgBillsRequest
 */
export interface BillingApiListOrgBillsRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof BillingApiListOrgBills
     */
    readonly orgName: string

    /**
     * The type of aggregation time
     * @type {AggregationTimeType}
     * @memberof BillingApiListOrgBills
     */
    readonly aggregationTime: AggregationTimeType

    /**
     * The type of aggregation group
     * @type {OrgAggregationGroupType}
     * @memberof BillingApiListOrgBills
     */
    readonly aggregationGroup: OrgAggregationGroupType

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

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

    /**
     * The ID of the bill
     * @type {string}
     * @memberof BillingApiListOrgBills
     */
    readonly billID?: string

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

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

/**
 * BillingApi - object-oriented interface
 * @export
 * @class BillingApi
 * @extends {BaseAPI}
 */
export class BillingApi extends BaseAPI implements BillingApiInterface {
    /**
     * 
     * @summary List bills in the organization
     * @param {BillingApiListOrgBillsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BillingApi
     */
    public listOrgBills(requestParameters: BillingApiListOrgBillsRequest, options?: RawAxiosRequestConfig) {
        return BillingApiFp(this.configuration).listOrgBills(requestParameters.orgName, requestParameters.aggregationTime, requestParameters.aggregationGroup, requestParameters.start, requestParameters.end, requestParameters.billID, requestParameters.clusterID, requestParameters.projectName, options).then((request) => request(this.axios, this.basePath));
    }
}

