/* 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 { GetUploadImageProgress200Response } from '../models';
/**
 * ServiceVersionApi - axios parameter creator
 * @export
 */
export const ServiceVersionApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * get the progress of uploading image task
         * @summary get the progress of uploading image task
         * @param {string} environmentName environment name
         * @param {string} engineName Name of the engine
         * @param {string} uploadId upload id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUploadImageProgress: async (environmentName: string, engineName: string, uploadId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('getUploadImageProgress', 'environmentName', environmentName)
            // verify required parameter 'engineName' is not null or undefined
            assertParamExists('getUploadImageProgress', 'engineName', engineName)
            // verify required parameter 'uploadId' is not null or undefined
            assertParamExists('getUploadImageProgress', 'uploadId', uploadId)
            const localVarPath = `/admin/v1/environments/{environmentName}/engines/{engineName}/imageUploadProgress`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)))
                .replace(`{${"engineName"}}`, encodeURIComponent(String(engineName)));
            // 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 (uploadId !== undefined) {
                localVarQueryParameter['uploadId'] = uploadId;
            }


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

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

/**
 * ServiceVersionApi - functional programming interface
 * @export
 */
export const ServiceVersionApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ServiceVersionApiAxiosParamCreator(configuration)
    return {
        /**
         * get the progress of uploading image task
         * @summary get the progress of uploading image task
         * @param {string} environmentName environment name
         * @param {string} engineName Name of the engine
         * @param {string} uploadId upload id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getUploadImageProgress(environmentName: string, engineName: string, uploadId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetUploadImageProgress200Response>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getUploadImageProgress(environmentName, engineName, uploadId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ServiceVersionApi.getUploadImageProgress']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ServiceVersionApi - factory interface
 * @export
 */
export const ServiceVersionApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ServiceVersionApiFp(configuration)
    return {
        /**
         * get the progress of uploading image task
         * @summary get the progress of uploading image task
         * @param {ServiceVersionApiGetUploadImageProgressRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getUploadImageProgress(requestParameters: ServiceVersionApiGetUploadImageProgressRequest, options?: RawAxiosRequestConfig): AxiosPromise<GetUploadImageProgress200Response> {
            return localVarFp.getUploadImageProgress(requestParameters.environmentName, requestParameters.engineName, requestParameters.uploadId, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ServiceVersionApi - interface
 * @export
 * @interface ServiceVersionApi
 */
export interface ServiceVersionApiInterface {
    /**
     * get the progress of uploading image task
     * @summary get the progress of uploading image task
     * @param {ServiceVersionApiGetUploadImageProgressRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ServiceVersionApiInterface
     */
    getUploadImageProgress(requestParameters: ServiceVersionApiGetUploadImageProgressRequest, options?: RawAxiosRequestConfig): AxiosPromise<GetUploadImageProgress200Response>;

}

/**
 * Request parameters for getUploadImageProgress operation in ServiceVersionApi.
 * @export
 * @interface ServiceVersionApiGetUploadImageProgressRequest
 */
export interface ServiceVersionApiGetUploadImageProgressRequest {
    /**
     * environment name
     * @type {string}
     * @memberof ServiceVersionApiGetUploadImageProgress
     */
    readonly environmentName: string

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

    /**
     * upload id
     * @type {string}
     * @memberof ServiceVersionApiGetUploadImageProgress
     */
    readonly uploadId: string
}

/**
 * ServiceVersionApi - object-oriented interface
 * @export
 * @class ServiceVersionApi
 * @extends {BaseAPI}
 */
export class ServiceVersionApi extends BaseAPI implements ServiceVersionApiInterface {
    /**
     * get the progress of uploading image task
     * @summary get the progress of uploading image task
     * @param {ServiceVersionApiGetUploadImageProgressRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ServiceVersionApi
     */
    public getUploadImageProgress(requestParameters: ServiceVersionApiGetUploadImageProgressRequest, options?: RawAxiosRequestConfig) {
        return ServiceVersionApiFp(this.configuration).getUploadImageProgress(requestParameters.environmentName, requestParameters.engineName, requestParameters.uploadId, options).then((request) => request(this.axios, this.basePath));
    }
}

