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-module   js

Repository URL to install this package:

Version: 0.0.1 

/ esm5 / lib / services / PlatformService / DomainsService.js

/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { Injectable } from '@angular/core';
import { MotifConnectorService } from 'web-console-core';
import { WAGlobals } from '../../WAGlobals';
import { String } from 'typescript-string-operations';
import * as i0 from "@angular/core";
import * as i1 from "web-console-core";
var /** @type {?} */ DOMAINS_LIST_ENDPOINT = WAGlobals.API_ENDPOINT_PRFIX + "/platform/domains";
var /** @type {?} */ DOMAIN_CREATE_ENDPOINT = WAGlobals.API_ENDPOINT_PRFIX + "/platform/domains";
var /** @type {?} */ DOMAIN_DELETE_ENDPOINT = WAGlobals.API_ENDPOINT_PRFIX + "/platform/domains/{0}";
var Domain = /** @class */ (function () {
    function Domain() {
    }
    return Domain;
}());
export { Domain };
function Domain_tsickle_Closure_declarations() {
    /** @type {?} */
    Domain.prototype.name;
    /** @type {?} */
    Domain.prototype.description;
}
var DomainsService = /** @class */ (function () {
    function DomainsService(motifConnector) {
        this.motifConnector = motifConnector;
        console.log("MotifConnectorService=", motifConnector);
    }
    /**
     * @return {?}
     */
    DomainsService.prototype.getDomainList = /**
     * @return {?}
     */
    function () {
        var _this = this;
        return new Promise(function (resolve, reject) {
            _this.motifConnector.get(DOMAINS_LIST_ENDPOINT).subscribe(function (data) {
                console.log("Get Domain List done: ", data);
                resolve(data);
            }, reject);
        });
    };
    /**
     * @param {?} domain
     * @return {?}
     */
    DomainsService.prototype.createDomain = /**
     * @param {?} domain
     * @return {?}
     */
    function (domain) {
        var _this = this;
        return new Promise(function (resolve, reject) {
            _this.motifConnector.post(DOMAINS_LIST_ENDPOINT, {
                "description": domain.description,
                "name": domain.name
            }).subscribe(function (data) {
                console.log("Add new Domain done: ", data);
                resolve(data);
            }, reject);
        });
    };
    /**
     * @param {?} domainName
     * @return {?}
     */
    DomainsService.prototype.deleteDomain = /**
     * @param {?} domainName
     * @return {?}
     */
    function (domainName) {
        var _this = this;
        return new Promise(function (resolve, reject) {
            _this.motifConnector.delete(String.Format(DOMAIN_DELETE_ENDPOINT, domainName)).subscribe(function (data) {
                console.log("Domain deleted: ", data);
                resolve(data);
            }, reject);
        });
    };
    DomainsService.decorators = [
        { type: Injectable, args: [{
                    providedIn: 'root'
                },] },
    ];
    /** @nocollapse */
    DomainsService.ctorParameters = function () { return [
        { type: MotifConnectorService }
    ]; };
    /** @nocollapse */ DomainsService.ngInjectableDef = i0.defineInjectable({ factory: function DomainsService_Factory() { return new DomainsService(i0.inject(i1.MotifConnectorService)); }, token: DomainsService, providedIn: "root" });
    return DomainsService;
}());
export { DomainsService };
function DomainsService_tsickle_Closure_declarations() {
    /** @type {?} */
    DomainsService.prototype.motifConnector;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRG9tYWluc1NlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly93YS1tb3RpZi1vcGVuLWFwaS1tb2R1bGUvIiwic291cmNlcyI6WyJsaWIvc2VydmljZXMvUGxhdGZvcm1TZXJ2aWNlL0RvbWFpbnNTZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNDLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGtCQUFrQixDQUFBO0FBQ3hELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQTtBQUMzQyxPQUFPLEVBQUUsTUFBTSxFQUFpQixNQUFNLDhCQUE4QixDQUFBOzs7QUFFcEUscUJBQU0scUJBQXFCLEdBQUksU0FBUyxDQUFDLGtCQUFrQixHQUFHLG1CQUFtQixDQUFBO0FBQ2pGLHFCQU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