/* tslint:disable */
/* eslint-disable */
/**
 * nexus-transfer API
 * ### nexus-transfer API #### Notes: 
 *
 * The version of the OpenAPI document: 1.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } 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, RequestArgs, BaseAPI, RequiredError } from './base';

/**
 * 
 * @export
 * @interface AssetInfo
 */
export interface AssetInfo {
    /**
     * 
     * @type {string}
     * @memberof AssetInfo
     */
    version?: string;
    /**
     * 
     * @type {string}
     * @memberof AssetInfo
     */
    assetId?: string;
}
/**
 * 
 * @export
 * @interface ErrorDTO
 */
export interface ErrorDTO {
    /**
     * 
     * @type {string}
     * @memberof ErrorDTO
     */
    timestamp?: string;
    /**
     * 
     * @type {number}
     * @memberof ErrorDTO
     */
    status: number;
    /**
     * 
     * @type {string}
     * @memberof ErrorDTO
     */
    error: string;
    /**
     * 
     * @type {string}
     * @memberof ErrorDTO
     */
    trace?: string;
}
/**
 * 
 * @export
 * @interface FileUploadResultDTO
 */
export interface FileUploadResultDTO {
    /**
     * 
     * @type {boolean}
     * @memberof FileUploadResultDTO
     */
    uploadSuccessful?: boolean;
}
/**
 * 
 * @export
 * @interface ServiceMetaDataDTO
 */
export interface ServiceMetaDataDTO {
    /**
     * 
     * @type {string}
     * @memberof ServiceMetaDataDTO
     */
    serviceName?: string;
    /**
     * 
     * @type {string}
     * @memberof ServiceMetaDataDTO
     */
    version?: string;
    /**
     * 
     * @type {string}
     * @memberof ServiceMetaDataDTO
     */
    shortName?: string;
    /**
     * 
     * @type {string}
     * @memberof ServiceMetaDataDTO
     */
    fullName?: string;
}
/**
 * 
 * @export
 * @interface ServiceVersionInfoDTO
 */
export interface ServiceVersionInfoDTO {
    /**
     * 
     * @type {string}
     * @memberof ServiceVersionInfoDTO
     */
    serviceName?: string;
    /**
     * 
     * @type {Array<AssetInfo>}
     * @memberof ServiceVersionInfoDTO
     */
    assets?: Array<AssetInfo>;
}

/**
 * ComponentApi - axios parameter creator
 * @export
 */
