mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-18 08:06:21 +08:00
85 lines
2.3 KiB
Dart
85 lines
2.3 KiB
Dart
import 'package:PiliPlus/models/dynamics/article_list/category.dart';
|
|
import 'package:PiliPlus/models/dynamics/article_list/stats.dart';
|
|
|
|
class Article {
|
|
int? id;
|
|
String? title;
|
|
int? state;
|
|
int? publishTime;
|
|
int? words;
|
|
List? imageUrls;
|
|
Category? category;
|
|
List<Category>? categories;
|
|
String? summary;
|
|
int? type;
|
|
String? dynIdStr;
|
|
int? attributes;
|
|
int? authorUid;
|
|
int? onlyFans;
|
|
Stats? stats;
|
|
int? likeState;
|
|
|
|
Article({
|
|
this.id,
|
|
this.title,
|
|
this.state,
|
|
this.publishTime,
|
|
this.words,
|
|
this.imageUrls,
|
|
this.category,
|
|
this.categories,
|
|
this.summary,
|
|
this.type,
|
|
this.dynIdStr,
|
|
this.attributes,
|
|
this.authorUid,
|
|
this.onlyFans,
|
|
this.stats,
|
|
this.likeState,
|
|
});
|
|
|
|
factory Article.fromJson(Map<String, dynamic> json) => Article(
|
|
id: json['id'] as int?,
|
|
title: json['title'] as String?,
|
|
state: json['state'] as int?,
|
|
publishTime: json['publish_time'] as int?,
|
|
words: json['words'] as int?,
|
|
imageUrls: json['image_urls'],
|
|
category: json['category'] == null
|
|
? null
|
|
: Category.fromJson(json['category'] as Map<String, dynamic>),
|
|
categories: (json['categories'] as List<dynamic>?)
|
|
?.map((e) => Category.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
summary: json['summary'] as String?,
|
|
type: json['type'] as int?,
|
|
dynIdStr: json['dyn_id_str'] as String?,
|
|
attributes: json['attributes'] as int?,
|
|
authorUid: json['author_uid'] as int?,
|
|
onlyFans: json['only_fans'] as int?,
|
|
stats: json['stats'] == null
|
|
? null
|
|
: Stats.fromJson(json['stats'] as Map<String, dynamic>),
|
|
likeState: json['like_state'] as int?,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'title': title,
|
|
'state': state,
|
|
'publish_time': publishTime,
|
|
'words': words,
|
|
'image_urls': imageUrls,
|
|
'category': category?.toJson(),
|
|
'categories': categories?.map((e) => e.toJson()).toList(),
|
|
'summary': summary,
|
|
'type': type,
|
|
'dyn_id_str': dynIdStr,
|
|
'attributes': attributes,
|
|
'author_uid': authorUid,
|
|
'only_fans': onlyFans,
|
|
'stats': stats?.toJson(),
|
|
'like_state': likeState,
|
|
};
|
|
}
|