Merge branch 'http-client' of ssh://github.com/krawieck/lemmur into http-client

This commit is contained in:
shilangyu 2020-08-09 13:19:18 +00:00
commit d3744476de
4 changed files with 30 additions and 4 deletions

View File

@ -9,14 +9,15 @@ class CommentView {
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;
@ -25,6 +26,7 @@ class CommentView {
final String communityActorId;
final bool communityLocal;
final String communityName;
/// can be null
final String communityIcon;
final bool banned;
@ -32,9 +34,11 @@ class CommentView {
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;
@ -42,12 +46,16 @@ class CommentView {
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;

View File

@ -19,7 +19,9 @@ CommentView _$CommentViewFromJson(Map<String, dynamic> json) {
published: json['published'] == null
? null
: DateTime.parse(json['published'] as String),
updated: DateTime.tryParse(json['updated'] as String),
updated: json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
deleted: json['deleted'] as bool,
apId: json['ap_id'] as String,
local: json['local'] as bool,

View File

@ -7,8 +7,10 @@ part 'post.g.dart';
class PostView {
final int id;
final String name;
/// can be null
final String url;
/// can be null
final String body;
final int creatorId;
@ -16,18 +18,22 @@ class PostView {
final bool removed;
final bool locked;
final DateTime published;
/// can be null
@JsonKey(fromJson: DateTime.tryParse)
final DateTime updated;
final bool deleted;
final bool nsfw;
final bool stickied;
/// can be null
final String embedTitle;
/// can be null
final String embedDescription;
/// can be null
final String embedHtml;
/// can be null
final String thumbnailUrl;
final String apId;
@ -35,9 +41,11 @@ class PostView {
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 bool banned;
@ -45,6 +53,7 @@ class PostView {
final String communityActorId;
final bool communityLocal;
final String communityName;
/// can be null
final String communityIcon;
final bool communityRemoved;
@ -57,14 +66,19 @@ class PostView {
final int hotRank;
final int hotRankActive;
final DateTime newestActivityTime;
/// can be null
final int userId;
/// can be null
final int myVote;
/// can be null
final bool subscribed;
/// can be null
final bool read;
/// can be null
final bool saved;

View File

@ -19,7 +19,9 @@ PostView _$PostViewFromJson(Map<String, dynamic> json) {
published: json['published'] == null
? null
: DateTime.parse(json['published'] as String),
updated: DateTime.tryParse(json['updated'] as String),
updated: json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
deleted: json['deleted'] as bool,
nsfw: json['nsfw'] as bool,
stickied: json['stickied'] as bool,