gitbay/Repos/WebhookModels.swift

v1.14.0
gitbay-ios/gitbay/Repos/WebhookModels.swift history · blame · raw

32 lines · 806 bytes

 1import Foundation
 2
 3/// One row of `webhook list`.
 4nonisolated struct Webhook: Decodable, Sendable, Hashable, Identifiable {
 5    let id: Int64
 6    let url: String
 7    let events: String
 8    let active: Bool
 9    let hasSecret: Bool
10
11    enum CodingKeys: String, CodingKey {
12        case id, url, events, active
13        case hasSecret = "has_secret"
14    }
15}
16
17/// One row of `webhook deliveries`.
18nonisolated struct WebhookDelivery: Decodable, Sendable, Hashable, Identifiable {
19    let id: Int64
20    let url: String
21    let event: String
22    let status: String
23    let attempts: Int
24    let lastStatus: Int?
25    let lastError: String?
26
27    enum CodingKeys: String, CodingKey {
28        case id, url, event, status, attempts
29        case lastStatus = "last_status"
30        case lastError = "last_error"
31    }
32}