@@ -29,7 +29,31 @@ import Foundation
2929
3030// Represents a bookmark to insert.
3131@available ( macOS 10 . 12 , iOS 10 . 3 , watchOS 3 . 3 , tvOS 12 . 0 , * )
32- public class BookmarkInsert : BookmarkData {
32+ public class BookmarkInsert : Codable , WordsApiModel {
33+ // Field of name. Represents a bookmark to insert.
34+ private var _name : String ? = nil ;
35+
36+ public var name : String ? {
37+ get {
38+ return self . _name;
39+ }
40+ set {
41+ self . _name = newValue;
42+ }
43+ }
44+
45+ // Field of text. Represents a bookmark to insert.
46+ private var _text : String ? = nil ;
47+
48+ public var text : String ? {
49+ get {
50+ return self . _text;
51+ }
52+ set {
53+ self . _text = newValue;
54+ }
55+ }
56+
3357 // Field of startRange. Represents a bookmark to insert.
3458 private var _startRange : NewDocumentPosition ? = nil ;
3559
@@ -55,17 +79,19 @@ public class BookmarkInsert : BookmarkData {
5579 }
5680
5781 private enum CodingKeys : String , CodingKey {
82+ case name = " Name " ;
83+ case text = " Text " ;
5884 case startRange = " StartRange " ;
5985 case endRange = " EndRange " ;
6086 case invalidCodingKey;
6187 }
6288
63- public override init ( ) {
64- super. init ( ) ;
89+ public init ( ) {
6590 }
6691
6792 public required init ( from json: [ String : Any ] ) throws {
68- try super. init ( from: json) ;
93+ self . name = json [ " Name " ] as? String ;
94+ self . text = json [ " Text " ] as? String ;
6995 if let raw_startRange = json [ " StartRange " ] as? [ String : Any ] {
7096 self . startRange = try ObjectSerializer . deserialize ( type: NewDocumentPosition . self, from: raw_startRange) ;
7197 }
@@ -77,15 +103,21 @@ public class BookmarkInsert : BookmarkData {
77103 }
78104
79105 public required init ( from decoder: Decoder ) throws {
80- try super. init ( from: decoder) ;
81106 let container = try decoder. container ( keyedBy: CodingKeys . self) ;
107+ self . name = try container. decodeIfPresent ( String . self, forKey: . name) ;
108+ self . text = try container. decodeIfPresent ( String . self, forKey: . text) ;
82109 self . startRange = try container. decodeIfPresent ( NewDocumentPosition . self, forKey: . startRange) ;
83110 self . endRange = try container. decodeIfPresent ( NewDocumentPosition . self, forKey: . endRange) ;
84111 }
85112
86- public override func encode( to encoder: Encoder ) throws {
87- try super. encode ( to: encoder) ;
113+ public func encode( to encoder: Encoder ) throws {
88114 var container = encoder. container ( keyedBy: CodingKeys . self) ;
115+ if ( self . name != nil ) {
116+ try container. encode ( self . name, forKey: . name) ;
117+ }
118+ if ( self . text != nil ) {
119+ try container. encode ( self . text, forKey: . text) ;
120+ }
89121 if ( self . startRange != nil ) {
90122 try container. encode ( self . startRange, forKey: . startRange) ;
91123 }
@@ -94,16 +126,55 @@ public class BookmarkInsert : BookmarkData {
94126 }
95127 }
96128
97- public override func collectFilesContent( _ resultFilesContent : inout [ FileReference ] ) {
129+ public func collectFilesContent( _ resultFilesContent : inout [ FileReference ] ) {
98130 }
99131
100- public override func validate( ) throws {
101- try super. validate ( ) ;
132+ public func validate( ) throws {
133+ if ( self . name == nil )
134+ {
135+ throw WordsApiError . requiredParameterError ( paramName: " name " ) ;
136+ }
137+ if ( self . text == nil )
138+ {
139+ throw WordsApiError . requiredParameterError ( paramName: " text " ) ;
140+ }
141+ if ( self . startRange == nil )
142+ {
143+ throw WordsApiError . requiredParameterError ( paramName: " startRange " ) ;
144+ }
145+ if ( self . endRange == nil )
146+ {
147+ throw WordsApiError . requiredParameterError ( paramName: " endRange " ) ;
148+ }
102149 try self . startRange? . validate ( ) ;
103150 try self . endRange? . validate ( ) ;
104151
105152 }
106153
154+ // Sets name. Gets or sets the name of the bookmark.
155+ public func setName( name : String ? ) -> BookmarkInsert {
156+ self . name = name;
157+ return self ;
158+ }
159+
160+ // Gets name. Gets or sets the name of the bookmark.
161+ public func getName( ) -> String ? {
162+ return self . name;
163+ }
164+
165+
166+ // Sets text. Gets or sets text, enclosed in the bookmark.
167+ public func setText( text : String ? ) -> BookmarkInsert {
168+ self . text = text;
169+ return self ;
170+ }
171+
172+ // Gets text. Gets or sets text, enclosed in the bookmark.
173+ public func getText( ) -> String ? {
174+ return self . text;
175+ }
176+
177+
107178 // Sets startRange. Gets or sets the link to start bookmark node.
108179 public func setStartRange( startRange : NewDocumentPosition ? ) -> BookmarkInsert {
109180 self . startRange = startRange;
0 commit comments