Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vipera-npm-registry / @wa-motif-open-api/license-management-service   js

Repository URL to install this package:

Version: 0.6.0 

/ esm5 / lib / api / license.service.js

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
/**
 * Motif License Management Service API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: info@vipera.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { WC_API_BASE_PATH } from 'web-console-core';
import { Configuration } from '../configuration';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common/http";
import * as i2 from "web-console-core";
import * as i3 from "../configuration";
var LicenseService = /** @class */ (function () {
    function LicenseService(httpClient, basePath, configuration) {
        this.httpClient = httpClient;
        this.basePath = 'http://localhost:8080/rest/v2';
        this.defaultHeaders = new HttpHeaders();
        this.configuration = new Configuration();
        if (configuration) {
            this.configuration = configuration;
            this.configuration.basePath = configuration.basePath || basePath || this.basePath;
        }
        else {
            this.configuration.basePath = basePath || this.basePath;
        }
    }
    /**
     * @param consumes string[] mime-types
     * @return true: consumes contains 'multipart/form-data', false: otherwise
     */
    /**
     * @private
     * @param {?} consumes string[] mime-types
     * @return {?} true: consumes contains 'multipart/form-data', false: otherwise
     */
    LicenseService.prototype.canConsumeForm = /**
     * @private
     * @param {?} consumes string[] mime-types
     * @return {?} true: consumes contains 'multipart/form-data', false: otherwise
     */
    function (consumes) {
        var e_1, _a;
        /** @type {?} */
        var form = 'multipart/form-data';
        try {
            for (var consumes_1 = tslib_1.__values(consumes), consumes_1_1 = consumes_1.next(); !consumes_1_1.done; consumes_1_1 = consumes_1.next()) {
                var consume = consumes_1_1.value;
                if (form === consume) {
                    return true;
                }
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (consumes_1_1 && !consumes_1_1.done && (_a = consumes_1.return)) _a.call(consumes_1);
            }
            finally { if (e_1) throw e_1.error; }
        }
        return false;
    };
    /**
     * @param {?} productName
     * @param {?} productVersion
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    LicenseService.prototype.deleteLicense = /**
     * @param {?} productName
     * @param {?} productVersion
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    function (productName, productVersion, observe, reportProgress) {
        if (observe === void 0) { observe = 'body'; }
        if (reportProgress === void 0) { reportProgress = false; }
        if (productName === null || productName === undefined) {
            throw new Error('Required parameter productName was null or undefined when calling deleteLicense.');
        }
        if (productVersion === null || productVersion === undefined) {
            throw new Error('Required parameter productVersion was null or undefined when calling deleteLicense.');
        }
        /** @type {?} */
        var headers = this.defaultHeaders;
        // authentication (vipera_basic) required
        if (this.configuration.username || this.configuration.password) {
            headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
        }
        // authentication (vipera_cookie) required
        // authentication (vipera_oauth2) required
        if (this.configuration.accessToken) {
            /** @type {?} */
            var accessToken = typeof this.configuration.accessToken === 'function'
                ? this.configuration.accessToken()
                : this.configuration.accessToken;
            headers = headers.set('Authorization', 'Bearer ' + accessToken);
        }
        // to determine the Accept header
        /** @type {?} */
        var httpHeaderAccepts = [
            'application/json'
        ];
        /** @type {?} */
        var httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
        if (httpHeaderAcceptSelected !== undefined) {
            headers = headers.set('Accept', httpHeaderAcceptSelected);
        }
        // to determine the Content-Type header
        /** @type {?} */
        var consumes = [];
        return this.httpClient.delete(this.configuration.basePath + "/licenses/" + encodeURIComponent(String(productName)) + "/" + encodeURIComponent(String(productVersion)), {
            withCredentials: this.configuration.withCredentials,
            headers: headers,
            observe: observe,
            reportProgress: reportProgress
        });
    };
    /**
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    LicenseService.prototype.listLicenses = /**
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    function (observe, reportProgress) {
        if (observe === void 0) { observe = 'body'; }
        if (reportProgress === void 0) { reportProgress = false; }
        /** @type {?} */
        var headers = this.defaultHeaders;
        // authentication (vipera_basic) required
        if (this.configuration.username || this.configuration.password) {
            headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
        }
        // authentication (vipera_cookie) required
        // authentication (vipera_oauth2) required
        if (this.configuration.accessToken) {
            /** @type {?} */
            var accessToken = typeof this.configuration.accessToken === 'function'
                ? this.configuration.accessToken()
                : this.configuration.accessToken;
            headers = headers.set('Authorization', 'Bearer ' + accessToken);
        }
        // to determine the Accept header
        /** @type {?} */
        var httpHeaderAccepts = [
            'application/json'
        ];
        /** @type {?} */
        var httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
        if (httpHeaderAcceptSelected !== undefined) {
            headers = headers.set('Accept', httpHeaderAcceptSelected);
        }
        // to determine the Content-Type header
        /** @type {?} */
        var consumes = [];
        return this.httpClient.get(this.configuration.basePath + "/licenses", {
            withCredentials: this.configuration.withCredentials,
            headers: headers,
            observe: observe,
            reportProgress: reportProgress
        });
    };
    /**
     * @param {?} file
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    LicenseService.prototype.uploadLicense = /**
     * @param {?} file
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    function (file, observe, reportProgress) {
        if (observe === void 0) { observe = 'body'; }
        if (reportProgress === void 0) { reportProgress = false; }
        if (file === null || file === undefined) {
            throw new Error('Required parameter file was null or undefined when calling uploadLicense.');
        }
        /** @type {?} */
        var headers = this.defaultHeaders;
        // authentication (vipera_basic) required
        if (this.configuration.username || this.configuration.password) {
            headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
        }
        // authentication (vipera_cookie) required
        // authentication (vipera_oauth2) required
        if (this.configuration.accessToken) {
            /** @type {?} */
            var accessToken = typeof this.configuration.accessToken === 'function'
                ? this.configuration.accessToken()
                : this.configuration.accessToken;
            headers = headers.set('Authorization', 'Bearer ' + accessToken);
        }
        // to determine the Accept header
        /** @type {?} */
        var httpHeaderAccepts = [
            'application/json'
        ];
        /** @type {?} */
        var httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
        if (httpHeaderAcceptSelected !== undefined) {
            headers = headers.set('Accept', httpHeaderAcceptSelected);
        }
        // to determine the Content-Type header
        /** @type {?} */
        var consumes = [
            'multipart/form-data'
        ];
        /** @type {?} */
        var canConsumeForm = this.canConsumeForm(consumes);
        /** @type {?} */
        var formParams;
        /** @type {?} */
        var useForm = false;
        /** @type {?} */
        var convertFormParamsToString = false;
        // use FormData to transmit files using content-type "multipart/form-data"
        // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
        useForm = canConsumeForm;
        if (useForm) {
            formParams = new FormData();
        }
        else {
            formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
        }
        if (file !== undefined) {
            formParams = (/** @type {?} */ (formParams.append('file', (/** @type {?} */ (file))))) || formParams;
        }
        return this.httpClient.put(this.configuration.basePath + "/licenses", convertFormParamsToString ? formParams.toString() : formParams, {
            withCredentials: this.configuration.withCredentials,
            headers: headers,
            observe: observe,
            reportProgress: reportProgress
        });
    };
    /**
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    LicenseService.prototype.validateLicense = /**
     * @param {?=} observe
     * @param {?=} reportProgress
     * @return {?}
     */
    function (observe, reportProgress) {
        if (observe === void 0) { observe = 'body'; }
        if (reportProgress === void 0) { reportProgress = false; }
        /** @type {?} */
        var headers = this.defaultHeaders;
        // authentication (vipera_basic) required
        if (this.configuration.username || this.configuration.password) {
            headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
        }
        // authentication (vipera_cookie) required
        // authentication (vipera_oauth2) required
        if (this.configuration.accessToken) {
            /** @type {?} */
            var accessToken = typeof this.configuration.accessToken === 'function'
                ? this.configuration.accessToken()
                : this.configuration.accessToken;
            headers = headers.set('Authorization', 'Bearer ' + accessToken);
        }
        // to determine the Accept header
        /** @type {?} */
        var httpHeaderAccepts = [
            'application/json'
        ];
        /** @type {?} */
        var httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
        if (httpHeaderAcceptSelected !== undefined) {
            headers = headers.set('Accept', httpHeaderAcceptSelected);
        }
        // to determine the Content-Type header
        /** @type {?} */
        var consumes = [];
        return this.httpClient.get(this.configuration.basePath + "/licenses/validate", {
            withCredentials: this.configuration.withCredentials,
            headers: headers,
            observe: observe,
            reportProgress: reportProgress
        });
    };
    LicenseService.decorators = [
        { type: Injectable, args: [{
                    providedIn: 'root'
                },] }
    ];
    /** @nocollapse */
    LicenseService.ctorParameters = function () { return [
        { type: HttpClient },
        { type: String, decorators: [{ type: Optional }, { type: Inject, args: [WC_API_BASE_PATH,] }] },
        { type: Configuration, decorators: [{ type: Optional }] }
    ]; };
    /** @nocollapse */ LicenseService.ngInjectableDef = i0.defineInjectable({ factory: function LicenseService_Factory() { return new LicenseService(i0.inject(i1.HttpClient), i0.inject(i2.WC_API_BASE_PATH, 8), i0.inject(i3.Configuration, 8)); }, token: LicenseService, providedIn: "root" });
    return LicenseService;
}());
export { LicenseService };
if (false) {
    /**
     * @type {?}
     * @protected
     */
    LicenseService.prototype.basePath;
    /** @type {?} */
    LicenseService.prototype.defaultHeaders;
    /** @type {?} */
    LicenseService.prototype.configuration;
    /**
     * @type {?}
     * @protected
     */
    LicenseService.prototype.httpClient;
}
//# sourceMappingURL=data:application/json;base64,eyJ2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