opt: non null (#1091)

* opt: type

* opt: type 2

* opt: type 3
This commit is contained in:
My-Responsitories
2025-08-23 18:25:41 +08:00
committed by GitHub
parent 6009668427
commit 3c34e43827
75 changed files with 400 additions and 362 deletions

View File

@@ -39,7 +39,7 @@ class VideoHttp {
static bool enableFilter = zoneRegExp.pattern.isNotEmpty;
// 首页推荐视频
static Future<LoadingState> rcmdVideoList({
static Future<LoadingState<List<RecVideoItemModel>>> rcmdVideoList({
required int ps,
required int freshIdx,
}) async {
@@ -75,7 +75,9 @@ class VideoHttp {
}
// 添加额外的loginState变量模拟未登录状态
static Future<LoadingState> rcmdVideoListApp({required int freshIdx}) async {
static Future<LoadingState<List<RecVideoItemAppModel>>> rcmdVideoListApp({
required int freshIdx,
}) async {
final params = {
'build': 2001100,
'c_locale': 'zh_CN',
@@ -191,8 +193,8 @@ class VideoHttp {
String? bvid,
required int cid,
int? qn,
dynamic epid,
dynamic seasonId,
Object? epid,
Object? seasonId,
required bool tryLook,
required VideoType videoType,
}) async {
@@ -280,7 +282,7 @@ class VideoHttp {
}
}
static Future videoRelation({required dynamic bvid}) async {
static Future videoRelation({required String bvid}) async {
var res = await Request().get(
Api.videoRelation,
queryParameters: {
@@ -323,7 +325,7 @@ class VideoHttp {
}
// 获取点赞/投币/收藏状态 pgc
static Future pgcLikeCoinFav({dynamic epId}) async {
static Future pgcLikeCoinFav({required Object epId}) async {
var res = await Request().get(
Api.pgcLikeCoinFav,
queryParameters: {'ep_id': epId},
@@ -360,7 +362,10 @@ class VideoHttp {
}
// 一键三连 pgc
static Future pgcTriple({dynamic epId, required dynamic seasonId}) async {
static Future pgcTriple({
required Object epId,
Object? seasonId,
}) async {
var res = await Request().post(
Api.pgcTriple,
data: {
@@ -371,7 +376,10 @@ class VideoHttp {
contentType: Headers.formUrlEncodedContentType,
headers: {
'origin': 'https://www.bilibili.com',
'referer': 'https://www.bilibili.com/bangumi/play/ss$seasonId',
if (seasonId != null)
'referer': 'https://www.bilibili.com/bangumi/play/ss$seasonId',
if (seasonId == null)
'referer': 'https://www.bilibili.com/bangumi/play/ep$epId',
'user-agent': UaType.pc.ua,
},
),
@@ -627,7 +635,7 @@ class VideoHttp {
}
static Future roomEntryAction({
roomId,
required Object roomId,
}) async {
await Request().post(
Api.roomEntryAction,
@@ -642,14 +650,14 @@ class VideoHttp {
}
static Future historyReport({
aid,
type,
required Object aid,
required Object type,
}) async {
await Request().post(
Api.historyReport,
data: {
'aid': ?aid,
'type': ?type,
'aid': aid,
'type': type,
'csrf': Accounts.heartbeat.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
@@ -658,13 +666,13 @@ class VideoHttp {
// 视频播放进度
static Future heartBeat({
aid,
bvid,
cid,
progress,
epid,
seasonId,
subType,
Object? aid,
Object? bvid,
required Object cid,
required Object progress,
Object? epid,
Object? seasonId,
Object? subType,
required VideoType videoType,
}) async {
final isPugv = videoType == VideoType.pugv;
@@ -686,8 +694,8 @@ class VideoHttp {
static Future medialistHistory({
required int desc,
required dynamic oid,
required dynamic upperMid,
required Object oid,
required Object upperMid,
}) async {
await Request().post(
Api.mediaListHistory,
@@ -779,12 +787,13 @@ class VideoHttp {
}
// 查看视频同时在看人数
static Future onlineTotal({int? aid, String? bvid, int? cid}) async {
static Future onlineTotal({int? aid, String? bvid, required int cid}) async {
assert(aid != null || bvid != null);
var res = await Request().get(
Api.onlineTotal,
queryParameters: {
'aid': aid,
'bvid': bvid,
'aid': ?aid,
'bvid': ?bvid,
'cid': cid,
},
);
@@ -796,14 +805,14 @@ class VideoHttp {
}
static Future aiConclusion({
String? bvid,
int? cid,
required String bvid,
required int cid,
int? upMid,
}) async {
final params = await WbiSign.makSign({
'bvid': bvid,
'cid': cid,
'up_mid': upMid,
'up_mid': ?upMid,
});
var res = await Request().get(Api.aiConclusion, queryParameters: params);
if (res.data['code'] == 0 && res.data['data']['code'] == 0) {
@@ -903,7 +912,7 @@ class VideoHttp {
}
// pgc 排行
static Future<LoadingState> pgcRankList({
static Future<LoadingState<List<PgcRankItemModel>?>> pgcRankList({
int day = 3,
required int seasonType,
}) async {
@@ -926,7 +935,7 @@ class VideoHttp {
}
// pgc season 排行
static Future<LoadingState> pgcSeasonRankList({
static Future<LoadingState<List<PgcRankItemModel>?>> pgcSeasonRankList({
int day = 3,
required int seasonType,
}) async {
@@ -949,8 +958,8 @@ class VideoHttp {
}
static Future<LoadingState<VideoNoteData>> getVideoNoteList({
dynamic oid,
dynamic uperMid,
required Object oid,
Object? uperMid,
required int page,
}) async {
var res = await Request().get(