feat: 暂停/恢复历史记录、清空历史记录

This commit is contained in:
guozhigq
2023-07-24 00:32:54 +08:00
parent bafda1f0bd
commit ee973167a5
4 changed files with 169 additions and 8 deletions

View File

@ -148,6 +148,15 @@ class Api {
// 获取历史记录
static const String historyList = '/x/web-interface/history/cursor';
// 暂停历史记录
static const String pauseHistory = '/x/v2/history/shadow/set';
// 查询历史记录暂停状态
static const String historyStatus = '/x/v2/history/shadow?jsonp=jsonp';
// 清空历史记录
static const String clearHistory = '/x/v2/history/clear';
// 热搜
static const String hotSearchList =
'https://s.search.bilibili.com/main/hotword';

View File

@ -112,4 +112,36 @@ class UserHttp {
return {'status': false, 'data': [], 'msg': res.data['message']};
}
}
// 暂停观看历史
static Future pauseHistory(bool switchStatus) async {
// 暂停switchStatus传true 否则false
var res = await Request().post(
Api.pauseHistory,
queryParameters: {
'switch': switchStatus,
'jsonp': 'jsonp',
'csrf': await Request.getCsrf(),
},
);
return res;
}
// 观看历史暂停状态
static Future historyStatus() async {
var res = await Request().get(Api.historyStatus);
return res;
}
// 清空历史记录
static Future clearHistory() async {
var res = await Request().post(
Api.clearHistory,
queryParameters: {
'jsonp': 'jsonp',
'csrf': await Request.getCsrf(),
},
);
return res;
}
}