/* 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';
/**
 * ProgressApi - axios parameter creator
 * @export
 */
export const ProgressApiAxiosParamCreator = 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,
            };
        },
    }
};

/**
 * ProgressApi - functional programming interface
 * @export
 */
export const ProgressApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ProgressApiAxiosParamCreator(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['ProgressApi.getUploadImageProgress']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

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

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

}

/**
 * Request parameters for getUploadImageProgress operation in ProgressApi.
 * @export
 * @interface ProgressApiGetUploadImageProgressRequest
 */
export interface ProgressApiGetUploadImageProgressRequest {
    /**
     * environment name
     * @type {string}
     * @memberof ProgressApiGetUploadImageProgress
     */
    readonly environmentName: string

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

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

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

