Skip to content

Commit 7ab4c2e

Browse files
committed
fix(specs): multiple clients fixes (generated)
algolia/api-clients-automation#3971 Co-authored-by: algolia-bot <[email protected]>
1 parent a066ab9 commit 7ab4c2e

10 files changed

+75
-23
lines changed

Sources/Abtesting/Models/ABTestConfiguration.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import Foundation
88

99
/// A/B test configuration.
1010
public struct ABTestConfiguration: Codable, JSONEncodable {
11-
public var outliers: Outliers
11+
public var outliers: Outliers?
1212
public var emptySearch: EmptySearch?
1313
public var minimumDetectableEffect: MinimumDetectableEffect?
1414

1515
public init(
16-
outliers: Outliers,
16+
outliers: Outliers? = nil,
1717
emptySearch: EmptySearch? = nil,
1818
minimumDetectableEffect: MinimumDetectableEffect? = nil
1919
) {
@@ -32,7 +32,7 @@ public struct ABTestConfiguration: Codable, JSONEncodable {
3232

3333
public func encode(to encoder: Encoder) throws {
3434
var container = encoder.container(keyedBy: CodingKeys.self)
35-
try container.encode(self.outliers, forKey: .outliers)
35+
try container.encodeIfPresent(self.outliers, forKey: .outliers)
3636
try container.encodeIfPresent(self.emptySearch, forKey: .emptySearch)
3737
try container.encodeIfPresent(self.minimumDetectableEffect, forKey: .minimumDetectableEffect)
3838
}
@@ -48,7 +48,7 @@ extension ABTestConfiguration: Equatable {
4848

4949
extension ABTestConfiguration: Hashable {
5050
public func hash(into hasher: inout Hasher) {
51-
hasher.combine(self.outliers.hashValue)
51+
hasher.combine(self.outliers?.hashValue)
5252
hasher.combine(self.emptySearch?.hashValue)
5353
hasher.combine(self.minimumDetectableEffect?.hashValue)
5454
}

Sources/Abtesting/Models/Variant.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public struct Variant: Codable, JSONEncodable {
2828
/// A/B test currencies.
2929
public var currencies: [String: Currency]?
3030
/// Description for this variant.
31-
public var description: String
31+
public var description: String?
3232
/// Estimated number of searches required to achieve the desired statistical significance. The A/B test
3333
/// configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
3434
public var estimatedSampleSize: Int?
@@ -64,7 +64,7 @@ public struct Variant: Codable, JSONEncodable {
6464
conversionCount: Int,
6565
conversionRate: Double? = nil,
6666
currencies: [String: Currency]? = nil,
67-
description: String,
67+
description: String? = nil,
6868
estimatedSampleSize: Int? = nil,
6969
filterEffects: FilterEffects? = nil,
7070
index: String,
@@ -134,7 +134,7 @@ public struct Variant: Codable, JSONEncodable {
134134
try container.encode(self.conversionCount, forKey: .conversionCount)
135135
try container.encodeIfPresent(self.conversionRate, forKey: .conversionRate)
136136
try container.encodeIfPresent(self.currencies, forKey: .currencies)
137-
try container.encode(self.description, forKey: .description)
137+
try container.encodeIfPresent(self.description, forKey: .description)
138138
try container.encodeIfPresent(self.estimatedSampleSize, forKey: .estimatedSampleSize)
139139
try container.encodeIfPresent(self.filterEffects, forKey: .filterEffects)
140140
try container.encode(self.index, forKey: .index)
@@ -184,7 +184,7 @@ extension Variant: Hashable {
184184
hasher.combine(self.conversionCount.hashValue)
185185
hasher.combine(self.conversionRate?.hashValue)
186186
hasher.combine(self.currencies?.hashValue)
187-
hasher.combine(self.description.hashValue)
187+
hasher.combine(self.description?.hashValue)
188188
hasher.combine(self.estimatedSampleSize?.hashValue)
189189
hasher.combine(self.filterEffects?.hashValue)
190190
hasher.combine(self.index.hashValue)

Sources/Recommend/Models/RecommendBaseSearchResponse.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
1616
/// Distance from a central coordinate provided by `aroundLatLng`.
1717
public var automaticRadius: String?
1818
public var exhaustive: RecommendExhaustive?
19+
/// Rules applied to the query.
20+
public var appliedRules: [AnyCodable]?
1921
/// See the `facetsCount` field of the `exhaustive` object in the response.
2022
@available(*, deprecated, message: "This property is deprecated.")
2123
public var exhaustiveFacetsCount: Bool?
@@ -67,6 +69,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
6769
aroundLatLng: String? = nil,
6870
automaticRadius: String? = nil,
6971
exhaustive: RecommendExhaustive? = nil,
72+
appliedRules: [AnyCodable]? = nil,
7073
exhaustiveFacetsCount: Bool? = nil,
7174
exhaustiveNbHits: Bool? = nil,
7275
exhaustiveTypo: Bool? = nil,
@@ -93,6 +96,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
9396
self.aroundLatLng = aroundLatLng
9497
self.automaticRadius = automaticRadius
9598
self.exhaustive = exhaustive
99+
self.appliedRules = appliedRules
96100
self.exhaustiveFacetsCount = exhaustiveFacetsCount
97101
self.exhaustiveNbHits = exhaustiveNbHits
98102
self.exhaustiveTypo = exhaustiveTypo
@@ -121,6 +125,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
121125
case aroundLatLng
122126
case automaticRadius
123127
case exhaustive
128+
case appliedRules
124129
case exhaustiveFacetsCount
125130
case exhaustiveNbHits
126131
case exhaustiveTypo
@@ -169,6 +174,8 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
169174

170175
self.exhaustive = dictionary["exhaustive"]?.value as? RecommendExhaustive
171176

177+
self.appliedRules = dictionary["appliedRules"]?.value as? [AnyCodable]
178+
172179
self.exhaustiveFacetsCount = dictionary["exhaustiveFacetsCount"]?.value as? Bool
173180

174181
self.exhaustiveNbHits = dictionary["exhaustiveNbHits"]?.value as? Bool
@@ -213,7 +220,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
213220

214221
for (key, value) in dictionary {
215222
switch key {
216-
case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive",
223+
case "abTestID", "abTestVariantID", "aroundLatLng", "automaticRadius", "exhaustive", "appliedRules",
217224
"exhaustiveFacetsCount", "exhaustiveNbHits", "exhaustiveTypo", "facets", "facetsStats", "index",
218225
"indexUsed", "message", "nbSortedHits", "parsedQuery", "processingTimeMS", "processingTimingsMS",
219226
"queryAfterRemoval", "redirect", "renderingContent", "serverTimeMS", "serverUsed", "userData",
@@ -234,6 +241,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
234241
try container.encodeIfPresent(self.aroundLatLng, forKey: .aroundLatLng)
235242
try container.encodeIfPresent(self.automaticRadius, forKey: .automaticRadius)
236243
try container.encodeIfPresent(self.exhaustive, forKey: .exhaustive)
244+
try container.encodeIfPresent(self.appliedRules, forKey: .appliedRules)
237245
try container.encodeIfPresent(self.exhaustiveFacetsCount, forKey: .exhaustiveFacetsCount)
238246
try container.encodeIfPresent(self.exhaustiveNbHits, forKey: .exhaustiveNbHits)
239247
try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo)
@@ -268,6 +276,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
268276
self.aroundLatLng = try container.decodeIfPresent(String.self, forKey: .aroundLatLng)
269277
self.automaticRadius = try container.decodeIfPresent(String.self, forKey: .automaticRadius)
270278
self.exhaustive = try container.decodeIfPresent(RecommendExhaustive.self, forKey: .exhaustive)
279+
self.appliedRules = try container.decodeIfPresent([AnyCodable].self, forKey: .appliedRules)
271280
self.exhaustiveFacetsCount = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveFacetsCount)
272281
self.exhaustiveNbHits = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveNbHits)
273282
self.exhaustiveTypo = try container.decodeIfPresent(Bool.self, forKey: .exhaustiveTypo)
@@ -294,6 +303,7 @@ public struct RecommendBaseSearchResponse: Codable, JSONEncodable {
294303
nonAdditionalPropertyKeys.insert("aroundLatLng")
295304
nonAdditionalPropertyKeys.insert("automaticRadius")
296305
nonAdditionalPropertyKeys.insert("exhaustive")
306+
nonAdditionalPropertyKeys.insert("appliedRules")
297307
nonAdditionalPropertyKeys.insert("exhaustiveFacetsCount")
298308
nonAdditionalPropertyKeys.insert("exhaustiveNbHits")
299309
nonAdditionalPropertyKeys.insert("exhaustiveTypo")
@@ -329,6 +339,7 @@ extension RecommendBaseSearchResponse: Equatable {
329339
lhs.aroundLatLng == rhs.aroundLatLng &&
330340
lhs.automaticRadius == rhs.automaticRadius &&
331341
lhs.exhaustive == rhs.exhaustive &&
342+
lhs.appliedRules == rhs.appliedRules &&
332343
lhs.exhaustiveFacetsCount == rhs.exhaustiveFacetsCount &&
333344
lhs.exhaustiveNbHits == rhs.exhaustiveNbHits &&
334345
lhs.exhaustiveTypo == rhs.exhaustiveTypo &&
@@ -360,6 +371,7 @@ extension RecommendBaseSearchResponse: Hashable {
360371
hasher.combine(self.aroundLatLng?.hashValue)
361372
hasher.combine(self.automaticRadius?.hashValue)
362373
hasher.combine(self.exhaustive?.hashValue)
374+
hasher.combine(self.appliedRules?.hashValue)
363375
hasher.combine(self.exhaustiveFacetsCount?.hashValue)
364376
hasher.combine(self.exhaustiveNbHits?.hashValue)
365377
hasher.combine(self.exhaustiveTypo?.hashValue)

Sources/Recommend/Models/RecommendationsResults.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public struct RecommendationsResults: Codable, JSONEncodable {
1616
/// Distance from a central coordinate provided by `aroundLatLng`.
1717
public var automaticRadius: String?
1818
public var exhaustive: RecommendExhaustive?
19+
/// Rules applied to the query.
20+
public var appliedRules: [AnyCodable]?
1921
/// See the `facetsCount` field of the `exhaustive` object in the response.
2022
@available(*, deprecated, message: "This property is deprecated.")
2123
public var exhaustiveFacetsCount: Bool?
@@ -76,6 +78,7 @@ public struct RecommendationsResults: Codable, JSONEncodable {
7678
aroundLatLng: String? = nil,
7779
automaticRadius: String? = nil,
7880
exhaustive: RecommendExhaustive? = nil,
81+
appliedRules: [AnyCodable]? = nil,
7982
exhaustiveFacetsCount: Bool? = nil,
8083
exhaustiveNbHits: Bool? = nil,
8184
exhaustiveTypo: Bool? = nil,
@@ -107,6 +110,7 @@ public struct RecommendationsResults: Codable, JSONEncodable {
107110
self.aroundLatLng = aroundLatLng
108111
self.automaticRadius = automaticRadius
109112
self.exhaustive = exhaustive
113+
self.appliedRules = appliedRules
110114
self.exhaustiveFacetsCount = exhaustiveFacetsCount
111115
self.exhaustiveNbHits = exhaustiveNbHits
112116
self.exhaustiveTypo = exhaustiveTypo
@@ -140,6 +144,7 @@ public struct RecommendationsResults: Codable, JSONEncodable {
140144
case aroundLatLng
141145
case automaticRadius
142146
case exhaustive
147+
case appliedRules
143148
case exhaustiveFacetsCount
144149
case exhaustiveNbHits
145150
case exhaustiveTypo
@@ -176,6 +181,7 @@ public struct RecommendationsResults: Codable, JSONEncodable {
176181
try container.encodeIfPresent(self.aroundLatLng, forKey: .aroundLatLng)
177182
try container.encodeIfPresent(self.automaticRadius, forKey: .automaticRadius)
178183
try container.encodeIfPresent(self.exhaustive, forKey: .exhaustive)
184+
try container.encodeIfPresent(self.appliedRules, forKey: .appliedRules)
179185
try container.encodeIfPresent(self.exhaustiveFacetsCount, forKey: .exhaustiveFacetsCount)
180186
try container.encodeIfPresent(self.exhaustiveNbHits, forKey: .exhaustiveNbHits)
181187
try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo)
@@ -211,6 +217,7 @@ extension RecommendationsResults: Equatable {
211217
lhs.aroundLatLng == rhs.aroundLatLng &&
212218
lhs.automaticRadius == rhs.automaticRadius &&
213219
lhs.exhaustive == rhs.exhaustive &&
220+
lhs.appliedRules == rhs.appliedRules &&
214221
lhs.exhaustiveFacetsCount == rhs.exhaustiveFacetsCount &&
215222
lhs.exhaustiveNbHits == rhs.exhaustiveNbHits &&
216223
lhs.exhaustiveTypo == rhs.exhaustiveTypo &&
@@ -246,6 +253,7 @@ extension RecommendationsResults: Hashable {
246253
hasher.combine(self.aroundLatLng?.hashValue)
247254
hasher.combine(self.automaticRadius?.hashValue)
248255
hasher.combine(self.exhaustive?.hashValue)
256+
hasher.combine(self.appliedRules?.hashValue)
249257
hasher.combine(self.exhaustiveFacetsCount?.hashValue)
250258
hasher.combine(self.exhaustiveNbHits?.hashValue)
251259
hasher.combine(self.exhaustiveTypo?.hashValue)

Sources/Search/Models/BaseGetApiKeyResponse.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import Foundation
88

99
public struct BaseGetApiKeyResponse: Codable, JSONEncodable {
1010
/// API key.
11-
public var value: String?
11+
public var value: String
1212
/// Timestamp when the object was created, in milliseconds since the Unix epoch.
1313
public var createdAt: Int64
1414

15-
public init(value: String? = nil, createdAt: Int64) {
15+
public init(value: String, createdAt: Int64) {
1616
self.value = value
1717
self.createdAt = createdAt
1818
}
@@ -26,7 +26,7 @@ public struct BaseGetApiKeyResponse: Codable, JSONEncodable {
2626

2727
public func encode(to encoder: Encoder) throws {
2828
var container = encoder.container(keyedBy: CodingKeys.self)
29-
try container.encodeIfPresent(self.value, forKey: .value)
29+
try container.encode(self.value, forKey: .value)
3030
try container.encode(self.createdAt, forKey: .createdAt)
3131
}
3232
}
@@ -40,7 +40,7 @@ extension BaseGetApiKeyResponse: Equatable {
4040

4141
extension BaseGetApiKeyResponse: Hashable {
4242
public func hash(into hasher: inout Hasher) {
43-
hasher.combine(self.value?.hashValue)
43+
hasher.combine(self.value.hashValue)
4444
hasher.combine(self.createdAt.hashValue)
4545
}
4646
}

Sources/Search/Models/BrowseResponse.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public struct BrowseResponse<T: Codable>: Codable, JSONEncodable {
1616
/// Distance from a central coordinate provided by `aroundLatLng`.
1717
public var automaticRadius: String?
1818
public var exhaustive: SearchExhaustive?
19+
/// Rules applied to the query.
20+
public var appliedRules: [AnyCodable]?
1921
/// See the `facetsCount` field of the `exhaustive` object in the response.
2022
@available(*, deprecated, message: "This property is deprecated.")
2123
public var exhaustiveFacetsCount: Bool?
@@ -85,6 +87,7 @@ public struct BrowseResponse<T: Codable>: Codable, JSONEncodable {
8587
aroundLatLng: String? = nil,
8688
automaticRadius: String? = nil,
8789
exhaustive: SearchExhaustive? = nil,
90+
appliedRules: [AnyCodable]? = nil,
8891
exhaustiveFacetsCount: Bool? = nil,
8992
exhaustiveNbHits: Bool? = nil,
9093
exhaustiveTypo: Bool? = nil,
@@ -119,6 +122,7 @@ public struct BrowseResponse<T: Codable>: Codable, JSONEncodable {
119122
self.aroundLatLng = aroundLatLng
120123
self.automaticRadius = automaticRadius
121124
self.exhaustive = exhaustive
125+
self.appliedRules = appliedRules
122126
self.exhaustiveFacetsCount = exhaustiveFacetsCount
123127
self.exhaustiveNbHits = exhaustiveNbHits
124128
self.exhaustiveTypo = exhaustiveTypo
@@ -155,6 +159,7 @@ public struct BrowseResponse<T: Codable>: Codable, JSONEncodable {
155159
case aroundLatLng
156160
case automaticRadius
157161
case exhaustive
162+
case appliedRules
158163
case exhaustiveFacetsCount
159164
case exhaustiveNbHits
160165
case exhaustiveTypo
@@ -194,6 +199,7 @@ public struct BrowseResponse<T: Codable>: Codable, JSONEncodable {
194199
try container.encodeIfPresent(self.aroundLatLng, forKey: .aroundLatLng)
195200
try container.encodeIfPresent(self.automaticRadius, forKey: .automaticRadius)
196201
try container.encodeIfPresent(self.exhaustive, forKey: .exhaustive)
202+
try container.encodeIfPresent(self.appliedRules, forKey: .appliedRules)
197203
try container.encodeIfPresent(self.exhaustiveFacetsCount, forKey: .exhaustiveFacetsCount)
198204
try container.encodeIfPresent(self.exhaustiveNbHits, forKey: .exhaustiveNbHits)
199205
try container.encodeIfPresent(self.exhaustiveTypo, forKey: .exhaustiveTypo)
@@ -232,6 +238,7 @@ extension BrowseResponse: Equatable where T: Equatable {
232238
lhs.aroundLatLng == rhs.aroundLatLng &&
233239
lhs.automaticRadius == rhs.automaticRadius &&
234240
lhs.exhaustive == rhs.exhaustive &&
241+
lhs.appliedRules == rhs.appliedRules &&
235242
lhs.exhaustiveFacetsCount == rhs.exhaustiveFacetsCount &&
236243
lhs.exhaustiveNbHits == rhs.exhaustiveNbHits &&
237244
lhs.exhaustiveTypo == rhs.exhaustiveTypo &&
@@ -270,6 +277,7 @@ extension BrowseResponse: Hashable where T: Hashable {
270277
hasher.combine(self.aroundLatLng?.hashValue)
271278
hasher.combine(self.automaticRadius?.hashValue)
272279
hasher.combine(self.exhaustive?.hashValue)
280+
hasher.combine(self.appliedRules?.hashValue)
273281
hasher.combine(self.exhaustiveFacetsCount?.hashValue)
274282
hasher.combine(self.exhaustiveNbHits?.hashValue)
275283
hasher.combine(self.exhaustiveTypo?.hashValue)

Sources/Search/Models/GetApiKeyResponse.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88

99
public struct GetApiKeyResponse: Codable, JSONEncodable {
1010
/// API key.
11-
public var value: String?
11+
public var value: String
1212
/// Timestamp when the object was created, in milliseconds since the Unix epoch.
1313
public var createdAt: Int64
1414
/// Permissions that determine the type of API requests this key can make. The required ACL is listed in each
@@ -43,7 +43,7 @@ public struct GetApiKeyResponse: Codable, JSONEncodable {
4343
public var validity: Int?
4444

4545
public init(
46-
value: String? = nil,
46+
value: String,
4747
createdAt: Int64,
4848
acl: [Acl],
4949
description: String? = nil,
@@ -83,7 +83,7 @@ public struct GetApiKeyResponse: Codable, JSONEncodable {
8383

8484
public func encode(to encoder: Encoder) throws {
8585
var container = encoder.container(keyedBy: CodingKeys.self)
86-
try container.encodeIfPresent(self.value, forKey: .value)
86+
try container.encode(self.value, forKey: .value)
8787
try container.encode(self.createdAt, forKey: .createdAt)
8888
try container.encode(self.acl, forKey: .acl)
8989
try container.encodeIfPresent(self.description, forKey: .description)
@@ -113,7 +113,7 @@ extension GetApiKeyResponse: Equatable {
113113

114114
extension GetApiKeyResponse: Hashable {
115115
public func hash(into hasher: inout Hasher) {
116-
hasher.combine(self.value?.hashValue)
116+
hasher.combine(self.value.hashValue)
117117
hasher.combine(self.createdAt.hashValue)
118118
hasher.combine(self.acl.hashValue)
119119
hasher.combine(self.description?.hashValue)

Sources/Search/Models/GetObjectsResponse.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import Foundation
88

99
public struct GetObjectsResponse<T: Codable>: Codable, JSONEncodable {
1010
/// Retrieved records.
11-
public var results: [T]
11+
public var results: [T]?
1212

13-
public init(results: [T]) {
13+
public init(results: [T]? = nil) {
1414
self.results = results
1515
}
1616

@@ -22,7 +22,7 @@ public struct GetObjectsResponse<T: Codable>: Codable, JSONEncodable {
2222

2323
public func encode(to encoder: Encoder) throws {
2424
var container = encoder.container(keyedBy: CodingKeys.self)
25-
try container.encode(self.results, forKey: .results)
25+
try container.encodeIfPresent(self.results, forKey: .results)
2626
}
2727
}
2828

@@ -34,6 +34,6 @@ extension GetObjectsResponse: Equatable where T: Equatable {
3434

3535
extension GetObjectsResponse: Hashable where T: Hashable {
3636
public func hash(into hasher: inout Hasher) {
37-
hasher.combine(self.results.hashValue)
37+
hasher.combine(self.results?.hashValue)
3838
}
3939
}

0 commit comments

Comments
 (0)