import 'package:json_annotation/json_annotation.dart'; import 'package:marianum_mobile/api/apiResponse.dart'; import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoomResponse.dart'; part 'getChatResponse.g.dart'; @JsonSerializable(explicitToJson: true) class GetChatResponse extends ApiResponse { Set data; GetChatResponse(this.data); factory GetChatResponse.fromJson(Map json) => _$GetChatResponseFromJson(json); Map toJson() => _$GetChatResponseToJson(this); List sortByTimestamp() { List sorted = data.toList(); sorted.sort((a, b) => a.timestamp.compareTo(b.timestamp)); return sorted; } } @JsonSerializable(explicitToJson: true) class GetChatResponseObject { int id; String token; GetRoomResponseObjectMessageActorType actorType; String actorId; String actorDisplayName; int timestamp; String systemMessage; GetRoomResponseObjectMessageType messageType; bool isReplyable; String referenceId; String message; GetChatResponseObject( this.id, this.token, this.actorType, this.actorId, this.actorDisplayName, this.timestamp, this.systemMessage, this.messageType, this.isReplyable, this.referenceId, this.message); factory GetChatResponseObject.fromJson(Map json) => _$GetChatResponseObjectFromJson(json); Map toJson() => _$GetChatResponseObjectToJson(this); }