@@ -26,7 +26,7 @@ public struct Log: Codable, JSONEncodable {
26
26
/// SHA1 signature of the log entry.
27
27
public var sha1 : String
28
28
/// Number of API requests.
29
- public var nbApiCalls : String
29
+ public var nbApiCalls : String ?
30
30
/// Processing time for the query in milliseconds. This doesn't include latency due to the network.
31
31
public var processingTimeMs : String
32
32
/// Index targeted by the query.
@@ -48,7 +48,7 @@ public struct Log: Codable, JSONEncodable {
48
48
ip: String ,
49
49
queryHeaders: String ,
50
50
sha1: String ,
51
- nbApiCalls: String ,
51
+ nbApiCalls: String ? = nil ,
52
52
processingTimeMs: String ,
53
53
index: String ? = nil ,
54
54
queryParams: String ? = nil ,
@@ -103,7 +103,7 @@ public struct Log: Codable, JSONEncodable {
103
103
try container. encode ( self . ip, forKey: . ip)
104
104
try container. encode ( self . queryHeaders, forKey: . queryHeaders)
105
105
try container. encode ( self . sha1, forKey: . sha1)
106
- try container. encode ( self . nbApiCalls, forKey: . nbApiCalls)
106
+ try container. encodeIfPresent ( self . nbApiCalls, forKey: . nbApiCalls)
107
107
try container. encode ( self . processingTimeMs, forKey: . processingTimeMs)
108
108
try container. encodeIfPresent ( self . index, forKey: . index)
109
109
try container. encodeIfPresent ( self . queryParams, forKey: . queryParams)
@@ -143,7 +143,7 @@ extension Log: Hashable {
143
143
hasher. combine ( self . ip. hashValue)
144
144
hasher. combine ( self . queryHeaders. hashValue)
145
145
hasher. combine ( self . sha1. hashValue)
146
- hasher. combine ( self . nbApiCalls. hashValue)
146
+ hasher. combine ( self . nbApiCalls? . hashValue)
147
147
hasher. combine ( self . processingTimeMs. hashValue)
148
148
hasher. combine ( self . index? . hashValue)
149
149
hasher. combine ( self . queryParams? . hashValue)
0 commit comments