diff --git a/AIStudyApp/AIStudyApp/Core/Services/APIService.swift b/AIStudyApp/AIStudyApp/Core/Services/APIService.swift index 6d7dbaa..557df83 100644 --- a/AIStudyApp/AIStudyApp/Core/Services/APIService.swift +++ b/AIStudyApp/AIStudyApp/Core/Services/APIService.swift @@ -210,6 +210,13 @@ class LearningSessionService { func end(id: String) async throws -> LearningSession { return try await client.request("/learning-sessions/\(id)/end", method: "POST") } + + func list(page: Int = 1, limit: Int = 20) async throws -> [LearningSession] { + return try await client.request("/learning-sessions", queryItems: [ + URLQueryItem(name: "page", value: String(page)), + URLQueryItem(name: "limit", value: String(limit)), + ]) + } } // MARK: - Review diff --git a/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift b/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift index c010470..95adacd 100644 --- a/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift +++ b/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift @@ -74,6 +74,11 @@ class FileUploadService { return confirmResp.id } + /// 删除文件(COS + 数据库) + func deleteFile(fileId: String) async throws { + let _: GenericSuccessResponse = try await client.request("/files/\(fileId)", method: "DELETE") + } + /// 获取文件下载 URL func getDownloadUrl(fileId: String) async throws -> String { let detail: FileDetailResponse = try await client.request("/files/\(fileId)")