Skip to content

Commit 8ebd820

Browse files
algolia-botmillotp
andcommitted
fix(specs): add tags and scope to rules (generated)
algolia/api-clients-automation#5625 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 81b8723 commit 8ebd820

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Sources/Search/Models/Rule.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,27 @@ public struct Rule: Codable, JSONEncodable {
2121
public var enabled: Bool?
2222
/// Time periods when the rule is active.
2323
public var validity: [SearchTimeRange]?
24+
public var tags: [String]?
25+
public var scope: String?
2426

2527
public init(
2628
objectID: String,
2729
conditions: [SearchCondition]? = nil,
2830
consequence: SearchConsequence,
2931
description: String? = nil,
3032
enabled: Bool? = nil,
31-
validity: [SearchTimeRange]? = nil
33+
validity: [SearchTimeRange]? = nil,
34+
tags: [String]? = nil,
35+
scope: String? = nil
3236
) {
3337
self.objectID = objectID
3438
self.conditions = conditions
3539
self.consequence = consequence
3640
self.description = description
3741
self.enabled = enabled
3842
self.validity = validity
43+
self.tags = tags
44+
self.scope = scope
3945
}
4046

4147
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -45,6 +51,8 @@ public struct Rule: Codable, JSONEncodable {
4551
case description
4652
case enabled
4753
case validity
54+
case tags
55+
case scope
4856
}
4957

5058
// Encodable protocol methods
@@ -57,6 +65,8 @@ public struct Rule: Codable, JSONEncodable {
5765
try container.encodeIfPresent(self.description, forKey: .description)
5866
try container.encodeIfPresent(self.enabled, forKey: .enabled)
5967
try container.encodeIfPresent(self.validity, forKey: .validity)
68+
try container.encodeIfPresent(self.tags, forKey: .tags)
69+
try container.encodeIfPresent(self.scope, forKey: .scope)
6070
}
6171
}
6272

@@ -67,7 +77,9 @@ extension Rule: Equatable {
6777
lhs.consequence == rhs.consequence &&
6878
lhs.description == rhs.description &&
6979
lhs.enabled == rhs.enabled &&
70-
lhs.validity == rhs.validity
80+
lhs.validity == rhs.validity &&
81+
lhs.tags == rhs.tags &&
82+
lhs.scope == rhs.scope
7183
}
7284
}
7385

@@ -79,5 +91,7 @@ extension Rule: Hashable {
7991
hasher.combine(self.description?.hashValue)
8092
hasher.combine(self.enabled?.hashValue)
8193
hasher.combine(self.validity?.hashValue)
94+
hasher.combine(self.tags?.hashValue)
95+
hasher.combine(self.scope?.hashValue)
8296
}
8397
}

0 commit comments

Comments
 (0)