/* 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 { Account } from '../models';
// @ts-ignore
import type { AccountListItem } from '../models';
/**
 * HiveApi - axios parameter creator
 * @export
 */
export const HiveApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * create an hive account
         * @summary Create Hive account
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the Cluster
         * @param {Account} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createHiveAccount: async (orgName: string, clusterName: string, body: Account, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('createHiveAccount', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('createHiveAccount', 'clusterName', clusterName)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('createHiveAccount', 'body', body)
            const localVarPath = `/api/v1/data/hive/organizations/{orgName}/clusters/{clusterName}/accounts`
                .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: 'POST', ...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)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * delete an hive account in cluster
         * @summary Delete hive account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} accountName name of the account
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteHiveAccount: async (orgName: string, clusterName: string, accountName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('deleteHiveAccount', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('deleteHiveAccount', 'clusterName', clusterName)
            // verify required parameter 'accountName' is not null or undefined
            assertParamExists('deleteHiveAccount', 'accountName', accountName)
            const localVarPath = `/api/v1/data/hive/organizations/{orgName}/clusters/{clusterName}/accounts/{accountName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"accountName"}}`, encodeURIComponent(String(accountName)));
            // 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: 'DELETE', ...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,
            };
        },
        /**
         * Get Hive accounts
         * @summary Get Hive accounts
         * @param {string} orgName The name of organization
         * @param {string} clusterName The name of cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getHiveAccounts: async (orgName: string, clusterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getHiveAccounts', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('getHiveAccounts', 'clusterName', clusterName)
            const localVarPath = `/api/v1/data/hive/organizations/{orgName}/clusters/{clusterName}/accounts`
                .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,
            };
        },
        /**
         * update an hive account in cluster
         * @summary update hive account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} accountName name of the account
         * @param {Account} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateHiveAccount: async (orgName: string, clusterName: string, accountName: string, body: Account, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('updateHiveAccount', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('updateHiveAccount', 'clusterName', clusterName)
            // verify required parameter 'accountName' is not null or undefined
            assertParamExists('updateHiveAccount', 'accountName', accountName)
            // verify required parameter 'body' is not null or undefined
            assertParamExists('updateHiveAccount', 'body', body)
            const localVarPath = `/api/v1/data/hive/organizations/{orgName}/clusters/{clusterName}/accounts/{accountName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"accountName"}}`, encodeURIComponent(String(accountName)));
            // 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: 'PATCH', ...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)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

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

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

/**
 * HiveApi - functional programming interface
 * @export
 */
