fix(llc): regenerate code and remove default values where possible

This commit is contained in:
Salvatore Giordano
2021-10-05 13:50:42 +02:00
parent d808276fe3
commit 3adc75c265
32 changed files with 744 additions and 751 deletions
@@ -15,7 +15,7 @@ class SortOption<T> {
/// ``` /// ```
const SortOption( const SortOption(
this.field, { this.field, {
this.direction = DESC, this.direction = SortOption.DESC,
this.comparator, this.comparator,
}); });
@@ -6,12 +6,11 @@ part of 'requests.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
SortOption<T> _$SortOptionFromJson<T>(Map<String, dynamic> json) { SortOption<T> _$SortOptionFromJson<T>(Map<String, dynamic> json) =>
return SortOption<T>( SortOption<T>(
json['field'] as String, json['field'] as String,
direction: json['direction'] as int, direction: json['direction'] as int? ?? SortOption.DESC,
); );
}
Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) => Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) =>
<String, dynamic>{ <String, dynamic>{
@@ -19,22 +18,20 @@ Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) =>
'direction': instance.direction, 'direction': instance.direction,
}; };
PaginationParams _$PaginationParamsFromJson(Map<String, dynamic> json) { PaginationParams _$PaginationParamsFromJson(Map<String, dynamic> json) =>
return PaginationParams( PaginationParams(
limit: json['limit'] as int, limit: json['limit'] as int? ?? 10,
offset: json['offset'] as int, offset: json['offset'] as int?,
next: json['next'] as String?, next: json['next'] as String?,
greaterThan: json['id_gt'] as String?, greaterThan: json['id_gt'] as String?,
greaterThanOrEqual: json['id_gte'] as String?, greaterThanOrEqual: json['id_gte'] as String?,
lessThan: json['id_lt'] as String?, lessThan: json['id_lt'] as String?,
lessThanOrEqual: json['id_lte'] as String?, lessThanOrEqual: json['id_lte'] as String?,
); );
}
Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) { Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
final val = <String, dynamic>{ final val = <String, dynamic>{
'limit': instance.limit, 'limit': instance.limit,
'offset': instance.offset,
}; };
void writeNotNull(String key, dynamic value) { void writeNotNull(String key, dynamic value) {
@@ -43,6 +40,7 @@ Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
} }
} }
writeNotNull('offset', instance.offset);
writeNotNull('next', instance.next); writeNotNull('next', instance.next);
writeNotNull('id_gt', instance.greaterThan); writeNotNull('id_gt', instance.greaterThan);
writeNotNull('id_gte', instance.greaterThanOrEqual); writeNotNull('id_gte', instance.greaterThanOrEqual);
@@ -6,14 +6,13 @@ part of 'responses.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
ErrorResponse _$ErrorResponseFromJson(Map<String, dynamic> json) { ErrorResponse _$ErrorResponseFromJson(Map<String, dynamic> json) =>
return ErrorResponse() ErrorResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..code = json['code'] as int? ..code = json['code'] as int?
..message = json['message'] as String? ..message = json['message'] as String?
..statusCode = json['StatusCode'] as int? ..statusCode = json['StatusCode'] as int?
..moreInfo = json['more_info'] as String?; ..moreInfo = json['more_info'] as String?;
}
Map<String, dynamic> _$ErrorResponseToJson(ErrorResponse instance) => Map<String, dynamic> _$ErrorResponseToJson(ErrorResponse instance) =>
<String, dynamic>{ <String, dynamic>{
@@ -24,275 +23,253 @@ Map<String, dynamic> _$ErrorResponseToJson(ErrorResponse instance) =>
'more_info': instance.moreInfo, 'more_info': instance.moreInfo,
}; };
SyncResponse _$SyncResponseFromJson(Map<String, dynamic> json) { SyncResponse _$SyncResponseFromJson(Map<String, dynamic> json) => 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() ?? [];
[];
}
QueryChannelsResponse _$QueryChannelsResponseFromJson( QueryChannelsResponse _$QueryChannelsResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return QueryChannelsResponse() QueryChannelsResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..channels = (json['channels'] as List<dynamic>?) ..channels = (json['channels'] as List<dynamic>?)
?.map((e) => ChannelState.fromJson(e as Map<String, dynamic>)) ?.map((e) => ChannelState.fromJson(e as Map<String, dynamic>))
.toList() ?? .toList() ??
[]; [];
}
TranslateMessageResponse _$TranslateMessageResponseFromJson( TranslateMessageResponse _$TranslateMessageResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return TranslateMessageResponse() TranslateMessageResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>); ..message = Message.fromJson(json['message'] as Map<String, dynamic>);
}
QueryMembersResponse _$QueryMembersResponseFromJson(Map<String, dynamic> json) { QueryMembersResponse _$QueryMembersResponseFromJson(
return QueryMembersResponse() Map<String, dynamic> json) =>
..duration = json['duration'] as String? QueryMembersResponse()
..members = (json['members'] as List<dynamic>?) ..duration = json['duration'] as String?
?.map((e) => Member.fromJson(e as Map<String, dynamic>)) ..members = (json['members'] as List<dynamic>?)
.toList() ?? ?.map((e) => Member.fromJson(e as Map<String, dynamic>))
[]; .toList() ??
} [];
QueryUsersResponse _$QueryUsersResponseFromJson(Map<String, dynamic> json) { QueryUsersResponse _$QueryUsersResponseFromJson(Map<String, dynamic> json) =>
return QueryUsersResponse() 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() ??
[]; [];
}
QueryReactionsResponse _$QueryReactionsResponseFromJson( QueryReactionsResponse _$QueryReactionsResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return QueryReactionsResponse() 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() ??
[]; [];
}
QueryRepliesResponse _$QueryRepliesResponseFromJson(Map<String, dynamic> json) { QueryRepliesResponse _$QueryRepliesResponseFromJson(
return QueryRepliesResponse() Map<String, dynamic> json) =>
..duration = json['duration'] as String? QueryRepliesResponse()
..messages = (json['messages'] as List<dynamic>?) ..duration = json['duration'] as String?
?.map((e) => Message.fromJson(e as Map<String, dynamic>)) ..messages = (json['messages'] as List<dynamic>?)
.toList() ?? ?.map((e) => Message.fromJson(e as Map<String, dynamic>))
[]; .toList() ??
} [];
ListDevicesResponse _$ListDevicesResponseFromJson(Map<String, dynamic> json) { ListDevicesResponse _$ListDevicesResponseFromJson(Map<String, dynamic> json) =>
return ListDevicesResponse() ListDevicesResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..devices = (json['devices'] as List<dynamic>?) ..devices = (json['devices'] as List<dynamic>?)
?.map((e) => Device.fromJson(e as Map<String, dynamic>)) ?.map((e) => Device.fromJson(e as Map<String, dynamic>))
.toList() ?? .toList() ??
[]; [];
}
SendFileResponse _$SendFileResponseFromJson(Map<String, dynamic> json) { SendFileResponse _$SendFileResponseFromJson(Map<String, dynamic> json) =>
return SendFileResponse() SendFileResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..file = json['file'] as String; ..file = json['file'] as String;
}
SendImageResponse _$SendImageResponseFromJson(Map<String, dynamic> json) { SendImageResponse _$SendImageResponseFromJson(Map<String, dynamic> json) =>
return SendImageResponse() SendImageResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..file = json['file'] as String; ..file = json['file'] as String;
}
SendReactionResponse _$SendReactionResponseFromJson(Map<String, dynamic> json) { SendReactionResponse _$SendReactionResponseFromJson(
return SendReactionResponse() Map<String, dynamic> json) =>
..duration = json['duration'] as String? SendReactionResponse()
..message = Message.fromJson(json['message'] as Map<String, dynamic>) ..duration = json['duration'] as String?
..reaction = Reaction.fromJson(json['reaction'] as Map<String, dynamic>); ..message = Message.fromJson(json['message'] as Map<String, dynamic>)
} ..reaction = Reaction.fromJson(json['reaction'] as Map<String, dynamic>);
ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson( ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return ConnectGuestUserResponse() ConnectGuestUserResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..accessToken = json['access_token'] as String ..accessToken = json['access_token'] as String
..user = User.fromJson(json['user'] as Map<String, dynamic>); ..user = User.fromJson(json['user'] as Map<String, dynamic>);
}
UpdateUsersResponse _$UpdateUsersResponseFromJson(Map<String, dynamic> json) { UpdateUsersResponse _$UpdateUsersResponseFromJson(Map<String, dynamic> json) =>
return UpdateUsersResponse() 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>)),
) ?? ) ??
{}; {};
}
UpdateMessageResponse _$UpdateMessageResponseFromJson( UpdateMessageResponse _$UpdateMessageResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return UpdateMessageResponse() UpdateMessageResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>); ..message = Message.fromJson(json['message'] as Map<String, dynamic>);
}
SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) { SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) =>
return SendMessageResponse() SendMessageResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>); ..message = Message.fromJson(json['message'] as Map<String, dynamic>);
}
GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) { GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) =>
return GetMessageResponse() GetMessageResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>) ..message = 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(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return SearchMessagesResponse() SearchMessagesResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..results = (json['results'] as List<dynamic>?) ..results = (json['results'] as List<dynamic>?)
?.map((e) => GetMessageResponse.fromJson(e as Map<String, dynamic>)) ?.map(
.toList() ?? (e) => GetMessageResponse.fromJson(e as Map<String, dynamic>))
[] .toList() ??
..next = json['next'] as String? []
..previous = json['previous'] as String?; ..next = json['next'] as String?
} ..previous = json['previous'] as String?;
GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson( GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GetMessagesByIdResponse() 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() ??
[]; [];
}
UpdateChannelResponse _$UpdateChannelResponseFromJson( UpdateChannelResponse _$UpdateChannelResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return UpdateChannelResponse() UpdateChannelResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..channel = 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(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return PartialUpdateChannelResponse() PartialUpdateChannelResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..channel = 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();
}
InviteMembersResponse _$InviteMembersResponseFromJson( InviteMembersResponse _$InviteMembersResponseFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return InviteMembersResponse() InviteMembersResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..channel = 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(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return RemoveMembersResponse() RemoveMembersResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..channel = 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) =>
return SendActionResponse() 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<String, dynamic>); : Message.fromJson(json['message'] as Map<String, dynamic>);
}
AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) { AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) =>
return AddMembersResponse() AddMembersResponse()
..duration = json['duration'] as String? ..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..channel = 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(
return AcceptInviteResponse() Map<String, dynamic> json) =>
..duration = json['duration'] as String? AcceptInviteResponse()
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..duration = json['duration'] as String?
..members = (json['members'] as List<dynamic>?) ..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
?.map((e) => Member.fromJson(e as Map<String, dynamic>)) ..members = (json['members'] as List<dynamic>?)
.toList() ?? ?.map((e) => Member.fromJson(e as Map<String, dynamic>))
[] .toList() ??
..message = json['message'] == null []
? null ..message = json['message'] == null
: Message.fromJson(json['message'] as Map<String, dynamic>); ? null
} : Message.fromJson(json['message'] as Map<String, dynamic>);
RejectInviteResponse _$RejectInviteResponseFromJson(Map<String, dynamic> json) { RejectInviteResponse _$RejectInviteResponseFromJson(
return RejectInviteResponse() Map<String, dynamic> json) =>
..duration = json['duration'] as String? RejectInviteResponse()
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..duration = json['duration'] as String?
..members = (json['members'] as List<dynamic>?) ..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
?.map((e) => Member.fromJson(e as Map<String, dynamic>)) ..members = (json['members'] as List<dynamic>?)
.toList() ?? ?.map((e) => Member.fromJson(e as Map<String, dynamic>))
[] .toList() ??
..message = json['message'] == null []
? null ..message = json['message'] == null
: Message.fromJson(json['message'] as Map<String, dynamic>); ? null
} : Message.fromJson(json['message'] as Map<String, dynamic>);
EmptyResponse _$EmptyResponseFromJson(Map<String, dynamic> json) { EmptyResponse _$EmptyResponseFromJson(Map<String, dynamic> json) =>
return EmptyResponse()..duration = json['duration'] as String?; EmptyResponse()..duration = json['duration'] as String?;
}
ChannelStateResponse _$ChannelStateResponseFromJson(Map<String, dynamic> json) { ChannelStateResponse _$ChannelStateResponseFromJson(
return ChannelStateResponse() Map<String, dynamic> json) =>
..duration = json['duration'] as String? ChannelStateResponse()
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>) ..duration = json['duration'] as String?
..messages = (json['messages'] as List<dynamic>?) ..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
?.map((e) => Message.fromJson(e as Map<String, dynamic>)) ..messages = (json['messages'] as List<dynamic>?)
.toList() ?? ?.map((e) => Message.fromJson(e as Map<String, dynamic>))
[] .toList() ??
..members = (json['members'] as List<dynamic>?) []
?.map((e) => Member.fromJson(e as Map<String, dynamic>)) ..members = (json['members'] as List<dynamic>?)
.toList() ?? ?.map((e) => Member.fromJson(e as Map<String, dynamic>))
[] .toList() ??
..watcherCount = json['watcher_count'] as int? ?? 0 []
..read = (json['read'] as List<dynamic>?) ..watcherCount = json['watcher_count'] as int? ?? 0
?.map((e) => Read.fromJson(e as Map<String, dynamic>)) ..read = (json['read'] as List<dynamic>?)
.toList() ?? ?.map((e) => Read.fromJson(e as Map<String, dynamic>))
[]; .toList() ??
} [];
@@ -21,7 +21,6 @@ class Action {
final String name; final String name;
/// The style of the action /// The style of the action
@JsonKey(defaultValue: 'default')
final String style; final String style;
/// The test of the action /// The test of the action
@@ -6,15 +6,13 @@ part of 'action.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Action _$ActionFromJson(Map<String, dynamic> json) { Action _$ActionFromJson(Map<String, dynamic> json) => Action(
return Action( name: json['name'] as String,
name: json['name'] as String, style: json['style'] as String? ?? 'default',
style: json['style'] as String? ?? 'default', 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?, );
);
}
Map<String, dynamic> _$ActionToJson(Action instance) => <String, dynamic>{ Map<String, dynamic> _$ActionToJson(Action instance) => <String, dynamic>{
'name': instance.name, 'name': instance.name,
@@ -117,10 +117,7 @@ class Attachment extends Equatable {
late final UploadState uploadState; late final UploadState uploadState;
/// Map of custom channel extraData /// Map of custom channel extraData
@JsonKey( @JsonKey(includeIfNull: false)
includeIfNull: false,
defaultValue: {},
)
final Map<String, Object?> extraData; final Map<String, Object?> extraData;
/// The attachment ID. /// The attachment ID.
@@ -6,39 +6,37 @@ part of 'attachment.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Attachment _$AttachmentFromJson(Map<String, dynamic> json) { Attachment _$AttachmentFromJson(Map<String, dynamic> json) => 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<dynamic>?)
actions: (json['actions'] as List<dynamic>?) ?.map((e) => Action.fromJson(e as Map<String, dynamic>))
?.map((e) => Action.fromJson(e as Map<String, dynamic>)) .toList() ??
.toList() ?? [],
[], extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, file: json['file'] == null
file: json['file'] == null ? null
? null : AttachmentFile.fromJson(json['file'] as Map<String, dynamic>),
: AttachmentFile.fromJson(json['file'] as Map<String, dynamic>), uploadState: json['upload_state'] == null
uploadState: json['upload_state'] == null ? null
? null : UploadState.fromJson(json['upload_state'] as Map<String, dynamic>),
: UploadState.fromJson(json['upload_state'] as Map<String, dynamic>), );
);
}
Map<String, dynamic> _$AttachmentToJson(Attachment instance) { Map<String, dynamic> _$AttachmentToJson(Attachment instance) {
final val = <String, dynamic>{}; final val = <String, dynamic>{};
@@ -1,5 +1,6 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// 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 // 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, invalid_annotation_target
part of 'attachment_file.dart'; part of 'attachment_file.dart';
@@ -13,7 +14,7 @@ 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'); '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':
return Preparing.fromJson(json); return Preparing.fromJson(json);
case 'inProgress': case 'inProgress':
@@ -24,7 +25,8 @@ UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
return Failed.fromJson(json); return Failed.fromJson(json);
default: default:
throw FallThroughError(); throw CheckedFromJsonException(json, 'runtimeType', 'UploadState',
'Invalid union type "${json['runtimeType']}"!');
} }
} }
@@ -72,6 +74,14 @@ mixin _$UploadState {
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
TResult Function()? preparing, TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress, TResult Function(int uploaded, int total)? inProgress,
@@ -89,6 +99,14 @@ mixin _$UploadState {
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
TResult Function(Preparing value)? preparing, TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress, TResult Function(InProgress value)? inProgress,
@@ -138,7 +156,7 @@ class _$Preparing implements Preparing {
const _$Preparing(); const _$Preparing();
factory _$Preparing.fromJson(Map<String, dynamic> json) => factory _$Preparing.fromJson(Map<String, dynamic> json) =>
_$_$PreparingFromJson(json); _$$PreparingFromJson(json);
@override @override
String toString() { String toString() {
@@ -164,6 +182,17 @@ class _$Preparing implements Preparing {
return preparing(); return preparing();
} }
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return preparing?.call();
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
@@ -190,6 +219,17 @@ class _$Preparing implements Preparing {
return preparing(this); return preparing(this);
} }
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return preparing?.call(this);
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
@@ -207,7 +247,7 @@ class _$Preparing implements Preparing {
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$_$PreparingToJson(this)..['runtimeType'] = 'preparing'; return _$$PreparingToJson(this)..['runtimeType'] = 'preparing';
} }
} }
@@ -258,7 +298,7 @@ class _$InProgress implements InProgress {
const _$InProgress({required this.uploaded, required 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);
@override @override
final int uploaded; final int uploaded;
@@ -303,6 +343,17 @@ class _$InProgress implements InProgress {
return inProgress(uploaded, total); return inProgress(uploaded, total);
} }
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return inProgress?.call(uploaded, total);
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
@@ -329,6 +380,17 @@ class _$InProgress implements InProgress {
return inProgress(this); return inProgress(this);
} }
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return inProgress?.call(this);
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
@@ -346,7 +408,7 @@ class _$InProgress implements InProgress {
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$_$InProgressToJson(this)..['runtimeType'] = 'inProgress'; return _$$InProgressToJson(this)..['runtimeType'] = 'inProgress';
} }
} }
@@ -386,7 +448,7 @@ class _$Success implements Success {
const _$Success(); const _$Success();
factory _$Success.fromJson(Map<String, dynamic> json) => factory _$Success.fromJson(Map<String, dynamic> json) =>
_$_$SuccessFromJson(json); _$$SuccessFromJson(json);
@override @override
String toString() { String toString() {
@@ -412,6 +474,17 @@ class _$Success implements Success {
return success(); return success();
} }
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return success?.call();
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
@@ -438,6 +511,17 @@ class _$Success implements Success {
return success(this); return success(this);
} }
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return success?.call(this);
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
@@ -455,7 +539,7 @@ class _$Success implements Success {
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$_$SuccessToJson(this)..['runtimeType'] = 'success'; return _$$SuccessToJson(this)..['runtimeType'] = 'success';
} }
} }
@@ -500,7 +584,7 @@ class _$Failed implements Failed {
const _$Failed({required this.error}); const _$Failed({required this.error});
factory _$Failed.fromJson(Map<String, dynamic> json) => factory _$Failed.fromJson(Map<String, dynamic> json) =>
_$_$FailedFromJson(json); _$$FailedFromJson(json);
@override @override
final String error; final String error;
@@ -538,6 +622,17 @@ class _$Failed implements Failed {
return failed(error); return failed(error);
} }
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return failed?.call(error);
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
@@ -564,6 +659,17 @@ class _$Failed implements Failed {
return failed(this); return failed(this);
} }
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return failed?.call(this);
}
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
@@ -581,7 +687,7 @@ class _$Failed implements Failed {
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$_$FailedToJson(this)..['runtimeType'] = 'failed'; return _$$FailedToJson(this)..['runtimeType'] = 'failed';
} }
} }
@@ -6,14 +6,13 @@ part of 'attachment_file.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) { AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) =>
return AttachmentFile( AttachmentFile(
size: json['size'] as int?, size: json['size'] as int?,
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?),
); );
}
Map<String, dynamic> _$AttachmentFileToJson(AttachmentFile instance) => Map<String, dynamic> _$AttachmentFileToJson(AttachmentFile instance) =>
<String, dynamic>{ <String, dynamic>{
@@ -23,39 +22,31 @@ Map<String, dynamic> _$AttachmentFileToJson(AttachmentFile instance) =>
'size': instance.size, 'size': instance.size,
}; };
_$Preparing _$_$PreparingFromJson(Map<String, dynamic> json) { _$Preparing _$$PreparingFromJson(Map<String, dynamic> json) => _$Preparing();
return _$Preparing();
}
Map<String, dynamic> _$_$PreparingToJson(_$Preparing instance) => Map<String, dynamic> _$$PreparingToJson(_$Preparing instance) =>
<String, dynamic>{}; <String, dynamic>{};
_$InProgress _$_$InProgressFromJson(Map<String, dynamic> json) { _$InProgress _$$InProgressFromJson(Map<String, dynamic> json) => _$InProgress(
return _$InProgress( uploaded: json['uploaded'] as int,
uploaded: json['uploaded'] as int, total: json['total'] as int,
total: json['total'] as int, );
);
}
Map<String, dynamic> _$_$InProgressToJson(_$InProgress instance) => Map<String, dynamic> _$$InProgressToJson(_$InProgress instance) =>
<String, dynamic>{ <String, dynamic>{
'uploaded': instance.uploaded, 'uploaded': instance.uploaded,
'total': instance.total, 'total': instance.total,
}; };
_$Success _$_$SuccessFromJson(Map<String, dynamic> json) { _$Success _$$SuccessFromJson(Map<String, dynamic> json) => _$Success();
return _$Success();
}
Map<String, dynamic> _$_$SuccessToJson(_$Success instance) => Map<String, dynamic> _$$SuccessToJson(_$Success instance) =>
<String, dynamic>{}; <String, dynamic>{};
_$Failed _$_$FailedFromJson(Map<String, dynamic> json) { _$Failed _$$FailedFromJson(Map<String, dynamic> json) => _$Failed(
return _$Failed( error: json['error'] as String,
error: json['error'] as String, );
);
}
Map<String, dynamic> _$_$FailedToJson(_$Failed instance) => <String, dynamic>{ Map<String, dynamic> _$$FailedToJson(_$Failed instance) => <String, dynamic>{
'error': instance.error, 'error': instance.error,
}; };
@@ -31,15 +31,12 @@ class ChannelConfig {
_$ChannelConfigFromJson(json); _$ChannelConfigFromJson(json);
/// Moderation configuration /// Moderation configuration
@JsonKey(defaultValue: 'flag')
final String automod; final String automod;
/// List of available commands /// List of available commands
@JsonKey(defaultValue: [])
final List<Command> commands; final List<Command> commands;
/// True if the channel should send connect events /// True if the channel should send connect events
@JsonKey(defaultValue: false)
final bool connectEvents; final bool connectEvents;
/// Date of channel creation /// Date of channel creation
@@ -49,43 +46,33 @@ class ChannelConfig {
final DateTime updatedAt; final DateTime updatedAt;
/// Max channel message length /// Max channel message length
@JsonKey(defaultValue: 0)
final int maxMessageLength; final int maxMessageLength;
/// Duration of message retention /// Duration of message retention
@JsonKey(defaultValue: '')
final String messageRetention; final String messageRetention;
/// True if users can be muted /// True if users can be muted
@JsonKey(defaultValue: false)
final bool mutes; final bool mutes;
/// True if reaction are active for this channel /// True if reaction are active for this channel
@JsonKey(defaultValue: false)
final bool reactions; final bool reactions;
/// True if readEvents are active for this channel /// True if readEvents are active for this channel
@JsonKey(defaultValue: false)
final bool readEvents; final bool readEvents;
/// True if reply message are active for this channel /// True if reply message are active for this channel
@JsonKey(defaultValue: false)
final bool replies; final bool replies;
/// True if it's possible to perform a search in this channel /// True if it's possible to perform a search in this channel
@JsonKey(defaultValue: false)
final bool search; final bool search;
/// True if typing events should be sent for this channel /// True if typing events should be sent for this channel
@JsonKey(defaultValue: false)
final bool typingEvents; final bool typingEvents;
/// True if it's possible to upload files to this channel /// True if it's possible to upload files to this channel
@JsonKey(defaultValue: false)
final bool uploads; final bool uploads;
/// True if urls appears as attachments /// True if urls appears as attachments
@JsonKey(defaultValue: false)
final bool urlEnrichment; final bool urlEnrichment;
/// Serialize to json /// Serialize to json
@@ -6,32 +6,31 @@ part of 'channel_config.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
ChannelConfig _$ChannelConfigFromJson(Map<String, dynamic> json) { ChannelConfig _$ChannelConfigFromJson(Map<String, dynamic> json) =>
return ChannelConfig( ChannelConfig(
automod: json['automod'] as String? ?? 'flag', automod: json['automod'] as String? ?? 'flag',
commands: (json['commands'] as List<dynamic>?) commands: (json['commands'] as List<dynamic>?)
?.map((e) => Command.fromJson(e as Map<String, dynamic>)) ?.map((e) => Command.fromJson(e as Map<String, dynamic>))
.toList() ?? .toList() ??
[], const [],
connectEvents: json['connect_events'] as bool? ?? false, connectEvents: json['connect_events'] as bool? ?? false,
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? ?? 0, maxMessageLength: json['max_message_length'] as int? ?? 0,
messageRetention: json['message_retention'] as String? ?? '', messageRetention: json['message_retention'] as String? ?? '',
mutes: json['mutes'] as bool? ?? false, mutes: json['mutes'] as bool? ?? false,
reactions: json['reactions'] as bool? ?? false, reactions: json['reactions'] as bool? ?? false,
readEvents: json['read_events'] as bool? ?? false, readEvents: json['read_events'] as bool? ?? false,
replies: json['replies'] as bool? ?? false, replies: json['replies'] as bool? ?? false,
search: json['search'] as bool? ?? false, search: json['search'] as bool? ?? false,
typingEvents: json['typing_events'] as bool? ?? false, typingEvents: json['typing_events'] as bool? ?? false,
uploads: json['uploads'] as bool? ?? false, uploads: json['uploads'] as bool? ?? false,
urlEnrichment: json['url_enrichment'] as bool? ?? false, urlEnrichment: json['url_enrichment'] as bool? ?? false,
); );
}
Map<String, dynamic> _$ChannelConfigToJson(ChannelConfig instance) => Map<String, dynamic> _$ChannelConfigToJson(ChannelConfig instance) =>
<String, dynamic>{ <String, dynamic>{
@@ -59,7 +59,7 @@ class ChannelModel {
final User? createdBy; final User? createdBy;
/// True if this channel is frozen /// True if this channel is frozen
@JsonKey(includeIfNull: false, defaultValue: false) @JsonKey(includeIfNull: false)
final bool frozen; final bool frozen;
/// The date of the last message /// The date of the last message
@@ -79,18 +79,15 @@ class ChannelModel {
final DateTime? deletedAt; final DateTime? deletedAt;
/// The count of this channel members /// The count of this channel members
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly, defaultValue: 0) @JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final int memberCount; final int memberCount;
/// The number of seconds in a cooldown /// The number of seconds in a cooldown
@JsonKey(includeIfNull: false, defaultValue: 0) @JsonKey(includeIfNull: false)
final int cooldown; final int cooldown;
/// Map of custom channel extraData /// Map of custom channel extraData
@JsonKey( @JsonKey(includeIfNull: false)
includeIfNull: false,
defaultValue: {},
)
final Map<String, Object?> extraData; final Map<String, Object?> extraData;
/// The team the channel belongs to /// The team the channel belongs to
@@ -6,36 +6,34 @@ part of 'channel_model.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) { ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) => 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<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 : DateTime.parse(json['last_message_at'] as String),
: DateTime.parse(json['last_message_at'] 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), 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), 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? ?? 0,
memberCount: json['member_count'] as int? ?? 0, extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, team: json['team'] as String?,
team: json['team'] as String?, cooldown: json['cooldown'] as int? ?? 0,
cooldown: json['cooldown'] as int? ?? 0, );
);
}
Map<String, dynamic> _$ChannelModelToJson(ChannelModel instance) { Map<String, dynamic> _$ChannelModelToJson(ChannelModel instance) {
final val = <String, dynamic>{ final val = <String, dynamic>{
@@ -25,26 +25,21 @@ class ChannelState {
final ChannelModel? channel; final ChannelModel? channel;
/// A paginated list of channel messages /// A paginated list of channel messages
@JsonKey(defaultValue: <Message>[])
final List<Message> messages; final List<Message> messages;
/// A paginated list of channel members /// A paginated list of channel members
@JsonKey(defaultValue: <Member>[])
final List<Member> members; final List<Member> members;
/// A paginated list of pinned messages /// A paginated list of pinned messages
@JsonKey(defaultValue: <Message>[])
final List<Message> pinnedMessages; final List<Message> pinnedMessages;
/// The count of users watching the channel /// The count of users watching the channel
final int? watcherCount; final int? watcherCount;
/// A paginated list of users watching the channel /// A paginated list of users watching the channel
@JsonKey(defaultValue: <User>[])
final List<User> watchers; final List<User> watchers;
/// The list of channel reads /// The list of channel reads
@JsonKey(defaultValue: <Read>[])
final List<Read> read; final List<Read> read;
/// Create a new instance from a json /// Create a new instance from a json
@@ -6,34 +6,32 @@ part of 'channel_state.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
ChannelState _$ChannelStateFromJson(Map<String, dynamic> json) { ChannelState _$ChannelStateFromJson(Map<String, dynamic> json) => 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() ?? const [],
[], 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() ?? const [],
[], 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() ?? const [],
[], 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() ?? const [],
[], read: (json['read'] as List<dynamic>?)
read: (json['read'] as List<dynamic>?) ?.map((e) => Read.fromJson(e as Map<String, dynamic>))
?.map((e) => Read.fromJson(e as Map<String, dynamic>)) .toList() ??
.toList() ?? const [],
[], );
);
}
Map<String, dynamic> _$ChannelStateToJson(ChannelState instance) => Map<String, dynamic> _$ChannelStateToJson(ChannelState instance) =>
<String, dynamic>{ <String, dynamic>{
@@ -6,13 +6,11 @@ part of 'command.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Command _$CommandFromJson(Map<String, dynamic> json) { Command _$CommandFromJson(Map<String, dynamic> json) => 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, );
);
}
Map<String, dynamic> _$CommandToJson(Command instance) => <String, dynamic>{ Map<String, dynamic> _$CommandToJson(Command instance) => <String, dynamic>{
'name': instance.name, 'name': instance.name,
@@ -6,12 +6,10 @@ part of 'device.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Device _$DeviceFromJson(Map<String, dynamic> json) { Device _$DeviceFromJson(Map<String, dynamic> json) => 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, );
);
}
Map<String, dynamic> _$DeviceToJson(Device instance) => <String, dynamic>{ Map<String, dynamic> _$DeviceToJson(Device instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
@@ -92,7 +92,6 @@ class Event {
final bool isLocal; final bool isLocal;
/// Map of custom channel extraData /// Map of custom channel extraData
@JsonKey(defaultValue: {})
final Map<String, Object?> extraData; final Map<String, Object?> extraData;
/// Known top level fields. /// Known top level fields.
@@ -6,42 +6,40 @@ part of 'event.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Event _$EventFromJson(Map<String, dynamic> json) { Event _$EventFromJson(Map<String, dynamic> json) => Event(
return Event( type: json['type'] as String? ?? 'local.event',
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<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>), channelId: json['channel_id'] as String?,
channelId: json['channel_id'] as String?, channelType: json['channel_type'] as String?,
channelType: json['channel_type'] as String?, parentId: json['parent_id'] as String?,
parentId: json['parent_id'] as String?, extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, isLocal: json['is_local'] as bool? ?? false,
isLocal: json['is_local'] as bool? ?? false, );
);
}
Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{ Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{
'type': instance.type, 'type': instance.type,
@@ -64,30 +62,28 @@ Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{
'extra_data': instance.extraData, 'extra_data': instance.extraData,
}; };
EventChannel _$EventChannelFromJson(Map<String, dynamic> json) { EventChannel _$EventChannelFromJson(Map<String, dynamic> json) => EventChannel(
return EventChannel( 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(), 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: 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 : DateTime.parse(json['last_message_at'] as String),
: DateTime.parse(json['last_message_at'] as String), createdAt: DateTime.parse(json['created_at'] as String),
createdAt: DateTime.parse(json['created_at'] as String), updatedAt: DateTime.parse(json['updated_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String), 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? ?? 0, extraData: json['extra_data'] as Map<String, dynamic>?,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, cooldown: json['cooldown'] as int,
cooldown: json['cooldown'] as int? ?? 0, team: json['team'] as String?,
team: json['team'] as String?, );
);
}
@@ -42,7 +42,6 @@ class Member extends Equatable {
final DateTime? inviteRejectedAt; final DateTime? inviteRejectedAt;
/// True if the user has been invited to the channel /// True if the user has been invited to the channel
@JsonKey(defaultValue: false)
final bool invited; final bool invited;
/// The role of the user in the channel /// The role of the user in the channel
@@ -52,15 +51,12 @@ class Member extends Equatable {
final String? userId; final String? userId;
/// True if the user is a moderator of the channel /// True if the user is a moderator of the channel
@JsonKey(defaultValue: false)
final bool isModerator; final bool isModerator;
/// True if the member is banned from the channel /// True if the member is banned from the channel
@JsonKey(defaultValue: false)
final bool banned; final bool banned;
/// True if the member is shadow banned from the channel /// True if the member is shadow banned from the channel
@JsonKey(defaultValue: false)
final bool shadowBanned; final bool shadowBanned;
/// The date of creation /// The date of creation
@@ -6,31 +6,29 @@ part of 'member.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Member _$MemberFromJson(Map<String, dynamic> json) { Member _$MemberFromJson(Map<String, dynamic> json) => 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), 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? ?? false,
invited: json['invited'] as bool? ?? false, 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? ?? false,
isModerator: json['is_moderator'] as bool? ?? false, 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? ?? false,
banned: json['banned'] as bool? ?? false, shadowBanned: json['shadow_banned'] as bool? ?? false,
shadowBanned: json['shadow_banned'] as bool? ?? false, );
);
}
Map<String, dynamic> _$MemberToJson(Member instance) => <String, dynamic>{ Map<String, dynamic> _$MemberToJson(Member instance) => <String, dynamic>{
'user': instance.user?.toJson(), 'user': instance.user?.toJson(),
@@ -98,23 +98,16 @@ class Message extends Equatable {
@JsonKey( @JsonKey(
includeIfNull: false, includeIfNull: false,
toJson: Serializer.readOnly, toJson: Serializer.readOnly,
defaultValue: 'regular',
) )
final String type; final String type;
/// The list of attachments, either provided by the user or generated from a /// The list of attachments, either provided by the user or generated from a
/// command or as a result of URL scraping. /// command or as a result of URL scraping.
@JsonKey( @JsonKey(includeIfNull: false)
includeIfNull: false,
defaultValue: [],
)
final List<Attachment> attachments; final List<Attachment> attachments;
/// The list of user mentioned in the message /// The list of user mentioned in the message
@JsonKey( @JsonKey(toJson: User.toIds)
toJson: User.toIds,
defaultValue: [],
)
final List<User> mentionedUsers; final List<User> mentionedUsers;
/// A map describing the count of number of every reaction /// A map describing the count of number of every reaction
@@ -155,14 +148,12 @@ class Message extends Equatable {
final bool? showInChannel; final bool? showInChannel;
/// If true the message is silent /// If true the message is silent
@JsonKey(defaultValue: false)
final bool silent; final bool silent;
/// If true the message is shadowed /// If true the message is shadowed
@JsonKey( @JsonKey(
includeIfNull: false, includeIfNull: false,
toJson: Serializer.readOnly, toJson: Serializer.readOnly,
defaultValue: false,
) )
final bool shadowed; final bool shadowed;
@@ -183,7 +174,6 @@ class Message extends Equatable {
final User? user; final User? user;
/// If true the message is pinned /// If true the message is pinned
@JsonKey(defaultValue: false)
final bool pinned; final bool pinned;
/// Reserved field indicating when the message was pinned /// Reserved field indicating when the message was pinned
@@ -200,10 +190,7 @@ class Message extends Equatable {
final User? pinnedBy; final User? pinnedBy;
/// Message custom extraData /// Message custom extraData
@JsonKey( @JsonKey(includeIfNull: false)
includeIfNull: false,
defaultValue: {},
)
final Map<String, Object?> extraData; final Map<String, Object?> extraData;
/// True if the message is a system info /// True if the message is a system info
@@ -6,72 +6,70 @@ part of 'message.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Message _$MessageFromJson(Map<String, dynamic> json) { Message _$MessageFromJson(Map<String, dynamic> json) => 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? ?? 'regular',
type: json['type'] as String? ?? 'regular', attachments: (json['attachments'] as List<dynamic>?)
attachments: (json['attachments'] as List<dynamic>?) ?.map((e) => Attachment.fromJson(e as Map<String, dynamic>))
?.map((e) => Attachment.fromJson(e as Map<String, dynamic>)) .toList() ??
.toList() ?? const [],
[], 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() ?? const [],
[], silent: json['silent'] as bool? ?? false,
silent: json['silent'] as bool? ?? false, shadowed: json['shadowed'] as bool? ?? false,
shadowed: json['shadowed'] as bool? ?? false, reactionCounts: (json['reaction_counts'] as Map<String, dynamic>?)?.map(
reactionCounts: (json['reaction_counts'] as Map<String, dynamic>?)?.map( (k, e) => MapEntry(k, e as int),
(k, e) => MapEntry(k, e as int), ),
), reactionScores: (json['reaction_scores'] as Map<String, dynamic>?)?.map(
reactionScores: (json['reaction_scores'] as Map<String, dynamic>?)?.map( (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? ?? 0,
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?, 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), 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? ?? false,
pinned: json['pinned'] as bool? ?? false, 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), pinExpires: json['pin_expires'] == null
pinExpires: json['pin_expires'] == null ? null
? null : 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>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, 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), i18n: (json['i18n'] as Map<String, dynamic>?)?.map(
i18n: (json['i18n'] as Map<String, dynamic>?)?.map( (k, e) => MapEntry(k, e as String),
(k, e) => MapEntry(k, e as String), ),
), );
);
}
Map<String, dynamic> _$MessageToJson(Message instance) { Map<String, dynamic> _$MessageToJson(Message instance) {
final val = <String, dynamic>{ final val = <String, dynamic>{
@@ -6,11 +6,9 @@ part of 'mute.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Mute _$MuteFromJson(Map<String, dynamic> json) { Mute _$MuteFromJson(Map<String, dynamic> json) => Mute(
return Mute( user: User.fromJson(json['user'] as Map<String, dynamic>),
user: User.fromJson(json['user'] as Map<String, dynamic>), channel: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
channel: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>), createdAt: DateTime.parse(json['created_at'] as String),
createdAt: DateTime.parse(json['created_at'] as String), updatedAt: DateTime.parse(json['updated_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String), );
);
}
@@ -131,23 +131,23 @@ class OwnUser extends User {
} }
/// List of user devices. /// List of user devices.
@JsonKey(includeIfNull: false, defaultValue: <Device>[]) @JsonKey(includeIfNull: false)
final List<Device> devices; final List<Device> devices;
/// List of users muted by the user. /// List of users muted by the user.
@JsonKey(includeIfNull: false, defaultValue: <Mute>[]) @JsonKey(includeIfNull: false)
final List<Mute> mutes; final List<Mute> mutes;
/// List of users muted by the user. /// List of users muted by the user.
@JsonKey(includeIfNull: false, defaultValue: <Mute>[]) @JsonKey(includeIfNull: false)
final List<Mute> channelMutes; final List<Mute> channelMutes;
/// Total unread messages by the user. /// Total unread messages by the user.
@JsonKey(includeIfNull: false, defaultValue: 0) @JsonKey(includeIfNull: false)
final int totalUnreadCount; final int totalUnreadCount;
/// Total unread channels by the user. /// Total unread channels by the user.
@JsonKey(includeIfNull: false, defaultValue: 0) @JsonKey(includeIfNull: false)
final int unreadChannels; final int unreadChannels;
/// Known top level fields. /// Known top level fields.
@@ -6,39 +6,37 @@ part of 'own_user.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
OwnUser _$OwnUserFromJson(Map<String, dynamic> json) { OwnUser _$OwnUserFromJson(Map<String, dynamic> json) => OwnUser(
return OwnUser( devices: (json['devices'] as List<dynamic>?)
devices: (json['devices'] as List<dynamic>?) ?.map((e) => Device.fromJson(e as Map<String, dynamic>))
?.map((e) => Device.fromJson(e as Map<String, dynamic>)) .toList() ??
.toList() ?? const [],
[], mutes: (json['mutes'] as List<dynamic>?)
mutes: (json['mutes'] as List<dynamic>?) ?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
?.map((e) => Mute.fromJson(e as Map<String, dynamic>)) .toList() ??
.toList() ?? const [],
[], totalUnreadCount: json['total_unread_count'] as int? ?? 0,
totalUnreadCount: json['total_unread_count'] as int? ?? 0, unreadChannels: json['unread_channels'] as int? ?? 0,
unreadChannels: json['unread_channels'] as int? ?? 0, channelMutes: (json['channel_mutes'] as List<dynamic>?)
channelMutes: (json['channel_mutes'] as List<dynamic>?) ?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
?.map((e) => Mute.fromJson(e as Map<String, dynamic>)) .toList() ??
.toList() ?? const [],
[], 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), 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), 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? ?? false,
online: json['online'] as bool? ?? false, extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, banned: json['banned'] as bool? ?? false,
banned: json['banned'] as bool? ?? false, teams:
teams: (json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ?? const [],
[], language: json['language'] as String?,
language: json['language'] as String?, );
);
}
@@ -41,7 +41,6 @@ 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
@@ -49,10 +48,7 @@ class Reaction {
final String? userId; final String? userId;
/// Reaction custom extraData /// Reaction custom extraData
@JsonKey( @JsonKey(includeIfNull: false)
includeIfNull: false,
defaultValue: {},
)
final Map<String, Object?> extraData; final Map<String, Object?> extraData;
/// Map of custom user extraData /// Map of custom user extraData
@@ -6,21 +6,19 @@ part of 'reaction.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Reaction _$ReactionFromJson(Map<String, dynamic> json) { Reaction _$ReactionFromJson(Map<String, dynamic> json) => 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<String, dynamic>),
: 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? ?? 0,
score: json['score'] as int? ?? 0, extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, );
);
}
Map<String, dynamic> _$ReactionToJson(Reaction instance) { Map<String, dynamic> _$ReactionToJson(Reaction instance) {
final val = <String, dynamic>{ final val = <String, dynamic>{
@@ -23,7 +23,6 @@ class Read {
final User user; final User user;
/// Number of unread messages /// Number of unread messages
@JsonKey(defaultValue: 0)
final int unreadMessages; final int unreadMessages;
/// Serialize to json /// Serialize to json
@@ -6,13 +6,11 @@ part of 'read.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Read _$ReadFromJson(Map<String, dynamic> json) { Read _$ReadFromJson(Map<String, dynamic> json) => 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, );
);
}
Map<String, dynamic> _$ReadToJson(Read instance) => <String, dynamic>{ Map<String, dynamic> _$ReadToJson(Read instance) => <String, dynamic>{
'last_read': instance.lastRead.toIso8601String(), 'last_read': instance.lastRead.toIso8601String(),
@@ -100,7 +100,6 @@ class User extends Equatable {
@JsonKey( @JsonKey(
includeIfNull: false, includeIfNull: false,
toJson: Serializer.readOnly, toJson: Serializer.readOnly,
defaultValue: <String>[],
) )
final List<String> teams; final List<String> teams;
@@ -118,19 +117,20 @@ class User extends Equatable {
/// True if user is online. /// True if user is online.
@JsonKey( @JsonKey(
includeIfNull: false, toJson: Serializer.readOnly, defaultValue: false) includeIfNull: false,
toJson: Serializer.readOnly,
)
final bool online; final bool online;
/// True if user is banned from the chat. /// True if user is banned from the chat.
@JsonKey( @JsonKey(
includeIfNull: false, toJson: Serializer.readOnly, defaultValue: false) includeIfNull: false,
toJson: Serializer.readOnly,
)
final bool banned; final bool banned;
/// Map of custom user extraData. /// Map of custom user extraData.
@JsonKey( @JsonKey(includeIfNull: false)
includeIfNull: false,
defaultValue: {},
)
final Map<String, Object?> extraData; final Map<String, Object?> extraData;
/// The language this user prefers. /// The language this user prefers.
@@ -6,28 +6,26 @@ part of 'user.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
User _$UserFromJson(Map<String, dynamic> json) { User _$UserFromJson(Map<String, dynamic> json) => 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), 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), 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), extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
extraData: json['extra_data'] as Map<String, dynamic>? ?? {}, online: json['online'] as bool? ?? false,
online: json['online'] as bool? ?? false, banned: json['banned'] as bool? ?? false,
banned: json['banned'] as bool? ?? false, teams:
teams: (json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ?? const [],
[], language: json['language'] as String?,
language: json['language'] as String?, );
);
}
Map<String, dynamic> _$UserToJson(User instance) { Map<String, dynamic> _$UserToJson(User instance) {
final val = <String, dynamic>{ final val = <String, dynamic>{