chore(llc): re-generate all files

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-04-08 15:30:57 +05:30
parent c80fc0a6b4
commit c289871a56
21 changed files with 507 additions and 636 deletions
@@ -13,7 +13,10 @@ Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) =>
}; };
Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) { Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
final val = <String, dynamic>{}; final val = <String, dynamic>{
'limit': instance.limit,
'offset': instance.offset,
};
void writeNotNull(String key, dynamic value) { void writeNotNull(String key, dynamic value) {
if (value != null) { if (value != null) {
@@ -21,11 +24,10 @@ Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
} }
} }
writeNotNull('limit', instance.limit);
writeNotNull('offset', instance.offset);
writeNotNull('id_gt', instance.greaterThan); writeNotNull('id_gt', instance.greaterThan);
writeNotNull('id_gte', instance.greaterThanOrEqual); writeNotNull('id_gte', instance.greaterThanOrEqual);
writeNotNull('id_lt', instance.lessThan); writeNotNull('id_lt', instance.lessThan);
writeNotNull('id_lte', instance.lessThanOrEqual); writeNotNull('id_lte', instance.lessThanOrEqual);
val['hash_code'] = instance.hashCode;
return val; return val;
} }
+128 -186
View File
@@ -8,392 +8,334 @@ part of 'responses.dart';
SyncResponse _$SyncResponseFromJson(Map json) { SyncResponse _$SyncResponseFromJson(Map json) {
return SyncResponse() return SyncResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..events = (json['events'] as List) ..events = (json['events'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Event.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: Event.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList();
)))
?.toList();
} }
QueryChannelsResponse _$QueryChannelsResponseFromJson(Map json) { QueryChannelsResponse _$QueryChannelsResponseFromJson(Map json) {
return QueryChannelsResponse() return QueryChannelsResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..channels = (json['channels'] as List) ..channels = (json['channels'] as List<dynamic>?)
?.map((e) => e == null ? null : ChannelState.fromJson(e as Map)) ?.map((e) => ChannelState.fromJson(e as Map))
?.toList(); .toList();
} }
TranslateMessageResponse _$TranslateMessageResponseFromJson(Map json) { TranslateMessageResponse _$TranslateMessageResponseFromJson(Map json) {
return TranslateMessageResponse() return TranslateMessageResponse()
..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)?.map( : TranslatedMessage.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
QueryMembersResponse _$QueryMembersResponseFromJson(Map json) { QueryMembersResponse _$QueryMembersResponseFromJson(Map json) {
return QueryMembersResponse() return QueryMembersResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList();
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList();
} }
QueryUsersResponse _$QueryUsersResponseFromJson(Map json) { QueryUsersResponse _$QueryUsersResponseFromJson(Map json) {
return QueryUsersResponse() return QueryUsersResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..users = (json['users'] as List) ..users = (json['users'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => User.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: User.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList();
)))
?.toList();
} }
QueryReactionsResponse _$QueryReactionsResponseFromJson(Map json) { QueryReactionsResponse _$QueryReactionsResponseFromJson(Map json) {
return QueryReactionsResponse() return QueryReactionsResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..reactions = (json['reactions'] as List) ..reactions = (json['reactions'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Reaction.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: Reaction.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList();
)))
?.toList();
} }
QueryRepliesResponse _$QueryRepliesResponseFromJson(Map json) { QueryRepliesResponse _$QueryRepliesResponseFromJson(Map json) {
return QueryRepliesResponse() return QueryRepliesResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..messages = (json['messages'] as List) ..messages = (json['messages'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Message.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: Message.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList();
)))
?.toList();
} }
ListDevicesResponse _$ListDevicesResponseFromJson(Map json) { ListDevicesResponse _$ListDevicesResponseFromJson(Map json) {
return ListDevicesResponse() return ListDevicesResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..devices = (json['devices'] as List) ..devices = (json['devices'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Device.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList();
: Device.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList();
} }
SendFileResponse _$SendFileResponseFromJson(Map json) { SendFileResponse _$SendFileResponseFromJson(Map json) {
return SendFileResponse() return SendFileResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..file = json['file'] as String; ..file = json['file'] as String?;
} }
SendImageResponse _$SendImageResponseFromJson(Map json) { SendImageResponse _$SendImageResponseFromJson(Map json) {
return SendImageResponse() return SendImageResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..file = json['file'] as String; ..file = json['file'] as String?;
} }
SendReactionResponse _$SendReactionResponseFromJson(Map json) { SendReactionResponse _$SendReactionResponseFromJson(Map json) {
return SendReactionResponse() return SendReactionResponse()
..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)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..reaction = json['reaction'] == null ..reaction = json['reaction'] == null
? null ? null
: Reaction.fromJson((json['reaction'] as Map)?.map( : Reaction.fromJson((json['reaction'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(Map json) { ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(Map json) {
return ConnectGuestUserResponse() return ConnectGuestUserResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..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)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
UpdateUsersResponse _$UpdateUsersResponseFromJson(Map json) { UpdateUsersResponse _$UpdateUsersResponseFromJson(Map json) {
return UpdateUsersResponse() return UpdateUsersResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..users = (json['users'] as Map)?.map( ..users = (json['users'] as Map?)?.map(
(k, e) => MapEntry( (k, e) => MapEntry(
k as String, k as String,
e == null User.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: User.fromJson((e as Map)?.map( ))),
(k, e) => MapEntry(k as String, e),
))),
); );
} }
UpdateMessageResponse _$UpdateMessageResponseFromJson(Map json) { UpdateMessageResponse _$UpdateMessageResponseFromJson(Map json) {
return UpdateMessageResponse() return UpdateMessageResponse()
..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)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
SendMessageResponse _$SendMessageResponseFromJson(Map json) { SendMessageResponse _$SendMessageResponseFromJson(Map json) {
return SendMessageResponse() return SendMessageResponse()
..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)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
GetMessageResponse _$GetMessageResponseFromJson(Map json) { GetMessageResponse _$GetMessageResponseFromJson(Map json) {
return GetMessageResponse() return GetMessageResponse()
..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)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..channel = json['channel'] == null ..channel = json['channel'] == null
? null ? null
: ChannelModel.fromJson((json['channel'] as Map)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
SearchMessagesResponse _$SearchMessagesResponseFromJson(Map json) { SearchMessagesResponse _$SearchMessagesResponseFromJson(Map json) {
return SearchMessagesResponse() return SearchMessagesResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..results = (json['results'] as List) ..results = (json['results'] as List<dynamic>?)
?.map((e) => e == null ? null : GetMessageResponse.fromJson(e as Map)) ?.map((e) => GetMessageResponse.fromJson(e as Map))
?.toList(); .toList();
} }
GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson(Map json) { GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson(Map json) {
return GetMessagesByIdResponse() return GetMessagesByIdResponse()
..duration = json['duration'] as String ..duration = json['duration'] as String?
..messages = (json['messages'] as List) ..messages = (json['messages'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Message.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: Message.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList();
)))
?.toList();
} }
UpdateChannelResponse _$UpdateChannelResponseFromJson(Map json) { UpdateChannelResponse _$UpdateChannelResponseFromJson(Map json) {
return UpdateChannelResponse() return UpdateChannelResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList()
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList()
..message = json['message'] == null ..message = json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(Map json) { PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(Map json) {
return PartialUpdateChannelResponse() return PartialUpdateChannelResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList();
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList();
} }
InviteMembersResponse _$InviteMembersResponseFromJson(Map json) { InviteMembersResponse _$InviteMembersResponseFromJson(Map json) {
return InviteMembersResponse() return InviteMembersResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList()
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList()
..message = json['message'] == null ..message = json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
RemoveMembersResponse _$RemoveMembersResponseFromJson(Map json) { RemoveMembersResponse _$RemoveMembersResponseFromJson(Map json) {
return RemoveMembersResponse() return RemoveMembersResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList()
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList()
..message = json['message'] == null ..message = json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
SendActionResponse _$SendActionResponseFromJson(Map json) { SendActionResponse _$SendActionResponseFromJson(Map json) {
return SendActionResponse() return SendActionResponse()
..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)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
AddMembersResponse _$AddMembersResponseFromJson(Map json) { AddMembersResponse _$AddMembersResponseFromJson(Map json) {
return AddMembersResponse() return AddMembersResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList()
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList()
..message = json['message'] == null ..message = json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
AcceptInviteResponse _$AcceptInviteResponseFromJson(Map json) { AcceptInviteResponse _$AcceptInviteResponseFromJson(Map json) {
return AcceptInviteResponse() return AcceptInviteResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList()
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList()
..message = json['message'] == null ..message = json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
RejectInviteResponse _$RejectInviteResponseFromJson(Map json) { RejectInviteResponse _$RejectInviteResponseFromJson(Map json) {
return RejectInviteResponse() return RejectInviteResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..members = (json['members'] as List) ..members = (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList()
: Member.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList()
..message = json['message'] == null ..message = json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)); ));
} }
EmptyResponse _$EmptyResponseFromJson(Map json) { EmptyResponse _$EmptyResponseFromJson(Map json) {
return EmptyResponse()..duration = json['duration'] as String; return EmptyResponse()..duration = json['duration'] as String?;
} }
ChannelStateResponse _$ChannelStateResponseFromJson(Map json) { ChannelStateResponse _$ChannelStateResponseFromJson(Map json) {
return ChannelStateResponse() return ChannelStateResponse()
..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)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)) ))
..messages = (json['messages'] as List) ..messages = (json['messages'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Message.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: Message.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList()
))) ..members = (json['members'] as List<dynamic>?)
?.toList() ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
..members = (json['members'] as List) .toList()
?.map((e) => e == null ..watcherCount = json['watcher_count'] as int?
? null ..read = (json['read'] as List<dynamic>?)
: Member.fromJson((e as Map)?.map( ?.map((e) => Read.fromJson(Map<String, dynamic>.from(e as Map)))
(k, e) => MapEntry(k as String, e), .toList();
)))
?.toList()
..watcherCount = json['watcher_count'] as int
..read = (json['read'] as List)
?.map((e) => e == null
? null
: Read.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList();
} }
@@ -8,11 +8,11 @@ part of 'action.dart';
Action _$ActionFromJson(Map json) { Action _$ActionFromJson(Map json) {
return Action( return Action(
name: json['name'] as String, name: json['name'] as String?,
style: json['style'] as String, style: json['style'] as String?,
text: json['text'] as String, text: json['text'] as String?,
type: json['type'] as String, type: json['type'] as String?,
value: json['value'] as String, value: json['value'] as String?,
); );
} }
@@ -8,44 +8,38 @@ part of 'attachment.dart';
Attachment _$AttachmentFromJson(Map json) { Attachment _$AttachmentFromJson(Map json) {
return Attachment( return Attachment(
id: json['id'] as String, id: json['id'] as String?,
type: json['type'] as String, type: json['type'] as String?,
titleLink: json['title_link'] as String, titleLink: json['title_link'] as String?,
title: json['title'] as String, title: json['title'] as String?,
thumbUrl: json['thumb_url'] as String, thumbUrl: json['thumb_url'] as String?,
text: json['text'] as String, text: json['text'] as String?,
pretext: json['pretext'] as String, pretext: json['pretext'] as String?,
ogScrapeUrl: json['og_scrape_url'] as String, ogScrapeUrl: json['og_scrape_url'] as String?,
imageUrl: json['image_url'] as String, imageUrl: json['image_url'] as String?,
footerIcon: json['footer_icon'] as String, footerIcon: json['footer_icon'] as String?,
footer: json['footer'] as String, footer: json['footer'] as String?,
fields: json['fields'], fields: json['fields'],
fallback: json['fallback'] as String, fallback: json['fallback'] as String?,
color: json['color'] as String, color: json['color'] as String?,
authorName: json['author_name'] as String, authorName: json['author_name'] as String?,
authorLink: json['author_link'] as String, authorLink: json['author_link'] as String?,
authorIcon: json['author_icon'] as String, authorIcon: json['author_icon'] as String?,
assetUrl: json['asset_url'] as String, assetUrl: json['asset_url'] as String?,
actions: (json['actions'] as List) actions: (json['actions'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Action.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList(),
: Action.fromJson((e as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
extraData: (json['extra_data'] as Map)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
file: json['file'] == null file: json['file'] == null
? null ? null
: AttachmentFile.fromJson((json['file'] as Map)?.map( : AttachmentFile.fromJson(
(k, e) => MapEntry(k as String, e), Map<String, dynamic>.from(json['file'] as Map)),
)),
uploadState: json['upload_state'] == null uploadState: json['upload_state'] == null
? null ? null
: UploadState.fromJson((json['upload_state'] as Map)?.map( : UploadState.fromJson(
(k, e) => MapEntry(k as String, e), Map<String, dynamic>.from(json['upload_state'] as Map)),
)),
); );
} }
@@ -75,10 +69,10 @@ Map<String, dynamic> _$AttachmentToJson(Attachment instance) {
writeNotNull('author_link', instance.authorLink); writeNotNull('author_link', instance.authorLink);
writeNotNull('author_icon', instance.authorIcon); writeNotNull('author_icon', instance.authorIcon);
writeNotNull('asset_url', instance.assetUrl); writeNotNull('asset_url', instance.assetUrl);
writeNotNull('actions', instance.actions?.map((e) => e?.toJson())?.toList()); writeNotNull('actions', instance.actions?.map((e) => e.toJson()).toList());
writeNotNull('file', instance.file?.toJson()); writeNotNull('file', instance.file?.toJson());
writeNotNull('upload_state', instance.uploadState?.toJson()); writeNotNull('upload_state', instance.uploadState?.toJson());
writeNotNull('extra_data', instance.extraData); writeNotNull('extra_data', instance.extraData);
writeNotNull('id', instance.id); val['id'] = instance.id;
return val; return val;
} }
@@ -4,16 +4,18 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
part 'attachment_file.freezed.dart'; part 'attachment_file.freezed.dart';
part 'attachment_file.g.dart'; part 'attachment_file.g.dart';
/// Union class to hold various [UploadState] of a attachment. /// Union class to hold various [UploadState] of a attachment.
@freezed @freezed
abstract class UploadState with _$UploadState { class UploadState with _$UploadState {
/// Preparing state of the union /// Preparing state of the union
const factory UploadState.preparing() = Preparing; const factory UploadState.preparing() = Preparing;
/// InProgress state of the union /// InProgress state of the union
const factory UploadState.inProgress({int uploaded, int total}) = InProgress; const factory UploadState.inProgress(
{required int uploaded, required int total}) = InProgress;
/// Success state of the union /// Success state of the union
const factory UploadState.success() = Success; const factory UploadState.success() = Success;
@@ -41,9 +43,15 @@ extension UploadStateX on UploadState? {
bool get isFailed => this is Failed; bool get isFailed => this is Failed;
} }
Uint8List _fromString(String bytes) => Uint8List.fromList(bytes.codeUnits); Uint8List? _fromString(String? bytes) {
if (bytes == null) return null;
return Uint8List.fromList(bytes.codeUnits);
}
String _toString(Uint8List bytes) => String.fromCharCodes(bytes); String? _toString(Uint8List? bytes) {
if (bytes == null) return null;
return String.fromCharCodes(bytes);
}
/// The class that contains the information about an attachment file /// The class that contains the information about an attachment file
@JsonSerializable() @JsonSerializable()
@@ -1,5 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides
part of 'attachment_file.dart'; part of 'attachment_file.dart';
@@ -8,6 +8,10 @@ part of 'attachment_file.dart';
// ************************************************************************** // **************************************************************************
T _$identity<T>(T value) => value; T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
UploadState _$UploadStateFromJson(Map<String, dynamic> json) { UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
switch (json['runtimeType'] as String) { switch (json['runtimeType'] as String) {
case 'preparing': case 'preparing':
@@ -28,74 +32,72 @@ UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
class _$UploadStateTearOff { class _$UploadStateTearOff {
const _$UploadStateTearOff(); const _$UploadStateTearOff();
// ignore: unused_element
Preparing preparing() { Preparing preparing() {
return const Preparing(); return const Preparing();
} }
// ignore: unused_element InProgress inProgress({required int uploaded, required int total}) {
InProgress inProgress({int uploaded, int total}) {
return InProgress( return InProgress(
uploaded: uploaded, uploaded: uploaded,
total: total, total: total,
); );
} }
// ignore: unused_element
Success success() { Success success() {
return const Success(); return const Success();
} }
// ignore: unused_element Failed failed({required String error}) {
Failed failed({@required String error}) {
return Failed( return Failed(
error: error, error: error,
); );
} }
// ignore: unused_element
UploadState fromJson(Map<String, Object> json) { UploadState fromJson(Map<String, Object> json) {
return UploadState.fromJson(json); return UploadState.fromJson(json);
} }
} }
/// @nodoc /// @nodoc
// ignore: unused_element
const $UploadState = _$UploadStateTearOff(); const $UploadState = _$UploadStateTearOff();
/// @nodoc /// @nodoc
mixin _$UploadState { mixin _$UploadState {
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object>({ TResult when<TResult extends Object?>({
@required TResult preparing(), required TResult Function() preparing,
@required TResult inProgress(int uploaded, int total), required TResult Function(int uploaded, int total) inProgress,
@required TResult success(), required TResult Function() success,
@required TResult failed(String error), required TResult Function(String error) failed,
}); }) =>
throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object>({ TResult maybeWhen<TResult extends Object?>({
TResult preparing(), TResult Function()? preparing,
TResult inProgress(int uploaded, int total), TResult Function(int uploaded, int total)? inProgress,
TResult success(), TResult Function()? success,
TResult failed(String error), TResult Function(String error)? failed,
@required TResult orElse(), required TResult orElse(),
}); }) =>
throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object>({ TResult map<TResult extends Object?>({
@required TResult preparing(Preparing value), required TResult Function(Preparing value) preparing,
@required TResult inProgress(InProgress value), required TResult Function(InProgress value) inProgress,
@required TResult success(Success value), required TResult Function(Success value) success,
@required TResult failed(Failed value), required TResult Function(Failed value) failed,
}); }) =>
throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object>({ TResult maybeMap<TResult extends Object?>({
TResult preparing(Preparing value), TResult Function(Preparing value)? preparing,
TResult inProgress(InProgress value), TResult Function(InProgress value)? inProgress,
TResult success(Success value), TResult Function(Success value)? success,
TResult failed(Failed value), TResult Function(Failed value)? failed,
@required TResult orElse(), required TResult orElse(),
}); }) =>
Map<String, dynamic> toJson(); throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc
@@ -154,29 +156,24 @@ class _$Preparing implements Preparing {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object>({ TResult when<TResult extends Object?>({
@required TResult preparing(), required TResult Function() preparing,
@required TResult inProgress(int uploaded, int total), required TResult Function(int uploaded, int total) inProgress,
@required TResult success(), required TResult Function() success,
@required TResult failed(String error), required TResult Function(String error) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return preparing(); return preparing();
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object>({ TResult maybeWhen<TResult extends Object?>({
TResult preparing(), TResult Function()? preparing,
TResult inProgress(int uploaded, int total), TResult Function(int uploaded, int total)? inProgress,
TResult success(), TResult Function()? success,
TResult failed(String error), TResult Function(String error)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (preparing != null) { if (preparing != null) {
return preparing(); return preparing();
} }
@@ -185,29 +182,24 @@ class _$Preparing implements Preparing {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object>({ TResult map<TResult extends Object?>({
@required TResult preparing(Preparing value), required TResult Function(Preparing value) preparing,
@required TResult inProgress(InProgress value), required TResult Function(InProgress value) inProgress,
@required TResult success(Success value), required TResult Function(Success value) success,
@required TResult failed(Failed value), required TResult Function(Failed value) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return preparing(this); return preparing(this);
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object>({ TResult maybeMap<TResult extends Object?>({
TResult preparing(Preparing value), TResult Function(Preparing value)? preparing,
TResult inProgress(InProgress value), TResult Function(InProgress value)? inProgress,
TResult success(Success value), TResult Function(Success value)? success,
TResult failed(Failed value), TResult Function(Failed value)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (preparing != null) { if (preparing != null) {
return preparing(this); return preparing(this);
} }
@@ -245,12 +237,18 @@ class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
@override @override
$Res call({ $Res call({
Object uploaded = freezed, Object? uploaded = freezed,
Object total = freezed, Object? total = freezed,
}) { }) {
return _then(InProgress( return _then(InProgress(
uploaded: uploaded == freezed ? _value.uploaded : uploaded as int, uploaded: uploaded == freezed
total: total == freezed ? _value.total : total as int, ? _value.uploaded
: uploaded // ignore: cast_nullable_to_non_nullable
as int,
total: total == freezed
? _value.total
: total // ignore: cast_nullable_to_non_nullable
as int,
)); ));
} }
} }
@@ -259,7 +257,7 @@ class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
/// @nodoc /// @nodoc
class _$InProgress implements InProgress { class _$InProgress implements InProgress {
const _$InProgress({this.uploaded, this.total}); const _$InProgress({required this.uploaded, required this.total});
factory _$InProgress.fromJson(Map<String, dynamic> json) => factory _$InProgress.fromJson(Map<String, dynamic> json) =>
_$_$InProgressFromJson(json); _$_$InProgressFromJson(json);
@@ -298,29 +296,24 @@ class _$InProgress implements InProgress {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object>({ TResult when<TResult extends Object?>({
@required TResult preparing(), required TResult Function() preparing,
@required TResult inProgress(int uploaded, int total), required TResult Function(int uploaded, int total) inProgress,
@required TResult success(), required TResult Function() success,
@required TResult failed(String error), required TResult Function(String error) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return inProgress(uploaded, total); return inProgress(uploaded, total);
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object>({ TResult maybeWhen<TResult extends Object?>({
TResult preparing(), TResult Function()? preparing,
TResult inProgress(int uploaded, int total), TResult Function(int uploaded, int total)? inProgress,
TResult success(), TResult Function()? success,
TResult failed(String error), TResult Function(String error)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (inProgress != null) { if (inProgress != null) {
return inProgress(uploaded, total); return inProgress(uploaded, total);
} }
@@ -329,29 +322,24 @@ class _$InProgress implements InProgress {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object>({ TResult map<TResult extends Object?>({
@required TResult preparing(Preparing value), required TResult Function(Preparing value) preparing,
@required TResult inProgress(InProgress value), required TResult Function(InProgress value) inProgress,
@required TResult success(Success value), required TResult Function(Success value) success,
@required TResult failed(Failed value), required TResult Function(Failed value) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return inProgress(this); return inProgress(this);
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object>({ TResult maybeMap<TResult extends Object?>({
TResult preparing(Preparing value), TResult Function(Preparing value)? preparing,
TResult inProgress(InProgress value), TResult Function(InProgress value)? inProgress,
TResult success(Success value), TResult Function(Success value)? success,
TResult failed(Failed value), TResult Function(Failed value)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (inProgress != null) { if (inProgress != null) {
return inProgress(this); return inProgress(this);
} }
@@ -365,15 +353,17 @@ class _$InProgress implements InProgress {
} }
abstract class InProgress implements UploadState { abstract class InProgress implements UploadState {
const factory InProgress({int uploaded, int total}) = _$InProgress; const factory InProgress({required int uploaded, required int total}) =
_$InProgress;
factory InProgress.fromJson(Map<String, dynamic> json) = factory InProgress.fromJson(Map<String, dynamic> json) =
_$InProgress.fromJson; _$InProgress.fromJson;
int get uploaded; int get uploaded => throw _privateConstructorUsedError;
int get total; int get total => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
$InProgressCopyWith<InProgress> get copyWith; $InProgressCopyWith<InProgress> get copyWith =>
throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc
@@ -416,29 +406,24 @@ class _$Success implements Success {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object>({ TResult when<TResult extends Object?>({
@required TResult preparing(), required TResult Function() preparing,
@required TResult inProgress(int uploaded, int total), required TResult Function(int uploaded, int total) inProgress,
@required TResult success(), required TResult Function() success,
@required TResult failed(String error), required TResult Function(String error) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return success(); return success();
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object>({ TResult maybeWhen<TResult extends Object?>({
TResult preparing(), TResult Function()? preparing,
TResult inProgress(int uploaded, int total), TResult Function(int uploaded, int total)? inProgress,
TResult success(), TResult Function()? success,
TResult failed(String error), TResult Function(String error)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (success != null) { if (success != null) {
return success(); return success();
} }
@@ -447,29 +432,24 @@ class _$Success implements Success {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object>({ TResult map<TResult extends Object?>({
@required TResult preparing(Preparing value), required TResult Function(Preparing value) preparing,
@required TResult inProgress(InProgress value), required TResult Function(InProgress value) inProgress,
@required TResult success(Success value), required TResult Function(Success value) success,
@required TResult failed(Failed value), required TResult Function(Failed value) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return success(this); return success(this);
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object>({ TResult maybeMap<TResult extends Object?>({
TResult preparing(Preparing value), TResult Function(Preparing value)? preparing,
TResult inProgress(InProgress value), TResult Function(InProgress value)? inProgress,
TResult success(Success value), TResult Function(Success value)? success,
TResult failed(Failed value), TResult Function(Failed value)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (success != null) { if (success != null) {
return success(this); return success(this);
} }
@@ -506,10 +486,13 @@ class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
@override @override
$Res call({ $Res call({
Object error = freezed, Object? error = freezed,
}) { }) {
return _then(Failed( return _then(Failed(
error: error == freezed ? _value.error : error as String, error: error == freezed
? _value.error
: error // ignore: cast_nullable_to_non_nullable
as String,
)); ));
} }
} }
@@ -518,7 +501,7 @@ class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
/// @nodoc /// @nodoc
class _$Failed implements Failed { class _$Failed implements Failed {
const _$Failed({@required this.error}) : assert(error != null); const _$Failed({required this.error});
factory _$Failed.fromJson(Map<String, dynamic> json) => factory _$Failed.fromJson(Map<String, dynamic> json) =>
_$_$FailedFromJson(json); _$_$FailedFromJson(json);
@@ -550,29 +533,24 @@ class _$Failed implements Failed {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object>({ TResult when<TResult extends Object?>({
@required TResult preparing(), required TResult Function() preparing,
@required TResult inProgress(int uploaded, int total), required TResult Function(int uploaded, int total) inProgress,
@required TResult success(), required TResult Function() success,
@required TResult failed(String error), required TResult Function(String error) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return failed(error); return failed(error);
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object>({ TResult maybeWhen<TResult extends Object?>({
TResult preparing(), TResult Function()? preparing,
TResult inProgress(int uploaded, int total), TResult Function(int uploaded, int total)? inProgress,
TResult success(), TResult Function()? success,
TResult failed(String error), TResult Function(String error)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (failed != null) { if (failed != null) {
return failed(error); return failed(error);
} }
@@ -581,29 +559,24 @@ class _$Failed implements Failed {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object>({ TResult map<TResult extends Object?>({
@required TResult preparing(Preparing value), required TResult Function(Preparing value) preparing,
@required TResult inProgress(InProgress value), required TResult Function(InProgress value) inProgress,
@required TResult success(Success value), required TResult Function(Success value) success,
@required TResult failed(Failed value), required TResult Function(Failed value) failed,
}) { }) {
assert(preparing != null);
assert(inProgress != null);
assert(success != null);
assert(failed != null);
return failed(this); return failed(this);
} }
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object>({ TResult maybeMap<TResult extends Object?>({
TResult preparing(Preparing value), TResult Function(Preparing value)? preparing,
TResult inProgress(InProgress value), TResult Function(InProgress value)? inProgress,
TResult success(Success value), TResult Function(Success value)? success,
TResult failed(Failed value), TResult Function(Failed value)? failed,
@required TResult orElse(), required TResult orElse(),
}) { }) {
assert(orElse != null);
if (failed != null) { if (failed != null) {
return failed(this); return failed(this);
} }
@@ -617,11 +590,11 @@ class _$Failed implements Failed {
} }
abstract class Failed implements UploadState { abstract class Failed implements UploadState {
const factory Failed({@required String error}) = _$Failed; const factory Failed({required String error}) = _$Failed;
factory Failed.fromJson(Map<String, dynamic> json) = _$Failed.fromJson; factory Failed.fromJson(Map<String, dynamic> json) = _$Failed.fromJson;
String get error; String get error => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
$FailedCopyWith<Failed> get copyWith; $FailedCopyWith<Failed> get copyWith => throw _privateConstructorUsedError;
} }
@@ -8,10 +8,10 @@ part of 'attachment_file.dart';
AttachmentFile _$AttachmentFileFromJson(Map json) { AttachmentFile _$AttachmentFileFromJson(Map json) {
return AttachmentFile( return AttachmentFile(
path: json['path'] as String, path: json['path'] as String?,
name: json['name'] as String, name: json['name'] as String?,
bytes: _fromString(json['bytes'] as String), bytes: _fromString(json['bytes'] as String?),
size: json['size'] as int, size: json['size'] as int?,
); );
} }
@@ -8,39 +8,35 @@ part of 'channel_config.dart';
ChannelConfig _$ChannelConfigFromJson(Map json) { ChannelConfig _$ChannelConfigFromJson(Map json) {
return ChannelConfig( return ChannelConfig(
automod: json['automod'] as String, automod: json['automod'] as String?,
commands: (json['commands'] as List) commands: (json['commands'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Command.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList(),
: Command.fromJson((e as Map)?.map( connectEvents: json['connect_events'] as bool?,
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
connectEvents: json['connect_events'] as bool,
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),
updatedAt: json['updated_at'] == null updatedAt: json['updated_at'] == null
? null ? null
: DateTime.parse(json['updated_at'] as String), : DateTime.parse(json['updated_at'] as String),
maxMessageLength: json['max_message_length'] as int, maxMessageLength: json['max_message_length'] as int?,
messageRetention: json['message_retention'] as String, messageRetention: json['message_retention'] as String?,
mutes: json['mutes'] as bool, mutes: json['mutes'] as bool?,
name: json['name'] as String, name: json['name'] as String?,
reactions: json['reactions'] as bool, reactions: json['reactions'] as bool?,
readEvents: json['read_events'] as bool, readEvents: json['read_events'] as bool?,
replies: json['replies'] as bool, replies: json['replies'] as bool?,
search: json['search'] as bool, search: json['search'] as bool?,
typingEvents: json['typing_events'] as bool, typingEvents: json['typing_events'] as bool?,
uploads: json['uploads'] as bool, uploads: json['uploads'] as bool?,
urlEnrichment: json['url_enrichment'] as bool, urlEnrichment: json['url_enrichment'] as bool?,
); );
} }
Map<String, dynamic> _$ChannelConfigToJson(ChannelConfig instance) => Map<String, dynamic> _$ChannelConfigToJson(ChannelConfig instance) =>
<String, dynamic>{ <String, dynamic>{
'automod': instance.automod, 'automod': instance.automod,
'commands': instance.commands?.map((e) => e?.toJson())?.toList(), 'commands': instance.commands?.map((e) => e.toJson()).toList(),
'connect_events': instance.connectEvents, 'connect_events': instance.connectEvents,
'created_at': instance.createdAt?.toIso8601String(), 'created_at': instance.createdAt?.toIso8601String(),
'updated_at': instance.updatedAt?.toIso8601String(), 'updated_at': instance.updatedAt?.toIso8601String(),
@@ -8,20 +8,19 @@ part of 'channel_model.dart';
ChannelModel _$ChannelModelFromJson(Map json) { ChannelModel _$ChannelModelFromJson(Map json) {
return ChannelModel( return ChannelModel(
id: json['id'] as String, id: json['id'] as String?,
type: json['type'] as String, type: json['type'] as String?,
cid: json['cid'] as String, cid: json['cid'] as String?,
config: json['config'] == null config: json['config'] == null
? null ? null
: ChannelConfig.fromJson((json['config'] as Map)?.map( : ChannelConfig.fromJson(
(k, e) => MapEntry(k as String, e), Map<String, dynamic>.from(json['config'] as Map)),
)),
createdBy: json['created_by'] == null createdBy: json['created_by'] == null
? null ? null
: User.fromJson((json['created_by'] as Map)?.map( : User.fromJson((json['created_by'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
frozen: json['frozen'] as bool, frozen: json['frozen'] as bool?,
lastMessageAt: json['last_message_at'] == null lastMessageAt: json['last_message_at'] == null
? null ? null
: DateTime.parse(json['last_message_at'] as String), : DateTime.parse(json['last_message_at'] as String),
@@ -34,11 +33,11 @@ ChannelModel _$ChannelModelFromJson(Map json) {
deletedAt: json['deleted_at'] == null deletedAt: json['deleted_at'] == null
? null ? null
: DateTime.parse(json['deleted_at'] as String), : DateTime.parse(json['deleted_at'] as String),
memberCount: json['member_count'] as int, memberCount: json['member_count'] as int?,
extraData: (json['extra_data'] as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
team: json['team'] as String, team: json['team'] as String?,
); );
} }
@@ -10,56 +10,44 @@ ChannelState _$ChannelStateFromJson(Map json) {
return ChannelState( return ChannelState(
channel: json['channel'] == null channel: json['channel'] == null
? null ? null
: ChannelModel.fromJson((json['channel'] as Map)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
messages: (json['messages'] as List) messages: (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson((e as Map?)?.map(
(k, e) => MapEntry(k as String, e),
)))
.toList(),
members: (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => e == null
? null ? null
: Message.fromJson((e as Map)?.map( : Member.fromJson(Map<String, dynamic>.from(e as Map)))
(k, e) => MapEntry(k as String, e), .toList(),
))) pinnedMessages: (json['pinned_messages'] as List<dynamic>?)
?.toList(), ?.map((e) => Message.fromJson((e as Map?)?.map(
members: (json['members'] as List) (k, e) => MapEntry(k as String, e),
?.map((e) => e == null )))
? null .toList(),
: Member.fromJson((e as Map)?.map( watcherCount: json['watcher_count'] as int?,
(k, e) => MapEntry(k as String, e), watchers: (json['watchers'] as List<dynamic>?)
))) ?.map((e) => User.fromJson((e as Map?)?.map(
?.toList(), (k, e) => MapEntry(k as String, e),
pinnedMessages: (json['pinned_messages'] as List) )))
?.map((e) => e == null .toList(),
? null read: (json['read'] as List<dynamic>?)
: Message.fromJson((e as Map)?.map( ?.map((e) => Read.fromJson(Map<String, dynamic>.from(e as Map)))
(k, e) => MapEntry(k as String, e), .toList(),
)))
?.toList(),
watcherCount: json['watcher_count'] as int,
watchers: (json['watchers'] as List)
?.map((e) => e == null
? null
: User.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
read: (json['read'] as List)
?.map((e) => e == null
? null
: Read.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
); );
} }
Map<String, dynamic> _$ChannelStateToJson(ChannelState instance) => Map<String, dynamic> _$ChannelStateToJson(ChannelState instance) =>
<String, dynamic>{ <String, dynamic>{
'channel': instance.channel?.toJson(), 'channel': instance.channel?.toJson(),
'messages': instance.messages?.map((e) => e?.toJson())?.toList(), 'messages': instance.messages?.map((e) => e.toJson()).toList(),
'members': instance.members?.map((e) => e?.toJson())?.toList(), 'members': instance.members?.map((e) => e?.toJson()).toList(),
'pinned_messages': 'pinned_messages':
instance.pinnedMessages?.map((e) => e?.toJson())?.toList(), instance.pinnedMessages?.map((e) => e.toJson()).toList(),
'watcher_count': instance.watcherCount, 'watcher_count': instance.watcherCount,
'watchers': instance.watchers?.map((e) => e?.toJson())?.toList(), 'watchers': instance.watchers?.map((e) => e.toJson()).toList(),
'read': instance.read?.map((e) => e?.toJson())?.toList(), 'read': instance.read?.map((e) => e.toJson()).toList(),
}; };
@@ -8,9 +8,9 @@ part of 'command.dart';
Command _$CommandFromJson(Map json) { Command _$CommandFromJson(Map json) {
return Command( return Command(
name: json['name'] as String, name: json['name'] as String?,
description: json['description'] as String, description: json['description'] as String?,
args: json['args'] as String, args: json['args'] as String?,
); );
} }
@@ -8,8 +8,8 @@ part of 'device.dart';
Device _$DeviceFromJson(Map json) { Device _$DeviceFromJson(Map json) {
return Device( return Device(
id: json['id'] as String, id: json['id'] as String?,
pushProvider: json['push_provider'] as String, pushProvider: json['push_provider'] as String?,
); );
} }
@@ -8,52 +8,50 @@ part of 'event.dart';
Event _$EventFromJson(Map json) { Event _$EventFromJson(Map json) {
return Event( return Event(
type: json['type'] as String, type: json['type'] as String?,
cid: json['cid'] as String, cid: json['cid'] as String?,
connectionId: json['connection_id'] as String, connectionId: json['connection_id'] as String?,
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),
me: json['me'] == null me: json['me'] == null
? null ? null
: OwnUser.fromJson((json['me'] as Map)?.map( : OwnUser.fromJson((json['me'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
user: json['user'] == null user: json['user'] == null
? null ? null
: User.fromJson((json['user'] as Map)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
message: json['message'] == null message: json['message'] == null
? null ? null
: Message.fromJson((json['message'] as Map)?.map( : Message.fromJson((json['message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
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)?.map( : Reaction.fromJson((json['reaction'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
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)?.map( : EventChannel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
member: json['member'] == null member: json['member'] == null
? null ? null
: Member.fromJson((json['member'] as Map)?.map( : Member.fromJson(Map<String, dynamic>.from(json['member'] as Map)),
(k, e) => MapEntry(k as String, e), channelId: json['channel_id'] as String?,
)), channelType: json['channel_type'] as String?,
channelId: json['channel_id'] as String, parentId: json['parent_id'] as String?,
channelType: json['channel_type'] as String, extraData: (json['extra_data'] as Map?)?.map(
parentId: json['parent_id'] as String,
extraData: (json['extra_data'] as Map)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
)..isLocal = json['is_local'] as bool; )..isLocal = json['is_local'] as bool?;
} }
Map<String, dynamic> _$EventToJson(Event instance) { Map<String, dynamic> _$EventToJson(Event instance) {
@@ -89,27 +87,22 @@ Map<String, dynamic> _$EventToJson(Event instance) {
EventChannel _$EventChannelFromJson(Map json) { EventChannel _$EventChannelFromJson(Map json) {
return EventChannel( return EventChannel(
members: (json['members'] as List) members: (json['members'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Member.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList(),
: Member.fromJson((e as Map)?.map( id: json['id'] as String?,
(k, e) => MapEntry(k as String, e), type: json['type'] as String?,
))) cid: json['cid'] as String?,
?.toList(),
id: json['id'] as String,
type: json['type'] as String,
cid: json['cid'] as String,
config: json['config'] == null config: json['config'] == null
? null ? null
: ChannelConfig.fromJson((json['config'] as Map)?.map( : ChannelConfig.fromJson(
(k, e) => MapEntry(k as String, e), Map<String, dynamic>.from(json['config'] as Map)),
)),
createdBy: json['created_by'] == null createdBy: json['created_by'] == null
? null ? null
: User.fromJson((json['created_by'] as Map)?.map( : User.fromJson((json['created_by'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
frozen: json['frozen'] as bool, frozen: json['frozen'] as bool?,
lastMessageAt: json['last_message_at'] == null lastMessageAt: json['last_message_at'] == null
? null ? null
: DateTime.parse(json['last_message_at'] as String), : DateTime.parse(json['last_message_at'] as String),
@@ -122,8 +115,8 @@ EventChannel _$EventChannelFromJson(Map json) {
deletedAt: json['deleted_at'] == null deletedAt: json['deleted_at'] == null
? null ? null
: DateTime.parse(json['deleted_at'] as String), : DateTime.parse(json['deleted_at'] as String),
memberCount: json['member_count'] as int, memberCount: json['member_count'] as int?,
extraData: (json['extra_data'] as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
); );
@@ -151,6 +144,6 @@ Map<String, dynamic> _$EventChannelToJson(EventChannel instance) {
writeNotNull('deleted_at', readonly(instance.deletedAt)); writeNotNull('deleted_at', readonly(instance.deletedAt));
writeNotNull('member_count', readonly(instance.memberCount)); writeNotNull('member_count', readonly(instance.memberCount));
writeNotNull('extra_data', instance.extraData); writeNotNull('extra_data', instance.extraData);
val['members'] = instance.members?.map((e) => e?.toJson())?.toList(); val['members'] = instance.members?.map((e) => e.toJson()).toList();
return val; return val;
} }
@@ -10,7 +10,7 @@ Member _$MemberFromJson(Map json) {
return Member( return Member(
user: json['user'] == null user: json['user'] == null
? null ? null
: User.fromJson((json['user'] as Map)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
inviteAcceptedAt: json['invite_accepted_at'] == null inviteAcceptedAt: json['invite_accepted_at'] == null
@@ -19,18 +19,18 @@ Member _$MemberFromJson(Map json) {
inviteRejectedAt: json['invite_rejected_at'] == null inviteRejectedAt: json['invite_rejected_at'] == null
? null ? null
: DateTime.parse(json['invite_rejected_at'] as String), : DateTime.parse(json['invite_rejected_at'] as String),
invited: json['invited'] as bool, invited: json['invited'] as bool?,
role: json['role'] as String, role: json['role'] as String?,
userId: json['user_id'] as String, userId: json['user_id'] as String?,
isModerator: json['is_moderator'] as bool, isModerator: json['is_moderator'] as bool?,
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),
updatedAt: json['updated_at'] == null updatedAt: json['updated_at'] == null
? null ? null
: DateTime.parse(json['updated_at'] as String), : DateTime.parse(json['updated_at'] as String),
banned: json['banned'] as bool, banned: json['banned'] as bool?,
shadowBanned: json['shadow_banned'] as bool, shadowBanned: json['shadow_banned'] as bool?,
); );
} }
@@ -106,11 +106,11 @@ class Message {
/// A map describing the count of number of every reaction /// A map describing the count of number of every reaction
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly) @JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
final Map<String?, int>? reactionCounts; final Map<String, int>? reactionCounts;
/// A map describing the count of score of every reaction /// A map describing the count of score of every reaction
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly) @JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
final Map<String?, int>? reactionScores; final Map<String, int>? reactionScores;
/// The latest reactions to the message created by any user. /// The latest reactions to the message created by any user.
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly) @JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
@@ -8,62 +8,50 @@ part of 'message.dart';
Message _$MessageFromJson(Map json) { Message _$MessageFromJson(Map json) {
return Message( return Message(
id: json['id'] as String, id: json['id'] as String?,
text: json['text'] as String, text: json['text'] as String?,
type: json['type'] as String, type: json['type'] as String?,
attachments: (json['attachments'] as List) attachments: (json['attachments'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Attachment.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList(),
: Attachment.fromJson((e as Map)?.map( mentionedUsers: (json['mentioned_users'] as List<dynamic>?)
(k, e) => MapEntry(k as String, e), ?.map((e) => User.fromJson((e as Map?)?.map(
))) (k, e) => MapEntry(k as String, e),
?.toList(), )))
mentionedUsers: (json['mentioned_users'] as List) .toList(),
?.map((e) => e == null silent: json['silent'] as bool?,
? null shadowed: json['shadowed'] as bool?,
: User.fromJson((e as Map)?.map( reactionCounts: (json['reaction_counts'] as Map?)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
silent: json['silent'] as bool,
shadowed: json['shadowed'] as bool,
reactionCounts: (json['reaction_counts'] as Map)?.map(
(k, e) => MapEntry(k as String, e as int), (k, e) => MapEntry(k as String, e as int),
), ),
reactionScores: (json['reaction_scores'] as Map)?.map( reactionScores: (json['reaction_scores'] as Map?)?.map(
(k, e) => MapEntry(k as String, e as int), (k, e) => MapEntry(k as String, e as int),
), ),
latestReactions: (json['latest_reactions'] as List) latestReactions: (json['latest_reactions'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Reaction.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: Reaction.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList(),
))) ownReactions: (json['own_reactions'] as List<dynamic>?)
?.toList(), ?.map((e) => Reaction.fromJson((e as Map?)?.map(
ownReactions: (json['own_reactions'] as List) (k, e) => MapEntry(k as String, e),
?.map((e) => e == null )))
? null .toList(),
: Reaction.fromJson((e as Map)?.map( parentId: json['parent_id'] as String?,
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
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)?.map( : Message.fromJson((json['quoted_message'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
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) threadParticipants: (json['thread_participants'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => User.fromJson((e as Map?)?.map(
? null (k, e) => MapEntry(k as String, e),
: User.fromJson((e as Map)?.map( )))
(k, e) => MapEntry(k as String, e), .toList(),
))) showInChannel: json['show_in_channel'] as bool?,
?.toList(), command: json['command'] as String?,
showInChannel: json['show_in_channel'] as bool,
command: json['command'] as String,
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),
@@ -72,10 +60,10 @@ Message _$MessageFromJson(Map 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)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
pinned: json['pinned'] as bool, pinned: json['pinned'] as bool?,
pinnedAt: json['pinned_at'] == null pinnedAt: json['pinned_at'] == null
? null ? null
: DateTime.parse(json['pinned_at'] as String), : DateTime.parse(json['pinned_at'] as String),
@@ -84,16 +72,16 @@ Message _$MessageFromJson(Map 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)?.map( : User.fromJson((json['pinned_by'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
extraData: (json['extra_data'] as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
deletedAt: json['deleted_at'] == null deletedAt: json['deleted_at'] == null
? null ? null
: DateTime.parse(json['deleted_at'] as String), : DateTime.parse(json['deleted_at'] as String),
skipPush: json['skip_push'] as bool, skipPush: json['skip_push'] as bool?,
); );
} }
@@ -111,7 +99,7 @@ Map<String, dynamic> _$MessageToJson(Message instance) {
writeNotNull('type', readonly(instance.type)); writeNotNull('type', readonly(instance.type));
writeNotNull( writeNotNull(
'attachments', instance.attachments?.map((e) => e?.toJson())?.toList()); 'attachments', instance.attachments?.map((e) => e.toJson()).toList());
val['mentioned_users'] = Serialization.userIds(instance.mentionedUsers); val['mentioned_users'] = Serialization.userIds(instance.mentionedUsers);
writeNotNull('reaction_counts', readonly(instance.reactionCounts)); writeNotNull('reaction_counts', readonly(instance.reactionCounts));
writeNotNull('reaction_scores', readonly(instance.reactionScores)); writeNotNull('reaction_scores', readonly(instance.reactionScores));
@@ -141,7 +129,7 @@ Map<String, dynamic> _$MessageToJson(Message instance) {
TranslatedMessage _$TranslatedMessageFromJson(Map json) { TranslatedMessage _$TranslatedMessageFromJson(Map json) {
return TranslatedMessage( return TranslatedMessage(
(json['i18n'] as Map)?.map( (json['i18n'] as Map?)?.map(
(k, e) => MapEntry(k as String, e as String), (k, e) => MapEntry(k as String, e as String),
), ),
); );
@@ -10,12 +10,12 @@ Mute _$MuteFromJson(Map json) {
return Mute( return Mute(
user: json['user'] == null user: json['user'] == null
? null ? null
: User.fromJson((json['user'] as Map)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
channel: json['channel'] == null channel: json['channel'] == null
? null ? null
: ChannelModel.fromJson((json['channel'] as Map)?.map( : ChannelModel.fromJson((json['channel'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
createdAt: json['created_at'] == null createdAt: json['created_at'] == null
@@ -8,31 +8,19 @@ part of 'own_user.dart';
OwnUser _$OwnUserFromJson(Map json) { OwnUser _$OwnUserFromJson(Map json) {
return OwnUser( return OwnUser(
devices: (json['devices'] as List) devices: (json['devices'] as List<dynamic>?)
?.map((e) => e == null ?.map((e) => Device.fromJson(Map<String, dynamic>.from(e as Map)))
? null .toList(),
: Device.fromJson((e as Map)?.map( mutes: (json['mutes'] as List<dynamic>?)
(k, e) => MapEntry(k as String, e), ?.map((e) => Mute.fromJson(Map<String, dynamic>.from(e as Map)))
))) .toList(),
?.toList(), totalUnreadCount: json['total_unread_count'] as int?,
mutes: (json['mutes'] as List) unreadChannels: json['unread_channels'] as int?,
?.map((e) => e == null channelMutes: (json['channel_mutes'] as List<dynamic>?)
? null ?.map((e) => Mute.fromJson(Map<String, dynamic>.from(e as Map)))
: Mute.fromJson((e as Map)?.map( .toList(),
(k, e) => MapEntry(k as String, e), id: json['id'] as String?,
))) role: json['role'] as String?,
?.toList(),
totalUnreadCount: json['total_unread_count'] as int,
unreadChannels: json['unread_channels'] as int,
channelMutes: (json['channel_mutes'] as List)
?.map((e) => e == null
? null
: Mute.fromJson((e as Map)?.map(
(k, e) => MapEntry(k as String, e),
)))
?.toList(),
id: json['id'] as String,
role: json['role'] as String,
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),
@@ -42,11 +30,11 @@ OwnUser _$OwnUserFromJson(Map json) {
lastActive: json['last_active'] == null lastActive: json['last_active'] == null
? null ? null
: DateTime.parse(json['last_active'] as String), : DateTime.parse(json['last_active'] as String),
online: json['online'] as bool, online: json['online'] as bool?,
extraData: (json['extra_data'] as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
banned: json['banned'] as bool, banned: json['banned'] as bool?,
); );
} }
@@ -8,19 +8,19 @@ part of 'reaction.dart';
Reaction _$ReactionFromJson(Map json) { Reaction _$ReactionFromJson(Map json) {
return Reaction( return Reaction(
messageId: json['message_id'] as String, messageId: json['message_id'] as String?,
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),
type: json['type'] as String, type: json['type'] as String?,
user: json['user'] == null user: json['user'] == null
? null ? null
: User.fromJson((json['user'] as Map)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
userId: json['user_id'] as String, userId: json['user_id'] as String?,
score: json['score'] as int, score: json['score'] as int?,
extraData: (json['extra_data'] as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
); );
@@ -13,10 +13,10 @@ Read _$ReadFromJson(Map json) {
: DateTime.parse(json['last_read'] as String), : DateTime.parse(json['last_read'] as String),
user: json['user'] == null user: json['user'] == null
? null ? null
: User.fromJson((json['user'] as Map)?.map( : User.fromJson((json['user'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
)), )),
unreadMessages: json['unread_messages'] as int, unreadMessages: json['unread_messages'] as int?,
); );
} }
@@ -8,8 +8,8 @@ part of 'user.dart';
User _$UserFromJson(Map json) { User _$UserFromJson(Map json) {
return User( return User(
id: json['id'] as String, id: json['id'] as String?,
role: json['role'] as String, role: json['role'] as String?,
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),
@@ -19,12 +19,12 @@ User _$UserFromJson(Map json) {
lastActive: json['last_active'] == null lastActive: json['last_active'] == null
? null ? null
: DateTime.parse(json['last_active'] as String), : DateTime.parse(json['last_active'] as String),
online: json['online'] as bool, online: json['online'] as bool?,
extraData: (json['extra_data'] as Map)?.map( extraData: (json['extra_data'] as Map?)?.map(
(k, e) => MapEntry(k as String, e), (k, e) => MapEntry(k as String, e),
), ),
banned: json['banned'] as bool, banned: json['banned'] as bool?,
teams: (json['teams'] as List)?.map((e) => e as String)?.toList(), teams: (json['teams'] as List<dynamic>?)?.map((e) => e as String).toList(),
); );
} }