@mos-connection/helper
Version:
Helper functions for the MOS-connection library
40 lines • 1.99 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ROElementStat = exports.ROElementStatType = void 0;
const XMLBuilder = require("xmlbuilder");
const MosMessage_1 = require("../MosMessage");
const model_1 = require("@mos-connection/model");
const Utils_1 = require("../../utils/Utils");
var ROElementStatType;
(function (ROElementStatType) {
ROElementStatType["RO"] = "RO";
ROElementStatType["STORY"] = "STORY";
ROElementStatType["ITEM"] = "ITEM";
})(ROElementStatType = exports.ROElementStatType || (exports.ROElementStatType = {}));
class ROElementStat extends MosMessage_1.MosMessage {
/** */
constructor(options, strict) {
super('upper', strict);
this.options = options;
this.time = (0, model_1.getMosTypes)(strict).mosTime.create(Date.now());
}
/** */
get messageXMLBlocks() {
const root = XMLBuilder.create('roElementStat');
root.attribute('element', this.options.type.toString());
(0, Utils_1.addTextElementInternal)(root, 'roID', this.options.roId, undefined, this.strict);
if (this.options.storyId)
(0, Utils_1.addTextElementInternal)(root, 'storyID', this.options.storyId, undefined, this.strict);
if (this.options.itemId)
(0, Utils_1.addTextElementInternal)(root, 'itemID', this.options.itemId, undefined, this.strict);
if (this.options.objId)
(0, Utils_1.addTextElementInternal)(root, 'objID', this.options.objId, undefined, this.strict);
if (this.options.itemChannel)
(0, Utils_1.addTextElementInternal)(root, 'itemChannel', this.options.itemChannel, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(root, 'status', this.options.status, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(root, 'time', this.time, undefined, this.strict);
return root;
}
}
exports.ROElementStat = ROElementStat;
//# sourceMappingURL=roElementStat.js.map