gitbay/Repos/DepsStatus.swift

v1.1.1
gitbay-ios/gitbay/Repos/DepsStatus.swift history · blame · raw

32 lines · 1077 bytes

 1import Foundation
 2
 3/// `repo deps status <owner/name>` — dependency-check status. `lastCheck`,
 4/// `lastError` and `issueNumber` are `omitempty` server-side: a repository
 5/// whose checks were just switched on carries none of them, which is the
 6/// ordinary case, not an edge case.
 7nonisolated struct DepsStatus: Decodable, Sendable, Hashable {
 8    let enabled: Bool
 9    let lastCheck: Date?
10    let lastError: String?
11    let issueNumber: Int64?
12    let behind: [DepBehind]
13
14    enum CodingKeys: String, CodingKey {
15        case enabled, behind
16        case lastCheck = "last_check"
17        case lastError = "last_error"
18        case issueNumber = "issue_number"
19    }
20}
21
22/// One outdated dependency. `id` includes the ecosystem because two
23/// ecosystems can carry the same package name, and a colliding id makes
24/// SwiftUI reuse one row for the other.
25nonisolated struct DepBehind: Decodable, Sendable, Hashable, Identifiable {
26    let ecosystem: String
27    let name: String
28    let current: String
29    let latest: String
30
31    var id: String { "\(ecosystem)/\(name)" }
32}