krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

v3.0.4: Hutch/Models/Paste.swift · raw

 1import Foundation
 2
 3struct PasteFile: Codable, Sendable, Hashable, Identifiable {
 4    let filename: String?
 5    let hash: String
 6    let contents: URL?
 7
 8    var id: String { hash }
 9}
10
11struct Paste: Codable, Sendable, Identifiable, Hashable {
12    let id: String
13    let created: Date
14    let visibility: Visibility
15    let files: [PasteFile]
16    let user: Entity
17}
18
19struct PasteUploadDraft: Identifiable, Equatable, Sendable {
20    let id: UUID
21    var filename: String
22    var contents: String
23
24    init(id: UUID = UUID(), filename: String = "", contents: String = "") {
25        self.id = id
26        self.filename = filename
27        self.contents = contents
28    }
29}