xiot-core-spec-ts
Version:
XIOT Specification Codec
38 lines (37 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeviceOwnerCodec = void 0;
const DeviceOwner_1 = require("../../typedef/ownership/DeviceOwner");
class DeviceOwnerCodec {
static decode(o) {
const x = new DeviceOwner_1.DeviceOwner();
x.appId = o.appId;
x.ownerId = o.ownerId;
return x;
}
static encode(x) {
return {
appId: x.appId,
ownerId: x.ownerId
};
}
static decodeArray(arr) {
const list = [];
if (arr === null || arr === void 0 ? void 0 : arr.length) {
for (const o of arr) {
list.push(this.decode(o));
}
}
return list;
}
static encodeArray(x) {
const arr = [];
if (x === null || x === void 0 ? void 0 : x.length) {
for (const p of x) {
arr.push(this.encode(p));
}
}
return arr;
}
}
exports.DeviceOwnerCodec = DeviceOwnerCodec;