Files
mediaplayer/ios/OralTrainer/Services/VideoCatalogAPI.swift
2026-08-17 20:13:28 +08:00

19 lines
569 B
Swift

import Foundation
struct VideoCatalogResponse: Decodable {
let videos: [TrainingVideoSummary]
}
enum VideoCatalogAPI {
static func fetch() async throws -> (videos: [TrainingVideoSummary], baseURL: String) {
let result = try await HTTPClient.getJSON(
VideoCatalogResponse.self,
baseURL: AppConfig.serverBaseURL,
path: "api/v1/videos",
timeout: AppConfig.readTimeout
)
let ready = result.value.videos.filter { $0.status == "ready" }
return (ready, result.effectiveBaseURL)
}
}