"use strict";
/* 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.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EngineLicenseApi = exports.EngineLicenseApiFactory = exports.EngineLicenseApiFp = exports.EngineLicenseApiAxiosParamCreator = void 0;
const axios_1 = __importDefault(require("axios"));
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
 * EngineLicenseApi - axios parameter creator
 * @export
 */
const EngineLicenseApiAxiosParamCreator = function (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, engineName, type, description, expiredAt, environmentID, licenseFile, options = {}) => {
            // verify required parameter 'name' is not null or undefined
            (0, common_1.assertParamExists)('createEngineLicense', 'name', name);
            // verify required parameter 'engineName' is not null or undefined
            (0, common_1.assertParamExists)('createEngineLicense', 'engineName', engineName);
            // verify required parameter 'type' is not null or undefined
            (0, common_1.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, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            if (name !== undefined) {
                localVarFormParams.append('name', name);
            }
            if (engineName !== undefined) {
                localVarFormParams.append('engineName', engineName);
            }
            if (description !== undefined) {
                localVarFormParams.append('description', description);
            }
            if (expiredAt !== undefined) {
                localVarFormParams.append('expiredAt', expiredAt);
            }
            if (environmentID !== undefined) {
                localVarFormParams.append('environmentID', environmentID);
            }
            if (type !== undefined) {
                localVarFormParams.append('type', type);
            }
            if (licenseFile !== undefined) {
                localVarFormParams.append('licenseFile', licenseFile);
            }
            localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            localVarRequestOptions.data = localVarFormParams;
            return {
                url: (0, common_1.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, options = {}) => {
            // verify required parameter 'licenseId' is not null or undefined
            (0, common_1.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, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            if (licenseId !== undefined) {
                localVarQueryParameter['licenseId'] = licenseId;
            }
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.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, options = {}) => {
            // verify required parameter 'licenseId' is not null or undefined
            (0, common_1.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, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            if (licenseId !== undefined) {
                localVarQueryParameter['licenseId'] = licenseId;
            }
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.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, options = {}) => {
            const localVarPath = `/admin/v1/engineLicenses`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            if (engineName !== undefined) {
                localVarQueryParameter['engineName'] = engineName;
            }
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
exports.EngineLicenseApiAxiosParamCreator = EngineLicenseApiAxiosParamCreator;
/**
 * EngineLicenseApi - functional programming interface
 * @export
 */
const EngineLicenseApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.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, engineName, type, description, expiredAt, environmentID, licenseFile, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createEngineLicense(name, engineName, type, description, expiredAt, environmentID, licenseFile, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['EngineLicenseApi.createEngineLicense']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteEngineLicense(licenseId, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['EngineLicenseApi.deleteEngineLicense']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.engineLicense(licenseId, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['EngineLicenseApi.engineLicense']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listEngineLicenses(engineName, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['EngineLicenseApi.listEngineLicenses']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    };
};
exports.EngineLicenseApiFp = EngineLicenseApiFp;
/**
 * EngineLicenseApi - factory interface
 * @export
 */
const EngineLicenseApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.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, options) {
            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, options) {
            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, options) {
            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 = {}, options) {
            return localVarFp.listEngineLicenses(requestParameters.engineName, options).then((request) => request(axios, basePath));
        },
    };
};
exports.EngineLicenseApiFactory = EngineLicenseApiFactory;
/**
 * EngineLicenseApi - object-oriented interface
 * @export
 * @class EngineLicenseApi
 * @extends {BaseAPI}
 */
class EngineLicenseApi extends base_1.BaseAPI {
    /**
     * Create a new engineLicense
     * @summary Create engineLicense
     * @param {EngineLicenseApiCreateEngineLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EngineLicenseApi
     */
    createEngineLicense(requestParameters, options) {
        return (0, exports.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
     */
    deleteEngineLicense(requestParameters, options) {
        return (0, exports.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
     */
    engineLicense(requestParameters, options) {
        return (0, exports.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
     */
    listEngineLicenses(requestParameters = {}, options) {
        return (0, exports.EngineLicenseApiFp)(this.configuration).listEngineLicenses(requestParameters.engineName, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.EngineLicenseApi = EngineLicenseApi;
//# sourceMappingURL=engine-license-api.js.map