@@ -42,20 +42,25 @@ public class Configuration : Codable {
42
42
// Indicating whether debug mode
43
43
private var debugMode : Bool ? ;
44
44
45
+ // Specify request timeout
46
+ private var timeout : TimeInterval ;
47
+
45
48
private enum CodingKeys : String , CodingKey {
46
49
case baseUrl = " BaseUrl " ;
47
50
case clientId = " ClientId " ;
48
51
case clientSecret = " ClientSecret " ;
49
52
case debugMode = " DebugMode " ;
53
+ case timeout = " Timeout " ;
50
54
case invalidCodingKey;
51
55
}
52
56
53
57
// Initialize new instance of Aspose.Words for Cloud configuration object with given parameters
54
- public init ( clientId: String , clientSecret: String , baseUrl: String = " https://api.aspose.cloud " , debugMode: Bool = false ) {
58
+ public init ( clientId: String , clientSecret: String , baseUrl: String = " https://api.aspose.cloud " , debugMode: Bool = false , timeout : TimeInterval = 300 ) {
55
59
self . clientId = clientId;
56
60
self . clientSecret = clientSecret;
57
61
self . baseUrl = baseUrl;
58
62
self . debugMode = debugMode;
63
+ self . timeout = timeout;
59
64
}
60
65
61
66
public required init ( from decoder: Decoder ) throws {
@@ -64,6 +69,7 @@ public class Configuration : Codable {
64
69
self . clientId = try container. decode ( String . self, forKey: . clientId) ;
65
70
self . clientSecret = try container. decode ( String . self, forKey: . clientSecret) ;
66
71
self . debugMode = try container. decodeIfPresent ( Bool . self, forKey: . debugMode) ;
72
+ self . timeout = try container. decodeIfPresent ( TimeInterval . self, forKey: . timeout) ?? 300 ;
67
73
}
68
74
69
75
public func encode( to encoder: Encoder ) throws {
@@ -74,6 +80,7 @@ public class Configuration : Codable {
74
80
if ( self . debugMode != nil ) {
75
81
try container. encode ( self . debugMode, forKey: . debugMode) ;
76
82
}
83
+ try container. encode ( self . timeout, forKey: . timeout) ;
77
84
}
78
85
79
86
// Returns Aspose.Words for Cloud base URL
@@ -96,6 +103,11 @@ public class Configuration : Codable {
96
103
return self . debugMode != nil ? self . debugMode! : false ;
97
104
}
98
105
106
+ // Gets request timeout
107
+ public func getTimeout( ) -> TimeInterval {
108
+ return self . timeout;
109
+ }
110
+
99
111
// Returns general version of cloud api
100
112
public func getApiVersion( ) -> String {
101
113
return " v4.0 " ;
@@ -118,6 +130,6 @@ public class Configuration : Codable {
118
130
119
131
// Returns SDK version for using in statistics headers
120
132
public func getSdkVersion( ) -> String {
121
- return " 21.11 " ;
133
+ return " 21.12 " ;
122
134
}
123
135
}
0 commit comments