Skip to content

Commit 8d9d2ae

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 7434345 + b6c912e commit 8d9d2ae

Some content is hidden

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

50 files changed

+1049
-441
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 = '24.5'
3+
s.version = '24.6'
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ node('words-linux') {
5454
} finally{
5555
junit 'tests.xml'
5656
}
57+
58+
if (currentBuild.result == "UNSTABLE") {
59+
currentBuild.result = "FAILURE"
60+
}
5761
}
5862

5963
stage('clean-compiled'){
@@ -74,6 +78,10 @@ node('words-linux') {
7478
} finally{
7579
junit 'tests.xml'
7680
}
81+
82+
if (currentBuild.result == "UNSTABLE") {
83+
currentBuild.result = "FAILURE"
84+
}
7785
}
7886

7987
stage('clean-compiled'){
@@ -83,6 +91,7 @@ node('words-linux') {
8391
}
8492
} finally {
8593
deleteDir()
94+
8695
}
8796
}
8897
}

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 24.6
17+
18+
- Added the 'TranslateNodeId' method to transalate a node id to a node path.
19+
20+
1621
## Enhancements in Version 24.5
1722

1823
- Added the support of multistorage operations. Saving a file as a result of an operation can be performed in a specific storage, when, used file path in the next format '@storage:path/to/file.doc'.
@@ -336,7 +341,7 @@ Add link to this repository as dependency to your Package.swift:
336341

