File tree Expand file tree Collapse file tree 2 files changed +53
-4
lines changed Expand file tree Collapse file tree 2 files changed +53
-4
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,9 @@ import Foundation
99/// Update to perform on the attribute.
1010public struct BuiltInOperation : Codable , JSONEncodable {
1111 public var operation : BuiltInOperationType
12- /// Value that corresponds to the operation, for example an `Increment` or `Decrement` step, or an `Add` or `Remove`
13- /// value.
14- public var value : String
12+ public var value : BuiltInOperationValue
1513
16- public init ( operation: BuiltInOperationType , value: String ) {
14+ public init ( operation: BuiltInOperationType , value: BuiltInOperationValue ) {
1715 self . operation = operation
1816 self . value = value
1917 }
Original file line number Diff line number Diff line change 1+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+ // https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+ import Foundation
5+ #if canImport(Core)
6+ import Core
7+ #endif
8+
9+ public enum BuiltInOperationValue : Codable , JSONEncodable , AbstractEncodable {
10+ case string( String )
11+ case int( Int )
12+
13+ public func encode( to encoder: Encoder ) throws {
14+ var container = encoder. singleValueContainer ( )
15+ switch self {
16+ case let . string( value) :
17+ try container. encode ( value)
18+ case let . int( value) :
19+ try container. encode ( value)
20+ }
21+ }
22+
23+ public init ( from decoder: Decoder ) throws {
24+ let container = try decoder. singleValueContainer ( )
25+ if let value = try ? container. decode ( String . self) {
26+ self = . string( value)
27+ } else if let value = try ? container. decode ( Int . self) {
28+ self = . int( value)
29+ } else {
30+ throw DecodingError . typeMismatch (
31+ Self . Type. self,
32+ . init(
33+ codingPath: decoder. codingPath,
34+ debugDescription: " Unable to decode instance of BuiltInOperationValue "
35+ )
36+ )
37+ }
38+ }
39+
40+ public func GetActualInstance( ) -> Encodable {
41+ switch self {
42+ case let . string( value) :
43+ value as String
44+ case let . int( value) :
45+ value as Int
46+ }
47+ }
48+ }
49+
50+ extension BuiltInOperationValue : Equatable { }
51+ extension BuiltInOperationValue : Hashable { }
You can’t perform that action at this time.
0 commit comments