1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-16 10:30:24 +01:00
lemmur-app-android/lib/client/models/comment.dart

95 lines
2.2 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'comment.g.dart';
/// based on https://github.com/LemmyNet/lemmy/blob/464ea862b10fa7b226b2550268e40d8e685a939c/server/lemmy_db/src/comment_view.rs#L91
@JsonSerializable(fieldRename: FieldRename.snake, createToJson: false)
class CommentView {
final int id;
final int creatorId;
final int postId;
final String postName;
/// can be null
final int parentId;
final String content;
final bool removed;
final bool read;
final DateTime published;
/// can be null
@JsonKey(fromJson: DateTime.tryParse)
final DateTime updated;
final bool deleted;
final String apId;
final bool local;
final int communityId;
final String communityActorId;
final bool communityLocal;
final String communityName;
/// can be null
final String communityIcon;
final bool banned;
final bool bannedFromCommunity;
final String creatorActorId;
final bool creatorLocal;
final String creatorName;
/// can be null
final String creatorPreferredUsername;
final DateTime creatorPublished;
/// can be null
final String creatorAvatar;
final int score;
final int upvotes;
final int downvotes;
final int hotRank;
final int hotRankActive;
/// can be null
final int userId;
/// can be null
final int myVote;
/// can be null
final bool subscribed;
/// can be null
final bool saved;
const CommentView({
this.id,
this.creatorId,
this.postId,
this.postName,
this.parentId,
this.content,
this.removed,
this.read,
this.published,
this.updated,
this.deleted,
this.apId,
this.local,
this.communityId,
this.communityActorId,
this.communityLocal,
this.communityName,
this.communityIcon,
this.banned,
this.bannedFromCommunity,
this.creatorActorId,
this.creatorLocal,
this.creatorName,
this.creatorPreferredUsername,
this.creatorPublished,
this.creatorAvatar,
this.score,
this.upvotes,
this.downvotes,
this.hotRank,
this.hotRankActive,
this.userId,
this.myVote,
this.subscribed,
this.saved,
});
factory CommentView.fromJson(Map<String, dynamic> json) =>
_$CommentViewFromJson(json);
}