diff options
Diffstat (limited to 'Hutch/Models')
| -rw-r--r-- | Hutch/Models/Builds.swift | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Hutch/Models/Builds.swift b/Hutch/Models/Builds.swift index 8de4235..d666398 100644 --- a/Hutch/Models/Builds.swift +++ b/Hutch/Models/Builds.swift @@ -122,10 +122,29 @@ struct JobDetail: Codable, Sendable, Equatable { let image: String? let manifest: String? var tasks: [BuildTask] + let artifacts: [BuildArtifact] let log: BuildLog? let owner: Entity } +/// A downloadable artifact emitted by a build job. +struct BuildArtifact: Codable, Sendable, Identifiable, Equatable { + let id: Int + let created: Date + let path: String + let size: Int + let url: URL? + + var filename: String { + let pathComponents = path.split(separator: "/") + return pathComponents.last.map(String.init) ?? path + } + + var isDownloadable: Bool { + url != nil + } +} + /// The log associated with a build job. struct BuildLog: Codable, Sendable, Equatable { let fullURL: String |
