/* 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 { License } from '../models';
// @ts-ignore
import type { LicenseRequest } from '../models';
/**
 * LicenseApi - axios parameter creator
 * @export
 */
export const LicenseApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Get license
         * @summary Get license
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getLicense: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/license`;
            // 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,
            };
        },
        /**
         * Update license
         * @summary Update license
         * @param {LicenseRequest} licenseRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateLicense: async (licenseRequest: LicenseRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'licenseRequest' is not null or undefined
            assertParamExists('updateLicense', 'licenseRequest', licenseRequest)
            const localVarPath = `/admin/v1/license`;
            // 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(licenseRequest, localVarRequestOptions, configuration)

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

/**
 * LicenseApi - functional programming interface
 * @export
 */
export const LicenseApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = LicenseApiAxiosParamCreator(configuration)
    return {
        /**
         * Get license
         * @summary Get license
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getLicense(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<License>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getLicense(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['LicenseApi.getLicense']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Update license
         * @summary Update license
         * @param {LicenseRequest} licenseRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateLicense(licenseRequest: LicenseRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<License>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateLicense(licenseRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['LicenseApi.updateLicense']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * LicenseApi - factory interface
 * @export
 */
export const LicenseApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = LicenseApiFp(configuration)
    return {
        /**
         * Get license
         * @summary Get license
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getLicense(options?: RawAxiosRequestConfig): AxiosPromise<License> {
            return localVarFp.getLicense(options).then((request) => request(axios, basePath));
        },
        /**
         * Update license
         * @summary Update license
         * @param {LicenseApiUpdateLicenseRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateLicense(requestParameters: LicenseApiUpdateLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<License> {
            return localVarFp.updateLicense(requestParameters.licenseRequest, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * LicenseApi - interface
 * @export
 * @interface LicenseApi
 */
export interface LicenseApiInterface {
    /**
     * Get license
     * @summary Get license
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LicenseApiInterface
     */
    getLicense(options?: RawAxiosRequestConfig): AxiosPromise<License>;

    /**
     * Update license
     * @summary Update license
     * @param {LicenseApiUpdateLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LicenseApiInterface
     */
    updateLicense(requestParameters: LicenseApiUpdateLicenseRequest, options?: RawAxiosRequestConfig): AxiosPromise<License>;

}

/**
 * Request parameters for updateLicense operation in LicenseApi.
 * @export
 * @interface LicenseApiUpdateLicenseRequest
 */
export interface LicenseApiUpdateLicenseRequest {
    /**
     * 
     * @type {LicenseRequest}
     * @memberof LicenseApiUpdateLicense
     */
    readonly licenseRequest: LicenseRequest
}

/**
 * LicenseApi - object-oriented interface
 * @export
 * @class LicenseApi
 * @extends {BaseAPI}
 */
export class LicenseApi extends BaseAPI implements LicenseApiInterface {
    /**
     * Get license
     * @summary Get license
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LicenseApi
     */
    public getLicense(options?: RawAxiosRequestConfig) {
        return LicenseApiFp(this.configuration).getLicense(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Update license
     * @summary Update license
     * @param {LicenseApiUpdateLicenseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LicenseApi
     */
    public updateLicense(requestParameters: LicenseApiUpdateLicenseRequest, options?: RawAxiosRequestConfig) {
        return LicenseApiFp(this.configuration).updateLicense(requestParameters.licenseRequest, options).then((request) => request(this.axios, this.basePath));
    }
}

