15
15
**/
16
16
17
17
import Foundation
18
+ import RestKit
18
19
19
20
/**
20
21
An input object that includes the input text.
@@ -27,9 +28,13 @@ public struct InputData: Codable, Equatable {
27
28
*/
28
29
public var text : String
29
30
31
+ /// Additional properties associated with this model.
32
+ public var additionalProperties : [ String : JSON ]
33
+
30
34
// Map each property name to the key that shall be used for encoding/decoding.
31
35
private enum CodingKeys : String , CodingKey {
32
36
case text = " text "
37
+ static let allValues = [ text]
33
38
}
34
39
35
40
/**
@@ -41,10 +46,26 @@ public struct InputData: Codable, Equatable {
41
46
- returns: An initialized `InputData`.
42
47
*/
43
48
public init (
44
- text: String
49
+ text: String ,
50
+ additionalProperties: [ String : JSON ] = [ : ]
45
51
)
46
52
{
47
53
self . text = text
54
+ self . additionalProperties = additionalProperties
55
+ }
56
+
57
+ public init ( from decoder: Decoder ) throws {
58
+ let container = try decoder. container ( keyedBy: CodingKeys . self)
59
+ text = try container. decode ( String . self, forKey: . text)
60
+ let dynamicContainer = try decoder. container ( keyedBy: DynamicKeys . self)
61
+ additionalProperties = try dynamicContainer. decode ( [ String : JSON ] . self, excluding: CodingKeys . allValues)
62
+ }
63
+
64
+ public func encode( to encoder: Encoder ) throws {
65
+ var container = encoder. container ( keyedBy: CodingKeys . self)
66
+ try container. encode ( text, forKey: . text)
67
+ var dynamicContainer = encoder. container ( keyedBy: DynamicKeys . self)
68
+ try dynamicContainer. encodeIfPresent ( additionalProperties)
48
69
}
49
70
50
71
}
0 commit comments