Skip to content

Commit 1a810b9

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 3a787e8 + 5f69794 commit 1a810b9

File tree

10 files changed

+129
-5
lines changed

10 files changed

+129
-5
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 = '21.2'
3+
s.version = '21.3'
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' }

Examples/AcceptAllRevisions.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import AsposeWordsCloud
2+
3+
let currentDir = ...
4+
let config = Configuration(clientId: "####-####-####-####-####", clientSecret: "##################");
5+
let api = WordsAPI(configuration: config);
6+
let fileName = "test_doc.docx";
7+
8+
// Upload original document to cloud storage.
9+
let uploadFileRequest = UploadFileRequest(fileContent: InputStream(url: currentDir!.appendingPathComponent(fileName, isDirectory: false))!, path: fileName);
10+
_ = try api.uploadFile(request: uploadFileRequest);
11+
12+
// Calls AcceptAllRevisions method for document in cloud.
13+
let request = AcceptAllRevisionsRequest(name: fileName);
14+
_ = try api.acceptAllRevisions(request: request);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let currentDir = ...
2+
let config = Configuration(clientId: "####-####-####-####-####", clientSecret: "##################");
3+
let api = WordsAPI(configuration: config);
4+
let fileName = "test_doc.docx";
5+
6+
// Calls AcceptAllRevisionsOnline method for document in cloud.
7+
let request = AcceptAllRevisionsOnlineRequest(document: InputStream(url: currentDir!.appendingPathComponent(fileName, isDirectory: false))!);
8+
let acceptAllRevisionsOnlineResult = try api.acceptAllRevisionsOnline(request: request);
9+
try acceptAllRevisionsOnlineResult.getDocument()?.write(to: currentDir!.appendingPathComponent("test_result.docx", isDirectory: false));

ExamplesData/test_doc.docx

