Skip to content

Commit b523aaa

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 1a810b9 + 0ea2dbf commit b523aaa

File tree

10 files changed

+251
-39
lines changed

10 files changed

+251
-39
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.3'
3+
s.version = '21.4'
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.4
17+
18+
- Support batch requests.
19+
- Added DependsOn and ResultOf features support for batch requests.
20+
1621
## Enhancements in Version 21.3
1722

1823
- Added 'UpdateCreatedTimeProperty' save option
@@ -121,7 +126,7 @@ Add link to this repository as dependency to your Package.swift:
121126

122127
dependencies: [
123128
// Dependencies declare other packages that this package depends on.
124-
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "21.3"),
129+
.package(url: "https://github.com/aspose-words-cloud/aspose-words-cloud-swift", from: "21.4"),
125130
],
126131
targets: [
127132
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -139,7 +144,7 @@ targets: [
139144
Add link to git repository as dependency to your Podfile:
140145

141146
```ruby
142-
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '21.3'
147+
pod 'AsposeWordsCloud', :git => 'https://github.com/aspose-words-cloud/aspose-words-cloud-swift.git', :tag => '21.4'
143148
```
144149

145150
## Getting Started
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="WordsBatchRequest.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+
// General protocol for all models.
31+
public struct BatchRequest {
32+
private var requestId : String;
33+
private var dependsOn : String;
34+
private let request : WordsApiRequest;
35+
36+
public init(request : WordsApiRequest) {
37+
self.request = request;
38+
self.requestId = UUID().uuidString;
39+
self.dependsOn = "";
40+
}
41+
42+
public func getRequestId() -> String {
43+
return self.requestId;
44+
}
45+
46+
public mutating func setDependsOn(request : BatchRequest) {
47+
return self.dependsOn = request.requestId;
48+
}
49+
50+
public func getRequest() -> WordsApiRequest {
51+
return self.request;
52+
}
53+
54+
public func resultOf() -> InputStream {
55+
return InputStream(data: ("ResultOf(" + self.requestId + ")").data(using: .utf8)!);
56+
}
57+
58+
public func createApiRequestData(configuration : Configuration) throws -> WordsApiRequestData {
59+
var result = try request.createApiRequestData(configuration: configuration);
60+
result.addHeader(key: "RequestId", value: self.requestId);
61+
if (!self.dependsOn.isEmpty) {
62+
result.addHeader(key: "DependsOn", value: self.dependsOn);
63+
}
64+
return result;
65+
}
66+
}

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.3";
120+
return "21.4";
121121
}
122122
}

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13218,7 +13218,7 @@ public class WordsAPI {
1321813218
}
1321913219