export const ComponentApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Download asset by ID
         * @param {string} assetId 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        downloadAssetById: async (assetId: string, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'assetId' is not null or undefined
            assertParamExists('downloadAssetById', 'assetId', assetId)
            const localVarPath = `/api/v1/service/asset/{assetId}`
                .replace(`{${"assetId"}}`, encodeURIComponent(String(assetId)));
            // 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;


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get service versions by version name
         * @param {string} serviceName 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getServiceVersionsByServiceName: async (serviceName: string, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'serviceName' is not null or undefined
            assertParamExists('getServiceVersionsByServiceName', 'serviceName', serviceName)
            const localVarPath = `/api/v1/service/{serviceName}/versions`
                .replace(`{${"serviceName"}}`, encodeURIComponent(String(serviceName)));
            // 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;


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Upload service archive
         * @param {string} serviceName 
         * @param {any} fileToUpload Source file to be uploaded
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        uploadServiceArchive: async (serviceName: string, fileToUpload: any, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'serviceName' is not null or undefined
            assertParamExists('uploadServiceArchive', 'serviceName', serviceName)
            // verify required parameter 'fileToUpload' is not null or undefined
            assertParamExists('uploadServiceArchive', 'fileToUpload', fileToUpload)
            const localVarPath = `/api/v1/service/{serviceName}/upload`
                .replace(`{${"serviceName"}}`, encodeURIComponent(String(serviceName)));
            // 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)();


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Validate service archive
         * @param {string} serviceName 
         * @param {any} fileToValidate Source file to validate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        validateServiceArchive: async (serviceName: string, fileToValidate: any, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'serviceName' is not null or undefined
            assertParamExists('validateServiceArchive', 'serviceName', serviceName)
            // verify required parameter 'fileToValidate' is not null or undefined
            assertParamExists('validateServiceArchive', 'fileToValidate', fileToValidate)
            const localVarPath = `/api/v1/service/{serviceName}/validate`
                .replace(`{${"serviceName"}}`, encodeURIComponent(String(serviceName)));
            // 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)();


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

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

/**
 * ComponentApi - functional programming interface
 * @export
 */
export const ComponentApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ComponentApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Download asset by ID
         * @param {string} assetId 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async downloadAssetById(assetId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.downloadAssetById(assetId, options);
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
        },
        /**
         * 
         * @summary Get service versions by version name
         * @param {string} serviceName 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getServiceVersionsByServiceName(serviceName: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ServiceVersionInfoDTO>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getServiceVersionsByServiceName(serviceName, options);
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
        },
        /**
         * 
         * @summary Upload service archive
         * @param {string} serviceName 
         * @param {any} fileToUpload Source file to be uploaded
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async uploadServiceArchive(serviceName: string, fileToUpload: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FileUploadResultDTO>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.uploadServiceArchive(serviceName, fileToUpload, options);
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
        },
        /**
         * 
         * @summary Validate service archive
         * @param {string} serviceName 
         * @param {any} fileToValidate Source file to validate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async validateServiceArchive(serviceName: string, fileToValidate: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ServiceMetaDataDTO>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.validateServiceArchive(serviceName, fileToValidate, options);
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
        },
    }
};

/**
 * ComponentApi - factory interface
 * @export
 */
export const ComponentApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ComponentApiFp(configuration)
    return {
        /**
         * 
         * @summary Download asset by ID
         * @param {string} assetId 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        downloadAssetById(assetId: string, options?: any): AxiosPromise<any> {
            return localVarFp.downloadAssetById(assetId, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get service versions by version name
         * @param {string} serviceName 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getServiceVersionsByServiceName(serviceName: string, options?: any): AxiosPromise<Array<ServiceVersionInfoDTO>> {
            return localVarFp.getServiceVersionsByServiceName(serviceName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Upload service archive
         * @param {string} serviceName 
         * @param {any} fileToUpload Source file to be uploaded
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        uploadServiceArchive(serviceName: string, fileToUpload: any, options?: any): AxiosPromise<FileUploadResultDTO> {
            return localVarFp.uploadServiceArchive(serviceName, fileToUpload, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Validate service archive
         * @param {string} serviceName 
         * @param {any} fileToValidate Source file to validate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        validateServiceArchive(serviceName: string, fileToValidate: any, options?: any): AxiosPromise<ServiceMetaDataDTO> {
            return localVarFp.validateServiceArchive(serviceName, fileToValidate, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ComponentApi - object-oriented interface
 * @export
 * @class ComponentApi
 * @extends {BaseAPI}
 */
export class ComponentApi extends BaseAPI {
    /**
     * 
     * @summary Download asset by ID
     * @param {string} assetId 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ComponentApi
     */
    public downloadAssetById(assetId: string, options?: any) {
        return ComponentApiFp(this.configuration).downloadAssetById(assetId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get service versions by version name
     * @param {string} serviceName 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ComponentApi
     */
    public getServiceVersionsByServiceName(serviceName: string, options?: any) {
        return ComponentApiFp(this.configuration).getServiceVersionsByServiceName(serviceName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Upload service archive
     * @param {string} serviceName 
     * @param {any} fileToUpload Source file to be uploaded
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ComponentApi
     */
    public uploadServiceArchive(serviceName: string, fileToUpload: any, options?: any) {
        return ComponentApiFp(this.configuration).uploadServiceArchive(serviceName, fileToUpload, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Validate service archive
     * @param {string} serviceName 
     * @param {any} fileToValidate Source file to validate
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ComponentApi
     */
    public validateServiceArchive(serviceName: string, fileToValidate: any, options?: any) {
        return ComponentApiFp(this.configuration).validateServiceArchive(serviceName, fileToValidate, options).then((request) => request(this.axios, this.basePath));
    }
}


