@@ -29,6 +29,16 @@ import Foundation
2929
3030// DTO container with compare documents options.
3131public class CompareOptions : Codable , WordsApiModel {
32+ // Gets or sets the option indicating whether changes are tracked by character or by word.
33+ public enum Granularity : String , Codable
34+ {
35+ // Enum value "charLevel"
36+ case charLevel = " CharLevel "
37+
38+ // Enum value "wordLevel"
39+ case wordLevel = " WordLevel "
40+ }
41+
3242 // Gets or sets the option that controls which document shall be used as a target during comparison.
3343 public enum Target : String , Codable
3444 {
@@ -51,6 +61,18 @@ public class CompareOptions : Codable, WordsApiModel {
5161 }
5262 }
5363
64+ // Field of granularity. DTO container with compare documents options.
65+ private var _granularity : Granularity ? = nil ;
66+
67+ public var granularity : Granularity ? {
68+ get {
69+ return self . _granularity;
70+ }
71+ set {
72+ self . _granularity = newValue;
73+ }
74+ }
75+
5476 // Field of ignoreCaseChanges. DTO container with compare documents options.
5577 private var _ignoreCaseChanges : Bool ? = nil ;
5678
@@ -161,6 +183,7 @@ public class CompareOptions : Codable, WordsApiModel {
161183
162184 private enum CodingKeys : String , CodingKey {
163185 case acceptAllRevisionsBeforeComparison = " AcceptAllRevisionsBeforeComparison " ;
186+ case granularity = " Granularity " ;
164187 case ignoreCaseChanges = " IgnoreCaseChanges " ;
165188 case ignoreComments = " IgnoreComments " ;
166189 case ignoreFields = " IgnoreFields " ;
@@ -178,6 +201,10 @@ public class CompareOptions : Codable, WordsApiModel {
178201
179202 public required init ( from json: [ String : Any ] ) throws {
180203 self . acceptAllRevisionsBeforeComparison = json [ " AcceptAllRevisionsBeforeComparison " ] as? Bool ;
204+ if let raw_granularity = json [ " Granularity " ] as? String {
205+ self . granularity = Granularity ( rawValue: raw_granularity) ;
206+ }
207+
181208 self . ignoreCaseChanges = json [ " IgnoreCaseChanges " ] as? Bool ;
182209 self . ignoreComments = json [ " IgnoreComments " ] as? Bool ;
183210 self . ignoreFields = json [ " IgnoreFields " ] as? Bool ;
@@ -195,6 +222,7 @@ public class CompareOptions : Codable, WordsApiModel {
195222 public required init ( from decoder: Decoder ) throws {
196223 let container = try decoder. container ( keyedBy: CodingKeys . self) ;
197224 self . acceptAllRevisionsBeforeComparison = try container. decodeIfPresent ( Bool . self, forKey: . acceptAllRevisionsBeforeComparison) ;
225+ self . granularity = try container. decodeIfPresent ( Granularity . self, forKey: . granularity) ;
198226 self . ignoreCaseChanges = try container. decodeIfPresent ( Bool . self, forKey: . ignoreCaseChanges) ;
199227 self . ignoreComments = try container. decodeIfPresent ( Bool . self, forKey: . ignoreComments) ;
200228 self . ignoreFields = try container. decodeIfPresent ( Bool . self, forKey: . ignoreFields) ;
@@ -211,6 +239,9 @@ public class CompareOptions : Codable, WordsApiModel {
211239 if ( self . acceptAllRevisionsBeforeComparison != nil ) {
212240 try container. encode ( self . acceptAllRevisionsBeforeComparison, forKey: . acceptAllRevisionsBeforeComparison) ;
213241 }
242+ if ( self . granularity != nil ) {
243+ try container. encode ( self . granularity, forKey: . granularity) ;
244+ }
214245 if ( self . ignoreCaseChanges != nil ) {
215246 try container. encode ( self . ignoreCaseChanges, forKey: . ignoreCaseChanges) ;
216247 }
@@ -258,6 +289,18 @@ public class CompareOptions : Codable, WordsApiModel {
258289 }
259290
260291
292+ // Sets granularity. Gets or sets the option indicating whether changes are tracked by character or by word.
293+ public func setGranularity( granularity : Granularity ? ) -> CompareOptions {
294+ self . granularity = granularity;
295+ return self ;
296+ }
297+
298+ // Gets granularity. Gets or sets the option indicating whether changes are tracked by character or by word.
299+ public func getGranularity( ) -> Granularity ? {
300+ return self . granularity;
301+ }
302+
303+
261304 // Sets ignoreCaseChanges. Gets or sets a value indicating whether documents comparison is case insensitive. By default comparison is case sensitive.
262305 public func setIgnoreCaseChanges( ignoreCaseChanges : Bool ? ) -> CompareOptions {
263306 self . ignoreCaseChanges = ignoreCaseChanges;
0 commit comments