Skip to content

Commit 3a787e8

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents d9c0d40 + 4338987 commit 3a787e8

File tree

11 files changed

+416
-8
lines changed

11 files changed

+416
-8
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.1'
3+
s.version = '21.2'
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' }

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ 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.2
17+
18+
- Added delete all comments method
19+
20+
1621
## Enhancements in Version 21.1
1722

1823
- Added online version for all API methods
@@ -110,7 +115,7 @@ Add link to this repository as dependency to your Package.swift:
110115

111116
dependencies: [
112117
// Dependencies declare other packages that this package depends on.
113-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "21.1"),
118+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "21.2"),
114119
],
115120
targets: [
116121
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -128,7 +133,7 @@ targets: [
128133
Add link to git repository as dependency to your Podfile:
129134

130135
```ruby
131-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '21.1'
136+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '21.2'
132137
```
133138

134139
## 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.1";
120+
return "21.2";
121121
}
122122
}

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,85 @@ public class WordsAPI {
13721372
return responseObject!;
13731373
}
13741374

1375+
// Async representation of deleteComments method
1376+
// Removes all comments from the document.
1377+
public func deleteComments(request : DeleteCommentsRequest, callback : @escaping (_ error : Error?) -> ()) {
1378+
do {
1379+
apiInvoker.invoke(
1380+
apiRequestData: try request.createApiRequestData(configuration: self.configuration),
1381+
callback: { response, error in
1382+
callback(error);
1383+
}
1384+
);
1385+
}
1386+
catch let error {
1387+
callback(error);
1388+
}
1389+
}
1390+
1391+
// Sync representation of deleteComments method
1392+
// Removes all comments from the document.
1393+
public func deleteComments(request : DeleteCommentsRequest) throws {
1394+
let semaphore = DispatchSemaphore(value: 0);
1395+
var responseError : Error? = nil;
1396+
self.deleteComments(request : request, callback: { error in
1397+
responseError = error;
1398+
semaphore.signal();
1399+
});
1400+
1401+
_ = semaphore.wait();
1402+
1403+
if (responseError != nil) {
1404+
throw responseError!;
1405+
}
1406+
}
1407+
1408+
// Async representation of deleteCommentsOnline method
1409+
// Removes all comments from the document.
1410+
public func deleteCommentsOnline(request : DeleteCommentsOnlineRequest, callback : @escaping (_ response : Data?, _ error : Error?) -> ()) {
1411+
do {
1412+
apiInvoker.invoke(
1413+
apiRequestData: try request.createApiRequestData(configuration: self.configuration),
1414+
callback: { response, error in
1415+
if (error != nil) {
1416+
callback(nil, error);
1417+
}
1418+
else {
1419+
do {
1420+
callback(try request.deserializeResponse(data: response!) as? Data, nil);
1421+
}
1422+
catch let deserializeError {
1423+
callback(nil, deserializeError);
1424+
}
1425+
}
1426+
}
1427+
);
1428+
}
1429+
catch let error {
1430+
callback(nil, error);
1431+
}
1432+
}
1433+
1434+
// Sync representation of deleteCommentsOnline method
1435+
// Removes all comments from the document.
1436+
public func deleteCommentsOnline(request : DeleteCommentsOnlineRequest) throws -> Data {
1437+
let semaphore = DispatchSemaphore(value: 0);
1438+
var responseObject : Data? = nil;
1439+
var responseError : Error? = nil;
1440+
self.deleteCommentsOnline(request : request, callback: { response, error in
1441+
responseObject = response;
1442+
responseError = error;
1443+
semaphore.signal();
1444+
});
1445+
1446+
_ = semaphore.wait();
1447+
1448+
if (responseError != nil) {
1449+
throw responseError!;
1450+
}
1451+
return responseObject!;
1452+
}
1453+
13751454
// Async representation of deleteDocumentProperty method
13761455
// Removes a document property.
13771456
public func deleteDocumentProperty(request : DeleteDocumentPropertyRequest, callback : @escaping (_ error : Error?) -> ()) {
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="DeleteCommentsOnlineRequest.swift">
4+
* Copyright (c) 2021 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
import Foundation
29+
30+
// Request model for deleteCommentsOnline operation.
31+
public class DeleteCommentsOnlineRequest : WordsApiRequest {
32+
private let document : InputStream;
33+
private let loadEncoding : String?;
34+
private let password : String?;
35+
private let destFileName : String?;
36+
private let revisionAuthor : String?;
37+
private let revisionDateTime : String?;
38+
39+
private enum CodingKeys: String, CodingKey {
40+
case document;
41+
case loadEncoding;
42+
case password;
43+
case destFileName;
44+
case revisionAuthor;
45+
case revisionDateTime;
46+
case invalidCodingKey;
47+
}
48+
49+
// Initializes a new instance of the DeleteCommentsOnlineRequest class.
50+
public init(document : InputStream, loadEncoding : String? = nil, password : String? = nil, destFileName : String? = nil, revisionAuthor : String? = nil, revisionDateTime : String? = nil) {
51+
self.document = document;
52+
self.loadEncoding = loadEncoding;
53+
self.password = password;
54+
self.destFileName = destFileName;
55+
self.revisionAuthor = revisionAuthor;
56+
self.revisionDateTime = revisionDateTime;
57+
}
58+
59+
// The document.
60+
public func getDocument() -> InputStream {
61+
return self.document;
62+
}
63+
64+
// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
65+
public func getLoadEncoding() -> String? {
66+
return self.loadEncoding;
67+
}
68+
69+
// Password for opening an encrypted document.
70+
public func getPassword() -> String? {
71+
return self.password;
72+
}
73+
74+
// Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.
75+
public func getDestFileName() -> String? {
76+
return self.destFileName;
77+
}
78+
79+
// Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions.
80+
public func getRevisionAuthor() -> String? {
81+
return self.revisionAuthor;
82+
}
83+
84+
// The date and time to use for revisions.
85+
public func getRevisionDateTime() -> String? {
86+
return self.revisionDateTime;
87+
}
88+
89+
// Creates the api request data
90+
public func createApiRequestData(configuration : Configuration) throws -> WordsApiRequestData {
91+
var rawPath = "/words/online/delete/comments";
92+
rawPath = rawPath.replacingOccurrences(of: "//", with: "/");
93+
94+
let urlPath = (try configuration.getApiRootUrl()).appendingPathComponent(rawPath);
95+
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
96+
var queryItems : [URLQueryItem] = [];
97+
if (self.getLoadEncoding() != nil) {
98+
queryItems.append(URLQueryItem(name: "loadEncoding", value: try ObjectSerializer.serializeToString(value: self.getLoadEncoding()!)));
99+
}
100+
101+
if (self.getPassword() != nil) {
102+
queryItems.append(URLQueryItem(name: "password", value: try ObjectSerializer.serializeToString(value: self.getPassword()!)));
103+
}
104+
105+
if (self.getDestFileName() != nil) {
106+
queryItems.append(URLQueryItem(name: "destFileName", value: try ObjectSerializer.serializeToString(value: self.getDestFileName()!)));
107+
}
108+
109+
if (self.getRevisionAuthor() != nil) {
110+
queryItems.append(URLQueryItem(name: "revisionAuthor", value: try ObjectSerializer.serializeToString(value: self.getRevisionAuthor()!)));
111+
}
112+
113+
if (self.getRevisionDateTime() != nil) {
114+
queryItems.append(URLQueryItem(name: "revisionDateTime", value: try ObjectSerializer.serializeToString(value: self.getRevisionDateTime()!)));
115+
}
116+
117+
if (queryItems.count > 0) {
118+
urlBuilder.queryItems = queryItems;
119+
}
120+
var formParams : [RequestFormParam] = [];
121+
formParams.append(RequestFormParam(name: "document", body: try ObjectSerializer.serializeFile(value: self.getDocument()), contentType: "application/octet-stream"));
122+
123+
124+
var result = WordsApiRequestData(url: urlBuilder.url!, method: "PUT");
125+
result.setBody(formParams: formParams);
126+
return result;
127+
}
128+
129+
// Deserialize response of this request
130+
public func deserializeResponse(data : Data) throws -> Any? {
131+
return data;
132+
}
133+
}

0 commit comments

Comments
 (0)