refa: article (#757)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-04-26 14:54:22 +08:00
committed by GitHub
parent 64f7ba2a1a
commit 40fb93f036
87 changed files with 2628 additions and 993 deletions

View File

@@ -0,0 +1,26 @@
import 'data.dart';
class ArticleView {
int? code;
String? message;
int? ttl;
ArticleData? data;
ArticleView({this.code, this.message, this.ttl, this.data});
factory ArticleView.fromJson(Map<String, dynamic> json) => ArticleView(
code: json['code'] as int?,
message: json['message'] as String?,
ttl: json['ttl'] as int?,
data: json['data'] == null
? null
: ArticleData.fromJson(json['data'] as Map<String, dynamic>),
);
Map<String, dynamic> toJson() => {
'code': code,
'message': message,
'ttl': ttl,
'data': data?.toJson(),
};
}

View File

@@ -0,0 +1,60 @@
import 'nameplate.dart';
import 'official_verify.dart';
import 'pendant.dart';
import 'vip.dart';
class Author {
int? mid;
String? name;
String? face;
Pendant? pendant;
OfficialVerify? officialVerify;
Nameplate? nameplate;
Vip? vip;
int? fans;
int? level;
Author({
this.mid,
this.name,
this.face,
this.pendant,
this.officialVerify,
this.nameplate,
this.vip,
this.fans,
this.level,
});
factory Author.fromJson(Map<String, dynamic> json) => Author(
mid: json['mid'] as int?,
name: json['name'] as String?,
face: json['face'] as String?,
pendant: json['pendant'] == null
? null
: Pendant.fromJson(json['pendant'] as Map<String, dynamic>),
officialVerify: json['official_verify'] == null
? null
: OfficialVerify.fromJson(json['official_verify'] as Map<String, dynamic>),
nameplate: json['nameplate'] == null
? null
: Nameplate.fromJson(json['nameplate'] as Map<String, dynamic>),
vip: json['vip'] == null
? null
: Vip.fromJson(json['vip'] as Map<String, dynamic>),
fans: json['fans'] as int?,
level: json['level'] as int?,
);
Map<String, dynamic> toJson() => {
'mid': mid,
'name': name,
'face': face,
'pendant': pendant?.toJson(),
'official_verify': officialVerify?.toJson(),
'nameplate': nameplate?.toJson(),
'vip': vip?.toJson(),
'fans': fans,
'level': level,
};
}

View File

@@ -0,0 +1,19 @@
class Category {
int? id;
int? parentId;
String? name;
Category({this.id, this.parentId, this.name});
factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json['id'] as int?,
parentId: json['parent_id'] as int?,
name: json['name'] as String?,
);
Map<String, dynamic> toJson() => {
'id': id,
'parent_id': parentId,
'name': name,
};
}

View File

