diff --git a/Sources/Recommend/Models/RecommendBaseSearchResponse.swift b/Sources/Recommend/Models/RecommendBaseSearchResponse.swift index f33d7c18..74eed82e 100644 --- a/Sources/Recommend/Models/RecommendBaseSearchResponse.swift +++ b/Sources/Recommend/Models/RecommendBaseSearchResponse.swift @@ -58,6 +58,8 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Whether automatic events collection is enabled for the application. + public var automaticInsights: Bool? public init( abTestID: Int? = nil, @@ -83,7 +85,8 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { serverTimeMS: Int? = nil, serverUsed: String? = nil, userData: AnyCodable? = nil, - queryID: String? = nil + queryID: String? = nil, + automaticInsights: Bool? = nil ) { self.abTestID = abTestID self.abTestVariantID = abTestVariantID @@ -109,6 +112,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.automaticInsights = automaticInsights } public enum CodingKeys: String, CodingKey, CaseIterable { @@ -136,6 +140,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { case serverUsed case userData case queryID + case automaticInsights = "_automaticInsights" } public var additionalProperties: [String: AnyCodable] = [:] @@ -204,13 +209,15 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { self.queryID = dictionary["queryID"]?.value as? String + self.automaticInsights = dictionary["automaticInsights"]?.value as? Bool + for (key, value) in dictionary { switch key { case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive", "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index", "indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData", - "queryID": + "queryID", "automaticInsights": continue default: self.additionalProperties[key] = value @@ -246,6 +253,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encodeIfPresent(self.automaticInsights, forKey: .automaticInsights) var additionalPropertiesContainer = encoder.container(keyedBy: String.self) try additionalPropertiesContainer.encodeMap(self.additionalProperties) } @@ -279,6 +287,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { self.serverUsed = try container.decodeIfPresent(String.self, forKey: .serverUsed) self.userData = try container.decodeIfPresent(AnyCodable.self, forKey: .userData) self.queryID = try container.decodeIfPresent(String.self, forKey: .queryID) + self.automaticInsights = try container.decodeIfPresent(Bool.self, forKey: .automaticInsights) var nonAdditionalPropertyKeys = Set() nonAdditionalPropertyKeys.insert("abTestID") nonAdditionalPropertyKeys.insert("abTestVariantID") @@ -304,6 +313,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("serverUsed") nonAdditionalPropertyKeys.insert("userData") nonAdditionalPropertyKeys.insert("queryID") + nonAdditionalPropertyKeys.insert("_automaticInsights") let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) self.additionalProperties = try additionalPropertiesContainer.decodeMap( AnyCodable.self, @@ -337,7 +347,8 @@ extension RecommendBaseSearchResponse: Equatable { lhs.serverTimeMS == rhs.serverTimeMS && lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && - lhs.queryID == rhs.queryID + lhs.queryID == rhs.queryID && + lhs.automaticInsights == rhs.automaticInsights && lhs.additionalProperties == rhs.additionalProperties } } @@ -368,6 +379,7 @@ extension RecommendBaseSearchResponse: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.automaticInsights?.hashValue) hasher.combine(self.additionalProperties.hashValue) } } diff --git a/Sources/Recommend/Models/RecommendationsResults.swift b/Sources/Recommend/Models/RecommendationsResults.swift index 97b3cef7..635f1481 100644 --- a/Sources/Recommend/Models/RecommendationsResults.swift +++ b/Sources/Recommend/Models/RecommendationsResults.swift @@ -58,6 +58,8 @@ public struct RecommendationsResults: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Whether automatic events collection is enabled for the application. + public var automaticInsights: Bool? /// Page of search results to retrieve. public var page: Int /// Number of results (hits). @@ -93,6 +95,7 @@ public struct RecommendationsResults: Codable, JSONEncodable { serverUsed: String? = nil, userData: AnyCodable? = nil, queryID: String? = nil, + automaticInsights: Bool? = nil, page: Int, nbHits: Int, nbPages: Int, @@ -123,6 +126,7 @@ public struct RecommendationsResults: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.automaticInsights = automaticInsights self.page = page self.nbHits = nbHits self.nbPages = nbPages @@ -155,6 +159,7 @@ public struct RecommendationsResults: Codable, JSONEncodable { case serverUsed case userData case queryID + case automaticInsights = "_automaticInsights" case page case nbHits case nbPages @@ -190,6 +195,7 @@ public struct RecommendationsResults: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encodeIfPresent(self.automaticInsights, forKey: .automaticInsights) try container.encode(self.page, forKey: .page) try container.encode(self.nbHits, forKey: .nbHits) try container.encode(self.nbPages, forKey: .nbPages) @@ -224,6 +230,7 @@ extension RecommendationsResults: Equatable { lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && lhs.queryID == rhs.queryID && + lhs.automaticInsights == rhs.automaticInsights && lhs.page == rhs.page && lhs.nbHits == rhs.nbHits && lhs.nbPages == rhs.nbPages && @@ -258,6 +265,7 @@ extension RecommendationsResults: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.automaticInsights?.hashValue) hasher.combine(self.page.hashValue) hasher.combine(self.nbHits.hashValue) hasher.combine(self.nbPages.hashValue) diff --git a/Sources/Search/Models/BrowseResponse.swift b/Sources/Search/Models/BrowseResponse.swift index acf7ea95..a5f0b48b 100644 --- a/Sources/Search/Models/BrowseResponse.swift +++ b/Sources/Search/Models/BrowseResponse.swift @@ -58,6 +58,8 @@ public struct BrowseResponse: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Whether automatic events collection is enabled for the application. + public var automaticInsights: Bool? /// Page of search results to retrieve. public var page: Int? /// Number of results (hits). @@ -102,6 +104,7 @@ public struct BrowseResponse: Codable, JSONEncodable { serverUsed: String? = nil, userData: AnyCodable? = nil, queryID: String? = nil, + automaticInsights: Bool? = nil, page: Int? = nil, nbHits: Int? = nil, nbPages: Int? = nil, @@ -135,6 +138,7 @@ public struct BrowseResponse: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.automaticInsights = automaticInsights self.page = page self.nbHits = nbHits self.nbPages = nbPages @@ -170,6 +174,7 @@ public struct BrowseResponse: Codable, JSONEncodable { case serverUsed case userData case queryID + case automaticInsights = "_automaticInsights" case page case nbHits case nbPages @@ -208,6 +213,7 @@ public struct BrowseResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encodeIfPresent(self.automaticInsights, forKey: .automaticInsights) try container.encodeIfPresent(self.page, forKey: .page) try container.encodeIfPresent(self.nbHits, forKey: .nbHits) try container.encodeIfPresent(self.nbPages, forKey: .nbPages) @@ -245,6 +251,7 @@ extension BrowseResponse: Equatable where T: Equatable { lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && lhs.queryID == rhs.queryID && + lhs.automaticInsights == rhs.automaticInsights && lhs.page == rhs.page && lhs.nbHits == rhs.nbHits && lhs.nbPages == rhs.nbPages && @@ -282,6 +289,7 @@ extension BrowseResponse: Hashable where T: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.automaticInsights?.hashValue) hasher.combine(self.page?.hashValue) hasher.combine(self.nbHits?.hashValue) hasher.combine(self.nbPages?.hashValue) diff --git a/Sources/Search/Models/SearchBaseSearchResponse.swift b/Sources/Search/Models/SearchBaseSearchResponse.swift index 767f3d68..132acf81 100644 --- a/Sources/Search/Models/SearchBaseSearchResponse.swift +++ b/Sources/Search/Models/SearchBaseSearchResponse.swift @@ -58,6 +58,8 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Whether automatic events collection is enabled for the application. + public var automaticInsights: Bool? public init( abTestID: Int? = nil, @@ -83,7 +85,8 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { serverTimeMS: Int? = nil, serverUsed: String? = nil, userData: AnyCodable? = nil, - queryID: String? = nil + queryID: String? = nil, + automaticInsights: Bool? = nil ) { self.abTestID = abTestID self.abTestVariantID = abTestVariantID @@ -109,6 +112,7 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.automaticInsights = automaticInsights } public enum CodingKeys: String, CodingKey, CaseIterable { @@ -136,6 +140,7 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { case serverUsed case userData case queryID + case automaticInsights = "_automaticInsights" } public var additionalProperties: [String: AnyCodable] = [:] @@ -204,13 +209,15 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { self.queryID = dictionary["queryID"]?.value as? String + self.automaticInsights = dictionary["automaticInsights"]?.value as? Bool + for (key, value) in dictionary { switch key { case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive", "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index", "indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData", - "queryID": + "queryID", "automaticInsights": continue default: self.additionalProperties[key] = value @@ -246,6 +253,7 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encodeIfPresent(self.automaticInsights, forKey: .automaticInsights) var additionalPropertiesContainer = encoder.container(keyedBy: String.self) try additionalPropertiesContainer.encodeMap(self.additionalProperties) } @@ -279,6 +287,7 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { self.serverUsed = try container.decodeIfPresent(String.self, forKey: .serverUsed) self.userData = try container.decodeIfPresent(AnyCodable.self, forKey: .userData) self.queryID = try container.decodeIfPresent(String.self, forKey: .queryID) + self.automaticInsights = try container.decodeIfPresent(Bool.self, forKey: .automaticInsights) var nonAdditionalPropertyKeys = Set() nonAdditionalPropertyKeys.insert("abTestID") nonAdditionalPropertyKeys.insert("abTestVariantID") @@ -304,6 +313,7 @@ public struct SearchBaseSearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("serverUsed") nonAdditionalPropertyKeys.insert("userData") nonAdditionalPropertyKeys.insert("queryID") + nonAdditionalPropertyKeys.insert("_automaticInsights") let additionalPropertiesContainer = try decoder.container(keyedBy: String.self) self.additionalProperties = try additionalPropertiesContainer.decodeMap( AnyCodable.self, @@ -337,7 +347,8 @@ extension SearchBaseSearchResponse: Equatable { lhs.serverTimeMS == rhs.serverTimeMS && lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && - lhs.queryID == rhs.queryID + lhs.queryID == rhs.queryID && + lhs.automaticInsights == rhs.automaticInsights && lhs.additionalProperties == rhs.additionalProperties } } @@ -368,6 +379,7 @@ extension SearchBaseSearchResponse: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.automaticInsights?.hashValue) hasher.combine(self.additionalProperties.hashValue) } } diff --git a/Sources/Search/Models/SearchResponse.swift b/Sources/Search/Models/SearchResponse.swift index 3f569c06..13906b74 100644 --- a/Sources/Search/Models/SearchResponse.swift +++ b/Sources/Search/Models/SearchResponse.swift @@ -58,6 +58,8 @@ public struct SearchResponse: Codable, JSONEncodable { /// Unique identifier for the query. This is used for [click /// analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). public var queryID: String? + /// Whether automatic events collection is enabled for the application. + public var automaticInsights: Bool? /// Page of search results to retrieve. public var page: Int /// Number of results (hits). @@ -99,6 +101,7 @@ public struct SearchResponse: Codable, JSONEncodable { serverUsed: String? = nil, userData: AnyCodable? = nil, queryID: String? = nil, + automaticInsights: Bool? = nil, page: Int, nbHits: Int, nbPages: Int, @@ -131,6 +134,7 @@ public struct SearchResponse: Codable, JSONEncodable { self.serverUsed = serverUsed self.userData = userData self.queryID = queryID + self.automaticInsights = automaticInsights self.page = page self.nbHits = nbHits self.nbPages = nbPages @@ -165,6 +169,7 @@ public struct SearchResponse: Codable, JSONEncodable { case serverUsed case userData case queryID + case automaticInsights = "_automaticInsights" case page case nbHits case nbPages @@ -240,6 +245,8 @@ public struct SearchResponse: Codable, JSONEncodable { self.queryID = dictionary["queryID"]?.value as? String + self.automaticInsights = dictionary["automaticInsights"]?.value as? Bool + guard let page = dictionary["page"]?.value as? Int else { throw GenericError(description: "Failed to cast") } @@ -274,7 +281,7 @@ public struct SearchResponse: Codable, JSONEncodable { "exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index", "indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData", - "queryID", "page", "nbHits", "nbPages", "hitsPerPage", "hits", "query", "params": + "queryID", "automaticInsights", "page", "nbHits", "nbPages", "hitsPerPage", "hits", "query", "params": continue default: self.additionalProperties[key] = value @@ -310,6 +317,7 @@ public struct SearchResponse: Codable, JSONEncodable { try container.encodeIfPresent(self.serverUsed, forKey: .serverUsed) try container.encodeIfPresent(self.userData, forKey: .userData) try container.encodeIfPresent(self.queryID, forKey: .queryID) + try container.encodeIfPresent(self.automaticInsights, forKey: .automaticInsights) try container.encode(self.page, forKey: .page) try container.encode(self.nbHits, forKey: .nbHits) try container.encode(self.nbPages, forKey: .nbPages) @@ -350,6 +358,7 @@ public struct SearchResponse: Codable, JSONEncodable { self.serverUsed = try container.decodeIfPresent(String.self, forKey: .serverUsed) self.userData = try container.decodeIfPresent(AnyCodable.self, forKey: .userData) self.queryID = try container.decodeIfPresent(String.self, forKey: .queryID) + self.automaticInsights = try container.decodeIfPresent(Bool.self, forKey: .automaticInsights) self.page = try container.decode(Int.self, forKey: .page) self.nbHits = try container.decode(Int.self, forKey: .nbHits) self.nbPages = try container.decode(Int.self, forKey: .nbPages) @@ -382,6 +391,7 @@ public struct SearchResponse: Codable, JSONEncodable { nonAdditionalPropertyKeys.insert("serverUsed") nonAdditionalPropertyKeys.insert("userData") nonAdditionalPropertyKeys.insert("queryID") + nonAdditionalPropertyKeys.insert("_automaticInsights") nonAdditionalPropertyKeys.insert("page") nonAdditionalPropertyKeys.insert("nbHits") nonAdditionalPropertyKeys.insert("nbPages") @@ -423,6 +433,7 @@ extension SearchResponse: Equatable where T: Equatable { lhs.serverUsed == rhs.serverUsed && lhs.userData == rhs.userData && lhs.queryID == rhs.queryID && + lhs.automaticInsights == rhs.automaticInsights && lhs.page == rhs.page && lhs.nbHits == rhs.nbHits && lhs.nbPages == rhs.nbPages && @@ -460,6 +471,7 @@ extension SearchResponse: Hashable where T: Hashable { hasher.combine(self.serverUsed?.hashValue) hasher.combine(self.userData?.hashValue) hasher.combine(self.queryID?.hashValue) + hasher.combine(self.automaticInsights?.hashValue) hasher.combine(self.page.hashValue) hasher.combine(self.nbHits.hashValue) hasher.combine(self.nbPages.hashValue)