Skip to content

Commit 43c7d5e

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 35463a7 + d8bee97 commit 43c7d5e

File tree

172 files changed

+3459
-2266
lines changed

Some content is hidden

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

172 files changed

+3459
-2266
lines changed

Jenkinsfile

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,40 @@ parameters {
33
string(name: 'apiUrl', defaultValue: 'https://api-qa.aspose.cloud', description: 'server url')
44
}
55

6-
def runtests(version)
7-
{
8-
dir(version){
9-
try {
10-
stage('checkout_' + version){
11-
checkout([$class: 'GitSCM', branches: [[name: params.branch]], 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\\": \\"$apiUrl\\"}" > Settings/servercreds.json'
15-
}
16-
}
17-
18-
docker.image('swift:' + version).inside{
19-
stage('build_' + version){
20-
sh "swift build"
21-
}
22-
23-
stage('tests_' + version){
24-
try{
25-
sh "swift test"
26-
} finally{
27-
junit 'tests.xml'
28-
}
29-
}
30-
31-
stage('clean-compiled_' + version){
32-
sh "rm -rf %s"
33-
}
34-
}
35-
} finally {
36-
deleteDir()
37-
}
38-
}
39-
}
40-
416
node('words-linux') {
427
cleanWs()
438
if (!params.branch.contains("release")) {
44-
runtests("4.2")
45-
runtests("5.0")
9+
dir('swift') {
10+
try {
11+
stage('checkout'){
12+
checkout([$class: 'GitSCM', branches: [[name: params.branch]], 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']]])
13+
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'AppKey', usernameVariable: 'AppSid')]) {
14+
sh 'mkdir -p Settings'
15+
sh 'echo "{\\"AppSid\\": \\"$AppSid\\",\\"AppKey\\": \\"$AppKey\\", \\"BaseUrl\\": \\"$apiUrl\\"}" > Settings/servercreds.json'
16+
}
17+
}
18+
19+
docker.image('swift:5.0').inside{
20+
stage('build'){
21+
sh "swift build"
22+
}
23+
24+
stage('tests'){
25+
try{
26+
sh "chmod +x ./Scripts/runTests.sh"
27+
sh "./Scripts/runTests.sh"
28+
} finally{
29+
junit 'tests.xml'
30+
}
31+
}
32+
33+
stage('clean-compiled'){
34+
sh "rm -rf %s"
35+
}
36+
}
37+
} finally {
38+
deleteDir()
39+
}
40+
}
4641
}
47-
4842
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Add link to this repository as dependency to your Package.swift:
2626

2727
dependencies: [
2828
// Dependencies declare other packages that this package depends on.
29-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "20.3"),
29+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "20.4"),
3030
],
3131
targets: [
3232
// Targets are the basic building blocks of a package. A target can define a module or a test suite.

Scripts/runTests.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
docker run --rm -v %cd%:/opt/project -w="/opt/project" swift:4.2 /bin/bash Scripts/runTests.sh
1+
docker run --rm -v %cd%:/opt/project -w="/opt/project" swift:5.0 /bin/bash Scripts/runTests.sh

Scripts/runTests.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
swift build && swift test
1+
#!/bin/bash
2+
swift build && swift test --enable-code-coverage
3+
report_line=$(llvm-cov report .build/x86_64-unknown-linux/debug/AsposeWordsCloudPackageTests.xctest -instr-profile=.build/x86_64-unknown-linux/debug/codecov/default.profdata | grep "Sources/AsposeWordsCloud/Api/WordsAPI.swift *")
4+
IFS=' ' read -ra report_splited <<< "$report_line"
5+
code_coverage=${report_splited[6]}
6+
echo "Words API code coverage: $code_coverage"
7+
8+
if [[ $code_coverage == "100.00%" ]]
9+
then
10+
echo "OK"
11+
else
12+
echo "Failed: code coverage should be 100.00%"
13+
exit 1
14+
fi

Sources/AsposeWordsCloud/Api/Configuration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ public class Configuration : Codable {
9191

9292
// Returns SDK version for using in statistics headers
9393
public func getSdkVersion() -> String {
94-
return "20.3";
94+
return "20.4";
9595
}
9696
}

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class WordsAPI {
3939
}
4040

4141
// Initializes a new instance of the WordsAPI class based on AppSid and AppKey.
42-
public init(appSid: String, appKey: String) {
42+
public init(appSid: String, appKey: String) {
4343
self.configuration = Configuration(appSid: appSid, appKey: appKey);
4444
self.apiInvoker = ApiInvoker(configuration: configuration);
4545
}
@@ -426,7 +426,7 @@ public class WordsAPI {
426426
}
427427

428428
// Async representation of convertDocument method
429-
// Converts document from the request&#39;s content to the specified format .
429+
// Converts document from the request&#39;s content to the specified format.
430430
public func convertDocument(request : ConvertDocumentRequest, callback : @escaping (_ response : Data?, _ error : Error?) -> ()) {
431431
do {
432432
let rawPath = "/words/convert";
@@ -472,7 +472,7 @@ public class WordsAPI {
472472
}
473473

474474
// Sync representation of convertDocument method
475-
// Converts document from the request&#39;s content to the specified format .
475+
// Converts document from the request&#39;s content to the specified format.
476476
public func convertDocument(request : ConvertDocumentRequest) throws -> Data {
477477
let semaphore = DispatchSemaphore(value: 0);
478478
var responseObject : Data? = nil;
@@ -7041,7 +7041,9 @@ public class WordsAPI {
70417041
var rawPath = "/words/{name}/range/{rangeStartIdentifier}/{rangeEndIdentifier}";
70427042
rawPath = rawPath.replacingOccurrences(of: "{name}", with: try ObjectSerializer.serializeToString(value: request.getName()));
70437043
rawPath = rawPath.replacingOccurrences(of: "{rangeStartIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeStartIdentifier()));
7044-
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()));
7044+
if (request.getRangeEndIdentifier() != nil) {
7045+
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()!));
7046+
}
70457047
let urlPath = (try self.configuration.getApiRootUrl()).appendingPathComponent(rawPath);
70467048

70477049
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
@@ -10283,7 +10285,9 @@ public class WordsAPI {
1028310285
var rawPath = "/words/{name}/range/{rangeStartIdentifier}/{rangeEndIdentifier}";
1028410286
rawPath = rawPath.replacingOccurrences(of: "{name}", with: try ObjectSerializer.serializeToString(value: request.getName()));
1028510287
rawPath = rawPath.replacingOccurrences(of: "{rangeStartIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeStartIdentifier()));
10286-
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()));
10288+
if (request.getRangeEndIdentifier() != nil) {
10289+
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()!));
10290+
}
1028710291
let urlPath = (try self.configuration.getApiRootUrl()).appendingPathComponent(rawPath);
1028810292

1028910293
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
@@ -11070,7 +11074,9 @@ public class WordsAPI {
1107011074
var rawPath = "/words/{name}/range/{rangeStartIdentifier}/{rangeEndIdentifier}";
1107111075
rawPath = rawPath.replacingOccurrences(of: "{name}", with: try ObjectSerializer.serializeToString(value: request.getName()));
1107211076
rawPath = rawPath.replacingOccurrences(of: "{rangeStartIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeStartIdentifier()));
11073-
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()));
11077+
if (request.getRangeEndIdentifier() != nil) {
11078+
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()!));
11079+
}
1107411080
let urlPath = (try self.configuration.getApiRootUrl()).appendingPathComponent(rawPath);
1107511081

