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 creatorId;
final int postId; final int postId;
final String postName; final String postName;
/// can be null /// can be null
final int parentId; final int parentId;
final String content; final String content;
final bool removed; final bool removed;
final bool read; final bool read;
final DateTime published; final DateTime published;
/// can be null /// can be null
@JsonKey(fromJson: DateTime.tryParse)
final DateTime updated; final DateTime updated;
final bool deleted; final bool deleted;
final String apId; final String apId;
@ -25,6 +26,7 @@ class CommentView {
final String communityActorId; final String communityActorId;
final bool communityLocal; final bool communityLocal;
final String communityName; final String communityName;
/// can be null /// can be null
final String communityIcon; final String communityIcon;
final bool banned; final bool banned;
@ -32,9 +34,11 @@ class CommentView {
final String creatorActorId; final String creatorActorId;
final bool creatorLocal; final bool creatorLocal;
final String creatorName; final String creatorName;
/// can be null /// can be null
final String creatorPreferredUsername; final String creatorPreferredUsername;
final DateTime creatorPublished; final DateTime creatorPublished;
/// can be null /// can be null
final String creatorAvatar; final String creatorAvatar;
final int score; final int score;
@ -42,12 +46,16 @@ class CommentView {
final int downvotes; final int downvotes;
final int hotRank; final int hotRank;
final int hotRankActive; final int hotRankActive;
/// can be null /// can be null
final int userId; final int userId;
/// can be null /// can be null
final int myVote; final int myVote;
/// can be null /// can be null
final bool subscribed; final bool subscribed;
/// can be null /// can be null
final bool saved; final bool saved;

View File

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

View File

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

View File

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