UNPKG

xiot-core-spec-ts

Version:
25 lines (24 loc) 903 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OwnerRuleChangedCodec = void 0; const OwnerRuleChanged_1 = require("../../../typedef/notice/owner/impl/OwnerRuleChanged"); const RuleCodec_1 = require("../../rule/RuleCodec"); class OwnerRuleChangedCodec { 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 OwnerRuleChanged_1.OwnerRuleChanged(timestamp || new Date().getTime(), appId, ownerId, userId, rule); } } exports.OwnerRuleChangedCodec = OwnerRuleChangedCodec;