Skip to content

Commit 4202aa8

Browse files
feat(specs): add CT Query predicate property (generated)
algolia/api-clients-automation#4654 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Morgan Leroi <[email protected]>
1 parent bbcd347 commit 4202aa8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Sources/Ingestion/Models/SourceCommercetools.swift

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public struct SourceCommercetools: Codable, JSONEncodable {
1414
public var projectKey: String
1515
/// Whether a fallback value is stored in the Algolia record if there's no inventory information about the product.
1616
public var fallbackIsInStockValue: Bool?
17+
/// Predicate to filter out specific products when indexing. For more information, see [Query
18+
/// Predicate](https://docs.commercetools.com/api/predicates/query).
19+
public var productQueryPredicate: String?
1720
public var customFields: CommercetoolsCustomFields?
1821

1922
public init(
@@ -22,13 +25,15 @@ public struct SourceCommercetools: Codable, JSONEncodable {
2225
url: String,
2326
projectKey: String,
2427
fallbackIsInStockValue: Bool? = nil,
28+
productQueryPredicate: String? = nil,
2529
customFields: CommercetoolsCustomFields? = nil
2630
) {
2731
self.storeKeys = storeKeys
2832
self.locales = locales
2933
self.url = url
3034
self.projectKey = projectKey
3135
self.fallbackIsInStockValue = fallbackIsInStockValue
36+
self.productQueryPredicate = productQueryPredicate
3237
self.customFields = customFields
3338
}
3439

@@ -38,6 +43,7 @@ public struct SourceCommercetools: Codable, JSONEncodable {
3843
case url
3944
case projectKey
4045
case fallbackIsInStockValue
46+
case productQueryPredicate
4147
case customFields
4248
}
4349

@@ -50,6 +56,7 @@ public struct SourceCommercetools: Codable, JSONEncodable {
5056
try container.encode(self.url, forKey: .url)
5157
try container.encode(self.projectKey, forKey: .projectKey)
5258
try container.encodeIfPresent(self.fallbackIsInStockValue, forKey: .fallbackIsInStockValue)
59+
try container.encodeIfPresent(self.productQueryPredicate, forKey: .productQueryPredicate)
5360
try container.encodeIfPresent(self.customFields, forKey: .customFields)
5461
}
5562
}
@@ -61,6 +68,7 @@ extension SourceCommercetools: Equatable {
6168
lhs.url == rhs.url &&
6269
lhs.projectKey == rhs.projectKey &&
6370
lhs.fallbackIsInStockValue == rhs.fallbackIsInStockValue &&
71+
lhs.productQueryPredicate == rhs.productQueryPredicate &&
6472
lhs.customFields == rhs.customFields
6573
}
6674
}
@@ -72,6 +80,7 @@ extension SourceCommercetools: Hashable {
7280
hasher.combine(self.url.hashValue)
7381
hasher.combine(self.projectKey.hashValue)
7482
hasher.combine(self.fallbackIsInStockValue?.hashValue)
83+
hasher.combine(self.productQueryPredicate?.hashValue)
7584
hasher.combine(self.customFields?.hashValue)
7685
}
7786
}

Sources/Ingestion/Models/SourceUpdateCommercetools.swift

+9
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ public struct SourceUpdateCommercetools: Codable, JSONEncodable {
1313
public var url: String?
1414
/// Whether a fallback value is stored in the Algolia record if there's no inventory information about the product.
1515
public var fallbackIsInStockValue: Bool?
16+
/// Predicate to filter out specific products when indexing. For more information, see [Query
17+
/// Predicate](https://docs.commercetools.com/api/predicates/query).
18+
public var productQueryPredicate: String?
1619
public var customFields: CommercetoolsCustomFields?
1720

1821
public init(
1922
storeKeys: [String]? = nil,
2023
locales: [String]? = nil,
2124
url: String? = nil,
2225
fallbackIsInStockValue: Bool? = nil,
26+
productQueryPredicate: String? = nil,
2327
customFields: CommercetoolsCustomFields? = nil
2428
) {
2529
self.storeKeys = storeKeys
2630
self.locales = locales
2731
self.url = url
2832
self.fallbackIsInStockValue = fallbackIsInStockValue
33+
self.productQueryPredicate = productQueryPredicate
2934
self.customFields = customFields
3035
}
3136

@@ -34,6 +39,7 @@ public struct SourceUpdateCommercetools: Codable, JSONEncodable {
3439
case locales
3540
case url
3641
case fallbackIsInStockValue
42+
case productQueryPredicate
3743
case customFields
3844
}
3945

@@ -45,6 +51,7 @@ public struct SourceUpdateCommercetools: Codable, JSONEncodable {
4551
try container.encodeIfPresent(self.locales, forKey: .locales)
4652
try container.encodeIfPresent(self.url, forKey: .url)
4753
try container.encodeIfPresent(self.fallbackIsInStockValue, forKey: .fallbackIsInStockValue)
54+
try container.encodeIfPresent(self.productQueryPredicate, forKey: .productQueryPredicate)
4855
try container.encodeIfPresent(self.customFields, forKey: .customFields)
4956
}
5057
}
@@ -55,6 +62,7 @@ extension SourceUpdateCommercetools: Equatable {
5562
lhs.locales == rhs.locales &&
5663
lhs.url == rhs.url &&
5764
lhs.fallbackIsInStockValue == rhs.fallbackIsInStockValue &&
65+
lhs.productQueryPredicate == rhs.productQueryPredicate &&
5866
lhs.customFields == rhs.customFields
5967
}
6068
}
@@ -65,6 +73,7 @@ extension SourceUpdateCommercetools: Hashable {
6573
hasher.combine(self.locales?.hashValue)
6674
hasher.combine(self.url?.hashValue)
6775
hasher.combine(self.fallbackIsInStockValue?.hashValue)
76+
hasher.combine(self.productQueryPredicate?.hashValue)
6877
hasher.combine(self.customFields?.hashValue)
6978
}
7079
}

0 commit comments

Comments
 (0)