/* 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 { EngineLicense } from '../models';
// @ts-ignore
import type { EngineLicenseList } from '../models';
/**
 * EngineLicenseApi - axios parameter creator
 * @export
 */
export const EngineLicenseApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Create a new engineLicense
         * @summary Create engineLicense
         * @param {string} name Name of the engine license
         * @param {string} engineName Name of the engine
         * @param {string} type Type of the license. Determines whether licenseFile is required.
         * @param {string} [description] Description of the engine license
         * @param {string} [expiredAt] Expiration date and time of the license (optional)
         * @param {string} [environmentID] Environment ID of the license (optional)
         * @param {File} [licenseFile] The license file to upload. Required when type is not NodeScope; optional when type is NodeScope.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createEngineLicense: async (name: string, engineName: string, type: string, description?: string, expiredAt?: string, environmentID?: string, licenseFile?: File, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'name' is not null or undefined
            assertParamExists('createEngineLicense', 'name', name)
            // verify required parameter 'engineName' is not null or undefined
            assertParamExists('createEngineLicense', 'engineName', engineName)
            // verify required parameter 'type' is not null or undefined
            assertParamExists('createEngineLicense', 'type', type)
            const localVarPath = `/admin/v1/engineLicense`;
            // 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;
            const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


            if (name !== undefined) { 
                localVarFormParams.append('name', name as any);
            }
    
            if (engineName !== undefined) { 
                localVarFormParams.append('engineName', engineName as any);
            }
    
            if (description !== undefined) { 
                localVarFormParams.append('description', description as any);
            }
    
            if (expiredAt !== undefined) { 
                localVarFormParams.append('expiredAt', expiredAt as any);
            }
    
            if (environmentID !== undefined) { 
                localVarFormParams.append('environmentID', environmentID as any);
            }
    
            if (type !== undefined) { 
                localVarFormParams.append('type', type as any);
            }
    
            if (licenseFile !== undefined) { 
                localVarFormParams.append('licenseFile', licenseFile as any);
            }
    
    
            localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = localVarFormParams;

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * delete an engine license
         * @summary Delete engine license
         * @param {string} licenseId license id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteEngineLicense: async (licenseId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'licenseId' is not null or undefined
            assertParamExists('deleteEngineLicense', 'licenseId', licenseId)
            const localVarPath = `/admin/v1/engineLicense`;
            // 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)

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


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Get a engineLicense detail
         * @summary Get engineLicense
         * @param {string} licenseId license id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        engineLicense: async (licenseId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'licenseId' is not null or undefined
            assertParamExists('engineLicense', 'licenseId', licenseId)
            const localVarPath = `/admin/v1/engineLicense`;
            // 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 (licenseId !== undefined) {
                localVarQueryParameter['licenseId'] = licenseId;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * list all engineLicenses
         * @summary List all engineLicenses
         * @param {string} [engineName] engine name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEngineLicenses: async (engineName?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/engineLicenses`;
            // 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;
            }


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

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

/**
 * EngineLicenseApi - functional programming interface
 * @export
 */
export const EngineLicenseApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = EngineLicenseApiAxiosParamCreator(configuration)
    return {
        /**
         * Create a new engineLicense
         * @summary Create engineLicense
         * @param {string} name Name of the engine license
         * @param {string} engineName Name of the engine
         * @param {string} type Type of the license. Determines whether licenseFile is required.
         * @param {string} [description] Description of the engine license
         * @param {string} [expiredAt] Expiration date and time of the license (optional)
         * @param {string} [environmentID] Environment ID of the license (optional)
         * @param {File} [licenseFile] The license file to upload. Required when type is not NodeScope; optional when type is NodeScope.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createEngineLicense(name: string, engineName: string, type: string, description?: string, expiredAt?: string, environmentID?: string, licenseFile?: File, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EngineLicense>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createEngineLicense(name, engineName, type, description, expiredAt, environmentID, licenseFile, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineLicenseApi.createEngineLicense']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * delete an engine license
         * @summary Delete engine license
         * @param {string} licenseId license id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteEngineLicense(licenseId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteEngineLicense(licenseId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineLicenseApi.deleteEngineLicense']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Get a engineLicense detail
         * @summary Get engineLicense
         * @param {string} licenseId license id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async engineLicense(licenseId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EngineLicense>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.engineLicense(licenseId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineLicenseApi.engineLicense']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * list all engineLicenses
         * @summary List all engineLicenses
         * @param {string} [engineName] engine name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listEngineLicenses(engineName?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EngineLicenseList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listEngineLicenses(engineName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EngineLicenseApi.listEngineLicenses']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * EngineLicenseApi - factory interface
 * @export
 */
export const EngineLicenseApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = EngineLicenseApiFp(configuration)
    return {
        /**
         * Create a new engineLicense
         * @summary Create engineLicense
         * @param {EngineLicenseApiCreateEngineLicenseRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createEngineLicense(requestParameters: EngineLicenseApiCreateEngineLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineLicense> {
            return localVarFp.createEngineLicense(requestParameters.name, requestParameters.engineName, requestParameters.type, requestParameters.description, requestParameters.expiredAt, requestParameters.environmentID, requestParameters.licenseFile, options).then((request) => request(axios, basePath));
        },
        /**
         * delete an engine license
         * @summary Delete engine license
         * @param {EngineLicenseApiDeleteEngineLicenseRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteEngineLicense(requestParameters: EngineLicenseApiDeleteEngineLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteEngineLicense(requestParameters.licenseId, options).then((request) => request(axios, basePath));
        },
        /**
         * Get a engineLicense detail
         * @summary Get engineLicense
         * @param {EngineLicenseApiEngineLicenseRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        engineLicense(requestParameters: EngineLicenseApiEngineLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineLicense> {
            return localVarFp.engineLicense(requestParameters.licenseId, options).then((request) => request(axios, basePath));
        },
        /**
         * list all engineLicenses
         * @summary List all engineLicenses
         * @param {EngineLicenseApiListEngineLicensesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEngineLicenses(requestParameters: EngineLicenseApiListEngineLicensesRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<EngineLicenseList> {
            return localVarFp.listEngineLicenses(requestParameters.engineName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * EngineLicenseApi - interface
 * @export
 * @interface EngineLicenseApi
 */
export interface EngineLicenseApiInterface {
    /**
     * Create a new engineLicense
     * @summary Create engineLicense
     * @param {EngineLicenseApiCreateEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApiInterface
     */
    createEngineLicense(requestParameters: EngineLicenseApiCreateEngineLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineLicense>;

    /**
     * delete an engine license
     * @summary Delete engine license
     * @param {EngineLicenseApiDeleteEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApiInterface
     */
    deleteEngineLicense(requestParameters: EngineLicenseApiDeleteEngineLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * Get a engineLicense detail
     * @summary Get engineLicense
     * @param {EngineLicenseApiEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApiInterface
     */
    engineLicense(requestParameters: EngineLicenseApiEngineLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineLicense>;

    /**
     * list all engineLicenses
     * @summary List all engineLicenses
     * @param {EngineLicenseApiListEngineLicensesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApiInterface
     */
    listEngineLicenses(requestParameters?: EngineLicenseApiListEngineLicensesRequest, options?: RawAxiosRequestConfig): AxiosPromise<EngineLicenseList>;

}

/**
 * Request parameters for createEngineLicense operation in EngineLicenseApi.
 * @export
 * @interface EngineLicenseApiCreateEngineLicenseRequest
 */
export interface EngineLicenseApiCreateEngineLicenseRequest {
    /**
     * Name of the engine license
     * @type {string}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly name: string

    /**
     * Name of the engine
     * @type {string}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly engineName: string

    /**
     * Type of the license. Determines whether licenseFile is required.
     * @type {string}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly type: string

    /**
     * Description of the engine license
     * @type {string}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly description?: string

    /**
     * Expiration date and time of the license (optional)
     * @type {string}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly expiredAt?: string

    /**
     * Environment ID of the license (optional)
     * @type {string}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly environmentID?: string

    /**
     * The license file to upload. Required when type is not NodeScope; optional when type is NodeScope.
     * @type {File}
     * @memberof EngineLicenseApiCreateEngineLicense
     */
    readonly licenseFile?: File
}

/**
 * Request parameters for deleteEngineLicense operation in EngineLicenseApi.
 * @export
 * @interface EngineLicenseApiDeleteEngineLicenseRequest
 */
export interface EngineLicenseApiDeleteEngineLicenseRequest {
    /**
     * license id
     * @type {string}
     * @memberof EngineLicenseApiDeleteEngineLicense
     */
    readonly licenseId: string
}

/**
 * Request parameters for engineLicense operation in EngineLicenseApi.
 * @export
 * @interface EngineLicenseApiEngineLicenseRequest
 */
export interface EngineLicenseApiEngineLicenseRequest {
    /**
     * license id
     * @type {string}
     * @memberof EngineLicenseApiEngineLicense
     */
    readonly licenseId: string
}

/**
 * Request parameters for listEngineLicenses operation in EngineLicenseApi.
 * @export
 * @interface EngineLicenseApiListEngineLicensesRequest
 */
export interface EngineLicenseApiListEngineLicensesRequest {
    /**
     * engine name
     * @type {string}
     * @memberof EngineLicenseApiListEngineLicenses
     */
    readonly engineName?: string
}

/**
 * EngineLicenseApi - object-oriented interface
 * @export
 * @class EngineLicenseApi
 * @extends {BaseAPI}
 */
export class EngineLicenseApi extends BaseAPI implements EngineLicenseApiInterface {
    /**
     * Create a new engineLicense
     * @summary Create engineLicense
     * @param {EngineLicenseApiCreateEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApi
     */
    public createEngineLicense(requestParameters: EngineLicenseApiCreateEngineLicenseRequest, options?: RawAxiosRequestConfig) {
        return EngineLicenseApiFp(this.configuration).createEngineLicense(requestParameters.name, requestParameters.engineName, requestParameters.type, requestParameters.description, requestParameters.expiredAt, requestParameters.environmentID, requestParameters.licenseFile, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * delete an engine license
     * @summary Delete engine license
     * @param {EngineLicenseApiDeleteEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApi
     */
    public deleteEngineLicense(requestParameters: EngineLicenseApiDeleteEngineLicenseRequest, options?: RawAxiosRequestConfig) {
        return EngineLicenseApiFp(this.configuration).deleteEngineLicense(requestParameters.licenseId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Get a engineLicense detail
     * @summary Get engineLicense
     * @param {EngineLicenseApiEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApi
     */
    public engineLicense(requestParameters: EngineLicenseApiEngineLicenseRequest, options?: RawAxiosRequestConfig) {
        return EngineLicenseApiFp(this.configuration).engineLicense(requestParameters.licenseId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * list all engineLicenses
     * @summary List all engineLicenses
     * @param {EngineLicenseApiListEngineLicensesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApi
     */
    public listEngineLicenses(requestParameters: EngineLicenseApiListEngineLicensesRequest = {}, options?: RawAxiosRequestConfig) {
        return EngineLicenseApiFp(this.configuration).listEngineLicenses(requestParameters.engineName, options).then((request) => request(this.axios, this.basePath));
    }
}

