/* 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 { PlatformParameter } from '../models';
// @ts-ignore
import type { PlatformParameterList } from '../models';
// @ts-ignore
import type { PlatformParameterUpdate } from '../models';
/**
 * PlatformParameterApi - axios parameter creator
 * @export
 */
export const PlatformParameterApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary get platformParameter by name
         * @param {string} platformParameterName name of the platformParameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPlatformParameter: async (platformParameterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'platformParameterName' is not null or undefined
            assertParamExists('getPlatformParameter', 'platformParameterName', platformParameterName)
            const localVarPath = `/admin/v1/platformParameters/{platformParameterName}`
                .replace(`{${"platformParameterName"}}`, encodeURIComponent(String(platformParameterName)));
            // 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 platformParameters
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPlatformParameters: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/platformParameters`;
            // 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 update platformParameters
         * @param {Array<PlatformParameterUpdate>} [platformParameterUpdate] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updatePlatformParameters: async (platformParameterUpdate?: Array<PlatformParameterUpdate>, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/platformParameters`;
            // 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(platformParameterUpdate, localVarRequestOptions, configuration)

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

/**
 * PlatformParameterApi - functional programming interface
 * @export
 */
export const PlatformParameterApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = PlatformParameterApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary get platformParameter by name
         * @param {string} platformParameterName name of the platformParameter
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getPlatformParameter(platformParameterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PlatformParameter>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getPlatformParameter(platformParameterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PlatformParameterApi.getPlatformParameter']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary list platformParameters
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listPlatformParameters(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PlatformParameterList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listPlatformParameters(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PlatformParameterApi.listPlatformParameters']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary update platformParameters
         * @param {Array<PlatformParameterUpdate>} [platformParameterUpdate] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updatePlatformParameters(platformParameterUpdate?: Array<PlatformParameterUpdate>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<PlatformParameter>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updatePlatformParameters(platformParameterUpdate, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PlatformParameterApi.updatePlatformParameters']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * PlatformParameterApi - factory interface
 * @export
 */
export const PlatformParameterApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = PlatformParameterApiFp(configuration)
    return {
        /**
         * 
         * @summary get platformParameter by name
         * @param {PlatformParameterApiGetPlatformParameterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPlatformParameter(requestParameters: PlatformParameterApiGetPlatformParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<PlatformParameter> {
            return localVarFp.getPlatformParameter(requestParameters.platformParameterName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary list platformParameters
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPlatformParameters(options?: RawAxiosRequestConfig): AxiosPromise<PlatformParameterList> {
            return localVarFp.listPlatformParameters(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary update platformParameters
         * @param {PlatformParameterApiUpdatePlatformParametersRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updatePlatformParameters(requestParameters: PlatformParameterApiUpdatePlatformParametersRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<Array<PlatformParameter>> {
            return localVarFp.updatePlatformParameters(requestParameters.platformParameterUpdate, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * PlatformParameterApi - interface
 * @export
 * @interface PlatformParameterApi
 */
export interface PlatformParameterApiInterface {
    /**
     * 
     * @summary get platformParameter by name
     * @param {PlatformParameterApiGetPlatformParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformParameterApiInterface
     */
    getPlatformParameter(requestParameters: PlatformParameterApiGetPlatformParameterRequest, options?: RawAxiosRequestConfig): AxiosPromise<PlatformParameter>;

    /**
     * 
     * @summary list platformParameters
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformParameterApiInterface
     */
    listPlatformParameters(options?: RawAxiosRequestConfig): AxiosPromise<PlatformParameterList>;

    /**
     * 
     * @summary update platformParameters
     * @param {PlatformParameterApiUpdatePlatformParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformParameterApiInterface
     */
    updatePlatformParameters(requestParameters?: PlatformParameterApiUpdatePlatformParametersRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<PlatformParameter>>;

}

/**
 * Request parameters for getPlatformParameter operation in PlatformParameterApi.
 * @export
 * @interface PlatformParameterApiGetPlatformParameterRequest
 */
export interface PlatformParameterApiGetPlatformParameterRequest {
    /**
     * name of the platformParameter
     * @type {string}
     * @memberof PlatformParameterApiGetPlatformParameter
     */
    readonly platformParameterName: string
}

/**
 * Request parameters for updatePlatformParameters operation in PlatformParameterApi.
 * @export
 * @interface PlatformParameterApiUpdatePlatformParametersRequest
 */
export interface PlatformParameterApiUpdatePlatformParametersRequest {
    /**
     * 
     * @type {Array<PlatformParameterUpdate>}
     * @memberof PlatformParameterApiUpdatePlatformParameters
     */
    readonly platformParameterUpdate?: Array<PlatformParameterUpdate>
}

/**
 * PlatformParameterApi - object-oriented interface
 * @export
 * @class PlatformParameterApi
 * @extends {BaseAPI}
 */
export class PlatformParameterApi extends BaseAPI implements PlatformParameterApiInterface {
    /**
     * 
     * @summary get platformParameter by name
     * @param {PlatformParameterApiGetPlatformParameterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformParameterApi
     */
    public getPlatformParameter(requestParameters: PlatformParameterApiGetPlatformParameterRequest, options?: RawAxiosRequestConfig) {
        return PlatformParameterApiFp(this.configuration).getPlatformParameter(requestParameters.platformParameterName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary list platformParameters
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformParameterApi
     */
    public listPlatformParameters(options?: RawAxiosRequestConfig) {
        return PlatformParameterApiFp(this.configuration).listPlatformParameters(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary update platformParameters
     * @param {PlatformParameterApiUpdatePlatformParametersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformParameterApi
     */
    public updatePlatformParameters(requestParameters: PlatformParameterApiUpdatePlatformParametersRequest = {}, options?: RawAxiosRequestConfig) {
        return PlatformParameterApiFp(this.configuration).updatePlatformParameters(requestParameters.platformParameterUpdate, options).then((request) => request(this.axios, this.basePath));
    }
}

