Skip to content

Commit 1d74d3b

Browse files
algolia-botmillotp
andcommitted
chore: generated code for commit d2b0f7d6. [skip ci]
algolia/api-clients-automation@d2b0f7d Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 0082369 commit 1d74d3b

File tree

8 files changed

+312
-244
lines changed

8 files changed

+312
-244
lines changed

Sources/Recommend/Models/RecommendBaseSearchResponse.swift

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,14 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
2929
public var facets: [String: [String: Int]]?
3030
/// Statistics for numerical facets.
3131
public var facetsStats: [String: RecommendFacetsStats]?
32-
/// Number of hits per page.
33-
public var hitsPerPage: Int
3432
/// Index name used for the query.
3533
public var index: String?
3634
/// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.
3735
public var indexUsed: String?
3836
/// Warnings about the query.
3937
public var message: String?
40-
/// Number of results (hits).
41-
public var nbHits: Int
42-
/// Number of pages of results.
43-
public var nbPages: Int
4438
/// Number of hits selected and sorted by the relevant sort algorithm.
4539
public var nbSortedHits: Int?
46-
/// Page of search results to retrieve.
47-
public var page: Int
4840
/// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean)
4941
/// query string that will be searched.
5042
public var parsedQuery: String?
@@ -78,14 +70,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
7870
exhaustiveTypo: Bool? = nil,
7971
facets: [String: [String: Int]]? = nil,
8072
facetsStats: [String: RecommendFacetsStats]? = nil,
81-
hitsPerPage: Int,
8273
index: String? = nil,
8374
indexUsed: String? = nil,
8475
message: String? = nil,
85-
nbHits: Int,
86-
nbPages: Int,
8776
nbSortedHits: Int? = nil,
88-
page: Int,
8977
parsedQuery: String? = nil,
9078
processingTimeMS: Int,
9179
processingTimingsMS: AnyCodable? = nil,
@@ -107,14 +95,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
10795
self.exhaustiveTypo = exhaustiveTypo
10896
self.facets = facets
10997
self.facetsStats = facetsStats
110-
self.hitsPerPage = hitsPerPage
11198
self.index = index
11299
self.indexUsed = indexUsed
113100
self.message = message
114-
self.nbHits = nbHits
115-
self.nbPages = nbPages
116101
self.nbSortedHits = nbSortedHits
117-
self.page = page
118102
self.parsedQuery = parsedQuery
119103
self.processingTimeMS = processingTimeMS
120104
self.processingTimingsMS = processingTimingsMS
@@ -138,14 +122,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
138122
case exhaustiveTypo
139123
case facets
140124
case facetsStats = "facets_stats"
141-
case hitsPerPage
142125
case index
143126
case indexUsed
144127
case message
145-
case nbHits
146-
case nbPages
147128
case nbSortedHits
148-
case page
149129
case parsedQuery
150130
case processingTimeMS
151131
case processingTimingsMS
@@ -194,30 +174,14 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
194174

195175
self.facetsStats = dictionary["facetsStats"]?.value as? [String: RecommendFacetsStats]
196176

197-
guard let hitsPerPage = dictionary["hitsPerPage"]?.value as? Int else {
198-
throw GenericError(description: "Failed to cast")
199-
}
200-
self.hitsPerPage = hitsPerPage
201177
self.index = dictionary["index"]?.value as? String
202178

203179
self.indexUsed = dictionary["indexUsed"]?.value as? String
204180

205181
self.message = dictionary["message"]?.value as? String
206182

207-
guard let nbHits = dictionary["nbHits"]?.value as? Int else {
208-
throw GenericError(description: "Failed to cast")
209-
}
210-
self.nbHits = nbHits
211-
guard let nbPages = dictionary["nbPages"]?.value as? Int else {
212-
throw GenericError(description: "Failed to cast")
213-
}
214-
self.nbPages = nbPages
215183
self.nbSortedHits = dictionary["nbSortedHits"]?.value as? Int
216184

217-
guard let page = dictionary["page"]?.value as? Int else {
218-
throw GenericError(description: "Failed to cast")
219-
}
220-
self.page = page
221185
self.parsedQuery = dictionary["parsedQuery"]?.value as? String
222186