@@ -0,0 +1,185 @@
import 'author.dart';
import 'category.dart';
import 'media.dart';
import 'stats.dart';
import 'tag.dart';
class ArticleData {
int? id;
Category? category;
List<Category>? categories;
String? title;
String? summary;
String? bannerUrl;
int? templateId;
int? state;
Author? author;
int? reprint;
List? imageUrls;
int? publishTime;
int? ctime;
int? mtime;
Stats? stats;
List<Tag>? tags;
int? words;
List? originImageUrls;
dynamic list;
bool? isLike;
Media? media;
String? applyTime;
String? checkTime;
int? original;
int? actId;
dynamic dispute;
dynamic authenMark;
int? coverAvid;
dynamic topVideoInfo;
int? type;
int? checkState;
int? originTemplateId;
int? privatePub;
dynamic contentPicList;
String? content;
String? keywords;
int? versionId;
String? dynIdStr;
int? totalArtNum;
ArticleData({
this.id,
this.category,
this.categories,
this.title,
this.summary,
this.bannerUrl,
this.templateId,
this.state,
this.author,
this.reprint,
this.imageUrls,
this.publishTime,
this.ctime,
this.mtime,
this.stats,
this.tags,
this.words,
this.originImageUrls,
this.list,
this.isLike,
this.media,
this.applyTime,
this.checkTime,
this.original,
this.actId,
this.dispute,
this.authenMark,
this.coverAvid,
this.topVideoInfo,
this.type,
this.checkState,
this.originTemplateId,
this.privatePub,
this.contentPicList,
this.content,
this.keywords,
this.versionId,
this.dynIdStr,
this.totalArtNum,
});
factory ArticleData.fromJson(Map<String, dynamic> json) => ArticleData(
id: json['id'] as int?,
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(),
title: json['title'] as String?,
summary: json['summary'] as String?,
bannerUrl: json['banner_url'] as String?,
templateId: json['template_id'] as int?,
state: json['state'] as int?,
author: json['author'] == null
? null
: Author.fromJson(json['author'] as Map<String, dynamic>),
reprint: json['reprint'] as int?,
imageUrls: json['image_urls'],
publishTime: json['publish_time'] as int?,
ctime: json['ctime'] as int?,
mtime: json['mtime'] as int?,
stats: json['stats'] == null
? null
: Stats.fromJson(json['stats'] as Map<String, dynamic>),
tags: (json['tags'] as List<dynamic>?)
?.map((e) => Tag.fromJson(e as Map<String, dynamic>))
.toList(),
words: json['words'] as int?,
originImageUrls: json['origin_image_urls'],
list: json['list'] as dynamic,
isLike: json['is_like'] as bool?,
media: json['media'] == null
? null
: Media.fromJson(json['media'] as Map<String, dynamic>),
applyTime: json['apply_time'] as String?,
checkTime: json['check_time'] as String?,
original: json['original'] as int?,
actId: json['act_id'] as int?,
dispute: json['dispute'] as dynamic,
authenMark: json['authenMark'] as dynamic,
coverAvid: json['cover_avid'] as int?,
topVideoInfo: json['top_video_info'] as dynamic,
type: json['type'] as int?,
checkState: json['check_state'] as int?,
originTemplateId: json['origin_template_id'] as int?,
privatePub: json['private_pub'] as int?,
contentPicList: json['content_pic_list'] as dynamic,
content: json['content'] as String?,
keywords: json['keywords'] as String?,
versionId: json['version_id'] as int?,
dynIdStr: json['dyn_id_str'] as String?,
totalArtNum: json['total_art_num'] as int?,
);
Map<String, dynamic> toJson() => {
'id': id,
'category': category?.toJson(),
'categories': categories?.map((e) => e.toJson()).toList(),
'title': title,
'summary': summary,
'banner_url': bannerUrl,
'template_id': templateId,
'state': state,
'author': author?.toJson(),
'reprint': reprint,
'image_urls': imageUrls,
'publish_time': publishTime,
'ctime': ctime,
'mtime': mtime,
'stats': stats?.toJson(),
'tags': tags?.map((e) => e.toJson()).toList(),
'words': words,
'origin_image_urls': originImageUrls,
'list': list,
'is_like': isLike,
'media': media?.toJson(),
'apply_time': applyTime,
'check_time': checkTime,
'original': original,
'act_id': actId,
'dispute': dispute,
'authenMark': authenMark,
'cover_avid': coverAvid,
'top_video_info': topVideoInfo,
'type': type,
'check_state': checkState,
'origin_template_id': originTemplateId,
'private_pub': privatePub,
'content_pic_list': contentPicList,
'content': content,
'keywords': keywords,
'version_id': versionId,
'dyn_id_str': dynIdStr,
'total_art_num': totalArtNum,
};
}

View File

@@ -0,0 +1,19 @@
class Label {
String? path;
String? text;
String? labelTheme;
Label({this.path, this.text, this.labelTheme});
factory Label.fromJson(Map<String, dynamic> json) => Label(
path: json['path'] as String?,
text: json['text'] as String?,
labelTheme: json['label_theme'] as String?,
);
Map<String, dynamic> toJson() => {
'path': path,
'text': text,
'label_theme': labelTheme,
};
}

View File

@@ -0,0 +1,47 @@
class Media {
int? score;
int? mediaId;
String? title;
String? cover;
String? area;
int? typeId;
String? typeName;
int? spoiler;
int? seasonId;
Media({
this.score,
this.mediaId,
this.title,
this.cover,
this.area,
this.typeId,
this.typeName,
this.spoiler,
this.seasonId,
});
factory Media.fromJson(Map<String, dynamic> json) => Media(
score: json['score'] as int?,
mediaId: json['media_id'] as int?,
title: json['title'] as String?,
cover: json['cover'] as String?,
area: json['area'] as String?,
typeId: json['type_id'] as int?,
typeName: json['type_name'] as String?,
spoiler: json['spoiler'] as int?,
seasonId: json['season_id'] as int?,
);
Map<String, dynamic> toJson() => {
'score': score,
'media_id': mediaId,
'title': title,
'cover': cover,
'area': area,
'type_id': typeId,
'type_name': typeName,
'spoiler': spoiler,
'season_id': seasonId,
};
}

