fix: generated new models, fixed reactions
This commit is contained in:
@@ -10,7 +10,7 @@ SyncResponse _$SyncResponseFromJson(Map<String, dynamic> json) {
|
|||||||
return SyncResponse()
|
return SyncResponse()
|
||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..events = (json['events'] as List<dynamic>?)
|
..events = (json['events'] as List<dynamic>?)
|
||||||
?.map((e) => Event.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Event.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ TranslateMessageResponse _$TranslateMessageResponseFromJson(
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: TranslatedMessage.fromJson(json['message'] as Map<String, dynamic>?);
|
: TranslatedMessage.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryMembersResponse _$QueryMembersResponseFromJson(Map<String, dynamic> json) {
|
QueryMembersResponse _$QueryMembersResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -44,7 +44,7 @@ QueryUsersResponse _$QueryUsersResponseFromJson(Map<String, dynamic> json) {
|
|||||||
return QueryUsersResponse()
|
return QueryUsersResponse()
|
||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..users = (json['users'] as List<dynamic>?)
|
..users = (json['users'] as List<dynamic>?)
|
||||||
?.map((e) => User.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => User.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ QueryReactionsResponse _$QueryReactionsResponseFromJson(
|
|||||||
return QueryReactionsResponse()
|
return QueryReactionsResponse()
|
||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..reactions = (json['reactions'] as List<dynamic>?)
|
..reactions = (json['reactions'] as List<dynamic>?)
|
||||||
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ QueryRepliesResponse _$QueryRepliesResponseFromJson(Map<String, dynamic> json) {
|
|||||||
return QueryRepliesResponse()
|
return QueryRepliesResponse()
|
||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..messages = (json['messages'] as List<dynamic>?)
|
..messages = (json['messages'] as List<dynamic>?)
|
||||||
?.map((e) => Message.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,10 +90,10 @@ SendReactionResponse _$SendReactionResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?)
|
: Message.fromJson(json['message'] as Map<String, dynamic>)
|
||||||
..reaction = json['reaction'] == null
|
..reaction = json['reaction'] == null
|
||||||
? null
|
? null
|
||||||
: Reaction.fromJson(json['reaction'] as Map<String, dynamic>?);
|
: Reaction.fromJson(json['reaction'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(
|
ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(
|
||||||
@@ -103,14 +103,14 @@ ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(
|
|||||||
..accessToken = json['access_token'] as String?
|
..accessToken = json['access_token'] as String?
|
||||||
..user = json['user'] == null
|
..user = json['user'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['user'] as Map<String, dynamic>?);
|
: User.fromJson(json['user'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUsersResponse _$UpdateUsersResponseFromJson(Map<String, dynamic> json) {
|
UpdateUsersResponse _$UpdateUsersResponseFromJson(Map<String, dynamic> json) {
|
||||||
return UpdateUsersResponse()
|
return UpdateUsersResponse()
|
||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..users = (json['users'] as Map<String, dynamic>?)?.map(
|
..users = (json['users'] as Map<String, dynamic>?)?.map(
|
||||||
(k, e) => MapEntry(k, User.fromJson(e as Map<String, dynamic>?)),
|
(k, e) => MapEntry(k, User.fromJson(e as Map<String, dynamic>)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ UpdateMessageResponse _$UpdateMessageResponseFromJson(
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) {
|
SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -128,7 +128,7 @@ SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) {
|
GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -136,10 +136,10 @@ GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?)
|
: Message.fromJson(json['message'] as Map<String, dynamic>)
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?);
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchMessagesResponse _$SearchMessagesResponseFromJson(
|
SearchMessagesResponse _$SearchMessagesResponseFromJson(
|
||||||
@@ -156,7 +156,7 @@ GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson(
|
|||||||
return GetMessagesByIdResponse()
|
return GetMessagesByIdResponse()
|
||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..messages = (json['messages'] as List<dynamic>?)
|
..messages = (json['messages'] as List<dynamic>?)
|
||||||
?.map((e) => Message.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,13 +166,13 @@ UpdateChannelResponse _$UpdateChannelResponseFromJson(
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(
|
PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(
|
||||||
@@ -181,7 +181,7 @@ PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
@@ -193,13 +193,13 @@ InviteMembersResponse _$InviteMembersResponseFromJson(
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveMembersResponse _$RemoveMembersResponseFromJson(
|
RemoveMembersResponse _$RemoveMembersResponseFromJson(
|
||||||
@@ -208,13 +208,13 @@ RemoveMembersResponse _$RemoveMembersResponseFromJson(
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendActionResponse _$SendActionResponseFromJson(Map<String, dynamic> json) {
|
SendActionResponse _$SendActionResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -222,7 +222,7 @@ SendActionResponse _$SendActionResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) {
|
AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -230,13 +230,13 @@ AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
AcceptInviteResponse _$AcceptInviteResponseFromJson(Map<String, dynamic> json) {
|
AcceptInviteResponse _$AcceptInviteResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -244,13 +244,13 @@ AcceptInviteResponse _$AcceptInviteResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
RejectInviteResponse _$RejectInviteResponseFromJson(Map<String, dynamic> json) {
|
RejectInviteResponse _$RejectInviteResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -258,13 +258,13 @@ RejectInviteResponse _$RejectInviteResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..message = json['message'] == null
|
..message = json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?);
|
: Message.fromJson(json['message'] as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
EmptyResponse _$EmptyResponseFromJson(Map<String, dynamic> json) {
|
EmptyResponse _$EmptyResponseFromJson(Map<String, dynamic> json) {
|
||||||
@@ -276,9 +276,9 @@ ChannelStateResponse _$ChannelStateResponseFromJson(Map<String, dynamic> json) {
|
|||||||
..duration = json['duration'] as String?
|
..duration = json['duration'] as String?
|
||||||
..channel = json['channel'] == null
|
..channel = json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?)
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
|
||||||
..messages = (json['messages'] as List<dynamic>?)
|
..messages = (json['messages'] as List<dynamic>?)
|
||||||
?.map((e) => Message.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
|
||||||
.toList()
|
.toList()
|
||||||
..members = (json['members'] as List<dynamic>?)
|
..members = (json['members'] as List<dynamic>?)
|
||||||
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) {
|
|||||||
: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
|
: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||||
createdBy: json['created_by'] == null
|
createdBy: json['created_by'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['created_by'] as Map<String, dynamic>?),
|
: User.fromJson(json['created_by'] as Map<String, dynamic>),
|
||||||
frozen: json['frozen'] as bool? ?? false,
|
frozen: json['frozen'] as bool? ?? false,
|
||||||
lastMessageAt: json['last_message_at'] == null
|
lastMessageAt: json['last_message_at'] == null
|
||||||
? null
|
? null
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ ChannelState _$ChannelStateFromJson(Map<String, dynamic> json) {
|
|||||||
return ChannelState(
|
return ChannelState(
|
||||||
channel: json['channel'] == null
|
channel: json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?),
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
|
||||||
messages: (json['messages'] as List<dynamic>?)
|
messages: (json['messages'] as List<dynamic>?)
|
||||||
?.map((e) => Message.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
members: (json['members'] as List<dynamic>?)
|
members: (json['members'] as List<dynamic>?)
|
||||||
@@ -20,12 +20,12 @@ ChannelState _$ChannelStateFromJson(Map<String, dynamic> json) {
|
|||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
pinnedMessages: (json['pinned_messages'] as List<dynamic>?)
|
pinnedMessages: (json['pinned_messages'] as List<dynamic>?)
|
||||||
?.map((e) => Message.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
watcherCount: json['watcher_count'] as int?,
|
watcherCount: json['watcher_count'] as int?,
|
||||||
watchers: (json['watchers'] as List<dynamic>?)
|
watchers: (json['watchers'] as List<dynamic>?)
|
||||||
?.map((e) => User.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => User.fromJson(e as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
read: (json['read'] as List<dynamic>?)
|
read: (json['read'] as List<dynamic>?)
|
||||||
|
|||||||
@@ -16,22 +16,22 @@ Event _$EventFromJson(Map<String, dynamic> json) {
|
|||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
me: json['me'] == null
|
me: json['me'] == null
|
||||||
? null
|
? null
|
||||||
: OwnUser.fromJson(json['me'] as Map<String, dynamic>?),
|
: OwnUser.fromJson(json['me'] as Map<String, dynamic>),
|
||||||
user: json['user'] == null
|
user: json['user'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['user'] as Map<String, dynamic>?),
|
: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
message: json['message'] == null
|
message: json['message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['message'] as Map<String, dynamic>?),
|
: Message.fromJson(json['message'] as Map<String, dynamic>),
|
||||||
totalUnreadCount: json['total_unread_count'] as int?,
|
totalUnreadCount: json['total_unread_count'] as int?,
|
||||||
unreadChannels: json['unread_channels'] as int?,
|
unreadChannels: json['unread_channels'] as int?,
|
||||||
reaction: json['reaction'] == null
|
reaction: json['reaction'] == null
|
||||||
? null
|
? null
|
||||||
: Reaction.fromJson(json['reaction'] as Map<String, dynamic>?),
|
: Reaction.fromJson(json['reaction'] as Map<String, dynamic>),
|
||||||
online: json['online'] as bool?,
|
online: json['online'] as bool?,
|
||||||
channel: json['channel'] == null
|
channel: json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: EventChannel.fromJson(json['channel'] as Map<String, dynamic>?),
|
: EventChannel.fromJson(json['channel'] as Map<String, dynamic>),
|
||||||
member: json['member'] == null
|
member: json['member'] == null
|
||||||
? null
|
? null
|
||||||
: Member.fromJson(json['member'] as Map<String, dynamic>),
|
: Member.fromJson(json['member'] as Map<String, dynamic>),
|
||||||
@@ -84,7 +84,7 @@ EventChannel _$EventChannelFromJson(Map<String, dynamic> json) {
|
|||||||
config: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
|
config: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||||
createdBy: json['created_by'] == null
|
createdBy: json['created_by'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['created_by'] as Map<String, dynamic>?),
|
: User.fromJson(json['created_by'] as Map<String, dynamic>),
|
||||||
frozen: json['frozen'] as bool? ?? false,
|
frozen: json['frozen'] as bool? ?? false,
|
||||||
lastMessageAt: json['last_message_at'] == null
|
lastMessageAt: json['last_message_at'] == null
|
||||||
? null
|
? null
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Member _$MemberFromJson(Map<String, dynamic> json) {
|
|||||||
return Member(
|
return Member(
|
||||||
user: json['user'] == null
|
user: json['user'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['user'] as Map<String, dynamic>?),
|
: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
inviteAcceptedAt: json['invite_accepted_at'] == null
|
inviteAcceptedAt: json['invite_accepted_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['invite_accepted_at'] as String),
|
: DateTime.parse(json['invite_accepted_at'] as String),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Message _$MessageFromJson(Map<String, dynamic> json) {
|
|||||||
?.map((e) => Attachment.fromJson(e as Map<String, dynamic>))
|
?.map((e) => Attachment.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
mentionedUsers: (json['mentioned_users'] as List<dynamic>?)
|
mentionedUsers: (json['mentioned_users'] as List<dynamic>?)
|
||||||
?.map((e) => User.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => User.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
silent: json['silent'] as bool?,
|
silent: json['silent'] as bool?,
|
||||||
shadowed: json['shadowed'] as bool?,
|
shadowed: json['shadowed'] as bool?,
|
||||||
@@ -26,19 +26,19 @@ Message _$MessageFromJson(Map<String, dynamic> json) {
|
|||||||
(k, e) => MapEntry(k, e as int),
|
(k, e) => MapEntry(k, e as int),
|
||||||
),
|
),
|
||||||
latestReactions: (json['latest_reactions'] as List<dynamic>?)
|
latestReactions: (json['latest_reactions'] as List<dynamic>?)
|
||||||
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
ownReactions: (json['own_reactions'] as List<dynamic>?)
|
ownReactions: (json['own_reactions'] as List<dynamic>?)
|
||||||
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
parentId: json['parent_id'] as String?,
|
parentId: json['parent_id'] as String?,
|
||||||
quotedMessage: json['quoted_message'] == null
|
quotedMessage: json['quoted_message'] == null
|
||||||
? null
|
? null
|
||||||
: Message.fromJson(json['quoted_message'] as Map<String, dynamic>?),
|
: Message.fromJson(json['quoted_message'] as Map<String, dynamic>),
|
||||||
quotedMessageId: json['quoted_message_id'] as String?,
|
quotedMessageId: json['quoted_message_id'] as String?,
|
||||||
replyCount: json['reply_count'] as int?,
|
replyCount: json['reply_count'] as int?,
|
||||||
threadParticipants: (json['thread_participants'] as List<dynamic>?)
|
threadParticipants: (json['thread_participants'] as List<dynamic>?)
|
||||||
?.map((e) => User.fromJson(e as Map<String, dynamic>?))
|
?.map((e) => User.fromJson(e as Map<String, dynamic>))
|
||||||
.toList(),
|
.toList(),
|
||||||
showInChannel: json['show_in_channel'] as bool?,
|
showInChannel: json['show_in_channel'] as bool?,
|
||||||
command: json['command'] as String?,
|
command: json['command'] as String?,
|
||||||
@@ -50,7 +50,7 @@ Message _$MessageFromJson(Map<String, dynamic> json) {
|
|||||||
: DateTime.parse(json['updated_at'] as String),
|
: DateTime.parse(json['updated_at'] as String),
|
||||||
user: json['user'] == null
|
user: json['user'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['user'] as Map<String, dynamic>?),
|
: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
pinned: json['pinned'] as bool?,
|
pinned: json['pinned'] as bool?,
|
||||||
pinnedAt: json['pinned_at'] == null
|
pinnedAt: json['pinned_at'] == null
|
||||||
? null
|
? null
|
||||||
@@ -60,7 +60,7 @@ Message _$MessageFromJson(Map<String, dynamic> json) {
|
|||||||
: DateTime.parse(json['pin_expires'] as String),
|
: DateTime.parse(json['pin_expires'] as String),
|
||||||
pinnedBy: json['pinned_by'] == null
|
pinnedBy: json['pinned_by'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['pinned_by'] as Map<String, dynamic>?),
|
: User.fromJson(json['pinned_by'] as Map<String, dynamic>),
|
||||||
extraData: json['extra_data'] as Map<String, dynamic>?,
|
extraData: json['extra_data'] as Map<String, dynamic>?,
|
||||||
deletedAt: json['deleted_at'] == null
|
deletedAt: json['deleted_at'] == null
|
||||||
? null
|
? null
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ Mute _$MuteFromJson(Map<String, dynamic> json) {
|
|||||||
return Mute(
|
return Mute(
|
||||||
user: json['user'] == null
|
user: json['user'] == null
|
||||||
? null
|
? null
|
||||||
: User.fromJson(json['user'] as Map<String, dynamic>?),
|
: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
channel: json['channel'] == null
|
channel: json['channel'] == null
|
||||||
? null
|
? null
|
||||||
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>?),
|
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
|
||||||
createdAt: json['created_at'] == null
|
createdAt: json['created_at'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['created_at'] as String),
|
: DateTime.parse(json['created_at'] as String),
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ class Reaction {
|
|||||||
/// Constructor used for json serialization
|
/// Constructor used for json serialization
|
||||||
Reaction({
|
Reaction({
|
||||||
this.messageId,
|
this.messageId,
|
||||||
required this.createdAt,
|
DateTime? createdAt,
|
||||||
required this.type,
|
this.type = '',
|
||||||
required this.user,
|
required this.user,
|
||||||
String? userId,
|
String? userId,
|
||||||
required this.score,
|
this.score = 0,
|
||||||
this.extraData,
|
this.extraData,
|
||||||
}) : userId = userId ?? user.id;
|
}) : userId = userId ?? user.id,
|
||||||
|
createdAt = createdAt ?? DateTime.now();
|
||||||
|
|
||||||
/// Create a new instance from a json
|
/// Create a new instance from a json
|
||||||
factory Reaction.fromJson(Map<String, dynamic> json) =>
|
factory Reaction.fromJson(Map<String, dynamic> json) =>
|
||||||
@@ -40,6 +41,7 @@ class Reaction {
|
|||||||
final User user;
|
final User user;
|
||||||
|
|
||||||
/// The score of the reaction (ie. number of reactions sent)
|
/// The score of the reaction (ie. number of reactions sent)
|
||||||
|
@JsonKey(defaultValue: 0)
|
||||||
final int score;
|
final int score;
|
||||||
|
|
||||||
/// The userId that sent the reaction
|
/// The userId that sent the reaction
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ part of 'reaction.dart';
|
|||||||
Reaction _$ReactionFromJson(Map<String, dynamic> json) {
|
Reaction _$ReactionFromJson(Map<String, dynamic> json) {
|
||||||
return Reaction(
|
return Reaction(
|
||||||
messageId: json['message_id'] as String?,
|
messageId: json['message_id'] as String?,
|
||||||
createdAt: DateTime.parse(json['created_at'] as String),
|
createdAt: json['created_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['created_at'] as String),
|
||||||
type: json['type'] as String,
|
type: json['type'] as String,
|
||||||
user: User.fromJson(json['user'] as Map<String, dynamic>?),
|
user: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
userId: json['user_id'] as String?,
|
userId: json['user_id'] as String?,
|
||||||
score: json['score'] as int,
|
score: json['score'] as int? ?? 0,
|
||||||
extraData: json['extra_data'] as Map<String, dynamic>?,
|
extraData: json['extra_data'] as Map<String, dynamic>?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ part of 'read.dart';
|
|||||||
Read _$ReadFromJson(Map<String, dynamic> json) {
|
Read _$ReadFromJson(Map<String, dynamic> json) {
|
||||||
return Read(
|
return Read(
|
||||||
lastRead: DateTime.parse(json['last_read'] as String),
|
lastRead: DateTime.parse(json['last_read'] as String),
|
||||||
user: User.fromJson(json['user'] as Map<String, dynamic>?),
|
user: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||||
unreadMessages: json['unread_messages'] as int? ?? 0,
|
unreadMessages: json['unread_messages'] as int? ?? 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should return null', () {
|
test('should return null', () {
|
||||||
final result = Serialization.moveToExtraDataFromRoot(null, [
|
final result = Serialization.moveToExtraDataFromRoot({}, [
|
||||||
'prop1',
|
'prop1',
|
||||||
'prop2',
|
'prop2',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(result, null);
|
expect(result, {'extra_data': {}});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user