xiot-core-spec-ts
Version:
XIOT Specification Codec
25 lines (24 loc) • 887 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OwnerRuleAddedCodec = void 0;
const OwnerRuleAdded_1 = require("../../../typedef/notice/owner/impl/OwnerRuleAdded");
const RuleCodec_1 = require("../../rule/RuleCodec");
class OwnerRuleAddedCodec {
static encode(x) {
return {
appId: x.appId,
ownerId: x.ownerId,
rule: RuleCodec_1.RuleCodec.encode(x.rule),
timestamp: x.timestamp
};
}
static decode(x) {
const timestamp = x.timestamp;
const appId = x.appId;
const ownerId = x.ownerId;
const userId = x.userId;
const rule = RuleCodec_1.RuleCodec.decode(x.rule);
return new OwnerRuleAdded_1.OwnerRuleAdded(timestamp || new Date().getTime(), appId, ownerId, userId, rule);
}
}
exports.OwnerRuleAddedCodec = OwnerRuleAddedCodec;