clean up models

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-05 12:10:18 +08:00
parent b897103af0
commit 279f21857d
308 changed files with 156 additions and 6243 deletions

View File

@@ -1,17 +1,13 @@
import 'package:PiliPlus/models_new/live/live_area_list/area_item.dart';
class AreaList {
int? id;
String? name;
int? parentAreaType;
List<AreaItem>? areaList;
AreaList({this.id, this.name, this.parentAreaType, this.areaList});
AreaList({this.name, this.areaList});
factory AreaList.fromJson(Map<String, dynamic> json) => AreaList(
id: json['id'] as int?,
name: json['name'] ?? '',
parentAreaType: json['parent_area_type'] as int?,
areaList: (json['area_list'] as List<dynamic>?)
?.map((e) => AreaItem.fromJson(e as Map<String, dynamic>))
.toList(),

View File

@@ -4,7 +4,6 @@ class LiveContributionRankItem {
int? uid;
String? name;
String? face;
int? rank;
int? score;
UinfoMedal? uinfoMedal;
@@ -12,7 +11,6 @@ class LiveContributionRankItem {
this.uid,
this.name,
this.face,
this.rank,
this.score,
this.uinfoMedal,
});
@@ -22,7 +20,6 @@ class LiveContributionRankItem {
uid: json['uid'] as int?,
name: json['name'] as String?,
face: json['face'] as String?,
rank: json['rank'] as int?,
score: json['score'] as int?,
uinfoMedal: json['uinfo']?['medal'] == null
? null

View File

@@ -10,11 +10,8 @@ class CardLiveItem {
String? _systemCover;
String? get systemCover => _systemCover ?? cover;
String? title;
int? liveTime;
String? areaName;
int? areaV2Id;
String? areaV2Name;
String? areaV2ParentName;
int? areaV2ParentId;
WatchedShow? watchedShow;
@@ -26,11 +23,8 @@ class CardLiveItem {
this.cover,
String? systemCover,
this.title,
this.liveTime,
this.areaName,
this.areaV2Id,
this.areaV2Name,
this.areaV2ParentName,
this.areaV2ParentId,
this.watchedShow,
}) : _systemCover = noneNullOrEmptyString(systemCover);
@@ -43,11 +37,8 @@ class CardLiveItem {
cover: json['cover'] as String?,
systemCover: json['system_cover'],
title: json['title'] as String?,
liveTime: json['live_time'] as int?,
areaName: json['area_name'] as String?,
areaV2Id: json['area_v2_id'] as int?,
areaV2Name: json['area_v2_name'] as String?,
areaV2ParentName: json['area_v2_parent_name'] as String?,
areaV2ParentId: json['area_v2_parent_id'] as int?,
watchedShow: json['watched_show'] == null
? null

View File

@@ -1,37 +1,25 @@
class LiveFollowItem {
int? roomid;
int? uid;
String? uname;
String? title;
String? face;
int? liveStatus;
String? areaName;
String? areaNameV2;
String? textSmall;
String? roomCover;
LiveFollowItem({
this.roomid,
this.uid,
this.uname,
this.title,
this.face,
this.liveStatus,
this.areaName,
this.areaNameV2,
this.textSmall,
this.roomCover,
});
factory LiveFollowItem.fromJson(Map<String, dynamic> json) => LiveFollowItem(
roomid: json['roomid'] as int?,
uid: json['uid'] as int?,
uname: json['uname'] as String?,
title: json['title'] as String?,
face: json['face'] as String?,
liveStatus: json['live_status'] as int?,
areaName: json['area_name'] as String?,
areaNameV2: json['area_name_v2'] as String?,
textSmall: json['text_small'] as String?,
roomCover: json['room_cover'] as String?,
);

View File

@@ -5,16 +5,12 @@ class MedalWallData {
int? count;
String? name;
String? icon;
int? uid;
int? level;
MedalWallData({
this.list,
this.count,
this.name,
this.icon,
this.uid,
this.level,
});
factory MedalWallData.fromJson(Map<String, dynamic> json) => MedalWallData(
@@ -24,7 +20,5 @@ class MedalWallData {
count: json['count'] as int?,
name: json['name'] as String?,
icon: json['icon'] as String?,
uid: json['uid'] as int?,
level: json['level'] as int?,
);
}

View File

@@ -1,35 +1,20 @@
class RoomInfo {
int? uid;
int? roomId;
String? title;
String? cover;
int? liveStatus;
int? liveStartTime;
int? online;
String? appBackground;
String? subSessionKey;
RoomInfo({
this.uid,
this.roomId,
this.title,
this.cover,
this.liveStatus,
this.liveStartTime,
this.online,
this.appBackground,
this.subSessionKey,
});
factory RoomInfo.fromJson(Map<String, dynamic> json) => RoomInfo(
uid: json['uid'] as int?,
roomId: json['room_id'] as int?,
title: json['title'] as String?,
cover: json['cover'] as String?,
liveStatus: json['live_status'] as int?,
liveStartTime: json['live_start_time'] as int?,
online: json['online'] as int?,
appBackground: json['app_background'] as String?,
subSessionKey: json['sub_session_key'] as String?,
);
}

View File

@@ -2,39 +2,24 @@ import 'package:PiliPlus/models_new/live/live_room_play_info/url_info.dart';
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
class CodecItem {
String? codecName;
int? currentQn;
List<int>? acceptQn;
String? baseUrl;
List<UrlInfo>? urlInfo;
dynamic hdrQn;
int? dolbyType;
String? attrName;
int? hdrType;
CodecItem({
this.codecName,
this.currentQn,
this.acceptQn,
this.baseUrl,
this.urlInfo,
this.hdrQn,
this.dolbyType,
this.attrName,
this.hdrType,
});
factory CodecItem.fromJson(Map<String, dynamic> json) => CodecItem(
codecName: json['codec_name'] as String?,
currentQn: json['current_qn'] as int?,
acceptQn: (json['accept_qn'] as List?)?.fromCast(),
baseUrl: json['base_url'] as String?,
urlInfo: (json['url_info'] as List<dynamic>?)
?.map((e) => UrlInfo.fromJson(e as Map<String, dynamic>))
.toList(),
hdrQn: json['hdr_qn'] as dynamic,
dolbyType: json['dolby_type'] as int?,
attrName: json['attr_name'] as String?,
hdrType: json['hdr_type'] as int?,
);
}

View File

@@ -1,17 +1,13 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/codec.dart';
class Format {
String? formatName;
List<CodecItem>? codec;
String? masterUrl;
Format({this.formatName, this.codec, this.masterUrl});
Format({this.codec});
factory Format.fromJson(Map<String, dynamic> json) => Format(
formatName: json['format_name'] as String?,
codec: (json['codec'] as List<dynamic>?)
?.map((e) => CodecItem.fromJson(e as Map<String, dynamic>))
.toList(),
masterUrl: json['master_url'] as String?,
);
}

View File

@@ -1,16 +1,13 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/stream.dart';
class Playurl {
int? cid;
List<Stream>? stream;
Playurl({
this.cid,
this.stream,
});
factory Playurl.fromJson(Map<String, dynamic> json) => Playurl(
cid: json['cid'] as int?,
stream: (json['stream'] as List<dynamic>?)
?.map((e) => Stream.fromJson(e as Map<String, dynamic>))
.toList(),

View File

@@ -1,13 +1,11 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/format.dart';
class Stream {
String? protocolName;
List<Format>? format;
Stream({this.protocolName, this.format});
Stream({this.format});
factory Stream.fromJson(Map<String, dynamic> json) => Stream(
protocolName: json['protocol_name'] as String?,
format: (json['format'] as List<dynamic>?)
?.map((e) => Format.fromJson(e as Map<String, dynamic>))
.toList(),

View File

@@ -1,13 +1,11 @@
class UrlInfo {
String? host;
String? extra;
int? streamTtl;
UrlInfo({this.host, this.extra, this.streamTtl});
UrlInfo({this.host, this.extra});
factory UrlInfo.fromJson(Map<String, dynamic> json) => UrlInfo(
host: json['host'] as String?,
extra: json['extra'] as String?,
streamTtl: json['stream_ttl'] as int?,
);
}

View File

@@ -2,24 +2,15 @@ import 'package:PiliPlus/models_new/live/live_search/room.dart';
import 'package:PiliPlus/models_new/live/live_search/user.dart';
class LiveSearchData {
String? type;
int? page;
int? pagesize;
Room? room;
User? user;
LiveSearchData({
this.type,
this.page,
this.pagesize,
this.room,
this.user,
});
factory LiveSearchData.fromJson(Map<String, dynamic> json) => LiveSearchData(
type: json['type'] as String?,
page: json['page'] as int?,
pagesize: json['pagesize'] as int?,
room: json['room'] == null
? null
: Room.fromJson(json['room'] as Map<String, dynamic>),

View File

@@ -1,19 +0,0 @@
import 'package:PiliPlus/models_new/live/live_search/data.dart';
class LiveSearch {
int? code;
String? message;
int? ttl;
LiveSearchData? data;
LiveSearch({this.code, this.message, this.ttl, this.data});
factory LiveSearch.fromJson(Map<String, dynamic> json) => LiveSearch(
code: json['code'] as int?,
message: json['message'] as String?,
ttl: json['ttl'] as int?,
data: json['data'] == null
? null
: LiveSearchData.fromJson(json['data'] as Map<String, dynamic>),
);
}

View File

@@ -3,9 +3,8 @@ import 'package:PiliPlus/models_new/live/live_search/room_item.dart';
class Room {
List<LiveSearchRoomItemModel>? list;
int? totalRoom;
int? totalPage;
Room({this.list, this.totalRoom, this.totalPage});
Room({this.list, this.totalRoom});
factory Room.fromJson(Map<String, dynamic> json) => Room(
list: (json['list'] as List<dynamic>?)
@@ -14,6 +13,5 @@ class Room {
)
.toList(),
totalRoom: json['total_room'] as int?,
totalPage: json['total_page'] as int?,
);
}

View File

@@ -3,15 +3,13 @@ import 'package:PiliPlus/models_new/live/live_search/user_item.dart';
class User {
List<LiveSearchUserItemModel>? list;
int? totalUser;
int? totalPage;
User({this.list, this.totalUser, this.totalPage});
User({this.list, this.totalUser});
factory User.fromJson(Map<String, dynamic> json) => User(
list: (json['list'] as List<dynamic>?)
?.map((e) => LiveSearchUserItemModel.fromJson(e))
.toList(),
totalUser: json['total_user'] as int?,
totalPage: json['total_page'] as int?,
);
}

View File

@@ -1,16 +1,13 @@
class LiveSecondTag {
int? id;
String? name;
String? sortType;
LiveSecondTag({
this.id,
this.name,
this.sortType,
});
factory LiveSecondTag.fromJson(Map json) => LiveSecondTag(
id: json['id'],
name: json['name'],
sortType: json['sort_type'],
);