223187
guard let processingTimeMS = dictionary["processingTimeMS"]?.value as? Int else {
@@ -243,10 +207,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
243207
for (key, value) in dictionary {
244208
switch key {
245209
case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive",
246-
"exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "hitsPerPage",
247-
"index", "indexUsed", "message", "nbHits", "nbPages", "nbSortedHits", "page", "parsedQuery",
248-
"processingTimeMS", "processingTimingsMS", "queryAfterRemoval", "redirect", "renderingContent",
249-
"serverTimeMS", "serverUsed", "userData", "queryID":
210+
"exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index",
211+
"indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS",
212+
"queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData",
213+
"queryID":
250214
continue
251215
default:
252216
self.additionalProperties[key] = value
@@ -268,14 +232,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
268232
try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo)
269233
try container.encodeIfPresent(self.facets, forKey: .facets)
270234
try container.encodeIfPresent(self.facetsStats, forKey: .facetsStats)
271-
try container.encode(self.hitsPerPage, forKey: .hitsPerPage)
272235
try container.encodeIfPresent(self.index, forKey: .index)
273236
try container.encodeIfPresent(self.indexUsed, forKey: .indexUsed)
274237
try container.encodeIfPresent(self.message, forKey: .message)
275-
try container.encode(self.nbHits, forKey: .nbHits)
276-
try container.encode(self.nbPages, forKey: .nbPages)
277238
try container.encodeIfPresent(self.nbSortedHits, forKey: .nbSortedHits)
278-
try container.encode(self.page, forKey: .page)
279239
try container.encodeIfPresent(self.parsedQuery, forKey: .parsedQuery)
280240
try container.encode(self.processingTimeMS, forKey: .processingTimeMS)
281241
try container.encodeIfPresent(self.processingTimingsMS, forKey: .processingTimingsMS)
@@ -305,14 +265,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
305265
self.exhaustiveTypo = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveTypo)
306266
self.facets = try container.decodeIfPresent([String: [String: Int]].self, forKey: .facets)
307267
self.facetsStats = try container.decodeIfPresent([String: RecommendFacetsStats].self, forKey: .facetsStats)
308-
self.hitsPerPage = try container.decode(Int.self, forKey: .hitsPerPage)
309268
self.index = try container.decodeIfPresent(String.self, forKey: .index)
310269
self.indexUsed = try container.decodeIfPresent(String.self, forKey: .indexUsed)
311270
self.message = try container.decodeIfPresent(String.self, forKey: .message)
312-
self.nbHits = try container.decode(Int.self, forKey: .nbHits)
313-
self.nbPages = try container.decode(Int.self, forKey: .nbPages)
314271
self.nbSortedHits = try container.decodeIfPresent(Int.self, forKey: .nbSortedHits)
315-
self.page = try container.decode(Int.self, forKey: .page)
316272
self.parsedQuery = try container.decodeIfPresent(String.self, forKey: .parsedQuery)
317273
self.processingTimeMS = try container.decode(Int.self, forKey: .processingTimeMS)
318274
self.processingTimingsMS = try container.decodeIfPresent(AnyCodable.self, forKey: .processingTimingsMS)
@@ -334,14 +290,10 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
334290
nonAdditionalPropertyKeys.insert("exhaustiveTypo")
335291
nonAdditionalPropertyKeys.insert("facets")
336292
nonAdditionalPropertyKeys.insert("facets_stats")
337-
nonAdditionalPropertyKeys.insert("hitsPerPage")
338293
nonAdditionalPropertyKeys.insert("index")
339294
nonAdditionalPropertyKeys.insert("indexUsed")
340295
nonAdditionalPropertyKeys.insert("message")
341-
nonAdditionalPropertyKeys.insert("nbHits")
342-
nonAdditionalPropertyKeys.insert("nbPages")
343296
nonAdditionalPropertyKeys.insert("nbSortedHits")
344-
nonAdditionalPropertyKeys.insert("page")
345297
nonAdditionalPropertyKeys.insert("parsedQuery")
346298
nonAdditionalPropertyKeys.insert("processingTimeMS")
347299
nonAdditionalPropertyKeys.insert("processingTimingsMS")
@@ -372,14 +324,10 @@ extension RecommendBaseSearchResponse: Equatable {
372324
lhs.exhaustiveTypo == rhs.exhaustiveTypo &&
373325
lhs.facets == rhs.facets &&
374326
lhs.facetsStats == rhs.facetsStats &&
375-
lhs.hitsPerPage == rhs.hitsPerPage &&
376327
lhs.index == rhs.index &&
377328
lhs.indexUsed == rhs.indexUsed &&
378329
lhs.message == rhs.message &&
379-
lhs.nbHits == rhs.nbHits &&
380-
lhs.nbPages == rhs.nbPages &&
381330
lhs.nbSortedHits == rhs.nbSortedHits &&
382-
lhs.page == rhs.page &&
383331
lhs.parsedQuery == rhs.parsedQuery &&
384332
lhs.processingTimeMS == rhs.processingTimeMS &&
385333
lhs.processingTimingsMS == rhs.processingTimingsMS &&
@@ -406,14 +354,10 @@ extension RecommendBaseSearchResponse: Hashable {
406354
hasher.combine(self.exhaustiveTypo?.hashValue)
407355
hasher.combine(self.facets?.hashValue)
408356
hasher.combine(self.facetsStats?.hashValue)
409-
hasher.combine(self.hitsPerPage.hashValue)
410357
hasher.combine(self.index?.hashValue)
411358
hasher.combine(self.indexUsed?.hashValue)
412359
hasher.combine(self.message?.hashValue)
413-
hasher.combine(self.nbHits.hashValue)
414-
hasher.combine(self.nbPages.hashValue)
415360
hasher.combine(self.nbSortedHits?.hashValue)
416-
hasher.combine(self.page.hashValue)
417361
hasher.combine(self.parsedQuery?.hashValue)
418362
hasher.combine(self.processingTimeMS.hashValue)
419363
hasher.combine(self.processingTimingsMS?.hashValue)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
public struct RecommendSearchPagination: Codable, JSONEncodable {
10+
/// Page of search results to retrieve.
11+
public var page: Int
12+
/// Number of results (hits).
13+
public var nbHits: Int
14+
/// Number of pages of results.
15+
public var nbPages: Int
16+
/// Number of hits per page.
17+
public var hitsPerPage: Int
18+
19+
public init(page: Int, nbHits: Int, nbPages: Int, hitsPerPage: Int) {
20+
self.page = page
21+
self.nbHits = nbHits
22+
self.nbPages = nbPages
23+
self.hitsPerPage = hitsPerPage
24+
}
25+
26+
public enum CodingKeys: String, CodingKey, CaseIterable {
27+
case page
28+
case nbHits
29+
case nbPages
30+
case hitsPerPage
31+
}
32+
33+
// Encodable protocol methods
34+
35+
public func encode(to encoder: Encoder) throws {
36+
var container = encoder.container(keyedBy: CodingKeys.self)
37+
try container.encode(self.page, forKey: .page)
38+
try container.encode(self.nbHits, forKey: .nbHits)
39+
try container.encode(self.nbPages, forKey: .nbPages)
40+
try container.encode(self.hitsPerPage, forKey: .hitsPerPage)
41+
}
42+
}
43+
44+
extension RecommendSearchPagination: Equatable {
45+
public static func ==(lhs: RecommendSearchPagination, rhs: RecommendSearchPagination) -> Bool {
46+
lhs.page == rhs.page &&
47+
lhs.nbHits == rhs.nbHits &&
48+
lhs.nbPages == rhs.nbPages &&
49+
lhs.hitsPerPage == rhs.hitsPerPage
50+
}
51+
}
52+
53+
extension RecommendSearchPagination: Hashable {
54+
public func hash(into hasher: inout Hasher) {
55+
hasher.combine(self.page.hashValue)
56+
hasher.combine(self.nbHits.hashValue)
57+
hasher.combine(self.nbPages.hashValue)
58+
hasher.combine(self.hitsPerPage.hashValue)
59+
}
60+
}

0 commit comments

Comments
 (0)