export const HiveApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = HiveApiAxiosParamCreator(configuration)
    return {
        /**
         * create an hive account
         * @summary Create Hive account
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the Cluster
         * @param {Account} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createHiveAccount(orgName: string, clusterName: string, body: Account, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Account>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createHiveAccount(orgName, clusterName, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HiveApi.createHiveAccount']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * delete an hive account in cluster
         * @summary Delete hive account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} accountName name of the account
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteHiveAccount(orgName: string, clusterName: string, accountName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteHiveAccount(orgName, clusterName, accountName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HiveApi.deleteHiveAccount']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Get Hive accounts
         * @summary Get Hive accounts
         * @param {string} orgName The name of organization
         * @param {string} clusterName The name of cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getHiveAccounts(orgName: string, clusterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<AccountListItem>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getHiveAccounts(orgName, clusterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HiveApi.getHiveAccounts']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * update an hive account in cluster
         * @summary update hive account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} accountName name of the account
         * @param {Account} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateHiveAccount(orgName: string, clusterName: string, accountName: string, body: Account, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateHiveAccount(orgName, clusterName, accountName, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['HiveApi.updateHiveAccount']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * HiveApi - factory interface
 * @export
 */
export const HiveApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = HiveApiFp(configuration)
    return {
        /**
         * create an hive account
         * @summary Create Hive account
         * @param {HiveApiCreateHiveAccountRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createHiveAccount(requestParameters: HiveApiCreateHiveAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<Account> {
            return localVarFp.createHiveAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * delete an hive account in cluster
         * @summary Delete hive account
         * @param {HiveApiDeleteHiveAccountRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteHiveAccount(requestParameters: HiveApiDeleteHiveAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteHiveAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.accountName, options).then((request) => request(axios, basePath));
        },
        /**
         * Get Hive accounts
         * @summary Get Hive accounts
         * @param {HiveApiGetHiveAccountsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getHiveAccounts(requestParameters: HiveApiGetHiveAccountsRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<AccountListItem>> {
            return localVarFp.getHiveAccounts(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
        /**
         * update an hive account in cluster
         * @summary update hive account
         * @param {HiveApiUpdateHiveAccountRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateHiveAccount(requestParameters: HiveApiUpdateHiveAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.updateHiveAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.accountName, requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * HiveApi - interface
 * @export
 * @interface HiveApi
 */
export interface HiveApiInterface {
    /**
     * create an hive account
     * @summary Create Hive account
     * @param {HiveApiCreateHiveAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApiInterface
     */
    createHiveAccount(requestParameters: HiveApiCreateHiveAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<Account>;

    /**
     * delete an hive account in cluster
     * @summary Delete hive account
     * @param {HiveApiDeleteHiveAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApiInterface
     */
    deleteHiveAccount(requestParameters: HiveApiDeleteHiveAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * Get Hive accounts
     * @summary Get Hive accounts
     * @param {HiveApiGetHiveAccountsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApiInterface
     */
    getHiveAccounts(requestParameters: HiveApiGetHiveAccountsRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<AccountListItem>>;

    /**
     * update an hive account in cluster
     * @summary update hive account
     * @param {HiveApiUpdateHiveAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApiInterface
     */
    updateHiveAccount(requestParameters: HiveApiUpdateHiveAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

}

/**
 * Request parameters for createHiveAccount operation in HiveApi.
 * @export
 * @interface HiveApiCreateHiveAccountRequest
 */
export interface HiveApiCreateHiveAccountRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof HiveApiCreateHiveAccount
     */
    readonly orgName: string

    /**
     * name of the Cluster
     * @type {string}
     * @memberof HiveApiCreateHiveAccount
     */
    readonly clusterName: string

    /**
     * 
     * @type {Account}
     * @memberof HiveApiCreateHiveAccount
     */
    readonly body: Account
}

/**
 * Request parameters for deleteHiveAccount operation in HiveApi.
 * @export
 * @interface HiveApiDeleteHiveAccountRequest
 */
export interface HiveApiDeleteHiveAccountRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof HiveApiDeleteHiveAccount
     */
    readonly orgName: string

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

    /**
     * name of the account
     * @type {string}
     * @memberof HiveApiDeleteHiveAccount
     */
    readonly accountName: string
}

/**
 * Request parameters for getHiveAccounts operation in HiveApi.
 * @export
 * @interface HiveApiGetHiveAccountsRequest
 */
export interface HiveApiGetHiveAccountsRequest {
    /**
     * The name of organization
     * @type {string}
     * @memberof HiveApiGetHiveAccounts
     */
    readonly orgName: string

    /**
     * The name of cluster
     * @type {string}
     * @memberof HiveApiGetHiveAccounts
     */
    readonly clusterName: string
}

/**
 * Request parameters for updateHiveAccount operation in HiveApi.
 * @export
 * @interface HiveApiUpdateHiveAccountRequest
 */
export interface HiveApiUpdateHiveAccountRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof HiveApiUpdateHiveAccount
     */
    readonly orgName: string

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

    /**
     * name of the account
     * @type {string}
     * @memberof HiveApiUpdateHiveAccount
     */
    readonly accountName: string

    /**
     * 
     * @type {Account}
     * @memberof HiveApiUpdateHiveAccount
     */
    readonly body: Account
}

/**
 * HiveApi - object-oriented interface
 * @export
 * @class HiveApi
 * @extends {BaseAPI}
 */
export class HiveApi extends BaseAPI implements HiveApiInterface {
    /**
     * create an hive account
     * @summary Create Hive account
     * @param {HiveApiCreateHiveAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApi
     */
    public createHiveAccount(requestParameters: HiveApiCreateHiveAccountRequest, options?: RawAxiosRequestConfig) {
        return HiveApiFp(this.configuration).createHiveAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * delete an hive account in cluster
     * @summary Delete hive account
     * @param {HiveApiDeleteHiveAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApi
     */
    public deleteHiveAccount(requestParameters: HiveApiDeleteHiveAccountRequest, options?: RawAxiosRequestConfig) {
        return HiveApiFp(this.configuration).deleteHiveAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.accountName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Get Hive accounts
     * @summary Get Hive accounts
     * @param {HiveApiGetHiveAccountsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApi
     */
    public getHiveAccounts(requestParameters: HiveApiGetHiveAccountsRequest, options?: RawAxiosRequestConfig) {
        return HiveApiFp(this.configuration).getHiveAccounts(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * update an hive account in cluster
     * @summary update hive account
     * @param {HiveApiUpdateHiveAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof HiveApi
     */
    public updateHiveAccount(requestParameters: HiveApiUpdateHiveAccountRequest, options?: RawAxiosRequestConfig) {
        return HiveApiFp(this.configuration).updateHiveAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.accountName, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

