Skip to content

Commit 4206d1e

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents d3d3f70 + 0ded1e4 commit 4206d1e

File tree

6 files changed

+215
-4
lines changed

6 files changed

+215
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Add link to this repository as dependency to your Package.swift:
401401

402402
dependencies: [
403403
// Dependencies declare other packages that this package depends on.
404-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git", from: "25.9")
404+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git", from: "25.10")
405405
],
406406
targets: [
407407
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -419,7 +419,7 @@ targets: [
419419
Add link to git repository as dependency to your Podfile:
420420

421421
```ruby
422-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '25.9'
422+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '25.10'
423423
```
424424

425425
## Getting Started

Sources/AsposeWordsCloud/Api/Configuration.swift

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

188188
// Returns SDK version for using in statistics headers
189189
public func getSdkVersion() -> String {
190-
return "25.9";
190+
return "25.10";
191191
}
192192
}

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13609,6 +13609,60 @@ public class WordsAPI : Encryptor {
1360913609
return responseObject!;
1361013610
}
1361113611

13612+
// Async representation of loadWebDocumentOnline method
13613+
// Downloads a document from the Web using URL and saves it to cloud storage in the specified format.
13614+
public func loadWebDocumentOnline(request : LoadWebDocumentOnlineRequest, callback : @escaping (_ response : LoadWebDocumentOnlineResponse?, _ error : Error?) -> ()) {
13615+
do {
13616+
if (self.apiInvoker == nil) {
13617+
#if os(Linux)
13618+
self.apiInvoker = ApiInvoker(configuration: configuration);
13619+
#else
13620+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
13621+
#endif
13622+
}
13623+
13624+
apiInvoker!.invoke(
13625+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
13626+
callback: { response, headers, error in
13627+
if (error != nil) {
13628+
callback(nil, error);
13629+
}
13630+
else {
13631+
do {
13632+
callback(try request.deserializeResponse(data: response!, headers: headers) as? LoadWebDocumentOnlineResponse, nil);
13633+
}
13634+
catch let deserializeError {
13635+
callback(nil, deserializeError);
13636+
}
13637+
}
13638+
}
13639+
);
13640+
}
13641+
catch let error {
13642+
callback(nil, error);
13643+
}
13644+
}
13645+
13646+
// Sync representation of loadWebDocumentOnline method
13647+
// Downloads a document from the Web using URL and saves it to cloud storage in the specified format.
13648+
public func loadWebDocumentOnline(request : LoadWebDocumentOnlineRequest) throws -> LoadWebDocumentOnlineResponse {
13649+
let semaphore = DispatchSemaphore(value: 0);
13650+
var responseObject : LoadWebDocumentOnlineResponse? = nil;
13651+
var responseError : Error? = nil;
13652+
self.loadWebDocumentOnline(request : request, callback: { response, error in
13653+
responseObject = response;
13654+
responseError = error;
13655+
semaphore.signal();
13656+
});
13657+
13658+
semaphore.wait();
13659+
13660+
if (responseError != nil) {
13661+
throw responseError!;
13662+
}
13663+
return responseObject!;
13664+
}
13665+
1361213666
// Async representation of mergeWithNext method
1361313667
// Merge the section with the next one.
1361413668
public func mergeWithNext(request : MergeWithNextRequest, callback : @escaping (_ error : Error?) -> ()) {
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="LoadWebDocumentOnlineRequest.swift">
4+
* Copyright (c) 2025 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 loadWebDocumentOnline operation.
31+
public class LoadWebDocumentOnlineRequest : WordsApiRequest {
32+
private let data : LoadWebDocumentData;
33+
34+
private enum CodingKeys: String, CodingKey {
35+
case data;
36+
case invalidCodingKey;
37+
}
38+
39+
// Initializes a new instance of the LoadWebDocumentOnlineRequest class.
40+
public init(data : LoadWebDocumentData) {
41+
self.data = data;
42+
}
43+
44+
// The properties of data downloading.
45+
public func getData() -> LoadWebDocumentData {
46+
return self.data;
47+
}
48+
49+
// Creates the api request data
50+
public func createApiRequestData(apiInvoker : ApiInvoker, configuration : Configuration) throws -> WordsApiRequestData {
51+
var rawPath = "/words/online/put/loadWebDocument";
52+
rawPath = rawPath.replacingOccurrences(of: "//", with: "/");
53+
54+
let urlPath = (try configuration.getApiRootUrl()).appendingPathComponent(rawPath);
55+
var formParams = [RequestFormParam]();
56+
var requestFilesContent = [FileReference]();
57+
formParams.append(RequestFormParam(name: "data", body: try ObjectSerializer.serialize(value: self.getData()), contentType: "application/json"));
58+
self.getData().collectFilesContent(&requestFilesContent);
59+
try self.getData().validate();
60+
61+
try apiInvoker.prepareFilesContent(&requestFilesContent);
62+
for requestFileReference in requestFilesContent {
63+
if (requestFileReference.source == "Request") {
64+
formParams.append(RequestFormParam(name: requestFileReference.reference, body: try ObjectSerializer.serializeFile(value: requestFileReference.content), contentType: "application/octet-stream"));
65+
}
66+
}
67+
68+
var result = WordsApiRequestData(url: urlPath, method: "PUT");
69+
if (formParams.count > 0) {
70+
result.setBody(formParams: formParams);
71+
}
72+
return result;
73+
}
74+
75+
// Deserialize response of this request
76+
public func deserializeResponse(data : Data, headers : [String: String]) throws -> Any? {
77+
let multipart = try ObjectSerializer.parseMultipart(data: data);
78+
return LoadWebDocumentOnlineResponse(
79+
model: try ObjectSerializer.deserialize(
80+
type: SaveResponse.self,
81+
from: (try ObjectSerializer.getMultipartByName(multipart: multipart, name: "Model")).getBody()
82+
),
83+
document: try ObjectSerializer.parseFilesCollection(part: try ObjectSerializer.getMultipartByName(multipart: multipart, name: "Document"))
84+
);
85+
}
86+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="LoadWebDocumentOnlineResponse.swift">
4+
* Copyright (c) 2025 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+
// Response model for loadWebDocumentOnline operation.
31+
public class LoadWebDocumentOnlineResponse {
32+
private let model : SaveResponse?;
33+
private let document : [String: Data]?;
34+
35+
private enum CodingKeys: String, CodingKey {
36+
case model;
37+
case document;
38+
case invalidCodingKey;
39+
}
40+
41+
// Initializes a new instance of the LoadWebDocumentOnlineResponse class.
42+
public init(model : SaveResponse?, document : [String: Data]?) {
43+
self.model = model;
44+
self.document = document;
45+
}
46+
47+
// The REST response with a save result.
48+
public func getModel() -> SaveResponse? {
49+
return self.model;
50+
}
51+
52+
// The document after modification.
53+
public func getDocument() -> [String: Data]? {
54+
return self.document;
55+
}
56+
}

Tests/AsposeWordsCloudTests/LoadWebDocumentTests.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ import XCTest
3131
// Example of how to load web document.
3232
class LoadWebDocumentTests: BaseTestContext {
3333
static var allTests = [
34-
("testLoadWebDocument", testLoadWebDocument)
34+
("testLoadWebDocument", testLoadWebDocument),
35+
("testLoadWebDocumentOnline", testLoadWebDocumentOnline)
3536
];
3637

3738
// Test for loading web document.
@@ -50,4 +51,18 @@ class LoadWebDocumentTests: BaseTestContext {
5051
if (!(actual.getSaveResult()!.getDestDocument() != nil)) { XCTFail("actual.getSaveResult()!.getDestDocument() != nil"); return; }
5152
if (!(actual.getSaveResult()!.getDestDocument()!.getHref() == "google.doc")) { XCTFail("actual.getSaveResult()!.getDestDocument()!.getHref() == " + "google.doc"); return; }
5253
}
54+
55+
// Test for loading web document online.
56+
func testLoadWebDocumentOnline() throws {
57+
let requestDataSaveOptions = DocSaveOptionsData()
58+
.setDmlEffectsRenderingMode(dmlEffectsRenderingMode: DocSaveOptionsData.DmlEffectsRenderingMode._none)
59+
.setDmlRenderingMode(dmlRenderingMode: DocSaveOptionsData.DmlRenderingMode.drawingML)
60+
.setFileName(fileName: "google.doc")
61+
.setZipOutput(zipOutput: false);
62+
let requestData = LoadWebDocumentData()
63+
.setSaveOptions(saveOptions: requestDataSaveOptions as! DocSaveOptionsData)
64+
.setLoadingDocumentUrl(loadingDocumentUrl: "http://google.com");
65+
let request = LoadWebDocumentOnlineRequest(data: requestData);
66+
_ = try super.getApi().loadWebDocumentOnline(request: request);
67+
}
5368
}

0 commit comments

Comments
 (0)