/* 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 { BackupRepo } from '../models';
// @ts-ignore
import type { BackupRepoList } from '../models';
// @ts-ignore
import type { BackupRepoView } from '../models';
// @ts-ignore
import type { FileEntryList } from '../models';
/**
 * BackupRepoApi - axios parameter creator
 * @export
 */
export const BackupRepoApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get backup repo
         * @param {string} environmentName name of the environment
         * @param {string} backupRepoName name of the BackupRepo
         * @param {string} [orgName] name of the organization
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getBackupRepo: async (environmentName: string, backupRepoName: string, orgName?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('getBackupRepo', 'environmentName', environmentName)
            // verify required parameter 'backupRepoName' is not null or undefined
            assertParamExists('getBackupRepo', 'backupRepoName', backupRepoName)
            const localVarPath = `/api/v1/environments/{environmentName}/backupRepo/{backupRepoName}`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)))
                .replace(`{${"backupRepoName"}}`, encodeURIComponent(String(backupRepoName)));
            // 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 (orgName !== undefined) {
                localVarQueryParameter['orgName'] = orgName;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary List backup repos
         * @param {string} orgName name of the organization
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listBackupRepos: async (orgName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listBackupRepos', 'orgName', orgName)
            const localVarPath = `/api/v1/organizations/{orgName}/backupRepo`
                .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)


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary view backup repo
         * @param {string} environmentName name of the environment
         * @param {string} backupRepoName name of the environment
         * @param {BackupRepoView} backupRepoView 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        viewBackupRepo: async (environmentName: string, backupRepoName: string, backupRepoView: BackupRepoView, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('viewBackupRepo', 'environmentName', environmentName)
            // verify required parameter 'backupRepoName' is not null or undefined
            assertParamExists('viewBackupRepo', 'backupRepoName', backupRepoName)
            // verify required parameter 'backupRepoView' is not null or undefined
            assertParamExists('viewBackupRepo', 'backupRepoView', backupRepoView)
            const localVarPath = `/api/v1/environments/{environmentName}/backupRepo/{backupRepoName}/view`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)))
                .replace(`{${"backupRepoName"}}`, encodeURIComponent(String(backupRepoName)));
            // 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(backupRepoView, localVarRequestOptions, configuration)

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

/**
 * BackupRepoApi - functional programming interface
 * @export
 */
