/* 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 { Tenant } from '../models';
/**
 * OceanbaseApi - axios parameter creator
 * @export
 */
export const OceanbaseApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary get tenants detail information of the oceanbase cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {string} tenantId id of the tenant
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTenant: async (orgName: string, clusterName: string, tenantId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getTenant', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('getTenant', 'clusterName', clusterName)
            // verify required parameter 'tenantId' is not null or undefined
            assertParamExists('getTenant', 'tenantId', tenantId)
            const localVarPath = `/api/v1/organizations/{orgName}/clusters/{clusterName}/tenant/{tenantId}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"tenantId"}}`, encodeURIComponent(String(tenantId)));
            // 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 list all tenants for the oceanbase cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listTenants: async (orgName: string, clusterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listTenants', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('listTenants', 'clusterName', clusterName)
            const localVarPath = `/api/v1/organizations/{orgName}/clusters/{clusterName}/tenants`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)));
            // 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,
            };
        },
    }
};

/**
 * OceanbaseApi - functional programming interface
 * @export
 */
export const OceanbaseApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = OceanbaseApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary get tenants detail information of the oceanbase cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {string} tenantId id of the tenant
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getTenant(orgName: string, clusterName: string, tenantId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Tenant>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getTenant(orgName, clusterName, tenantId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OceanbaseApi.getTenant']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary list all tenants for the oceanbase cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listTenants(orgName: string, clusterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Tenant>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listTenants(orgName, clusterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['OceanbaseApi.listTenants']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * OceanbaseApi - factory interface
 * @export
 */
export const OceanbaseApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = OceanbaseApiFp(configuration)
    return {
        /**
         * 
         * @summary get tenants detail information of the oceanbase cluster
         * @param {OceanbaseApiGetTenantRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTenant(requestParameters: OceanbaseApiGetTenantRequest, options?: RawAxiosRequestConfig): AxiosPromise<Tenant> {
            return localVarFp.getTenant(requestParameters.orgName, requestParameters.clusterName, requestParameters.tenantId, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary list all tenants for the oceanbase cluster
         * @param {OceanbaseApiListTenantsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listTenants(requestParameters: OceanbaseApiListTenantsRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<Tenant>> {
            return localVarFp.listTenants(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * OceanbaseApi - interface
 * @export
 * @interface OceanbaseApi
 */
export interface OceanbaseApiInterface {
    /**
     * 
     * @summary get tenants detail information of the oceanbase cluster
     * @param {OceanbaseApiGetTenantRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OceanbaseApiInterface
     */
    getTenant(requestParameters: OceanbaseApiGetTenantRequest, options?: RawAxiosRequestConfig): AxiosPromise<Tenant>;

    /**
     * 
     * @summary list all tenants for the oceanbase cluster
     * @param {OceanbaseApiListTenantsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OceanbaseApiInterface
     */
    listTenants(requestParameters: OceanbaseApiListTenantsRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<Tenant>>;

}

/**
 * Request parameters for getTenant operation in OceanbaseApi.
 * @export
 * @interface OceanbaseApiGetTenantRequest
 */
export interface OceanbaseApiGetTenantRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof OceanbaseApiGetTenant
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof OceanbaseApiGetTenant
     */
    readonly clusterName: string

    /**
     * id of the tenant
     * @type {string}
     * @memberof OceanbaseApiGetTenant
     */
    readonly tenantId: string
}

/**
 * Request parameters for listTenants operation in OceanbaseApi.
 * @export
 * @interface OceanbaseApiListTenantsRequest
 */
export interface OceanbaseApiListTenantsRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof OceanbaseApiListTenants
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof OceanbaseApiListTenants
     */
    readonly clusterName: string
}

/**
 * OceanbaseApi - object-oriented interface
 * @export
 * @class OceanbaseApi
 * @extends {BaseAPI}
 */
export class OceanbaseApi extends BaseAPI implements OceanbaseApiInterface {
    /**
     * 
     * @summary get tenants detail information of the oceanbase cluster
     * @param {OceanbaseApiGetTenantRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OceanbaseApi
     */
    public getTenant(requestParameters: OceanbaseApiGetTenantRequest, options?: RawAxiosRequestConfig) {
        return OceanbaseApiFp(this.configuration).getTenant(requestParameters.orgName, requestParameters.clusterName, requestParameters.tenantId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary list all tenants for the oceanbase cluster
     * @param {OceanbaseApiListTenantsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof OceanbaseApi
     */
    public listTenants(requestParameters: OceanbaseApiListTenantsRequest, options?: RawAxiosRequestConfig) {
        return OceanbaseApiFp(this.configuration).listTenants(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }
}

