xiot-core-spec-ts
Version:
XIOT Specification Codec
22 lines (21 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OwnerPropertiesChangedCodec = void 0;
const OwnerPropertiesChanged_1 = require("../../../typedef/notice/owner/impl/OwnerPropertiesChanged");
const PropertyOperationCodec_1 = require("../../operation/PropertyOperationCodec");
class OwnerPropertiesChangedCodec {
static encode(x) {
return {
timestamp: x.timestamp,
appId: x.appId,
ownerId: x.ownerId,
properties: PropertyOperationCodec_1.PropertyOperationCodec.Notify.encodeArray(x.properties)
};
}
static decode(o) {
const { appId = '', ownerId = '', userId = '' } = o;
const properties = PropertyOperationCodec_1.PropertyOperationCodec.Notify.decodeArray(o.properties);
return new OwnerPropertiesChanged_1.OwnerPropertiesChanged(o.timestamp || new Date().getTime(), appId, ownerId, userId, properties);
}
}
exports.OwnerPropertiesChangedCodec = OwnerPropertiesChangedCodec;