/* tslint:disable */
/* eslint-disable */
/**
 * Admin API
 * The Admin API is used to manage the ApeCloud platform. 
 *
 * 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 { DatabaseParameterItem } from '../models';
// @ts-ignore
import type { DatabaseParameterList } from '../models';
// @ts-ignore
import type { DeleteDatabaseParameterItem } from '../models';
/**
 * DatabaseParametersApi - axios parameter creator
 * @export
 */
export const DatabaseParametersApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create database parameter
         * @param {DatabaseParameterItem} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createDatabaseParameter: async (body: DatabaseParameterItem, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('createDatabaseParameter', 'body', body)
            const localVarPath = `/admin/v1/databaseParameters`;
            // 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,
            };
        },
        /**
         * 
         * @summary Delete database parameter
         * @param {DeleteDatabaseParameterItem} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteDatabaseParameter: async (body: DeleteDatabaseParameterItem, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('deleteDatabaseParameter', 'body', body)
            const localVarPath = `/admin/v1/databaseParameters`;
            // 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)


    
            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,
            };
        },
        /**
         * 
         * @summary List database parameters
         * @param {string} engineName engine Name
         * @param {string} component component type
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listDatabaseParameters: async (engineName: string, component: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'engineName' is not null or undefined
            assertParamExists('listDatabaseParameters', 'engineName', engineName)
            // verify required parameter 'component' is not null or undefined
            assertParamExists('listDatabaseParameters', 'component', component)
            const localVarPath = `/admin/v1/databaseParameters`;
            // 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 (engineName !== undefined) {
                localVarQueryParameter['engineName'] = engineName;
            }

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Update database parameter
         * @param {DatabaseParameterItem} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateDatabaseParameter: async (body: DatabaseParameterItem, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('updateDatabaseParameter', 'body', body)
            const localVarPath = `/admin/v1/databaseParameters`;
            // 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,
            };
        },
    }
};

/**
 * DatabaseParametersApi - functional programming interface
 * @export
 */
