xiot-core-spec-ts
Version:
XIOT Specification Codec
39 lines (38 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountCodec = void 0;
const Account_1 = require("../../../typedef/rbac/account/Account");
class AccountCodec {
static decodeArray(array) {
if (array != null) {
if (array.length > 0) {
return array.map(x => AccountCodec.decode(x));
}
}
return [];
}
static decode(x) {
return new Account_1.Account(x.id, x.nickname, x.avatar, x.email, x.username, x.password, x.platformId, x.platformAccountId);
}
static encode(x) {
return {
id: x.id,
nickname: x.nickname,
avatar: x.avatar,
email: x.email,
username: x.username,
password: x.password,
platformId: x.platformId,
platformAccountId: x.platformAccountId,
};
}
static encodeArray(accounts) {
if (accounts != null) {
if (accounts.length > 0) {
return accounts.map(x => AccountCodec.encode(x));
}
}
return [];
}
}
exports.AccountCodec = AccountCodec;