Skip to content

Commit 72d6ed5

Browse files
chore: generated code for commit 31ba7f6d. [skip ci]
algolia/api-clients-automation@31ba7f6 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 797c592 commit 72d6ed5

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Sources/Recommend/Models/TrendingItems.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import Foundation
99
public struct TrendingItems: Codable, JSONEncodable {
1010
/// Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the
1111
/// facet filter will be returned.
12-
public var facetName: String
12+
public var facetName: String?
1313
/// Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet
1414
/// filter will be returned.
15-
public var facetValue: String
15+
public var facetValue: String?
1616
public var model: TrendingItemsModel
1717
public var fallbackParameters: RecommendSearchParamsObject?
1818

1919
public init(
20-
facetName: String,
21-
facetValue: String,
20+
facetName: String? = nil,
21+
facetValue: String? = nil,
2222
model: TrendingItemsModel,
2323
fallbackParameters: RecommendSearchParamsObject? = nil
2424
) {
@@ -39,8 +39,8 @@ public struct TrendingItems: Codable, JSONEncodable {
3939

4040
public func encode(to encoder: Encoder) throws {
4141
var container = encoder.container(keyedBy: CodingKeys.self)
42-
try container.encode(self.facetName, forKey: .facetName)
43-
try container.encode(self.facetValue, forKey: .facetValue)
42+
try container.encodeIfPresent(self.facetName, forKey: .facetName)
43+
try container.encodeIfPresent(self.facetValue, forKey: .facetValue)
4444
try container.encode(self.model, forKey: .model)
4545
try container.encodeIfPresent(self.fallbackParameters, forKey: .fallbackParameters)
4646
}
@@ -57,8 +57,8 @@ extension TrendingItems: Equatable {
5757

5858
extension TrendingItems: Hashable {
5959
public func hash(into hasher: inout Hasher) {
60-
hasher.combine(self.facetName.hashValue)
61-
hasher.combine(self.facetValue.hashValue)
60+
hasher.combine(self.facetName?.hashValue)
61+
hasher.combine(self.facetValue?.hashValue)
6262
hasher.combine(self.model.hashValue)
6363
hasher.combine(self.fallbackParameters?.hashValue)
6464
}

Sources/Recommend/Models/TrendingItemsQuery.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public struct TrendingItemsQuery: Codable, JSONEncodable {
1818
public var queryParameters: RecommendSearchParams?
1919
/// Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the
2020
/// facet filter will be returned.
21-
public var facetName: String
21+
public var facetName: String?
2222
/// Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet
2323
/// filter will be returned.
24-
public var facetValue: String
24+
public var facetValue: String?
2525
public var model: TrendingItemsModel
2626
public var fallbackParameters: RecommendSearchParamsObject?
2727

@@ -30,8 +30,8 @@ public struct TrendingItemsQuery: Codable, JSONEncodable {
3030
threshold: Double,
3131
maxRecommendations: Int? = nil,
3232
queryParameters: RecommendSearchParams? = nil,
33-
facetName: String,
34-
facetValue: String,
33+
facetName: String? = nil,
34+
facetValue: String? = nil,
3535
model: TrendingItemsModel,
3636
fallbackParameters: RecommendSearchParamsObject? = nil
3737
) {
@@ -64,8 +64,8 @@ public struct TrendingItemsQuery: Codable, JSONEncodable {
6464
try container.encode(self.threshold, forKey: .threshold)
6565
try container.encodeIfPresent(self.maxRecommendations, forKey: .maxRecommendations)
6666
try container.encodeIfPresent(self.queryParameters, forKey: .queryParameters)
67-
try container.encode(self.facetName, forKey: .facetName)
68-
try container.encode(self.facetValue, forKey: .facetValue)
67+
try container.encodeIfPresent(self.facetName, forKey: .facetName)
68+
try container.encodeIfPresent(self.facetValue, forKey: .facetValue)
6969
try container.encode(self.model, forKey: .model)
7070
try container.encodeIfPresent(self.fallbackParameters, forKey: .fallbackParameters)
7171
}
@@ -90,8 +90,8 @@ extension TrendingItemsQuery: Hashable {
9090
hasher.combine(self.threshold.hashValue)
9191
hasher.combine(self.maxRecommendations?.hashValue)
9292
hasher.combine(self.queryParameters?.hashValue)
93-
hasher.combine(self.facetName.hashValue)
94-
hasher.combine(self.facetValue.hashValue)
93+
hasher.combine(self.facetName?.hashValue)
94+
hasher.combine(self.facetValue?.hashValue)
9595
hasher.combine(self.model.hashValue)
9696
hasher.combine(self.fallbackParameters?.hashValue)
9797
}

0 commit comments

Comments
 (0)