ente/lib/models/sessions.dart

46 lines
852 B
Dart
Raw Normal View History

2021-11-23 19:40:22 +00:00
class Sessions {
final List<Session> sessions;
Sessions(
this.sessions,
);
factory Sessions.fromMap(Map<String, dynamic> map) {
if (map["sessions"] == null) {
throw Exception('\'map["sessions"]\' must not be null');
}
2021-11-23 19:40:22 +00:00
return Sessions(
List<Session>.from(map['sessions']?.map((x) => Session.fromMap(x))),
);
}
}
class Session {
final String token;
final int creationTime;
final String ip;
2021-11-24 05:40:07 +00:00
final String ua;
final String prettyUA;
2021-11-23 19:40:22 +00:00
final int lastUsedTime;
2021-11-24 05:40:07 +00:00
Session(
this.token,
this.creationTime,
this.ip,
this.ua,
this.prettyUA,
this.lastUsedTime,
);
2021-11-23 19:40:22 +00:00
factory Session.fromMap(Map<String, dynamic> map) {
return Session(
map['token'],
map['creationTime'],
map['ip'],
2021-11-24 05:40:07 +00:00
map['ua'],
map['prettyUA'],
2021-11-23 19:40:22 +00:00
map['lastUsedTime'],
);
}
}