@@ -9,52 +9,73 @@ import Foundation
9
9
public struct WatchResponse : Codable , JSONEncodable {
10
10
/// Universally unique identifier (UUID) of a task run.
11
11
public var runID : String
12
+ /// Universally unique identifier (UUID) of an event.
13
+ public var eventID : String ?
12
14
/// when used with discovering or validating sources, the sampled data of your source is returned.
13
15
public var data : [ AnyCodable ] ?
14
16
/// in case of error, observability events will be added to the response, if any.
15
17
public var events : [ Event ] ?
16
18
/// a message describing the outcome of a validate run.
17
19
public var message : String ?
20
+ /// Date of creation in RFC 3339 format.
21
+ public var createdAt : String ?
18
22
19
- public init ( runID: String , data: [ AnyCodable ] ? = nil , events: [ Event ] ? = nil , message: String ? = nil ) {
23
+ public init (
24
+ runID: String ,
25
+ eventID: String ? = nil ,
26
+ data: [ AnyCodable ] ? = nil ,
27
+ events: [ Event ] ? = nil ,
28
+ message: String ? = nil ,
29
+ createdAt: String ? = nil
30
+ ) {
20
31
self . runID = runID
32
+ self . eventID = eventID
21
33
self . data = data
22
34
self . events = events
23
35
self . message = message
36
+ self . createdAt = createdAt
24
37
}
25
38
26
39
public enum CodingKeys : String , CodingKey , CaseIterable {
27
40
case runID
41
+ case eventID
28
42
case data
29
43
case events
30
44
case message
45
+ case createdAt
31
46
}
32
47
33
48
// Encodable protocol methods
34
49
35
50
public func encode( to encoder: Encoder ) throws {
36
51
var container = encoder. container ( keyedBy: CodingKeys . self)
37
52
try container. encode ( self . runID, forKey: . runID)
53
+ try container. encodeIfPresent ( self . eventID, forKey: . eventID)
38
54
try container. encodeIfPresent ( self . data, forKey: . data)
39
55
try container. encodeIfPresent ( self . events, forKey: . events)
40
56
try container. encodeIfPresent ( self . message, forKey: . message)
57
+ try container. encodeIfPresent ( self . createdAt, forKey: . createdAt)
41
58
}
42
59
}
43
60
44
61
extension WatchResponse : Equatable {
45
62
public static func == ( lhs: WatchResponse , rhs: WatchResponse ) -> Bool {
46
63
lhs. runID == rhs. runID &&
64
+ lhs. eventID == rhs. eventID &&
47
65
lhs. data == rhs. data &&
48
66
lhs. events == rhs. events &&
49
- lhs. message == rhs. message
67
+ lhs. message == rhs. message &&
68
+ lhs. createdAt == rhs. createdAt
50
69
}
51
70
}
52
71
53
72
extension WatchResponse : Hashable {
54
73
public func hash( into hasher: inout Hasher ) {
55
74
hasher. combine ( self . runID. hashValue)
75
+ hasher. combine ( self . eventID? . hashValue)
56
76
hasher. combine ( self . data? . hashValue)
57
77
hasher. combine ( self . events? . hashValue)
58
78
hasher. combine ( self . message? . hashValue)
79
+ hasher. combine ( self . createdAt? . hashValue)
59
80
}
60
81
}
0 commit comments