实现文件下载功能,添加下载文件方法和相关的文件信息获取逻辑。更新主驱动类以支持文件下载,并在工具类中实现文件下载的进度条显示。

This commit is contained in:
2025-07-15 17:30:33 +08:00
parent dc5e8b4bfc
commit e5dbab6679
3 changed files with 79 additions and 4 deletions

View File

@@ -336,6 +336,11 @@ class API:
}
return await self._make_request("POST", "upload/v2/file/single/create", json=data, data=file)
async def download_file(self, fileId: int) -> Dict[str, Any]:
"""下载文件"""
params = {"fileId": fileId}
return await self._make_request("GET", "api/v1/file/download_info", params=params)
async def create_offline_downlod(self, url: str, dirID: int, fileName: Optional[str] = None, callBackUrl: Optional[str] = None) -> Dict[str, Any]:
"""创建离线下载任务"""
data: Dict[str, Any] = {