import Foundation import Observation /// `repo log`: the default branch's history, signature verdict per commit. @Observable @MainActor final class LogViewModel { private(set) var state: LoadState<[Commit]> = .loading private let client: GitbayClient let repoPath: String init(client: GitbayClient, repoPath: String) { self.client = client self.repoPath = repoPath } func load() async { do { let commits = try await client.readList(["repo", "log", repoPath], of: Commit.self) state = commits.isEmpty ? .empty("No commits yet.") : .loaded(commits) } catch { state = .from(error) } } }