export const DatabaseParametersApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = DatabaseParametersApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create database parameter
         * @param {DatabaseParameterItem} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createDatabaseParameter(body: DatabaseParameterItem, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DatabaseParameterItem>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createDatabaseParameter(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DatabaseParametersApi.createDatabaseParameter']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete database parameter
         * @param {DeleteDatabaseParameterItem} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteDatabaseParameter(body: DeleteDatabaseParameterItem, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteDatabaseParameter(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DatabaseParametersApi.deleteDatabaseParameter']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List database parameters
         * @param {string} engineName engine Name
         * @param {string} component component type
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listDatabaseParameters(engineName: string, component: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DatabaseParameterList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listDatabaseParameters(engineName, component, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DatabaseParametersApi.listDatabaseParameters']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Update database parameter
         * @param {DatabaseParameterItem} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateDatabaseParameter(body: DatabaseParameterItem, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DatabaseParameterItem>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateDatabaseParameter(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['DatabaseParametersApi.updateDatabaseParameter']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * DatabaseParametersApi - factory interface
 * @export
 */
export const DatabaseParametersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = DatabaseParametersApiFp(configuration)
    return {
        /**
         * 
         * @summary Create database parameter
         * @param {DatabaseParametersApiCreateDatabaseParameterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createDatabaseParameter(requestParameters: DatabaseParametersApiCreateDatabaseParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<DatabaseParameterItem> {
            return localVarFp.createDatabaseParameter(requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete database parameter
         * @param {DatabaseParametersApiDeleteDatabaseParameterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteDatabaseParameter(requestParameters: DatabaseParametersApiDeleteDatabaseParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteDatabaseParameter(requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List database parameters
         * @param {DatabaseParametersApiListDatabaseParametersRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listDatabaseParameters(requestParameters: DatabaseParametersApiListDatabaseParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<DatabaseParameterList> {
            return localVarFp.listDatabaseParameters(requestParameters.engineName, requestParameters.component, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Update database parameter
         * @param {DatabaseParametersApiUpdateDatabaseParameterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateDatabaseParameter(requestParameters: DatabaseParametersApiUpdateDatabaseParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<DatabaseParameterItem> {
            return localVarFp.updateDatabaseParameter(requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * DatabaseParametersApi - interface
 * @export
 * @interface DatabaseParametersApi
 */
export interface DatabaseParametersApiInterface {
    /**
     * 
     * @summary Create database parameter
     * @param {DatabaseParametersApiCreateDatabaseParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApiInterface
     */
    createDatabaseParameter(requestParameters: DatabaseParametersApiCreateDatabaseParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<DatabaseParameterItem>;

    /**
     * 
     * @summary Delete database parameter
     * @param {DatabaseParametersApiDeleteDatabaseParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApiInterface
     */
    deleteDatabaseParameter(requestParameters: DatabaseParametersApiDeleteDatabaseParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary List database parameters
     * @param {DatabaseParametersApiListDatabaseParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApiInterface
     */
    listDatabaseParameters(requestParameters: DatabaseParametersApiListDatabaseParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<DatabaseParameterList>;

    /**
     * 
     * @summary Update database parameter
     * @param {DatabaseParametersApiUpdateDatabaseParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApiInterface
     */
    updateDatabaseParameter(requestParameters: DatabaseParametersApiUpdateDatabaseParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<DatabaseParameterItem>;

}

/**
 * Request parameters for createDatabaseParameter operation in DatabaseParametersApi.
 * @export
 * @interface DatabaseParametersApiCreateDatabaseParameterRequest
 */
export interface DatabaseParametersApiCreateDatabaseParameterRequest {
    /**
     * 
     * @type {DatabaseParameterItem}
     * @memberof DatabaseParametersApiCreateDatabaseParameter
     */
    readonly body: DatabaseParameterItem
}

/**
 * Request parameters for deleteDatabaseParameter operation in DatabaseParametersApi.
 * @export
 * @interface DatabaseParametersApiDeleteDatabaseParameterRequest
 */
export interface DatabaseParametersApiDeleteDatabaseParameterRequest {
    /**
     * 
     * @type {DeleteDatabaseParameterItem}
     * @memberof DatabaseParametersApiDeleteDatabaseParameter
     */
    readonly body: DeleteDatabaseParameterItem
}

/**
 * Request parameters for listDatabaseParameters operation in DatabaseParametersApi.
 * @export
 * @interface DatabaseParametersApiListDatabaseParametersRequest
 */
export interface DatabaseParametersApiListDatabaseParametersRequest {
    /**
     * engine Name
     * @type {string}
     * @memberof DatabaseParametersApiListDatabaseParameters
     */
    readonly engineName: string

    /**
     * component type
     * @type {string}
     * @memberof DatabaseParametersApiListDatabaseParameters
     */
    readonly component: string
}

/**
 * Request parameters for updateDatabaseParameter operation in DatabaseParametersApi.
 * @export
 * @interface DatabaseParametersApiUpdateDatabaseParameterRequest
 */
export interface DatabaseParametersApiUpdateDatabaseParameterRequest {
    /**
     * 
     * @type {DatabaseParameterItem}
     * @memberof DatabaseParametersApiUpdateDatabaseParameter
     */
    readonly body: DatabaseParameterItem
}

/**
 * DatabaseParametersApi - object-oriented interface
 * @export
 * @class DatabaseParametersApi
 * @extends {BaseAPI}
 */
export class DatabaseParametersApi extends BaseAPI implements DatabaseParametersApiInterface {
    /**
     * 
     * @summary Create database parameter
     * @param {DatabaseParametersApiCreateDatabaseParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApi
     */
    public createDatabaseParameter(requestParameters: DatabaseParametersApiCreateDatabaseParameterRequest, options?: RawAxiosRequestConfig) {
        return DatabaseParametersApiFp(this.configuration).createDatabaseParameter(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete database parameter
     * @param {DatabaseParametersApiDeleteDatabaseParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApi
     */
    public deleteDatabaseParameter(requestParameters: DatabaseParametersApiDeleteDatabaseParameterRequest, options?: RawAxiosRequestConfig) {
        return DatabaseParametersApiFp(this.configuration).deleteDatabaseParameter(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List database parameters
     * @param {DatabaseParametersApiListDatabaseParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApi
     */
    public listDatabaseParameters(requestParameters: DatabaseParametersApiListDatabaseParametersRequest, options?: RawAxiosRequestConfig) {
        return DatabaseParametersApiFp(this.configuration).listDatabaseParameters(requestParameters.engineName, requestParameters.component, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Update database parameter
     * @param {DatabaseParametersApiUpdateDatabaseParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DatabaseParametersApi
     */
    public updateDatabaseParameter(requestParameters: DatabaseParametersApiUpdateDatabaseParameterRequest, options?: RawAxiosRequestConfig) {
        return DatabaseParametersApiFp(this.configuration).updateDatabaseParameter(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

