Repository URL to install this package:
/**
* @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";
const /** @type {?} */ DOMAINS_LIST_ENDPOINT = WAGlobals.API_ENDPOINT_PRFIX + "/platform/domains";
const /** @type {?} */ DOMAIN_CREATE_ENDPOINT = WAGlobals.API_ENDPOINT_PRFIX + "/platform/domains";
const /** @type {?} */ DOMAIN_DELETE_ENDPOINT = WAGlobals.API_ENDPOINT_PRFIX + "/platform/domains/{0}";
export class Domain {
}
function Domain_tsickle_Closure_declarations() {
/** @type {?} */
Domain.prototype.name;
/** @type {?} */
Domain.prototype.description;
}
export class DomainsService {
/**
* @param {?} motifConnector
*/
constructor(motifConnector) {
this.motifConnector = motifConnector;
console.log("MotifConnectorService=", motifConnector);
}
/**
* @return {?}
*/
getDomainList() {
return new Promise((resolve, reject) => {
this.motifConnector.get(DOMAINS_LIST_ENDPOINT).subscribe((data) => {
console.log("Get Domain List done: ", data);
resolve(data);
}, reject);
});
}
/**
* @param {?} domain
* @return {?}
*/
createDomain(domain) {
return new Promise((resolve, reject) => {
this.motifConnector.post(DOMAINS_LIST_ENDPOINT, {
"description": domain.description,
"name": domain.name
}).subscribe((data) => {
console.log("Add new Domain done: ", data);
resolve(data);
}, reject);
});
}
/**
* @param {?} domainName
* @return {?}
*/
deleteDomain(domainName) {
return new Promise((resolve, reject) => {
this.motifConnector.delete(String.Format(DOMAIN_DELETE_ENDPOINT, domainName)).subscribe((data) => {
console.log("Domain deleted: ", data);
resolve(data);
}, reject);
});
}
}
DomainsService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] },
];
/** @nocollapse */
DomainsService.ctorParameters = () => [
{ type: MotifConnectorService }
];
/** @nocollapse */ DomainsService.ngInjectableDef = i0.defineInjectable({ factory: function DomainsService_Factory() { return new DomainsService(i0.inject(i1.MotifConnectorService)); }, token: DomainsService, providedIn: "root" });
function DomainsService_tsickle_Closure_declarations() {
/** @type {?} */
DomainsService.prototype.motifConnector;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRG9tYWluc1NlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly93YS1tb3RpZi1vcGVuLWFwaS1tb2R1bGUvIiwic291cmNlcyI6WyJsaWIvc2VydmljZXMvUGxhdGZvcm1TZXJ2aWNlL0RvbWFpbnNTZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNDLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGtCQUFrQixDQUFBO0FBQ3hELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQTtBQUMzQyxPQUFPLEVBQUUsTUFBTSxFQUFpQixNQUFNLDhCQUE4QixDQUFBOzs7QUFFcEUsdUJBQU0scUJBQXFCLEdBQUksU0FBUyxDQUFDLGtCQUFrQixHQUFHLG1CQUFtQixDQUFBO0FBQ2pGLHVCQUFNLHNCQUFzQixHQUFJLFNBQVMsQ0FBQyxrQkFBa0IsR0FBRyxtQkFBbUIsQ0FBQTtBQUNsRix1QkFBTSxzQkFBc0IsR0FBSSxTQUFTLENBQUMsa0JBQWtCLEdBQUcsdUJBQXVCLENBQUE7QUFFdEYsTUFBTTtDQUdMOzs7Ozs7O0FBS0QsTUFBTTs7OztJQUVKLFlBQW9CLGNBQXFDO1FBQXJDLG1CQUFjLEdBQWQsY0FBYyxDQUF1QjtRQUN2RCxPQUFPLENBQUMsR0FBRyxDQUFDLHdCQUF3QixFQUFFLGNBQWMsQ0FBQyxDQUFDO0tBQ3ZEOzs7O0lBRUQsYUFBYTtRQUNYLE1BQU0sQ0FBQyxJQUFJ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