337342
dependencies: [
338343
// Dependencies declare other packages that this package depends on.
339-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "24.5"),
344+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "24.6"),
340345
],
341346
targets: [
342347
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -354,7 +359,7 @@ targets: [
354359
Add link to git repository as dependency to your Podfile:
355360

356361
```ruby
357-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '24.5'
362+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '24.6'
358363
```
359364

360365
## Getting Started

Sources/AsposeWordsCloud/Api/Configuration.swift

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

189189
// Returns SDK version for using in statistics headers
190190
public func getSdkVersion() -> String {
191-
return "24.5";
191+
return "24.6";
192192
}
193193
}

Sources/AsposeWordsCloud/Api/ObjectSerializer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ class ObjectSerializer {
295295
"TextSaveOptionsData, _": TextSaveOptionsData.self,
296296
"TiffSaveOptionsData, _": TiffSaveOptionsData.self,
297297
"TimeZoneInfoData, _": TimeZoneInfoData.self,
298+
"TranslateNodeIdResponse, _": TranslateNodeIdResponse.self,
298299
"UserInformation, _": UserInformation.self,
299300
"WatermarkDataImage, _": WatermarkDataImage.self,
300301
"WatermarkDataText, _": WatermarkDataText.self,

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15326,6 +15326,114 @@ public class WordsAPI : Encryptor {
1532615326
return responseObject!;
1532715327
}
1532815328

15329+
// Async representation of translateNodeId method
15330+
// Translate a node id to a node path.
15331+
public func translateNodeId(request : TranslateNodeIdRequest, callback : @escaping (_ response : TranslateNodeIdResponse?, _ error : Error?) -> ()) {
15332+
do {
15333+
if (self.apiInvoker == nil) {
15334+
#if os(Linux)
15335+
self.apiInvoker = ApiInvoker(configuration: configuration);
15336+
#else
15337+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
15338+
#endif
15339+
}
15340+
15341+
apiInvoker!.invoke(
15342+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
15343+
callback: { response, headers, error in
15344+
if (error != nil) {
15345+
callback(nil, error);
15346+
}
15347+
else {
15348+
do {
15349+
callback(try request.deserializeResponse(data: response!, headers: headers) as? TranslateNodeIdResponse, nil);
15350+
}
15351+
catch let deserializeError {
15352+
callback(nil, deserializeError);
15353+
}
15354+
}
15355+
}
15356+
);
15357+
}
15358+
catch let error {
15359+
callback(nil, error);
15360+
}
15361+
}
15362+
15363+
// Sync representation of translateNodeId method
15364+
// Translate a node id to a node path.
15365+
public func translateNodeId(request : TranslateNodeIdRequest) throws -> TranslateNodeIdResponse {
15366+
let semaphore = DispatchSemaphore(value: 0);
15367+
var responseObject : TranslateNodeIdResponse? = nil;
15368+
var responseError : Error? = nil;
15369+
self.translateNodeId(request : request, callback: { response, error in
15370+
responseObject = response;
15371+
responseError = error;
15372+
semaphore.signal();
15373+
});
15374+
15375+
_ = semaphore.wait();
15376+
15377+
if (responseError != nil) {
15378+
throw responseError!;
15379+
}
15380+
return responseObject!;
15381+
}
15382+
15383+
// Async representation of translateNodeIdOnline method
15384+
// Translate a node id to a node path.
15385+
public func translateNodeIdOnline(request : TranslateNodeIdOnlineRequest, callback : @escaping (_ response : TranslateNodeIdResponse?, _ error : Error?) -> ()) {
15386+
do {
15387+
if (self.apiInvoker == nil) {
15388+
#if os(Linux)
15389+
self.apiInvoker = ApiInvoker(configuration: configuration);
15390+
#else
15391+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
15392+
#endif
15393+
}
15394+
15395+
apiInvoker!.invoke(
15396+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
15397+
callback: { response, headers, error in
15398+
if (error != nil) {
15399+
callback(nil, error);
15400+
}
15401+
else {
15402+
do {
15403+
callback(try request.deserializeResponse(data: response!, headers: headers) as? TranslateNodeIdResponse, nil);
15404+
}
15405+
catch let deserializeError {
15406+
callback(nil, deserializeError);
15407+
}
15408+
}
15409+
}
15410+
);
15411+
}
15412+
catch let error {
15413+
callback(nil, error);
15414+
}
15415+
}
15416+
15417+
// Sync representation of translateNodeIdOnline method
15418+
// Translate a node id to a node path.
15419+
public func translateNodeIdOnline(request : TranslateNodeIdOnlineRequest) throws -> TranslateNodeIdResponse {
15420+
let semaphore = DispatchSemaphore(value: 0);
15421+
var responseObject : TranslateNodeIdResponse? = nil;
15422+
var responseError : Error? = nil;
15423+
self.translateNodeIdOnline(request : request, callback: { response, error in
15424+
responseObject = response;
15425+
responseError = error;
15426+
semaphore.signal();
15427+
});
15428+
15429+
_ = semaphore.wait();
15430+
15431+
if (responseError != nil) {
15432+
throw responseError!;
15433+
}
15434+
return responseObject!;
15435+
}
15436+
1532915437
// Async representation of unprotectDocument method
1533015438
// Removes protection from the document.
1533115439
public func unprotectDocument(request : UnprotectDocumentRequest, callback : @escaping (_ response : ProtectionDataResponse?, _ error : Error?) -> ()) {
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="TranslateNodeIdOnlineRequest.swift">
4+
* Copyright (c) 2024 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 translateNodeIdOnline operation.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class TranslateNodeIdOnlineRequest : WordsApiRequest {
33+
private let document : InputStream;
34+
private let nodeId : String;
35+
private let loadEncoding : String?;
36+
private let password : String?;
37+
private let encryptedPassword : String?;
38+
39+
private enum CodingKeys: String, CodingKey {
40+
case document;
41+
case nodeId;
42+
case loadEncoding;
43+
case password;
44+
case encryptedPassword;
45+
case invalidCodingKey;
46+
}
47+
48+
// Initializes a new instance of the TranslateNodeIdOnlineRequest class.
49+
public init(document : InputStream, nodeId : String, loadEncoding : String? = nil, password : String? = nil, encryptedPassword : String? = nil) {
50+
self.document = document;
51+
self.nodeId = nodeId;
52+
self.loadEncoding = loadEncoding;
53+
self.password = password;
54+
self.encryptedPassword = encryptedPassword;
55+
}
56+
57+
// The document.
58+
public func getDocument() -> InputStream {
59+
return self.document;
60+
}
61+
62+
// The node identifier. Identifier examples: id0.0.0.
63+
public func getNodeId() -> String {
64+
return self.nodeId;
65+
}
66+
67+
// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
68+
public func getLoadEncoding() -> String? {
69+
return self.loadEncoding;
70+
}
71+
72+
// Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
73+
public func getPassword() -> String? {
74+
return self.password;
75+
}
76+
77+
// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
78+
public func getEncryptedPassword() -> String? {
79+
return self.encryptedPassword;
80+
}
81+
82+
// Creates the api request data
83+
public func createApiRequestData(apiInvoker : ApiInvoker, configuration : Configuration) throws -> WordsApiRequestData {
84+
var rawPath = "/words/online/get/translate/{nodeId}";
85+
rawPath = rawPath.replacingOccurrences(of: "{nodeId}", with: try ObjectSerializer.serializeToString(value: self.getNodeId()));
86+
87+
rawPath = rawPath.replacingOccurrences(of: "//", with: "/");
88+
89+
let urlPath = (try configuration.getApiRootUrl()).appendingPathComponent(rawPath);
90+
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
91+
var queryItems : [URLQueryItem] = [];
92+
if (self.getLoadEncoding() != nil) {
93+
94+
#if os(Linux)
95+
queryItems.append(URLQueryItem(name: "loadEncoding", value: try ObjectSerializer.serializeToString(value: self.getLoadEncoding()!)));
96+
97+
#else
98+
queryItems.append(URLQueryItem(name: "loadEncoding", value: try ObjectSerializer.serializeToString(value: self.getLoadEncoding()!)));
99+
100+
#endif
101+
}
102+
103+
104+
if (self.getPassword() != nil) {
105+
106+
#if os(Linux)
107+
queryItems.append(URLQueryItem(name: "password", value: try ObjectSerializer.serializeToString(value: self.getPassword()!)));
108+
109+
#else
110+
queryItems.append(URLQueryItem(name: "encryptedPassword", value: try apiInvoker.encryptString(value: self.getPassword()!)));
111+
112+
#endif
113+
}
114+
115+
116+
if (self.getEncryptedPassword() != nil) {
117+
118+
#if os(Linux)
119+
queryItems.append(URLQueryItem(name: "encryptedPassword", value: try ObjectSerializer.serializeToString(value: self.getEncryptedPassword()!)));
120+
121+
#else
122+
queryItems.append(URLQueryItem(name: "encryptedPassword", value: try ObjectSerializer.serializeToString(value: self.getEncryptedPassword()!)));
123+
124+
#endif
125+
}
126+
127+
if (queryItems.count > 0) {
128+
urlBuilder.queryItems = queryItems;
129+
}
130+
var formParams = [RequestFormParam]();
131+
var requestFilesContent = [FileReference]();
132+
formParams.append(RequestFormParam(name: "document", body: try ObjectSerializer.serializeFile(value: self.getDocument()), contentType: "application/octet-stream"));
133+
134+
try apiInvoker.prepareFilesContent(&requestFilesContent);
135+
for requestFileReference in requestFilesContent {
136+
if (requestFileReference.source == "Request") {
137+
formParams.append(RequestFormParam(name: requestFileReference.reference, body: try ObjectSerializer.serializeFile(value: requestFileReference.content), contentType: "application/octet-stream"));
138+
}
139+
}
140+
141+
var result = WordsApiRequestData(url: urlBuilder.url!, method: "PUT");
142+
if (formParams.count > 0) {
143+
result.setBody(formParams: formParams);
144+
}
145+
return result;
146+
}
147+
148+
// Deserialize response of this request
149+
public func deserializeResponse(data : Data, headers : [String: String]) throws -> Any? {
150+
return try ObjectSerializer.deserialize(type: TranslateNodeIdResponse.self, from: data);
151+
}
152+
}

0 commit comments

Comments
 (0)