/* 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 { PlatformComponent } from '../models';
// @ts-ignore
import type { PlatformComponentDetails } from '../models';
/**
 * PlatformComponentApi - axios parameter creator
 * @export
 */
export const PlatformComponentApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Get platform component detail by name, including monitoring and log query metadata
         * @summary Get platform component detail
         * @param {string} componentName Platform component name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPlatformComponent: async (componentName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'componentName' is not null or undefined
            assertParamExists('getPlatformComponent', 'componentName', componentName)
            const localVarPath = `/admin/v1/platformComponents/{componentName}`
                .replace(`{${"componentName"}}`, encodeURIComponent(String(componentName)));
            // 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,
            };
        },
        /**
         * List platform components with monitoring and log query metadata
         * @summary List platform components
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPlatformComponents: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/platformComponents`;
            // 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,
            };
        },
    }
};

/**
 * PlatformComponentApi - functional programming interface
 * @export
 */
export const PlatformComponentApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = PlatformComponentApiAxiosParamCreator(configuration)
    return {
        /**
         * Get platform component detail by name, including monitoring and log query metadata
         * @summary Get platform component detail
         * @param {string} componentName Platform component name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getPlatformComponent(componentName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PlatformComponentDetails>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getPlatformComponent(componentName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PlatformComponentApi.getPlatformComponent']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List platform components with monitoring and log query metadata
         * @summary List platform components
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listPlatformComponents(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<PlatformComponent>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listPlatformComponents(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['PlatformComponentApi.listPlatformComponents']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * PlatformComponentApi - factory interface
 * @export
 */
export const PlatformComponentApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = PlatformComponentApiFp(configuration)
    return {
        /**
         * Get platform component detail by name, including monitoring and log query metadata
         * @summary Get platform component detail
         * @param {PlatformComponentApiGetPlatformComponentRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getPlatformComponent(requestParameters: PlatformComponentApiGetPlatformComponentRequest, options?: RawAxiosRequestConfig): AxiosPromise<PlatformComponentDetails> {
            return localVarFp.getPlatformComponent(requestParameters.componentName, options).then((request) => request(axios, basePath));
        },
        /**
         * List platform components with monitoring and log query metadata
         * @summary List platform components
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listPlatformComponents(options?: RawAxiosRequestConfig): AxiosPromise<Array<PlatformComponent>> {
            return localVarFp.listPlatformComponents(options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * PlatformComponentApi - interface
 * @export
 * @interface PlatformComponentApi
 */
export interface PlatformComponentApiInterface {
    /**
     * Get platform component detail by name, including monitoring and log query metadata
     * @summary Get platform component detail
     * @param {PlatformComponentApiGetPlatformComponentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformComponentApiInterface
     */
    getPlatformComponent(requestParameters: PlatformComponentApiGetPlatformComponentRequest, options?: RawAxiosRequestConfig): AxiosPromise<PlatformComponentDetails>;

    /**
     * List platform components with monitoring and log query metadata
     * @summary List platform components
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformComponentApiInterface
     */
    listPlatformComponents(options?: RawAxiosRequestConfig): AxiosPromise<Array<PlatformComponent>>;

}

/**
 * Request parameters for getPlatformComponent operation in PlatformComponentApi.
 * @export
 * @interface PlatformComponentApiGetPlatformComponentRequest
 */
export interface PlatformComponentApiGetPlatformComponentRequest {
    /**
     * Platform component name
     * @type {string}
     * @memberof PlatformComponentApiGetPlatformComponent
     */
    readonly componentName: string
}

/**
 * PlatformComponentApi - object-oriented interface
 * @export
 * @class PlatformComponentApi
 * @extends {BaseAPI}
 */
export class PlatformComponentApi extends BaseAPI implements PlatformComponentApiInterface {
    /**
     * Get platform component detail by name, including monitoring and log query metadata
     * @summary Get platform component detail
     * @param {PlatformComponentApiGetPlatformComponentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformComponentApi
     */
    public getPlatformComponent(requestParameters: PlatformComponentApiGetPlatformComponentRequest, options?: RawAxiosRequestConfig) {
        return PlatformComponentApiFp(this.configuration).getPlatformComponent(requestParameters.componentName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * List platform components with monitoring and log query metadata
     * @summary List platform components
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof PlatformComponentApi
     */
    public listPlatformComponents(options?: RawAxiosRequestConfig) {
        return PlatformComponentApiFp(this.configuration).listPlatformComponents(options).then((request) => request(this.axios, this.basePath));
    }
}

