dart format
This commit is contained in:
@@ -12,7 +12,8 @@ class GetChatResponse extends ApiResponse {
|
||||
|
||||
GetChatResponse(this.data);
|
||||
|
||||
factory GetChatResponse.fromJson(Map<String, dynamic> json) => _$GetChatResponseFromJson(json);
|
||||
factory GetChatResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetChatResponseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetChatResponseToJson(this);
|
||||
|
||||
List<GetChatResponseObject> sortByTimestamp() {
|
||||
@@ -37,28 +38,30 @@ class GetChatResponseObject {
|
||||
String message;
|
||||
Map<String, int>? reactions;
|
||||
List<String>? reactionsSelf;
|
||||
@JsonKey(fromJson: _fromJson) Map<String, RichObjectString>? messageParameters;
|
||||
@JsonKey(fromJson: _fromJson)
|
||||
Map<String, RichObjectString>? messageParameters;
|
||||
GetChatResponseObject? parent;
|
||||
|
||||
GetChatResponseObject(
|
||||
this.id,
|
||||
this.token,
|
||||
this.actorType,
|
||||
this.actorId,
|
||||
this.actorDisplayName,
|
||||
this.timestamp,
|
||||
this.systemMessage,
|
||||
this.messageType,
|
||||
this.isReplyable,
|
||||
this.referenceId,
|
||||
this.message,
|
||||
this.messageParameters,
|
||||
this.reactions,
|
||||
this.reactionsSelf,
|
||||
this.parent,
|
||||
this.id,
|
||||
this.token,
|
||||
this.actorType,
|
||||
this.actorId,
|
||||
this.actorDisplayName,
|
||||
this.timestamp,
|
||||
this.systemMessage,
|
||||
this.messageType,
|
||||
this.isReplyable,
|
||||
this.referenceId,
|
||||
this.message,
|
||||
this.messageParameters,
|
||||
this.reactions,
|
||||
this.reactionsSelf,
|
||||
this.parent,
|
||||
);
|
||||
|
||||
factory GetChatResponseObject.fromJson(Map<String, dynamic> json) => _$GetChatResponseObjectFromJson(json);
|
||||
factory GetChatResponseObject.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetChatResponseObjectFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetChatResponseObjectToJson(this);
|
||||
|
||||
static GetChatResponseObject getDateDummy(int timestamp) {
|
||||
@@ -66,7 +69,8 @@ class GetChatResponseObject {
|
||||
return getTextDummy(elementDate.formatDate());
|
||||
}
|
||||
|
||||
static GetChatResponseObject getTextDummy(String text) => GetChatResponseObject(
|
||||
static GetChatResponseObject getTextDummy(String text) =>
|
||||
GetChatResponseObject(
|
||||
0,
|
||||
'',
|
||||
GetRoomResponseObjectMessageActorType.user,
|
||||
@@ -82,15 +86,17 @@ class GetChatResponseObject {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, RichObjectString>? _fromJson(dynamic json) {
|
||||
if (json is Map<String, dynamic>) {
|
||||
final data = <String, RichObjectString>{};
|
||||
for (final element in json.keys) {
|
||||
data.putIfAbsent(element, () => RichObjectString.fromJson(json[element] as Map<String, dynamic>));
|
||||
data.putIfAbsent(
|
||||
element,
|
||||
() => RichObjectString.fromJson(json[element] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -109,17 +115,26 @@ class RichObjectString {
|
||||
|
||||
RichObjectString(this.type, this.id, this.name, this.path, this.link);
|
||||
|
||||
factory RichObjectString.fromJson(Map<String, dynamic> json) => _$RichObjectStringFromJson(json);
|
||||
factory RichObjectString.fromJson(Map<String, dynamic> json) =>
|
||||
_$RichObjectStringFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$RichObjectStringToJson(this);
|
||||
}
|
||||
|
||||
enum RichObjectStringObjectType {
|
||||
@JsonValue('user') user,
|
||||
@JsonValue('group') group,
|
||||
@JsonValue('file') file,
|
||||
@JsonValue('guest') guest,
|
||||
@JsonValue('highlight') highlight,
|
||||
@JsonValue('talk-poll') talkPoll,
|
||||
@JsonValue('geo-location') geoLocation,
|
||||
@JsonValue('call') call,
|
||||
@JsonValue('user')
|
||||
user,
|
||||
@JsonValue('group')
|
||||
group,
|
||||
@JsonValue('file')
|
||||
file,
|
||||
@JsonValue('guest')
|
||||
guest,
|
||||
@JsonValue('highlight')
|
||||
highlight,
|
||||
@JsonValue('talk-poll')
|
||||
talkPoll,
|
||||
@JsonValue('geo-location')
|
||||
geoLocation,
|
||||
@JsonValue('call')
|
||||
call,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user