dart format
This commit is contained in:
@@ -11,17 +11,22 @@ class GetRoomResponse extends ApiResponse {
|
||||
|
||||
GetRoomResponse(this.data);
|
||||
|
||||
factory GetRoomResponse.fromJson(Map<String, dynamic> json) => _$GetRoomResponseFromJson(json);
|
||||
factory GetRoomResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetRoomResponseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetRoomResponseToJson(this);
|
||||
|
||||
List<GetRoomResponseObject> sortBy({bool lastActivity = true, required bool favoritesToTop, required bool unreadToTop}) {
|
||||
List<GetRoomResponseObject> sortBy({
|
||||
bool lastActivity = true,
|
||||
required bool favoritesToTop,
|
||||
required bool unreadToTop,
|
||||
}) {
|
||||
for (var chat in data) {
|
||||
final buffer = StringBuffer();
|
||||
|
||||
if(favoritesToTop) {
|
||||
if (favoritesToTop) {
|
||||
buffer.write(chat.isFavorite ? 'b' : 'a');
|
||||
}
|
||||
if(unreadToTop) {
|
||||
if (unreadToTop) {
|
||||
buffer.write(chat.unreadMessages > 0 ? 'b' : 'a');
|
||||
}
|
||||
|
||||
@@ -69,69 +74,91 @@ class GetRoomResponseObject {
|
||||
String? sort;
|
||||
|
||||
GetRoomResponseObject(
|
||||
this.id,
|
||||
this.token,
|
||||
this.type,
|
||||
this.name,
|
||||
this.displayName,
|
||||
this.description,
|
||||
this.participantType,
|
||||
this.participantFlags,
|
||||
this.readOnly,
|
||||
this.listable,
|
||||
this.lastPing,
|
||||
this.sessionId,
|
||||
this.hasPassword,
|
||||
this.hasCall,
|
||||
this.callFlag,
|
||||
this.canStartCall,
|
||||
this.canDeleteConversation,
|
||||
this.canLeaveConversation,
|
||||
this.lastActivity,
|
||||
this.isFavorite,
|
||||
this.notificationLevel,
|
||||
this.unreadMessages,
|
||||
this.unreadMention,
|
||||
this.unreadMentionDirect,
|
||||
this.lastReadMessage,
|
||||
this.lastCommonReadMessage,
|
||||
this.lastMessage,
|
||||
this.status,
|
||||
this.statusIcon,
|
||||
this.statusMessage);
|
||||
this.id,
|
||||
this.token,
|
||||
this.type,
|
||||
this.name,
|
||||
this.displayName,
|
||||
this.description,
|
||||
this.participantType,
|
||||
this.participantFlags,
|
||||
this.readOnly,
|
||||
this.listable,
|
||||
this.lastPing,
|
||||
this.sessionId,
|
||||
this.hasPassword,
|
||||
this.hasCall,
|
||||
this.callFlag,
|
||||
this.canStartCall,
|
||||
this.canDeleteConversation,
|
||||
this.canLeaveConversation,
|
||||
this.lastActivity,
|
||||
this.isFavorite,
|
||||
this.notificationLevel,
|
||||
this.unreadMessages,
|
||||
this.unreadMention,
|
||||
this.unreadMentionDirect,
|
||||
this.lastReadMessage,
|
||||
this.lastCommonReadMessage,
|
||||
this.lastMessage,
|
||||
this.status,
|
||||
this.statusIcon,
|
||||
this.statusMessage,
|
||||
);
|
||||
|
||||
factory GetRoomResponseObject.fromJson(Map<String, dynamic> json) => _$GetRoomResponseObjectFromJson(json);
|
||||
factory GetRoomResponseObject.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetRoomResponseObjectFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetRoomResponseObjectToJson(this);
|
||||
}
|
||||
|
||||
enum GetRoomResponseObjectConversationType {
|
||||
@JsonValue(1) oneToOne,
|
||||
@JsonValue(2) group,
|
||||
@JsonValue(3) public,
|
||||
@JsonValue(4) changelog,
|
||||
@JsonValue(5) deleted,
|
||||
@JsonValue(6) noteToSelf,
|
||||
@JsonValue(1)
|
||||
oneToOne,
|
||||
@JsonValue(2)
|
||||
group,
|
||||
@JsonValue(3)
|
||||
public,
|
||||
@JsonValue(4)
|
||||
changelog,
|
||||
@JsonValue(5)
|
||||
deleted,
|
||||
@JsonValue(6)
|
||||
noteToSelf,
|
||||
}
|
||||
|
||||
enum GetRoomResponseObjectParticipantNotificationLevel {
|
||||
@JsonValue(0) defaultLevel,
|
||||
@JsonValue(1) alwaysNotify,
|
||||
@JsonValue(2) notifyOnMention,
|
||||
@JsonValue(3) neverNotify,
|
||||
@JsonValue(0)
|
||||
defaultLevel,
|
||||
@JsonValue(1)
|
||||
alwaysNotify,
|
||||
@JsonValue(2)
|
||||
notifyOnMention,
|
||||
@JsonValue(3)
|
||||
neverNotify,
|
||||
}
|
||||
|
||||
enum GetRoomResponseObjectMessageActorType {
|
||||
@JsonValue('deleted_users') deletedUsers,
|
||||
@JsonValue('users') user,
|
||||
@JsonValue('guests') guest,
|
||||
@JsonValue('bots') bot,
|
||||
@JsonValue('bridged') bridge,
|
||||
@JsonValue('deleted_users')
|
||||
deletedUsers,
|
||||
@JsonValue('users')
|
||||
user,
|
||||
@JsonValue('guests')
|
||||
guest,
|
||||
@JsonValue('bots')
|
||||
bot,
|
||||
@JsonValue('bridged')
|
||||
bridge,
|
||||
}
|
||||
|
||||
enum GetRoomResponseObjectMessageType {
|
||||
@JsonValue('comment') comment,
|
||||
@JsonValue('voice-message') voiceMessage,
|
||||
@JsonValue('comment_deleted') deletedComment,
|
||||
@JsonValue('system') system,
|
||||
@JsonValue('command') command,
|
||||
@JsonValue('comment')
|
||||
comment,
|
||||
@JsonValue('voice-message')
|
||||
voiceMessage,
|
||||
@JsonValue('comment_deleted')
|
||||
deletedComment,
|
||||
@JsonValue('system')
|
||||
system,
|
||||
@JsonValue('command')
|
||||
command,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user