14 KB
Binary file not shown.

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ properties([
55
[$class: 'StringParameterDefinition', name: 'branch', defaultValue: 'master', description: 'the branch to build'],
66
[$class: 'StringParameterDefinition', name: 'apiUrl', defaultValue: 'https://api-qa.aspose.cloud', description: 'api url'],
77
[$class: 'BooleanParameterDefinition', name: 'ignoreCiSkip', defaultValue: false, description: 'ignore CI Skip'],
8+
[$class: 'StringParameterDefinition', name: 'credentialsId', defaultValue: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', description: 'credentials id'],
89
]
910
]
1011
])
@@ -26,7 +27,7 @@ node('words-linux') {
2627
sh 'git clean -fdx'
2728

2829
if (needToBuild) {
29-
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'ClientSecret', usernameVariable: 'ClientId')]) {
30+
withCredentials([usernamePassword(credentialsId: params.credentialsId, passwordVariable: 'ClientSecret', usernameVariable: 'ClientId')]) {
3031
sh 'mkdir -p Settings'
3132
sh 'echo "{\\"ClientId\\": \\"$ClientId\\",\\"ClientSecret\\": \\"$ClientSecret\\", \\"BaseUrl\\": \\"$apiUrl\\"}" > Settings/servercreds.json'
3233
}

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ 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 21.3
17+
18+
- Added 'UpdateCreatedTimeProperty' save option
19+
- Added Tables into HeaderFooter so it's possible to address paragraphs inside table which is located in headerfooter (sections/0/headersfooters/1/tables/0/rows/0/cells/0/paragraphs/0)
20+
21+
1622
## Enhancements in Version 21.2
1723

1824
- Added delete all comments method
@@ -115,7 +121,7 @@ Add link to this repository as dependency to your Package.swift:
115121

116122
dependencies: [
117123
// Dependencies declare other packages that this package depends on.
118-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "21.2"),
124+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "21.3"),
119125
],
120126
targets: [
121127
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -133,7 +139,7 @@ targets: [
133139
Add link to git repository as dependency to your Podfile:
134140

135141
```ruby
136-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '21.2'
142+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '21.3'
137143
```
138144

139145
## Getting Started

Sources/AsposeWordsCloud/Api/Configuration.swift

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

118118
// Returns SDK version for using in statistics headers
119119
public func getSdkVersion() -> String {
120-
return "21.2";
120+
return "21.3";
121121
}
122122
}

Sources/AsposeWordsCloud/Model/SaveOptionsData.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public class SaveOptionsData : Codable, WordsApiModel {
5757
// Field of saveFormat. base container class for save options data.
5858
private var saveFormat : String?;
5959

60+
// Field of updateCreatedTimeProperty. base container class for save options data.
61+
private var updateCreatedTimeProperty : Bool?;
62+
6063
// Field of updateFields. base container class for save options data.
6164
private var updateFields : Bool?;
6265

@@ -79,6 +82,7 @@ public class SaveOptionsData : Codable, WordsApiModel {
7982
case dmlRenderingMode = "DmlRenderingMode";
8083
case fileName = "FileName";
8184
case saveFormat = "SaveFormat";
85+
case updateCreatedTimeProperty = "UpdateCreatedTimeProperty";
8286
case updateFields = "UpdateFields";
8387
case updateLastPrintedProperty = "UpdateLastPrintedProperty";
8488
case updateLastSavedTimeProperty = "UpdateLastSavedTimeProperty";
@@ -98,6 +102,7 @@ public class SaveOptionsData : Codable, WordsApiModel {
98102
self.dmlRenderingMode = try container.decodeIfPresent(String.self, forKey: .dmlRenderingMode);
99103
self.fileName = try container.decodeIfPresent(String.self, forKey: .fileName);
100104
self.saveFormat = try container.decodeIfPresent(String.self, forKey: .saveFormat);
105+
self.updateCreatedTimeProperty = try container.decodeIfPresent(Bool.self, forKey: .updateCreatedTimeProperty);
101106
self.updateFields = try container.decodeIfPresent(Bool.self, forKey: .updateFields);
102107
self.updateLastPrintedProperty = try container.decodeIfPresent(Bool.self, forKey: .updateLastPrintedProperty);
103108
self.updateLastSavedTimeProperty = try container.decodeIfPresent(Bool.self, forKey: .updateLastSavedTimeProperty);
@@ -125,6 +130,9 @@ public class SaveOptionsData : Codable, WordsApiModel {
125130
if (self.saveFormat != nil) {
126131
try container.encode(self.saveFormat, forKey: .saveFormat);
127132
}
133+
if (self.updateCreatedTimeProperty != nil) {
134+
try container.encode(self.updateCreatedTimeProperty, forKey: .updateCreatedTimeProperty);
135+
}
128136
if (self.updateFields != nil) {
129137
try container.encode(self.updateFields, forKey: .updateFields);
130138
}
@@ -202,6 +210,16 @@ public class SaveOptionsData : Codable, WordsApiModel {
202210
return self.saveFormat;
203211
}
204212

213+
// Sets updateCreatedTimeProperty. Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.CreatedTime property is updated before saving. Default value is false.
214+
public func setUpdateCreatedTimeProperty(updateCreatedTimeProperty : Bool?) {
215+
self.updateCreatedTimeProperty = updateCreatedTimeProperty;
216+
}
217+
218+
// Gets updateCreatedTimeProperty. Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.CreatedTime property is updated before saving. Default value is false.
219+
public func getUpdateCreatedTimeProperty() -> Bool? {
220+
return self.updateCreatedTimeProperty;
221+
}
222+
205223
// Sets updateFields. Gets or sets a value indicating whether fields should be updated before saving the document to a fixed page format. The default value is true.
206224
public func setUpdateFields(updateFields : Bool?) {
207225
self.updateFields = updateFields;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import AsposeWordsCloud
2+
3+
import XCTest
4+
@testable import AsposeWordsCloud
5+
6+
class ExamplesTests : XCTestCase
7+
{
8+
static var allTests = [
9+
("testAcceptAllRevisions", testAcceptAllRevisions),
10+
("testAcceptAllRevisionsOnline", testAcceptAllRevisionsOnline)
11+
];
12+
13+
private var configuration : Configuration?;
14+
15+
private var currentDir : URL?;
16+
17+
override func setUp() {
18+
if (self.configuration == nil) {
19+
let baseFolder = URL(fileURLWithPath: #file)
20+
.deletingLastPathComponent()
21+
.deletingLastPathComponent()
22+
.deletingLastPathComponent();
23+
24+
let credsUrl = baseFolder
25+
.appendingPathComponent("Settings", isDirectory: true)
26+
.appendingPathComponent("servercreds.json", isDirectory: false);
27+
28+
do {
29+
let credsData = try Data(contentsOf: credsUrl);
30+
self.configuration = try ObjectSerializer.deserialize(type: Configuration.self, from: credsData);
31+
}
32+
catch {
33+
XCTFail("File servercreds.json not found in Settings folder of project root.");
34+
}
35+
36+
currentDir = baseFolder
37+
.appendingPathComponent("ExamplesData", isDirectory: true);
38+
39+
do {
40+
let api = WordsAPI(configuration: configuration!);
41+
_ = try api.uploadFile(request: UploadFileRequest(fileContent: InputStream(url: currentDir!.appendingPathComponent("test_doc.docx", isDirectory: false))!, path: "test_doc.docx"));
42+
}
43+
catch {
44+
XCTFail("Failed to upload example documents.");
45+
}
46+
}
47+
}
48+
49+
func testAcceptAllRevisions() throws
50+
{
51+
let config = configuration!;
52+
let api = WordsAPI(configuration: config);
53+
let fileName = "test_doc.docx";
54+
55+
// Upload original document to cloud storage.
56+
let uploadFileRequest = UploadFileRequest(fileContent: InputStream(url: currentDir!.appendingPathComponent(fileName, isDirectory: false))!, path: fileName);
57+
_ = try api.uploadFile(request: uploadFileRequest);
58+
59+
// Calls AcceptAllRevisions method for document in cloud.
60+
let request = AcceptAllRevisionsRequest(name: fileName);
61+
_ = try api.acceptAllRevisions(request: request);
62+
}
63+
64+
func testAcceptAllRevisionsOnline() throws
65+
{
66+
let config = configuration!;
67+
let api = WordsAPI(configuration: config);
68+
let fileName = "test_doc.docx";
69+
70+
// Calls AcceptAllRevisionsOnline method for document in cloud.
71+
let request = AcceptAllRevisionsOnlineRequest(document: InputStream(url: currentDir!.appendingPathComponent(fileName, isDirectory: false))!);
72+
let acceptAllRevisionsOnlineResult = try api.acceptAllRevisionsOnline(request: request);
73+
try acceptAllRevisionsOnlineResult.getDocument()?.write(to: currentDir!.appendingPathComponent("test_result.docx", isDirectory: false));
74+
}
75+
}

Tests/AsposeWordsCloudTests/XCTestManifests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public func allTests() -> [XCTestCaseEntry] {
7272
testCase(TableBorderTests.allTests),
7373
testCase(TextTests.allTests),
7474
testCase(WatermarkTests.allTests),
75+
testCase(ExamplesTests.allTests),
7576
]
7677
}
7778
#endif

0 commit comments

Comments
 (0)