export const BackupRepoApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = BackupRepoApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get backup repo
         * @param {string} environmentName name of the environment
         * @param {string} backupRepoName name of the BackupRepo
         * @param {string} [orgName] name of the organization
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getBackupRepo(environmentName: string, backupRepoName: string, orgName?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BackupRepo>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getBackupRepo(environmentName, backupRepoName, orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['BackupRepoApi.getBackupRepo']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List backup repos
         * @param {string} orgName name of the organization
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listBackupRepos(orgName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BackupRepoList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listBackupRepos(orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['BackupRepoApi.listBackupRepos']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary view backup repo
         * @param {string} environmentName name of the environment
         * @param {string} backupRepoName name of the environment
         * @param {BackupRepoView} backupRepoView 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async viewBackupRepo(environmentName: string, backupRepoName: string, backupRepoView: BackupRepoView, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FileEntryList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.viewBackupRepo(environmentName, backupRepoName, backupRepoView, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['BackupRepoApi.viewBackupRepo']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * BackupRepoApi - factory interface
 * @export
 */
export const BackupRepoApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = BackupRepoApiFp(configuration)
    return {
        /**
         * 
         * @summary Get backup repo
         * @param {BackupRepoApiGetBackupRepoRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getBackupRepo(requestParameters: BackupRepoApiGetBackupRepoRequest, options?: RawAxiosRequestConfig): AxiosPromise<BackupRepo> {
            return localVarFp.getBackupRepo(requestParameters.environmentName, requestParameters.backupRepoName, requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List backup repos
         * @param {BackupRepoApiListBackupReposRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listBackupRepos(requestParameters: BackupRepoApiListBackupReposRequest, options?: RawAxiosRequestConfig): AxiosPromise<BackupRepoList> {
            return localVarFp.listBackupRepos(requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary view backup repo
         * @param {BackupRepoApiViewBackupRepoRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        viewBackupRepo(requestParameters: BackupRepoApiViewBackupRepoRequest, options?: RawAxiosRequestConfig): AxiosPromise<FileEntryList> {
            return localVarFp.viewBackupRepo(requestParameters.environmentName, requestParameters.backupRepoName, requestParameters.backupRepoView, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * BackupRepoApi - interface
 * @export
 * @interface BackupRepoApi
 */
export interface BackupRepoApiInterface {
    /**
     * 
     * @summary Get backup repo
     * @param {BackupRepoApiGetBackupRepoRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BackupRepoApiInterface
     */
    getBackupRepo(requestParameters: BackupRepoApiGetBackupRepoRequest, options?: RawAxiosRequestConfig): AxiosPromise<BackupRepo>;

    /**
     * 
     * @summary List backup repos
     * @param {BackupRepoApiListBackupReposRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BackupRepoApiInterface
     */
    listBackupRepos(requestParameters: BackupRepoApiListBackupReposRequest, options?: RawAxiosRequestConfig): AxiosPromise<BackupRepoList>;

    /**
     * 
     * @summary view backup repo
     * @param {BackupRepoApiViewBackupRepoRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BackupRepoApiInterface
     */
    viewBackupRepo(requestParameters: BackupRepoApiViewBackupRepoRequest, options?: RawAxiosRequestConfig): AxiosPromise<FileEntryList>;

}

/**
 * Request parameters for getBackupRepo operation in BackupRepoApi.
 * @export
 * @interface BackupRepoApiGetBackupRepoRequest
 */
export interface BackupRepoApiGetBackupRepoRequest {
    /**
     * name of the environment
     * @type {string}
     * @memberof BackupRepoApiGetBackupRepo
     */
    readonly environmentName: string

    /**
     * name of the BackupRepo
     * @type {string}
     * @memberof BackupRepoApiGetBackupRepo
     */
    readonly backupRepoName: string

    /**
     * name of the organization
     * @type {string}
     * @memberof BackupRepoApiGetBackupRepo
     */
    readonly orgName?: string
}

/**
 * Request parameters for listBackupRepos operation in BackupRepoApi.
 * @export
 * @interface BackupRepoApiListBackupReposRequest
 */
export interface BackupRepoApiListBackupReposRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof BackupRepoApiListBackupRepos
     */
    readonly orgName: string
}

/**
 * Request parameters for viewBackupRepo operation in BackupRepoApi.
 * @export
 * @interface BackupRepoApiViewBackupRepoRequest
 */
export interface BackupRepoApiViewBackupRepoRequest {
    /**
     * name of the environment
     * @type {string}
     * @memberof BackupRepoApiViewBackupRepo
     */
    readonly environmentName: string

    /**
     * name of the environment
     * @type {string}
     * @memberof BackupRepoApiViewBackupRepo
     */
    readonly backupRepoName: string

    /**
     * 
     * @type {BackupRepoView}
     * @memberof BackupRepoApiViewBackupRepo
     */
    readonly backupRepoView: BackupRepoView
}

/**
 * BackupRepoApi - object-oriented interface
 * @export
 * @class BackupRepoApi
 * @extends {BaseAPI}
 */
export class BackupRepoApi extends BaseAPI implements BackupRepoApiInterface {
    /**
     * 
     * @summary Get backup repo
     * @param {BackupRepoApiGetBackupRepoRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BackupRepoApi
     */
    public getBackupRepo(requestParameters: BackupRepoApiGetBackupRepoRequest, options?: RawAxiosRequestConfig) {
        return BackupRepoApiFp(this.configuration).getBackupRepo(requestParameters.environmentName, requestParameters.backupRepoName, requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List backup repos
     * @param {BackupRepoApiListBackupReposRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BackupRepoApi
     */
    public listBackupRepos(requestParameters: BackupRepoApiListBackupReposRequest, options?: RawAxiosRequestConfig) {
        return BackupRepoApiFp(this.configuration).listBackupRepos(requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary view backup repo
     * @param {BackupRepoApiViewBackupRepoRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof BackupRepoApi
     */
    public viewBackupRepo(requestParameters: BackupRepoApiViewBackupRepoRequest, options?: RawAxiosRequestConfig) {
        return BackupRepoApiFp(this.configuration).viewBackupRepo(requestParameters.environmentName, requestParameters.backupRepoName, requestParameters.backupRepoView, options).then((request) => request(this.axios, this.basePath));
    }
}