1107611082
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
@@ -11272,7 +11278,9 @@ public class WordsAPI {
1127211278
var rawPath = "/words/{name}/range/{rangeStartIdentifier}/{rangeEndIdentifier}/SaveAs";
1127311279
rawPath = rawPath.replacingOccurrences(of: "{name}", with: try ObjectSerializer.serializeToString(value: request.getName()));
1127411280
rawPath = rawPath.replacingOccurrences(of: "{rangeStartIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeStartIdentifier()));
11275-
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()));
11281+
if (request.getRangeEndIdentifier() != nil) {
11282+
rawPath = rawPath.replacingOccurrences(of: "{rangeEndIdentifier}", with: try ObjectSerializer.serializeToString(value: request.getRangeEndIdentifier()!));
11283+
}
1127611284
let urlPath = (try self.configuration.getApiRootUrl()).appendingPathComponent(rawPath);
1127711285

1127811286
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
@@ -11554,6 +11562,7 @@ public class WordsAPI {
1155411562

1155511563
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
1155611564
var queryItems : [URLQueryItem] = [];
11565+
queryItems.append(URLQueryItem(name: "format", value: try ObjectSerializer.serializeToString(value: request.getFormat())));
1155711566
if (request.getFolder() != nil) {
1155811567
queryItems.append(URLQueryItem(name: "folder", value: try ObjectSerializer.serializeToString(value: request.getFolder()!)));
1155911568
}
@@ -11569,9 +11578,6 @@ public class WordsAPI {
1156911578
if (request.getDestFileName() != nil) {
1157011579
queryItems.append(URLQueryItem(name: "destFileName", value: try ObjectSerializer.serializeToString(value: request.getDestFileName()!)));
1157111580
}
11572-
if (request.getFormat() != nil) {
11573-
queryItems.append(URLQueryItem(name: "format", value: try ObjectSerializer.serializeToString(value: request.getFormat()!)));
11574-
}
1157511581
if (request.getFrom() != nil) {
1157611582
queryItems.append(URLQueryItem(name: "from", value: try ObjectSerializer.serializeToString(value: request.getFrom()!)));
1157711583
}

Sources/AsposeWordsCloud/Model/ApiError.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class ApiError : Codable, WordsApiModel {
4242
// Field of dateTime. Gets or sets server datetime.
4343
private var dateTime : Date?;
4444

45-
// Field of innerError. Gets or sets inner error.
45+
// Field of innerError.
4646
private var innerError : ApiError?;
4747

4848
private enum CodingKeys: String, CodingKey {
@@ -128,12 +128,12 @@ public class ApiError : Codable, WordsApiModel {
128128
return self.dateTime;
129129
}
130130

131-
// Sets innerError. Gets or sets inner error.
131+
// Sets innerError.
132132
public func setInnerError(innerError : ApiError?) {
133133
self.innerError = innerError;
134134
}
135135

136-
// Gets innerError. Gets or sets inner error.
136+
// Gets innerError.
137137
public func getInnerError() -> ApiError? {
138138
return self.innerError;
139139
}

Sources/AsposeWordsCloud/Model/BookmarkResponse.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Foundation
3030
// This response should be returned by the service when handling: GET bookmarks/{bookmarkName}.
3131
public class BookmarkResponse : WordsResponse {
3232

33-
// Field of bookmark. Gets or sets bookmark.
33+
// Field of bookmark.
3434
private var bookmark : Bookmark?;
3535

3636
private enum CodingKeys: String, CodingKey {
@@ -56,12 +56,12 @@ public class BookmarkResponse : WordsResponse {
5656
}
5757
}
5858

59-
// Sets bookmark. Gets or sets bookmark.
59+
// Sets bookmark.
6060
public func setBookmark(bookmark : Bookmark?) {
6161
self.bookmark = bookmark;
6262
}
6363

64-
// Gets bookmark. Gets or sets bookmark.
64+
// Gets bookmark.
6565
public func getBookmark() -> Bookmark? {
6666
return self.bookmark;
6767
}

Sources/AsposeWordsCloud/Model/BookmarksOutlineLevelData.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class BookmarksOutlineLevelData : Codable, WordsApiModel {
5050

5151
let container = try decoder.container(keyedBy: CodingKeys.self);
5252
self.name = try container.decodeIfPresent(String.self, forKey: .name);
53-
self.bookmarksOutlineLevel = try container.decode(Int.self, forKey: .bookmarksOutlineLevel);
53+
self.bookmarksOutlineLevel = try container.decodeIfPresent(Int.self, forKey: .bookmarksOutlineLevel);
5454
}
5555

5656
public func encode(to encoder: Encoder) throws {
@@ -59,10 +59,9 @@ public class BookmarksOutlineLevelData : Codable, WordsApiModel {
5959
if (self.name != nil) {
6060
try container.encode(self.name, forKey: .name);
6161
}
62-
if (self.bookmarksOutlineLevel == nil) {
63-
throw WordsApiError.requiredArgumentError(argumentName: "bookmarksOutlineLevel");
62+
if (self.bookmarksOutlineLevel != nil) {
63+
try container.encode(self.bookmarksOutlineLevel, forKey: .bookmarksOutlineLevel);
6464
}
65-
try container.encode(self.bookmarksOutlineLevel, forKey: .bookmarksOutlineLevel);
6665
}
6766

6867
// Sets name. Gets or sets specify the bookmark's name.
@@ -76,12 +75,12 @@ public class BookmarksOutlineLevelData : Codable, WordsApiModel {
7675
}
7776

7877
// Sets bookmarksOutlineLevel. Gets or sets specify the bookmark's level.
79-
public func setBookmarksOutlineLevel(bookmarksOutlineLevel : Int) {
78+
public func setBookmarksOutlineLevel(bookmarksOutlineLevel : Int?) {
8079
self.bookmarksOutlineLevel = bookmarksOutlineLevel;
8180
}
8281

8382
// Gets bookmarksOutlineLevel. Gets or sets specify the bookmark's level.
84-
public func getBookmarksOutlineLevel() -> Int {
85-
return self.bookmarksOutlineLevel!;
83+
public func getBookmarksOutlineLevel() -> Int? {
84+
return self.bookmarksOutlineLevel;
8685
}
8786
}

Sources/AsposeWordsCloud/Model/BookmarksResponse.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Foundation
3030
// This response should be returned by the service when handling: GET bookmarks.
3131
public class BookmarksResponse : WordsResponse {
3232

33-
// Field of bookmarks. Gets or sets bookmarks which are contained in document.
33+
// Field of bookmarks.
3434
private var bookmarks : Bookmarks?;
3535

3636
private enum CodingKeys: String, CodingKey {
@@ -56,12 +56,12 @@ public class BookmarksResponse : WordsResponse {
5656
}
5757
}
5858

59-
// Sets bookmarks. Gets or sets bookmarks which are contained in document.
59+
// Sets bookmarks.
6060
public func setBookmarks(bookmarks : Bookmarks?) {
6161
self.bookmarks = bookmarks;
6262
}
6363

64-
// Gets bookmarks. Gets or sets bookmarks which are contained in document.
64+
// Gets bookmarks.
6565
public func getBookmarks() -> Bookmarks? {
6666
return self.bookmarks;
6767
}

0 commit comments

Comments
 (0)