@@ -7,97 +7,40 @@ import Foundation
77#endif
88
99public struct SourceShopify : Codable , JSONEncodable {
10- /// Whether to index collection IDs. If your store has `has_collection_search_page` set to true, collection IDs
11- /// will be indexed even if `collectionIDIndexing` is false.
12- public var collectionIDIndexing : Bool ?
13- /// Whether to increase the number of indexed collections per product. If true, Algolia indexes 200 collections per
14- /// product. If false, 100 collections per product are indexed.
15- public var increaseProductCollectionLimit : Bool ?
16- /// Whether to set the default price ratio to 1 if no sale price is present. The price ratio is determined by the
17- /// ratio: `sale_price` / `regular_price`. If no sale price is present, the price ratio would be 0. If
18- /// `defaultPriceRatioAsOne` is true, the price ratio is indexed as 1 instead.
19- public var defaultPriceRatioAsOne : Bool ?
20- /// Whether to exclude out-of-stock variants when determining the `max_variant_price` and `min_variant_price`
21- /// attributes.
22- public var excludeOOSVariantsForPriceAtTRS : Bool ?
23- /// Whether to include an inventory with every variant for every product record.
24- public var includeVariantsInventory : Bool ?
25- /// Whether to include collection IDs and handles in the product records.
26- public var hasCollectionSearchPage : Bool ?
27- /// Whether to convert tags on products to named tags. To learn more, see [Named
28- /// tags](https://www.algolia.com/doc/integration/shopify/sending-and-managing-data/named-tags).
29- public var productNamedTags : Bool ?
10+ /// Feature flags for the Shopify source.
11+ public var featureFlags : [ String : AnyCodable ] ?
3012 /// URL of the Shopify store.
3113 public var shopURL : String
3214
33- public init (
34- collectionIDIndexing: Bool ? = nil ,
35- increaseProductCollectionLimit: Bool ? = nil ,
36- defaultPriceRatioAsOne: Bool ? = nil ,
37- excludeOOSVariantsForPriceAtTRS: Bool ? = nil ,
38- includeVariantsInventory: Bool ? = nil ,
39- hasCollectionSearchPage: Bool ? = nil ,
40- productNamedTags: Bool ? = nil ,
41- shopURL: String
42- ) {
43- self . collectionIDIndexing = collectionIDIndexing
44- self . increaseProductCollectionLimit = increaseProductCollectionLimit
45- self . defaultPriceRatioAsOne = defaultPriceRatioAsOne
46- self . excludeOOSVariantsForPriceAtTRS = excludeOOSVariantsForPriceAtTRS
47- self . includeVariantsInventory = includeVariantsInventory
48- self . hasCollectionSearchPage = hasCollectionSearchPage
49- self . productNamedTags = productNamedTags
15+ public init ( featureFlags: [ String : AnyCodable ] ? = nil , shopURL: String ) {
16+ self . featureFlags = featureFlags
5017 self . shopURL = shopURL
5118 }
5219
5320 public enum CodingKeys : String , CodingKey , CaseIterable {
54- case collectionIDIndexing
55- case increaseProductCollectionLimit
56- case defaultPriceRatioAsOne
57- case excludeOOSVariantsForPriceAtTRS
58- case includeVariantsInventory
59- case hasCollectionSearchPage
60- case productNamedTags
21+ case featureFlags
6122 case shopURL
6223 }
6324
6425 // Encodable protocol methods
6526
6627 public func encode( to encoder: Encoder ) throws {
6728 var container = encoder. container ( keyedBy: CodingKeys . self)
68- try container. encodeIfPresent ( self . collectionIDIndexing, forKey: . collectionIDIndexing)
69- try container. encodeIfPresent ( self . increaseProductCollectionLimit, forKey: . increaseProductCollectionLimit)
70- try container. encodeIfPresent ( self . defaultPriceRatioAsOne, forKey: . defaultPriceRatioAsOne)
71- try container. encodeIfPresent ( self . excludeOOSVariantsForPriceAtTRS, forKey: . excludeOOSVariantsForPriceAtTRS)
72- try container. encodeIfPresent ( self . includeVariantsInventory, forKey: . includeVariantsInventory)
73- try container. encodeIfPresent ( self . hasCollectionSearchPage, forKey: . hasCollectionSearchPage)
74- try container. encodeIfPresent ( self . productNamedTags, forKey: . productNamedTags)
29+ try container. encodeIfPresent ( self . featureFlags, forKey: . featureFlags)
7530 try container. encode ( self . shopURL, forKey: . shopURL)
7631 }
7732}
7833
7934extension SourceShopify : Equatable {
8035 public static func == ( lhs: SourceShopify , rhs: SourceShopify ) -> Bool {
81- lhs. collectionIDIndexing == rhs. collectionIDIndexing &&
82- lhs. increaseProductCollectionLimit == rhs. increaseProductCollectionLimit &&
83- lhs. defaultPriceRatioAsOne == rhs. defaultPriceRatioAsOne &&
84- lhs. excludeOOSVariantsForPriceAtTRS == rhs. excludeOOSVariantsForPriceAtTRS &&
85- lhs. includeVariantsInventory == rhs. includeVariantsInventory &&
86- lhs. hasCollectionSearchPage == rhs. hasCollectionSearchPage &&
87- lhs. productNamedTags == rhs. productNamedTags &&
36+ lhs. featureFlags == rhs. featureFlags &&
8837 lhs. shopURL == rhs. shopURL
8938 }
9039}
9140
9241extension SourceShopify : Hashable {
9342 public func hash( into hasher: inout Hasher ) {
94- hasher. combine ( self . collectionIDIndexing? . hashValue)
95- hasher. combine ( self . increaseProductCollectionLimit? . hashValue)
96- hasher. combine ( self . defaultPriceRatioAsOne? . hashValue)
97- hasher. combine ( self . excludeOOSVariantsForPriceAtTRS? . hashValue)
98- hasher. combine ( self . includeVariantsInventory? . hashValue)
99- hasher. combine ( self . hasCollectionSearchPage? . hashValue)
100- hasher. combine ( self . productNamedTags? . hashValue)
43+ hasher. combine ( self . featureFlags? . hashValue)
10144 hasher. combine ( self . shopURL. hashValue)
10245 }
10346}
0 commit comments