Skip to content

Commit 03e9954

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 91fa596 + 56162e4 commit 03e9954

20 files changed

+1086
-15
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 = '22.6'
3+
s.version = '22.7'
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: 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 22.7
17+
18+
- Expand 'AppendDocument' API method to support 'ImageEntryList' for directly appending images to documents and another images.
19+
- Added 'CompressDocument' API method to support compression and resizing images inside the document for reduce the size of the document.
20+
21+
1622
## Enhancements in Version 22.6
1723

1824
- Added 'DeleteBookmark' and 'DeleteBookmarkOnline' API methods for delete bookmarks by name from the document.
@@ -217,7 +223,7 @@ Add link to this repository as dependency to your Package.swift:
217223

218224
dependencies: [
219225
// Dependencies declare other packages that this package depends on.
220-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "22.6"),
226+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "22.7"),
221227
],
222228
targets: [
223229
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -235,7 +241,7 @@ targets: [
235241
Add link to git repository as dependency to your Podfile:
236242

237243
```ruby
238-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '22.6'
244+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '22.7'
239245
```
240246

241247
## 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 "22.6";
191+
return "22.7";
192192
}
193193
}

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,114 @@ public class WordsAPI : Encryptor {
758758
return responseObject!;
759759
}
760760

761+
// Async representation of compressDocument method
762+
// The default settings allows to reduce the size of the document without any visible degradation of images quality.
763+
public func compressDocument(request : CompressDocumentRequest, callback : @escaping (_ response : CompressResponse?, _ error : Error?) -> ()) {
764+
do {
765+
if (self.apiInvoker == nil) {
766+
#if os(Linux)
767+
self.apiInvoker = ApiInvoker(configuration: configuration);
768+
#else
769+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
770+
#endif
771+
}
772+
773+
apiInvoker!.invoke(
774+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
775+
callback: { response, headers, error in
776+
if (error != nil) {
777+
callback(nil, error);
778+
}
779+
else {
780+
do {
781+
callback(try request.deserializeResponse(data: response!, headers: headers) as? CompressResponse, nil);
782+
}
783+
catch let deserializeError {
784+
callback(nil, deserializeError);
785+
}
786+
}
787+
}
788+
);
789+
}
790+
catch let error {
791+
callback(nil, error);
792+
}
793+
}
794+
795+
// Sync representation of compressDocument method
796+
// The default settings allows to reduce the size of the document without any visible degradation of images quality.
797+
public func compressDocument(request : CompressDocumentRequest) throws -> CompressResponse {
798+
let semaphore = DispatchSemaphore(value: 0);
799+
var responseObject : CompressResponse? = nil;
800+
var responseError : Error? = nil;
801+
self.compressDocument(request : request, callback: { response, error in
802+
responseObject = response;
803+
responseError = error;
804+
semaphore.signal();
805+
});
806+
807+
_ = semaphore.wait();
808+
809+
if (responseError != nil) {
810+
throw responseError!;
811+
}
812+
return responseObject!;
813+
}
814+
815+
// Async representation of compressDocumentOnline method
816+
// Compress and resize images inside the document.
817+
public func compressDocumentOnline(request : CompressDocumentOnlineRequest, callback : @escaping (_ response : CompressDocumentOnlineResponse?, _ error : Error?) -> ()) {
818+
do {
819+
if (self.apiInvoker == nil) {
820+
#if os(Linux)
821+
self.apiInvoker = ApiInvoker(configuration: configuration);
822+
#else
823+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
824+
#endif
825+
}
826+
827+
apiInvoker!.invoke(
828+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
829+
callback: { response, headers, error in
830+
if (error != nil) {
831+
callback(nil, error);
832+
}
833+
else {
834+
do {
835+
callback(try request.deserializeResponse(data: response!, headers: headers) as? CompressDocumentOnlineResponse, nil);
836+
}
837+
catch let deserializeError {
838+
callback(nil, deserializeError);
839+
}
840+
}
841+
}
842+
);
843+
}
844+
catch let error {
845+
callback(nil, error);
846+
}
847+
}
848+
849+
// Sync representation of compressDocumentOnline method
850+
// Compress and resize images inside the document.
851+
public func compressDocumentOnline(request : CompressDocumentOnlineRequest) throws -> CompressDocumentOnlineResponse {
852+
let semaphore = DispatchSemaphore(value: 0);
853+
var responseObject : CompressDocumentOnlineResponse? = nil;
854+
var responseError : Error? = nil;
855+
self.compressDocumentOnline(request : request, callback: { response, error in
856+
responseObject = response;
857+
responseError = error;
858+
semaphore.signal();
859+
});
860+
861+
_ = semaphore.wait();
862+
863+
if (responseError != nil) {
864+
throw responseError!;
865+
}
866+
return responseObject!;
867+
}
868+
761869
// Async representation of convertDocument method
762870
// Converts a document on a local drive to the specified format.
763871
public func convertDocument(request : ConvertDocumentRequest, callback : @escaping (_ response : Data?, _ error : Error?) -> ()) {
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="BaseEntry.swift">
4+
* Copyright (c) 2022 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+
// Represents a entry which will be appended to the original resource document.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class BaseEntry : Codable, WordsApiModel {
33+
// Field of href. Represents a entry which will be appended to the original resource document.
34+
private var _href : String? = nil;
35+
36+
public var href : String? {
37+
get {
38+
return self._href;
39+
}
40+
set {
41+
self._href = newValue;
42+
}
43+
}
44+
45+
private enum CodingKeys: String, CodingKey {
46+
case href = "Href";
47+
case invalidCodingKey;
48+
}
49+
50+
public init() {
51+
}
52+
53+
public required init(from decoder: Decoder) throws {
54+
let container = try decoder.container(keyedBy: CodingKeys.self);
55+
self.href = try container.decodeIfPresent(String.self, forKey: .href);
56+
}
57+
58+
public func encode(to encoder: Encoder) throws {
59+
var container = encoder.container(keyedBy: CodingKeys.self);
60+
if (self.href != nil) {
61+
try container.encode(self.href, forKey: .href);
62+
}
63+
}
64+
65+
// Sets href. Gets or sets the path to entry to append at the server.
66+
public func setHref(href : String?) -> BaseEntry {
67+
self.href = href;
68+
return self;
69+
}
70+
71+
// Gets href. Gets or sets the path to entry to append at the server.
72+
public func getHref() -> String? {
73+
return self.href;
74+
}
75+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="BaseEntryList.swift">
4+
* Copyright (c) 2022 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+
// Represents a list of entries which will be appended to the original resource entry.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class BaseEntryList : Codable, WordsApiModel {
33+
private enum CodingKeys: String, CodingKey {
34+
case invalidCodingKey;
35+
}
36+
37+
internal init() {
38+
}
39+
40+
public required init(from decoder: Decoder) throws {
41+
}
42+
43+
public func encode(to encoder: Encoder) throws {
44+
}
45+
46+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="CompressOptions.swift">
4+
* Copyright (c) 2022 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+
// Options of document compress.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class CompressOptions : Codable, WordsApiModel {
33+
// Field of imagesQuality. Options of document compress.
34+
private var _imagesQuality : Int? = nil;
35+
36+
public var imagesQuality : Int? {
37+
get {
38+
return self._imagesQuality;
39+
}
40+
set {
41+
self._imagesQuality = newValue;
42+
}
43+
}
44+
45+
// Field of imagesReduceSizeFactor. Options of document compress.
46+
private var _imagesReduceSizeFactor : Int? = nil;
47+
48+
public var imagesReduceSizeFactor : Int? {
49+
get {
50+
return self._imagesReduceSizeFactor;
51+
}
52+
set {
53+
self._imagesReduceSizeFactor = newValue;
54+
}
55+
}
56+
57+
private enum CodingKeys: String, CodingKey {
58+
case imagesQuality = "ImagesQuality";
59+
case imagesReduceSizeFactor = "ImagesReduceSizeFactor";
60+
case invalidCodingKey;
61+
}
62+
63+
public init() {
64+
}
65+
66+
public required init(from decoder: Decoder) throws {
67+
let container = try decoder.container(keyedBy: CodingKeys.self);
68+
self.imagesQuality = try container.decodeIfPresent(Int.self, forKey: .imagesQuality);
69+
self.imagesReduceSizeFactor = try container.decodeIfPresent(Int.self, forKey: .imagesReduceSizeFactor);
70+
}
71+
72+
public func encode(to encoder: Encoder) throws {
73+
var container = encoder.container(keyedBy: CodingKeys.self);
74+
if (self.imagesQuality != nil) {
75+
try container.encode(self.imagesQuality, forKey: .imagesQuality);
76+
}
77+
if (self.imagesReduceSizeFactor != nil) {
78+
try container.encode(self.imagesReduceSizeFactor, forKey: .imagesReduceSizeFactor);
79+
}
80+
}
81+
82+
// Sets imagesQuality. Gets or sets the quality level of images from 0 to 100. Default value is 75.
83+
public func setImagesQuality(imagesQuality : Int?) -> CompressOptions {
84+
self.imagesQuality = imagesQuality;
85+
return self;
86+
}
87+
88+
// Gets imagesQuality. Gets or sets the quality level of images from 0 to 100. Default value is 75.
89+
public func getImagesQuality() -> Int? {
90+
return self.imagesQuality;
91+
}
92+
93+
94+
// Sets imagesReduceSizeFactor. Gets or sets the resize factor of images. This value determines how many times the size of the images in the document will be reduced. The parameter value must be greater than 1 for resizing. Default value is 1 and has no effect on images size.
95+
public func setImagesReduceSizeFactor(imagesReduceSizeFactor : Int?) -> CompressOptions {
96+
self.imagesReduceSizeFactor = imagesReduceSizeFactor;
97+
return self;
98+
}
99+
100+
// Gets imagesReduceSizeFactor. Gets or sets the resize factor of images. This value determines how many times the size of the images in the document will be reduced. The parameter value must be greater than 1 for resizing. Default value is 1 and has no effect on images size.
101+
public func getImagesReduceSizeFactor() -> Int? {
102+
return self.imagesReduceSizeFactor;
103+
}
104+
}

0 commit comments

Comments
 (0)