1322013220
// Async representation of batch method
13221-
public func batch(requests : [WordsApiRequest], callback : @escaping (_ response : [Any?]?, _ error : Error?) -> ()) {
13221+
public func batch(requests : [BatchRequest], callback : @escaping (_ response : [Any?]?, _ error : Error?) -> ()) {
1322213222
do {
1322313223
let apiRequestData = try requests.map { try $0.createApiRequestData(configuration: self.configuration) };
1322413224
let formParams = try apiRequestData.map { RequestFormParam(name: nil, body: try $0.toBatchPart(configuration: self.configuration), contentType: "application/http; msgtype=request") };
@@ -13235,9 +13235,17 @@ public class WordsAPI {
1323513235
throw WordsApiError.invalidMultipartResponse(message: "Parts count of multipart request and response are mismatch.");
1323613236
}
1323713237

13238+
let sortedParts = parts.reduce(into: [String: ResponseFormParam]()) {
13239+
$0[$1.getHeaders()["RequestId"]] = $1
13240+
}
13241+
1323813242
var result = [Any?]();
13239-
for (index, part) in parts.enumerated() {
13240-
result.append(try ObjectSerializer.deserializeBatchPart(request: requests[index], partData: part));
13243+
for request in requests {
13244+
if (sortedParts[request.getRequestId()] == nil) {
13245+
throw WordsApiError.invalidMultipartResponse(message: "Failed to parse batch response.");
13246+
}
13247+
13248+
result.append(try ObjectSerializer.deserializeBatchPart(request: request.getRequest(), partData: sortedParts[request.getRequestId()]!));
1324113249
}
1324213250

1324313251
callback(result, nil);
@@ -13257,7 +13265,7 @@ public class WordsAPI {
1325713265
}
1325813266
}
1325913267

13260-
public func batch(requests : [WordsApiRequest]) throws -> [Any?] {
13268+
public func batch(requests : [BatchRequest]) throws -> [Any?] {
1326113269
let semaphore = DispatchSemaphore(value: 0);
1326213270
var responseObject : [Any?]? = nil;
1326313271
var responseError : Error? = nil;

Sources/AsposeWordsCloud/Model/PdfSaveOptionsData.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ public class PdfSaveOptionsData : FixedPageSaveOptionsData {
6767
// Field of encryptionDetails. Container class for pdf save options.
6868
private var encryptionDetails : PdfEncryptionDetailsData?;
6969

70-
// Field of escapeUri. Container class for pdf save options.
71-
private var escapeUri : Bool?;
72-
7370
// Field of exportDocumentStructure. Container class for pdf save options.
7471
private var exportDocumentStructure : Bool?;
7572

@@ -127,7 +124,6 @@ public class PdfSaveOptionsData : FixedPageSaveOptionsData {
127124
case downsampleOptions = "DownsampleOptions";
128125
case embedFullFonts = "EmbedFullFonts";
129126
case encryptionDetails = "EncryptionDetails";
130-
case escapeUri = "EscapeUri";
131127
case exportDocumentStructure = "ExportDocumentStructure";
132128
case fontEmbeddingMode = "FontEmbeddingMode";
133129
case headerFooterBookmarksExportMode = "HeaderFooterBookmarksExportMode";
@@ -162,7 +158,6 @@ public class PdfSaveOptionsData : FixedPageSaveOptionsData {
162158
self.downsampleOptions = try container.decodeIfPresent(DownsampleOptionsData.self, forKey: .downsampleOptions);
163159
self.embedFullFonts = try container.decodeIfPresent(Bool.self, forKey: .embedFullFonts);
164160
self.encryptionDetails = try container.decodeIfPresent(PdfEncryptionDetailsData.self, forKey: .encryptionDetails);
165-
self.escapeUri = try container.decodeIfPresent(Bool.self, forKey: .escapeUri);
166161
self.exportDocumentStructure = try container.decodeIfPresent(Bool.self, forKey: .exportDocumentStructure);
167162
self.fontEmbeddingMode = try container.decodeIfPresent(String.self, forKey: .fontEmbeddingMode);
168163
self.headerFooterBookmarksExportMode = try container.decodeIfPresent(HeaderFooterBookmarksExportMode.self, forKey: .headerFooterBookmarksExportMode);
@@ -208,9 +203,6 @@ public class PdfSaveOptionsData : FixedPageSaveOptionsData {
208203
if (self.encryptionDetails != nil) {
209204
try container.encode(self.encryptionDetails, forKey: .encryptionDetails);
210205
}
211-
if (self.escapeUri != nil) {
212-
try container.encode(self.escapeUri, forKey: .escapeUri);
213-
}
214206
if (self.exportDocumentStructure != nil) {
215207
try container.encode(self.exportDocumentStructure, forKey: .exportDocumentStructure);
216208
}
@@ -341,16 +333,6 @@ public class PdfSaveOptionsData : FixedPageSaveOptionsData {
341333
return self.encryptionDetails;
342334
}
343335

344-
// Sets escapeUri. Gets or sets a value indicating whether URI should be escaped before writing.
345-
public func setEscapeUri(escapeUri : Bool?) {
346-
self.escapeUri = escapeUri;
347-
}
348-
349-
// Gets escapeUri. Gets or sets a value indicating whether URI should be escaped before writing.
350-
public func getEscapeUri() -> Bool? {
351-
return self.escapeUri;
352-
}
353-
354336
// Sets exportDocumentStructure. Gets or sets a value indicating whether to export document structure.
355337
public func setExportDocumentStructure(exportDocumentStructure : Bool?) {
356338
self.exportDocumentStructure = exportDocumentStructure;

Sources/AsposeWordsCloud/Model/SaveOptionsData.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public class SaveOptionsData : Codable, WordsApiModel {
4242
// Field of allowEmbeddingPostScriptFonts. base container class for save options data.
4343
private var allowEmbeddingPostScriptFonts : Bool?;
4444

45+
// Field of customTimeZoneInfoData. base container class for save options data.
46+
private var customTimeZoneInfoData : TimeZoneInfoData?;
47+
4548
// Field of dml3DEffectsRenderingMode. base container class for save options data.
4649
private var dml3DEffectsRenderingMode : Dml3DEffectsRenderingMode?;
4750

@@ -77,6 +80,7 @@ public class SaveOptionsData : Codable, WordsApiModel {
7780

7881
private enum CodingKeys: String, CodingKey {
7982
case allowEmbeddingPostScriptFonts = "AllowEmbeddingPostScriptFonts";
83+
case customTimeZoneInfoData = "CustomTimeZoneInfoData";
8084
case dml3DEffectsRenderingMode = "Dml3DEffectsRenderingMode";
8185
case dmlEffectsRenderingMode = "DmlEffectsRenderingMode";
8286
case dmlRenderingMode = "DmlRenderingMode";
@@ -97,6 +101,7 @@ public class SaveOptionsData : Codable, WordsApiModel {
97101
public required init(from decoder: Decoder) throws {
98102
let container = try decoder.container(keyedBy: CodingKeys.self);
99103
self.allowEmbeddingPostScriptFonts = try container.decodeIfPresent(Bool.self, forKey: .allowEmbeddingPostScriptFonts);
104+
self.customTimeZoneInfoData = try container.decodeIfPresent(TimeZoneInfoData.self, forKey: .customTimeZoneInfoData);
100105
self.dml3DEffectsRenderingMode = try container.decodeIfPresent(Dml3DEffectsRenderingMode.self, forKey: .dml3DEffectsRenderingMode);
101106
self.dmlEffectsRenderingMode = try container.decodeIfPresent(String.self, forKey: .dmlEffectsRenderingMode);
102107
self.dmlRenderingMode = try container.decodeIfPresent(String.self, forKey: .dmlRenderingMode);
@@ -115,6 +120,9 @@ public class SaveOptionsData : Codable, WordsApiModel {
115120
if (self.allowEmbeddingPostScriptFonts != nil) {
116121
try container.encode(self.allowEmbeddingPostScriptFonts, forKey: .allowEmbeddingPostScriptFonts);
117122
}
123+
if (self.customTimeZoneInfoData != nil) {
124+
try container.encode(self.customTimeZoneInfoData, forKey: .customTimeZoneInfoData);
125+
}
118126
if (self.dml3DEffectsRenderingMode != nil) {
119127
try container.encode(self.dml3DEffectsRenderingMode, forKey: .dml3DEffectsRenderingMode);
120128
}
@@ -160,6 +168,16 @@ public class SaveOptionsData : Codable, WordsApiModel {
160168
return self.allowEmbeddingPostScriptFonts;
161169
}
162170

171+
// Sets customTimeZoneInfoData. Gets or sets CustomTimeZoneInfo.
172+
public func setCustomTimeZoneInfoData(customTimeZoneInfoData : TimeZoneInfoData?) {
173+
self.customTimeZoneInfoData = customTimeZoneInfoData;
174+
}
175+
176+
// Gets customTimeZoneInfoData. Gets or sets CustomTimeZoneInfo.
177+
public func getCustomTimeZoneInfoData() -> TimeZoneInfoData? {
178+
return self.customTimeZoneInfoData;
179+
}
180+
163181
// Sets dml3DEffectsRenderingMode. Gets or sets the value determining how 3D effects are rendered.
164182
public func setDml3DEffectsRenderingMode(dml3DEffectsRenderingMode : Dml3DEffectsRenderingMode?) {
165183
self.dml3DEffectsRenderingMode = dml3DEffectsRenderingMode;
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="TimeZoneInfoData.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+
// Class to specify TimeZoneInfo parameters.
31+
public class TimeZoneInfoData : Codable, WordsApiModel {
32+
// Field of baseUtcOffset. Class to specify TimeZoneInfo parameters.
33+
private var baseUtcOffset : String?;
34+
35+
// Field of displayName. Class to specify TimeZoneInfo parameters.
36+
private var displayName : String?;
37+
38+
// Field of id. Class to specify TimeZoneInfo parameters.
39+
private var id : String?;
40+
41+
// Field of standardDisplayName. Class to specify TimeZoneInfo parameters.
42+
private var standardDisplayName : String?;
43+
44+
private enum CodingKeys: String, CodingKey {
45+
case baseUtcOffset = "BaseUtcOffset";
46+
case displayName = "DisplayName";
47+
case id = "Id";
48+
case standardDisplayName = "StandardDisplayName";
49+
case invalidCodingKey;
50+
}
51+
52+
public init() {
53+
}
54+
55+
public required init(from decoder: Decoder) throws {
56+
let container = try decoder.container(keyedBy: CodingKeys.self);
57+
self.baseUtcOffset = try container.decodeIfPresent(String.self, forKey: .baseUtcOffset);
58+
self.displayName = try container.decodeIfPresent(String.self, forKey: .displayName);
59+
self.id = try container.decodeIfPresent(String.self, forKey: .id);
60+
self.standardDisplayName = try container.decodeIfPresent(String.self, forKey: .standardDisplayName);
61+
}
62+
63+
public func encode(to encoder: Encoder) throws {
64+
var container = encoder.container(keyedBy: CodingKeys.self);
65+
if (self.baseUtcOffset != nil) {
66+
try container.encode(self.baseUtcOffset, forKey: .baseUtcOffset);
67+
}
68+
if (self.displayName != nil) {
69+
try container.encode(self.displayName, forKey: .displayName);
70+
}
71+
if (self.id != nil) {
72+
try container.encode(self.id, forKey: .id);
73+
}
74+
if (self.standardDisplayName != nil) {
75+
try container.encode(self.standardDisplayName, forKey: .standardDisplayName);
76+
}
77+
}
78+
79+
// Sets baseUtcOffset. Gets or sets base utc offset in hh:mm:ss format.
80+
public func setBaseUtcOffset(baseUtcOffset : String?) {
81+
self.baseUtcOffset = baseUtcOffset;
82+
}
83+
84+
// Gets baseUtcOffset. Gets or sets base utc offset in hh:mm:ss format.
85+
public func getBaseUtcOffset() -> String? {
86+
return self.baseUtcOffset;
87+
}
88+
89+
// Sets displayName. Gets or sets display name.
90+
public func setDisplayName(displayName : String?) {
91+
self.displayName = displayName;
92+
}
93+
94+
// Gets displayName. Gets or sets display name.
95+
public func getDisplayName() -> String? {
96+
return self.displayName;
97+
}
98+
99+
// Sets id. Gets or sets an Id string for CustomTimeZoneInfo.
100+
public func setId(id : String?) {
101+
self.id = id;
102+
}
103+
104+
// Gets id. Gets or sets an Id string for CustomTimeZoneInfo.
105+
public func getId() -> String? {
106+
return self.id;
107+
}
108+
109+
// Sets standardDisplayName. Gets or sets standard display name.
110+
public func setStandardDisplayName(standardDisplayName : String?) {
111+
self.standardDisplayName = standardDisplayName;
112+
}
113+
114+
// Gets standardDisplayName. Gets or sets standard display name.
115+
public func getStandardDisplayName() -> String? {
116+
return self.standardDisplayName;
117+
}
118+
}

0 commit comments

Comments
 (0)