View File

@@ -0,0 +1,35 @@
class Nameplate {
int? nid;
String? name;
String? image;
String? imageSmall;
String? level;
String? condition;
Nameplate({
this.nid,
this.name,
this.image,
this.imageSmall,
this.level,
this.condition,
});
factory Nameplate.fromJson(Map<String, dynamic> json) => Nameplate(
nid: json['nid'] as int?,
name: json['name'] as String?,
image: json['image'] as String?,
imageSmall: json['image_small'] as String?,
level: json['level'] as String?,
condition: json['condition'] as String?,
);
Map<String, dynamic> toJson() => {
'nid': nid,
'name': name,
'image': image,
'image_small': imageSmall,
'level': level,
'condition': condition,
};
}

View File

@@ -0,0 +1,20 @@
class OfficialVerify {
int? type;
String? desc;
OfficialVerify({this.type, this.desc});
factory OfficialVerify.fromJson(Map<String, dynamic> json) {
return OfficialVerify(
type: json['type'] as int?,
desc: json['desc'] as String?,
);
}
Map<String, dynamic> toJson() => {
'type': type,
'desc': desc,
};
}

View File

@@ -0,0 +1,22 @@
class Pendant {
int? pid;
String? name;
String? image;
int? expire;
Pendant({this.pid, this.name, this.image, this.expire});
factory Pendant.fromJson(Map<String, dynamic> json) => Pendant(
pid: json['pid'] as int?,
name: json['name'] as String?,
image: json['image'] as String?,
expire: json['expire'] as int?,
);
Map<String, dynamic> toJson() => {
'pid': pid,
'name': name,
'image': image,
'expire': expire,
};
}

View File

@@ -0,0 +1,43 @@
class Stats {
int? view;
int? favorite;
int? like;
int? dislike;
int? reply;
int? share;
int? coin;
int? dynam1c;
Stats({
this.view,
this.favorite,
this.like,
this.dislike,
this.reply,
this.share,
this.coin,
this.dynam1c,
});
factory Stats.fromJson(Map<String, dynamic> json) => Stats(
view: json['view'] as int?,
favorite: json['favorite'] as int?,
like: json['like'] as int?,
dislike: json['dislike'] as int?,
reply: json['reply'] as int?,
share: json['share'] as int?,
coin: json['coin'] as int?,
dynam1c: json['dynamic'] as int?,
);
Map<String, dynamic> toJson() => {
'view': view,
'favorite': favorite,
'like': like,
'dislike': dislike,
'reply': reply,
'share': share,
'coin': coin,
'dynamic': dynam1c,
};
}

View File

@@ -0,0 +1,16 @@
class Tag {
int? tid;
String? name;
Tag({this.tid, this.name});
factory Tag.fromJson(Map<String, dynamic> json) => Tag(
tid: json['tid'] as int?,
name: json['name'] as String?,
);
Map<String, dynamic> toJson() => {
'tid': tid,
'name': name,
};
}

View File

@@ -0,0 +1,47 @@
import 'label.dart';
class Vip {
int? type;
int? status;
int? dueDate;
int? vipPayType;
int? themeType;
Label? label;
int? avatarSubscript;
String? nicknameColor;
Vip({
this.type,
this.status,
this.dueDate,
this.vipPayType,
this.themeType,
this.label,
this.avatarSubscript,
this.nicknameColor,
});
factory Vip.fromJson(Map<String, dynamic> json) => Vip(
type: json['type'] as int?,
status: json['status'] as int?,
dueDate: json['due_date'] as int?,
vipPayType: json['vip_pay_type'] as int?,
themeType: json['theme_type'] as int?,
label: json['label'] == null
? null
: Label.fromJson(json['label'] as Map<String, dynamic>),
avatarSubscript: json['avatar_subscript'] as int?,
nicknameColor: json['nickname_color'] as String?,
);
Map<String, dynamic> toJson() => {
'type': type,
'status': status,
'due_date': dueDate,
'vip_pay_type': vipPayType,
'theme_type': themeType,
'label': label?.toJson(),
'avatar_subscript': avatarSubscript,
'nickname_color': nicknameColor,
};
}