Skip to content

Commit 708e984

Browse files
algolia-botraed667
andcommitted
feat(specs): add fallbackParameters to Frequently bought together [RECO-2443] (generated)
algolia/api-clients-automation#5579 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Raed <[email protected]>
1 parent 449466d commit 708e984

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Sources/Recommend/Models/BoughtTogetherQuery.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,24 @@ public struct BoughtTogetherQuery: Codable, JSONEncodable {
1919
public var model: FbtModel
2020
/// Unique record identifier.
2121
public var objectID: String
22+
public var fallbackParameters: FallbackParams?
2223

2324
public init(
2425
indexName: String,
2526
threshold: Double,
2627
maxRecommendations: Int? = nil,
2728
queryParameters: RecommendSearchParams? = nil,
2829
model: FbtModel,
29-
objectID: String
30+
objectID: String,
31+
fallbackParameters: FallbackParams? = nil
3032
) {
3133
self.indexName = indexName
3234
self.threshold = threshold
3335
self.maxRecommendations = maxRecommendations
3436
self.queryParameters = queryParameters
3537
self.model = model
3638
self.objectID = objectID
39+
self.fallbackParameters = fallbackParameters
3740
}
3841

3942
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -43,6 +46,7 @@ public struct BoughtTogetherQuery: Codable, JSONEncodable {
4346
case queryParameters
4447
case model
4548
case objectID
49+
case fallbackParameters
4650
}
4751

4852
// Encodable protocol methods
@@ -55,6 +59,7 @@ public struct BoughtTogetherQuery: Codable, JSONEncodable {
5559
try container.encodeIfPresent(self.queryParameters, forKey: .queryParameters)
5660
try container.encode(self.model, forKey: .model)
5761
try container.encode(self.objectID, forKey: .objectID)
62+
try container.encodeIfPresent(self.fallbackParameters, forKey: .fallbackParameters)
5863
}
5964
}
6065

@@ -65,7 +70,8 @@ extension BoughtTogetherQuery: Equatable {
6570
lhs.maxRecommendations == rhs.maxRecommendations &&
6671
lhs.queryParameters == rhs.queryParameters &&
6772
lhs.model == rhs.model &&
68-
lhs.objectID == rhs.objectID
73+
lhs.objectID == rhs.objectID &&
74+
lhs.fallbackParameters == rhs.fallbackParameters
6975
}
7076
}
7177

@@ -77,5 +83,6 @@ extension BoughtTogetherQuery: Hashable {
7783
hasher.combine(self.queryParameters?.hashValue)
7884
hasher.combine(self.model.hashValue)
7985
hasher.combine(self.objectID.hashValue)
86+
hasher.combine(self.fallbackParameters?.hashValue)
8087
}
8188
}

Sources/Recommend/Models/FrequentlyBoughtTogether.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ public struct FrequentlyBoughtTogether: Codable, JSONEncodable {
1010
public var model: FbtModel
1111
/// Unique record identifier.
1212
public var objectID: String
13+
public var fallbackParameters: FallbackParams?
1314

14-
public init(model: FbtModel, objectID: String) {
15+
public init(model: FbtModel, objectID: String, fallbackParameters: FallbackParams? = nil) {
1516
self.model = model
1617
self.objectID = objectID
18+
self.fallbackParameters = fallbackParameters
1719
}
1820

1921
public enum CodingKeys: String, CodingKey, CaseIterable {
2022
case model
2123
case objectID
24+
case fallbackParameters
2225
}
2326

2427
// Encodable protocol methods
@@ -27,19 +30,22 @@ public struct FrequentlyBoughtTogether: Codable, JSONEncodable {
2730
var container = encoder.container(keyedBy: CodingKeys.self)
2831
try container.encode(self.model, forKey: .model)
2932
try container.encode(self.objectID, forKey: .objectID)
33+
try container.encodeIfPresent(self.fallbackParameters, forKey: .fallbackParameters)
3034
}
3135
}
3236

3337
extension FrequentlyBoughtTogether: Equatable {
3438
public static func ==(lhs: FrequentlyBoughtTogether, rhs: FrequentlyBoughtTogether) -> Bool {
3539
lhs.model == rhs.model &&
36-
lhs.objectID == rhs.objectID
40+
lhs.objectID == rhs.objectID &&
41+
lhs.fallbackParameters == rhs.fallbackParameters
3742
}
3843
}
3944

4045
extension FrequentlyBoughtTogether: Hashable {
4146
public func hash(into hasher: inout Hasher) {
4247
hasher.combine(self.model.hashValue)
4348
hasher.combine(self.objectID.hashValue)
49+
hasher.combine(self.fallbackParameters?.hashValue)
4450
}
4551
}

0 commit comments

Comments
 (0)