@@ -26,7 +26,7 @@ public struct Log: Codable, JSONEncodable {
2626 /// SHA1 signature of the log entry.
2727 public var sha1 : String
2828 /// Number of API requests.
29- public var nbApiCalls : String
29+ public var nbApiCalls : String ?
3030 /// Processing time for the query in milliseconds. This doesn't include latency due to the network.
3131 public var processingTimeMs : String
3232 /// Index targeted by the query.
@@ -48,7 +48,7 @@ public struct Log: Codable, JSONEncodable {
4848 ip: String ,
4949 queryHeaders: String ,
5050 sha1: String ,
51- nbApiCalls: String ,
51+ nbApiCalls: String ? = nil ,
5252 processingTimeMs: String ,
5353 index: String ? = nil ,
5454 queryParams: String ? = nil ,
@@ -103,7 +103,7 @@ public struct Log: Codable, JSONEncodable {
103103 try container. encode ( self . ip, forKey: . ip)
104104 try container. encode ( self . queryHeaders, forKey: . queryHeaders)
105105 try container. encode ( self . sha1, forKey: . sha1)
106- try container. encode ( self . nbApiCalls, forKey: . nbApiCalls)
106+ try container. encodeIfPresent ( self . nbApiCalls, forKey: . nbApiCalls)
107107 try container. encode ( self . processingTimeMs, forKey: . processingTimeMs)
108108 try container. encodeIfPresent ( self . index, forKey: . index)
109109 try container. encodeIfPresent ( self . queryParams, forKey: . queryParams)
@@ -143,7 +143,7 @@ extension Log: Hashable {
143143 hasher. combine ( self . ip. hashValue)
144144 hasher. combine ( self . queryHeaders. hashValue)
145145 hasher. combine ( self . sha1. hashValue)
146- hasher. combine ( self . nbApiCalls. hashValue)
146+ hasher. combine ( self . nbApiCalls? . hashValue)
147147 hasher. combine ( self . processingTimeMs. hashValue)
148148 hasher. combine ( self . index? . hashValue)
149149 hasher. combine ( self . queryParams? . hashValue)
0 commit comments