@@ -32,36 +32,62 @@ public class Configuration : Codable {
3232 // Aspose.Words for Cloud base URL
3333 private var baseUrl : String ;
3434
35- // Aspose.Words for Cloud app sid
36- private var appSid : String ;
35+ // Aspose.Words for Cloud client id
36+ private var clientId : String ;
3737
38- // Aspose.Words for Cloud app key
39- private var appKey : String ;
38+ // Aspose.Words for Cloud client secret
39+ private var clientSecret : String ;
4040
4141 // Indicating whether debug mode
4242 private var debugMode : Bool ? ;
4343
44+ private enum CodingKeys : String , CodingKey {
45+ case baseUrl = " BaseUrl " ;
46+ case clientId = " ClientId " ;
47+ case clientSecret = " ClientSecret " ;
48+ case debugMode = " DebugMode " ;
49+ case invalidCodingKey;
50+ }
51+
4452 // Initialize new instance of Aspose.Words for Cloud configuration object with given parameters
45- public init ( appSid : String , appKey : String , baseUrl: String = " https://api.aspose.cloud " , debugMode: Bool = false ) {
46- self . appSid = appSid ;
47- self . appKey = appKey ;
53+ public init ( clientId : String , clientSecret : String , baseUrl: String = " https://api.aspose.cloud " , debugMode: Bool = false ) {
54+ self . clientId = clientId ;
55+ self . clientSecret = clientSecret ;
4856 self . baseUrl = baseUrl;
4957 self . debugMode = debugMode;
5058 }
5159
60+ public required init ( from decoder: Decoder ) throws {
61+ let container = try decoder. container ( keyedBy: CodingKeys . self) ;
62+ self . baseUrl = try container. decodeIfPresent ( String . self, forKey: . baseUrl) ?? " https://api.aspose.cloud " ;
63+ self . clientId = try container. decode ( String . self, forKey: . clientId) ;
64+ self . clientSecret = try container. decode ( String . self, forKey: . clientSecret) ;
65+ self . debugMode = try container. decodeIfPresent ( Bool . self, forKey: . debugMode) ;
66+ }
67+
68+ public func encode( to encoder: Encoder ) throws {
69+ var container = encoder. container ( keyedBy: CodingKeys . self) ;
70+ try container. encode ( self . baseUrl, forKey: . baseUrl) ;
71+ try container. encode ( self . clientId, forKey: . clientId) ;
72+ try container. encode ( self . clientSecret, forKey: . clientSecret) ;
73+ if ( self . debugMode != nil ) {
74+ try container. encode ( self . debugMode, forKey: . debugMode) ;
75+ }
76+ }
77+
5278 // Returns Aspose.Words for Cloud base URL
5379 public func getBaseUrl( ) -> String {
5480 return self . baseUrl;
5581 }
5682
57- // Returns Aspose.Words for Cloud app sid
58- public func getAppSid ( ) -> String {
59- return self . appSid ;
83+ // Returns Aspose.Words for Cloud client id
84+ public func getClientId ( ) -> String {
85+ return self . clientId ;
6086 }
6187
62- // Returns Aspose.Words for Cloud app key
63- public func getAppKey ( ) -> String {
64- return self . appKey ;
88+ // Returns Aspose.Words for Cloud client secret
89+ public func getClientSecret ( ) -> String {
90+ return self . clientSecret ;
6591 }
6692
6793 // Is debug mode enabled
@@ -91,6 +117,6 @@ public class Configuration : Codable {
91117
92118 // Returns SDK version for using in statistics headers
93119 public func getSdkVersion( ) -> String {
94- return " 20.10 " ;
120+ return " 20.11 " ;
95121 }
96122}
0 commit comments