Skip to content

Commit 0961ec3

Browse files
SDK regenerated by CI server [ci skip]
1 parent 1cdaa49 commit 0961ec3

12 files changed

+275
-63
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ This repository contains Aspose.Words Cloud SDK for Swift source code. This SDK
1717

1818
- Properties Name, Text, StartRange, EndRange marked as required for InsertBookmark operation.
1919
- Implemented DeleteOfficeMathObjects operation to delete all office math objects from document.
20+
- Parameter ProtectionRequest was removed from the UnprotectDocument operation. Now removing protection from a document does not require a password.
21+
- Model ProtectionRequest marked as deprecated, please use ProtectionRequestV2 instead for perform ProtectDocument operation. To change the password or protection type of protected document, the old password is no required.
2022

2123

2224
## Enhancements in Version 23.11

Sources/AsposeWordsCloud/Api/ObjectSerializer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ class ObjectSerializer {
218218
"ProtectionData, _": ProtectionData.self,
219219
"ProtectionDataResponse, _": ProtectionDataResponse.self,
220220
"ProtectionRequest, _": ProtectionRequest.self,
221+
"ProtectionRequestV2, _": ProtectionRequestV2.self,
221222
"PsSaveOptionsData, _": PsSaveOptionsData.self,
222223
"PublicKeyResponse, _": PublicKeyResponse.self,
223224
"RangeDocument, _": RangeDocument.self,

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13457,7 +13457,7 @@ public class WordsAPI : Encryptor {
1345713457
}
1345813458

1345913459
// Async representation of protectDocument method
13460-
// Adds protection to the document.
13460+
// Changes the document protection. The previous protection will be overwritten if it exist.
1346113461
public func protectDocument(request : ProtectDocumentRequest, callback : @escaping (_ response : ProtectionDataResponse?, _ error : Error?) -> ()) {
1346213462
do {
1346313463
if (self.apiInvoker == nil) {
@@ -13491,7 +13491,7 @@ public class WordsAPI : Encryptor {
1349113491
}
1349213492

1349313493
// Sync representation of protectDocument method
13494-
// Adds protection to the document.
13494+
// Changes the document protection. The previous protection will be overwritten if it exist.
1349513495
public func protectDocument(request : ProtectDocumentRequest) throws -> ProtectionDataResponse {
1349613496
let semaphore = DispatchSemaphore(value: 0);
1349713497
var responseObject : ProtectionDataResponse? = nil;
@@ -13511,7 +13511,7 @@ public class WordsAPI : Encryptor {
1351113511
}
1351213512

1351313513
// Async representation of protectDocumentOnline method
13514-
// Adds protection to the document.
13514+
// Changes the document protection. The previous protection will be overwritten if it exist.
1351513515
public func protectDocumentOnline(request : ProtectDocumentOnlineRequest, callback : @escaping (_ response : ProtectDocumentOnlineResponse?, _ error : Error?) -> ()) {
1351613516
do {
1351713517
if (self.apiInvoker == nil) {
@@ -13545,7 +13545,7 @@ public class WordsAPI : Encryptor {
1354513545
}
1354613546

1354713547
// Sync representation of protectDocumentOnline method
13548-
// Adds protection to the document.
13548+
// Changes the document protection. The previous protection will be overwritten if it exist.
1354913549
public func protectDocumentOnline(request : ProtectDocumentOnlineRequest) throws -> ProtectDocumentOnlineResponse {
1355013550
let semaphore = DispatchSemaphore(value: 0);
1355113551
var responseObject : ProtectDocumentOnlineResponse? = nil;

Sources/AsposeWordsCloud/Model/ProtectionData.swift

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,29 @@ import Foundation
3030
// Container for the data about protection of the document.
3131
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
3232
public class ProtectionData : Codable, WordsApiModel {
33+
// Gets or sets type of the protection.
34+
public enum ProtectionType : String, Codable
35+
{
36+
// Enum value "allowOnlyRevisions"
37+
case allowOnlyRevisions = "AllowOnlyRevisions"
38+
39+
// Enum value "allowOnlyComments"
40+
case allowOnlyComments = "AllowOnlyComments"
41+
42+
// Enum value "allowOnlyFormFields"
43+
case allowOnlyFormFields = "AllowOnlyFormFields"
44+
45+
// Enum value "readOnly"
46+
case readOnly = "ReadOnly"
47+
48+
// Enum value "noProtection"
49+
case noProtection = "NoProtection"
50+
}
51+
3352
// Field of protectionType. Container for the data about protection of the document.
34-
private var _protectionType : String? = nil;
53+
private var _protectionType : ProtectionType? = nil;
3554

36-
public var protectionType : String? {
55+
public var protectionType : ProtectionType? {
3756
get {
3857
return self._protectionType;
3958
}
@@ -51,12 +70,15 @@ public class ProtectionData : Codable, WordsApiModel {
5170
}
5271

5372
public required init(from json: [String: Any]) throws {
54-
self.protectionType = json["ProtectionType"] as? String;
73+
if let raw_protectionType = json["ProtectionType"] as? String {
74+
self.protectionType = ProtectionType(rawValue: raw_protectionType);
75+
}
76+
5577
}
5678

5779
public required init(from decoder: Decoder) throws {
5880
let container = try decoder.container(keyedBy: CodingKeys.self);
59-
self.protectionType = try container.decodeIfPresent(String.self, forKey: .protectionType);
81+
self.protectionType = try container.decodeIfPresent(ProtectionType.self, forKey: .protectionType);
6082
}
6183

6284
public func encode(to encoder: Encoder) throws {
@@ -70,16 +92,20 @@ public class ProtectionData : Codable, WordsApiModel {
7092
}
7193

7294
public func validate() throws {
95+
if (self.protectionType == nil)
96+
{
97+
throw WordsApiError.requiredParameterError(paramName: "protectionType");
98+
}
7399
}
74100

75101
// Sets protectionType. Gets or sets type of the protection.
76-
public func setProtectionType(protectionType : String?) -> ProtectionData {
102+
public func setProtectionType(protectionType : ProtectionType?) -> ProtectionData {
77103
self.protectionType = protectionType;
78104
return self;
79105
}
80106

81107
// Gets protectionType. Gets or sets type of the protection.
82-
public func getProtectionType() -> String? {
108+
public func getProtectionType() -> ProtectionType? {
83109
return self.protectionType;
84110
}
85111
}

Sources/AsposeWordsCloud/Model/ProtectionRequest.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import Foundation
2929

3030
// Request on changing of protection.
3131
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32-
public class ProtectionRequest : Codable, WordsApiModel {
32+
@available(*, deprecated, message: "ProtectionRequest is deprecated and remains for backwards compatibility only.")
33+
public class ProtectionRequest : ProtectionRequestBase {
3334
// Field of newPassword. Request on changing of protection.
3435
private var _newPassword : String? = nil;
3536

@@ -73,23 +74,27 @@ public class ProtectionRequest : Codable, WordsApiModel {
7374
case invalidCodingKey;
7475
}
7576

76-
public init() {
77+
public override init() {
78+
super.init();
7779
}
7880

7981
public required init(from json: [String: Any]) throws {
82+
try super.init(from: json);
8083
self.newPassword = json["NewPassword"] as? String;
8184
self.password = json["Password"] as? String;
8285
self.protectionType = json["ProtectionType"] as? String;
8386
}
8487

8588
public required init(from decoder: Decoder) throws {
89+
try super.init(from: decoder);
8690
let container = try decoder.container(keyedBy: CodingKeys.self);
8791
self.newPassword = try container.decodeIfPresent(String.self, forKey: .newPassword);
8892
self.password = try container.decodeIfPresent(String.self, forKey: .password);
8993
self.protectionType = try container.decodeIfPresent(String.self, forKey: .protectionType);
9094
}
9195

92-
public func encode(to encoder: Encoder) throws {
96+
public override func encode(to encoder: Encoder) throws {
97+
try super.encode(to: encoder);
9398
var container = encoder.container(keyedBy: CodingKeys.self);
9499
if (self.newPassword != nil) {
95100
try container.encode(self.newPassword, forKey: .newPassword);
@@ -102,10 +107,11 @@ public class ProtectionRequest : Codable, WordsApiModel {
102107
}
103108
}
104109

105-
public func collectFilesContent(_ resultFilesContent : inout [FileReference]) {
110+
public override func collectFilesContent(_ resultFilesContent : inout [FileReference]) {
106111
}
107112

108-
public func validate() throws {
113+
public override func validate() throws {
114+
try super.validate();
109115
if (self.password == nil)
110116
{
111117
throw WordsApiError.requiredParameterError(paramName: "password");
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="ProtectionRequestBase.swift">
4+
* Copyright (c) 2023 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 on changing of protection.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class ProtectionRequestBase : Codable, WordsApiModel {
33+
private enum CodingKeys: String, CodingKey {
34+
case invalidCodingKey;
35+
}
36+
37+
internal init() {
38+
}
39+
40+
public required init(from json: [String: Any]) throws {
41+
}
42+
43+
public required init(from decoder: Decoder) throws {
44+
}
45+
46+
public func encode(to encoder: Encoder) throws {
47+
}
48+
49+
public func collectFilesContent(_ resultFilesContent : inout [FileReference]) {
50+
}
51+
52+
public func validate() throws {
53+
}
54+
55+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="ProtectionRequestV2.swift">
4+
* Copyright (c) 2023 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 on changing of protection.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class ProtectionRequestV2 : ProtectionRequestBase {
33+
// Gets or sets the new type of the document protection.
34+
public enum ProtectionType : String, Codable
35+
{
36+
// Enum value "allowOnlyRevisions"
37+
case allowOnlyRevisions = "AllowOnlyRevisions"
38+
39+
// Enum value "allowOnlyComments"
40+
case allowOnlyComments = "AllowOnlyComments"
41+
42+
// Enum value "allowOnlyFormFields"
43+
case allowOnlyFormFields = "AllowOnlyFormFields"
44+
45+
// Enum value "readOnly"
46+
case readOnly = "ReadOnly"
47+
48+
// Enum value "noProtection"
49+
case noProtection = "NoProtection"
50+
}
51+
52+
// Field of protectionPassword. Request on changing of protection.
53+
private var _protectionPassword : String? = nil;
54+
55+
public var protectionPassword : String? {
56+
get {
57+
return self._protectionPassword;
58+
}
59+
set {
60+
self._protectionPassword = newValue;
61+
}
62+
}
63+
64+
// Field of protectionType. Request on changing of protection.
65+
private var _protectionType : ProtectionType? = nil;
66+
67+
public var protectionType : ProtectionType? {
68+
get {
69+
return self._protectionType;
70+
}
71+
set {
72+
self._protectionType = newValue;
73+
}
74+
}
75+
76+
private enum CodingKeys: String, CodingKey {
77+
case protectionPassword = "ProtectionPassword";
78+
case protectionType = "ProtectionType";
79+
case invalidCodingKey;
80+
}
81+
82+
public override init() {
83+
super.init();
84+
}
85+
86+
public required init(from json: [String: Any]) throws {
87+
try super.init(from: json);
88+
self.protectionPassword = json["ProtectionPassword"] as? String;
89+
if let raw_protectionType = json["ProtectionType"] as? String {
90+
self.protectionType = ProtectionType(rawValue: raw_protectionType);
91+
}
92+
93+
}
94+
95+
public required init(from decoder: Decoder) throws {
96+
try super.init(from: decoder);
97+
let container = try decoder.container(keyedBy: CodingKeys.self);
98+
self.protectionPassword = try container.decodeIfPresent(String.self, forKey: .protectionPassword);
99+
self.protectionType = try container.decodeIfPresent(ProtectionType.self, forKey: .protectionType);
100+
}
101+
102+
public override func encode(to encoder: Encoder) throws {
103+
try super.encode(to: encoder);
104+
var container = encoder.container(keyedBy: CodingKeys.self);
105+
if (self.protectionPassword != nil) {
106+
try container.encode(self.protectionPassword, forKey: .protectionPassword);
107+
}
108+
if (self.protectionType != nil) {
109+
try container.encode(self.protectionType, forKey: .protectionType);
110+
}
111+
}
112+
113+
public override func collectFilesContent(_ resultFilesContent : inout [FileReference]) {
114+
}
115+
116+
public override func validate() throws {
117+
try super.validate();
118+
if (self.protectionPassword == nil)
119+
{
120+
throw WordsApiError.requiredParameterError(paramName: "protectionPassword");
121+
}
122+
if (self.protectionType == nil)
123+
{
124+
throw WordsApiError.requiredParameterError(paramName: "protectionType");
125+
}
126+
}
127+
128+
// Sets protectionPassword. Gets or sets the new password for the document protection. This property is required, but empty value is allowed.
129+
public func setProtectionPassword(protectionPassword : String?) -> ProtectionRequestV2 {
130+
self.protectionPassword = protectionPassword;
131+
return self;
132+
}
133+
134+
// Gets protectionPassword. Gets or sets the new password for the document protection. This property is required, but empty value is allowed.
135+
public func getProtectionPassword() -> String? {
136+
return self.protectionPassword;
137+
}
138+
139+
140+
// Sets protectionType. Gets or sets the new type of the document protection.
141+
public func setProtectionType(protectionType : ProtectionType?) -> ProtectionRequestV2 {
142+
self.protectionType = protectionType;
143+
return self;
144+
}
145+
146+
// Gets protectionType. Gets or sets the new type of the document protection.
147+
public func getProtectionType() -> ProtectionType? {
148+
return self.protectionType;
149+
}
150+
}

0 commit comments

Comments
 (0)