/* 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 { EnvironmentPricingList } from '../models';
// @ts-ignore
import type { GlobalPricing } from '../models';
/**
 * PricingApi - axios parameter creator
 * @export
 */
export const PricingApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get the environment pricing
         * @param {string} [environmentName] name of the environment (if provided, returns a list with one item; if omitted, returns all environment prices)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEnvironmentPricing: async (environmentName?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/pricing`;
            // 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 (environmentName !== undefined) {
                localVarQueryParameter['environmentName'] = environmentName;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get the global information of pricing
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getGlobalPricing: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/v1/pricing/global`;
            // 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,
            };
        },
    }
};

/**
 * PricingApi - functional programming interface
 * @export
 */
export const PricingApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = PricingApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get the environment pricing
         * @param {string} [environmentName] name of the environment (if provided, returns a list with one item; if omitted, returns all environment prices)
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getEnvironmentPricing(environmentName?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EnvironmentPricingList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getEnvironmentPricing(environmentName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PricingApi.getEnvironmentPricing']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get the global information of pricing
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getGlobalPricing(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GlobalPricing>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getGlobalPricing(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PricingApi.getGlobalPricing']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * PricingApi - factory interface
 * @export
 */
export const PricingApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = PricingApiFp(configuration)
    return {
        /**
         * 
         * @summary Get the environment pricing
         * @param {PricingApiGetEnvironmentPricingRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEnvironmentPricing(requestParameters: PricingApiGetEnvironmentPricingRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<EnvironmentPricingList> {
            return localVarFp.getEnvironmentPricing(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get the global information of pricing
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getGlobalPricing(options?: RawAxiosRequestConfig): AxiosPromise<GlobalPricing> {
            return localVarFp.getGlobalPricing(options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * PricingApi - interface
 * @export
 * @interface PricingApi
 */
export interface PricingApiInterface {
    /**
     * 
     * @summary Get the environment pricing
     * @param {PricingApiGetEnvironmentPricingRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PricingApiInterface
     */
    getEnvironmentPricing(requestParameters?: PricingApiGetEnvironmentPricingRequest, options?: RawAxiosRequestConfig): AxiosPromise<EnvironmentPricingList>;

    /**
     * 
     * @summary Get the global information of pricing
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PricingApiInterface
     */
    getGlobalPricing(options?: RawAxiosRequestConfig): AxiosPromise<GlobalPricing>;

}

/**
 * Request parameters for getEnvironmentPricing operation in PricingApi.
 * @export
 * @interface PricingApiGetEnvironmentPricingRequest
 */
export interface PricingApiGetEnvironmentPricingRequest {
    /**
     * name of the environment (if provided, returns a list with one item; if omitted, returns all environment prices)
     * @type {string}
     * @memberof PricingApiGetEnvironmentPricing
     */
    readonly environmentName?: string
}

/**
 * PricingApi - object-oriented interface
 * @export
 * @class PricingApi
 * @extends {BaseAPI}
 */
export class PricingApi extends BaseAPI implements PricingApiInterface {
    /**
     * 
     * @summary Get the environment pricing
     * @param {PricingApiGetEnvironmentPricingRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PricingApi
     */
    public getEnvironmentPricing(requestParameters: PricingApiGetEnvironmentPricingRequest = {}, options?: RawAxiosRequestConfig) {
        return PricingApiFp(this.configuration).getEnvironmentPricing(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get the global information of pricing
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PricingApi
     */
    public getGlobalPricing(options?: RawAxiosRequestConfig) {
        return PricingApiFp(this.configuration).getGlobalPricing(options).then((request) => request(this.axios, this.basePath));
    }
}

