Skip to content

Commit 7d5744e

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents ae1efe8 + 3cbe0e4 commit 7d5744e

File tree

401 files changed

+3677
-3297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

401 files changed

+3677
-3297
lines changed

AsposeWordsCloud.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'AsposeWordsCloud'
3-
s.version = '20.10'
3+
s.version = '20.11'
44
s.summary = 'Aspose Words for Cloud.'
55
s.homepage = 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git'
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ node('words-linux') {
2626
sh 'git clean -fdx'
2727

2828
if (needToBuild) {
29-
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'AppKey', usernameVariable: 'AppSid')]) {
29+
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'ClientSecret', usernameVariable: 'ClientId')]) {
3030
sh 'mkdir -p Settings'
31-
sh 'echo "{\\"AppSid\\": \\"$AppSid\\",\\"AppKey\\": \\"$AppKey\\", \\"BaseUrl\\": \\"$apiUrl\\"}" > Settings/servercreds.json'
31+
sh 'echo "{\\"ClientId\\": \\"$ClientId\\",\\"ClientSecret\\": \\"$ClientSecret\\", \\"BaseUrl\\": \\"$apiUrl\\"}" > Settings/servercreds.json'
3232
}
3333
}
3434
}

JenkinsfileRelease

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters {
22
string(name: 'tagVersion', description: 'new version number for tag')
3-
string(name: 'testServerUrl', defaultValue: 'https://api-qa.aspose.cloud', description: 'server url')
3+
string(name: 'testServerUrl', defaultValue: 'https://api-qa.aspose.cloud', description: 'server url')
44
}
55

66
def runtests(version)
@@ -9,9 +9,9 @@ def runtests(version)
99
try {
1010
stage('checkout_' + version){
1111
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-sdk-swift.git']]])
12-
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'AppKey', usernameVariable: 'AppSid')]) {
13-
sh 'mkdir -p Settings'
14-
sh 'echo "{\\"AppSid\\": \\"$AppSid\\",\\"AppKey\\": \\"$AppKey\\", \\"BaseUrl\\": \\"$testServerUrl\\"}" > Settings/servercreds.json'
12+
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'ClientSecret', usernameVariable: 'ClientId')]) {
13+
sh 'mkdir -p Settings'
14+
sh 'echo "{\\"ClientId\\": \\"$ClientId\\",\\"ClientSecret\\": \\"$ClientSecret\\", \\"BaseUrl\\": \\"$testServerUrl\\"}" > Settings/servercreds.json'
1515
}
1616
}
1717

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ This repository contains Aspose.Words Cloud SDK for Swift source code. This SDK
1313
* Watermarks and protection
1414
* Full read & write access to Document Object Model, including sections, paragraphs, text, images, tables, headers/footers and many others
1515

16+
## Enhancements in Version 20.11
17+
18+
- In configuration json file appSid / appKey has been replaced to clientId / clientSecret.
19+
- In Words API initialization methods clientId parameter precedes clientSecret parameter.
20+
- Fixed the problem with serialization of object properties (it was a souce of NPE).
21+
22+
## Enhancements in Version 20.10
23+
24+
- Internal API changes.
25+
26+
1627
## Enhancements in Version 20.9
1728

1829
- Added Batch API feature
@@ -94,7 +105,7 @@ Add link to this repository as dependency to your Package.swift:
94105

95106
dependencies: [
96107
// Dependencies declare other packages that this package depends on.
97-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "20.10"),
108+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "20.11"),
98109
],
99110
targets: [
100111
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -112,7 +123,7 @@ targets: [
112123
Add link to git repository as dependency to your Podfile:
113124

114125
```ruby
115-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '20.10'
126+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '20.11'
116127
```
117128

118129
## Getting Started
@@ -122,7 +133,7 @@ pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-wo
122133
import Foundation;
123134
import AsposeWordsCloud;
124135

125-
let wordsApi = WordsAPI(appSid: "YOUR_APP_SID", appKey: "YOUR_APP_KEY");
136+
let wordsApi = WordsAPI(clientId: "YOUR_APP_SID", clientSecret: "YOUR_APP_KEY");
126137
let fileName = "TestCreateDocument.doc";
127138
let request = CreateDocumentRequest(fileName: fileName);
128139
let response = try wordsApi.createDocument(request: request);

Sources/AsposeWordsCloud/Api/ApiInvoker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public class ApiInvoker {
225225
var request = URLRequest(url: urlPath);
226226
request.httpMethod = "POST";
227227
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type");
228-
request.httpBody = "grant_type=client_credentials&client_id=\(configuration.getAppSid())&client_secret=\(configuration.getAppKey())".data(using: .utf8);
228+
request.httpBody = "grant_type=client_credentials&client_id=\(configuration.getClientId())&client_secret=\(configuration.getClientSecret())".data(using: .utf8);
229229
invokeRequest(urlRequest: &request, accessToken: nil, callback: { response in
230230
var newAccessToken : String? = nil;
231231
if (response.errorCode == self.httpStatusCodeOK) {

Sources/AsposeWordsCloud/Api/Configuration.swift

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

Sources/AsposeWordsCloud/Api/ObjectSerializer.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,23 +245,13 @@ class ObjectSerializer {
245245
private static let customEncoder: JSONEncoder = {
246246
let encoder = JSONEncoder();
247247
encoder.dateEncodingStrategy = .formatted(customIso8601);
248-
encoder.keyEncodingStrategy = .custom { keys in
249-
let oldKey = keys.last!.stringValue;
250-
let newKey = oldKey.prefix(1).uppercased() + oldKey.dropFirst();
251-
return CustomKey(stringValue: newKey)!;
252-
};
253248
return encoder;
254249
}();
255250

256251
// Custom JSON decoder
257252
private static let customDecoder: JSONDecoder = {
258253
let decoder = JSONDecoder();
259254
decoder.dateDecodingStrategy = .formatted(customIso8601);
260-
decoder.keyDecodingStrategy = .custom { keys in
261-
let oldKey = keys.last!.stringValue;
262-
let newKey = oldKey.prefix(1).lowercased() + oldKey.dropFirst();
263-
return CustomKey(stringValue: newKey)!;
264-
};
265255
return decoder;
266256
}();
267257
}

0 commit comments

Comments
 (0)