UNPKG

xiot-core-spec-ts

Version:
24 lines (23 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OwnerDeviceAddedCodec = void 0; const OwnerDeviceAdded_1 = require("../../../typedef/notice/owner/impl/OwnerDeviceAdded"); const SummaryCodec_1 = require("../../summary/SummaryCodec"); const SomewhereCodec_1 = require("../../somewhere/SomewhereCodec"); class OwnerDeviceAddedCodec { static encode(x) { return { timestamp: x.timestamp, appId: x.appId, ownerId: x.ownerId, did: x.did, summary: SummaryCodec_1.SummaryCodec.encodeObject(x.summary), somewhere: SomewhereCodec_1.SomewhereCodec.encodeObject(x.somewhere) }; } static decode(o) { const { appId = '', ownerId = '', userId = '', did = '', summary, somewhere } = o; return new OwnerDeviceAdded_1.OwnerDeviceAdded(o.timestamp || new Date().getTime(), appId, ownerId, userId, did, SummaryCodec_1.SummaryCodec.decodeObject(summary), SomewhereCodec_1.SomewhereCodec.decodeObject(somewhere)); } } exports.OwnerDeviceAddedCodec = OwnerDeviceAddedCodec;