Skip to content

Commit cdc6cbe

Browse files
SDK regenerated by CI server [ci skip]
1 parent 9d0b9f3 commit cdc6cbe

File tree

12 files changed

+423
-134
lines changed

12 files changed

+423
-134
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 Java source code. This SDK a
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

src/main/java/com/aspose/words/cloud/JSON.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ public static class ModelAdapterFactory implements TypeAdapterFactory {
582582
put("ProtectionData, _", com.aspose.words.cloud.model.ProtectionData.class);
583583
put("ProtectionDataResponse, _", com.aspose.words.cloud.model.ProtectionDataResponse.class);
584584
put("ProtectionRequest, _", com.aspose.words.cloud.model.ProtectionRequest.class);
585+
put("ProtectionRequestV2, _", com.aspose.words.cloud.model.ProtectionRequestV2.class);
585586
put("PsSaveOptionsData, _", com.aspose.words.cloud.model.PsSaveOptionsData.class);
586587
put("PublicKeyResponse, _", com.aspose.words.cloud.model.PublicKeyResponse.class);
587588
put("RangeDocument, _", com.aspose.words.cloud.model.RangeDocument.class);

src/main/java/com/aspose/words/cloud/api/WordsApi.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18686,7 +18686,7 @@ private com.squareup.okhttp.Call protectDocumentValidateBeforeCall(ProtectDocume
1868618686
}
1868718687

1868818688
/**
18689-
* Adds protection to the document.
18689+
* Changes the document protection. The previous protection will be overwritten if it exist.
1869018690
* @param request Request object
1869118691
* @return ProtectionDataResponse
1869218692
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
@@ -18708,7 +18708,7 @@ public ProtectionDataResponse protectDocument(ProtectDocumentRequest request) th
1870818708
}
1870918709

1871018710
/**
18711-
* Adds protection to the document.
18711+
* Changes the document protection. The previous protection will be overwritten if it exist.
1871218712
* @param request Request object
1871318713
* @return ApiResponse< ProtectionDataResponse >;
1871418714
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
@@ -18720,7 +18720,7 @@ private ApiResponse< ProtectionDataResponse > protectDocumentWithHttpInfo(Protec
1872018720
}
1872118721

1872218722
/**
18723-
* Adds protection to the document. (asynchronously)
18723+
* Changes the document protection. The previous protection will be overwritten if it exist. (asynchronously)
1872418724
* @param request Request object
1872518725
* @param callback The callback to be executed when the API call finishes
1872618726
* @return The request call
@@ -18759,7 +18759,7 @@ private com.squareup.okhttp.Call protectDocumentOnlineValidateBeforeCall(Protect
1875918759
}
1876018760

1876118761
/**
18762-
* Adds protection to the document.
18762+
* Changes the document protection. The previous protection will be overwritten if it exist.
1876318763
* @param request Request object
1876418764
* @return ProtectDocumentOnlineResponse
1876518765
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
@@ -18781,7 +18781,7 @@ public ProtectDocumentOnlineResponse protectDocumentOnline(ProtectDocumentOnline
1878118781
}
1878218782

1878318783
/**
18784-
* Adds protection to the document.
18784+
* Changes the document protection. The previous protection will be overwritten if it exist.
1878518785
* @param request Request object
1878618786
* @return ApiResponse< ProtectDocumentOnlineResponse >;
1878718787
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
@@ -18793,7 +18793,7 @@ private ApiResponse< ProtectDocumentOnlineResponse > protectDocumentOnlineWithHt
1879318793
}
1879418794

1879518795
/**
18796-
* Adds protection to the document. (asynchronously)
18796+
* Changes the document protection. The previous protection will be overwritten if it exist. (asynchronously)
1879718797
* @param request Request object
1879818798
* @param callback The callback to be executed when the API call finishes
1879918799
* @return The request call

src/main/java/com/aspose/words/cloud/model/ProtectionData.java

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,72 @@
4848
*/
4949
@ApiModel(description = "Container for the data about protection of the document.")
5050
public class ProtectionData implements ModelIfc {
51+
/**
52+
* Gets or sets type of the protection.
53+
*/
54+
@JsonAdapter(ProtectionTypeEnum.Adapter.class)
55+
public enum ProtectionTypeEnum {
56+
ALLOWONLYREVISIONS("AllowOnlyRevisions"),
57+
ALLOWONLYCOMMENTS("AllowOnlyComments"),
58+
ALLOWONLYFORMFIELDS("AllowOnlyFormFields"),
59+
READONLY("ReadOnly"),
60+
NOPROTECTION("NoProtection");
61+
62+
private String value;
63+
64+
ProtectionTypeEnum(String value) {
65+
this.value = value;
66+
}
67+
68+
public String getValue() {
69+
return value;
70+
}
71+
72+
@Override
73+
public String toString() {
74+
return String.valueOf(value);
75+
}
76+
77+
public static ProtectionTypeEnum fromValue(String text) {
78+
for (ProtectionTypeEnum b : ProtectionTypeEnum.values()) {
79+
if (String.valueOf(b.value).equals(text)) {
80+
return b;
81+
}
82+
}
83+
return null;
84+
}
85+
86+
public static class Adapter extends TypeAdapter< ProtectionTypeEnum > {
87+
@Override
88+
public void write(final JsonWriter jsonWriter, final ProtectionTypeEnum enumeration) throws IOException {
89+
jsonWriter.value(enumeration.getValue());
90+
}
91+
92+
@Override
93+
public ProtectionTypeEnum read(final JsonReader jsonReader) throws IOException {
94+
String value = jsonReader.nextString();
95+
return ProtectionTypeEnum.fromValue(String.valueOf(value));
96+
}
97+
}
98+
}
99+
51100
@SerializedName("ProtectionType")
52-
protected String protectionType;
101+
protected ProtectionTypeEnum protectionType;
53102
/**
54103
* Gets or sets type of the protection.
55104
* @return protectionType
56105
**/
57106
@ApiModelProperty(value = "Gets or sets type of the protection.")
58-
public String getProtectionType() {
107+
public ProtectionTypeEnum getProtectionType() {
59108
return protectionType;
60109
}
61110

62-
public ProtectionData protectionType(String protectionType) {
111+
public ProtectionData protectionType(ProtectionTypeEnum protectionType) {
63112
this.protectionType = protectionType;
64113
return this;
65114
}
66115

67-
public void setProtectionType(String protectionType) {
116+
public void setProtectionType(ProtectionTypeEnum protectionType) {
68117
this.protectionType = protectionType;
69118
}
70119

@@ -89,6 +138,9 @@ public void getFilesContent(List<FileReference> resultFilesContent) {
89138
*/
90139
@Override
91140
public void validate() throws ApiException {
141+
if (this.protectionType == null) {
142+
throw new ApiException(400, "Property ProtectionType in ProtectionData is required.");
143+
}
92144
}
93145

94146
@Override

src/main/java/com/aspose/words/cloud/model/ProtectionRequest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@
4545

4646
/**
4747
* Request on changing of protection.
48+
* @deprecated ProtectionRequest is deprecated and remains for backwards compatibility only.
4849
*/
4950
@ApiModel(description = "Request on changing of protection.")
50-
public class ProtectionRequest implements ModelIfc {
51+
@Deprecated
52+
public class ProtectionRequest extends ProtectionRequestBase {
5153
@SerializedName("NewPassword")
5254
protected String newPassword;
5355

@@ -114,6 +116,7 @@ public void setProtectionType(String protectionType) {
114116

115117

116118
public ProtectionRequest() {
119+
super();
117120
this.newPassword = null;
118121
this.password = null;
119122
this.protectionType = null;
@@ -135,6 +138,7 @@ public void getFilesContent(List<FileReference> resultFilesContent) {
135138
*/
136139
@Override
137140
public void validate() throws ApiException {
141+
super.validate();
138142
if (this.password == null) {
139143
throw new ApiException(400, "Property Password in ProtectionRequest is required.");
140144
}
@@ -153,12 +157,13 @@ public boolean equals(java.lang.Object o) {
153157
return
154158
Objects.equals(this.newPassword, protectionRequest.newPassword) &&
155159
Objects.equals(this.password, protectionRequest.password) &&
156-
Objects.equals(this.protectionType, protectionRequest.protectionType);
160+
Objects.equals(this.protectionType, protectionRequest.protectionType) &&
161+
super.equals(o);
157162
}
158163

159164
@Override
160165
public int hashCode() {
161-
return Objects.hash(newPassword, password, protectionType);
166+
return Objects.hash(newPassword, password, protectionType, super.hashCode());
162167
}
163168

164169
@Override
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="ProtectionRequestBase.java">
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+
package com.aspose.words.cloud.model;
29+
30+
import java.util.Objects;
31+
import java.util.Arrays;
32+
import java.util.ArrayList;
33+
import java.util.List;
34+
import java.io.IOException;
35+
import org.threeten.bp.OffsetDateTime;
36+
import com.aspose.words.cloud.ApiException;
37+
import com.aspose.words.cloud.model.*;
38+
import com.google.gson.TypeAdapter;
39+
import com.google.gson.annotations.JsonAdapter;
40+
import com.google.gson.annotations.SerializedName;
41+
import com.google.gson.stream.JsonReader;
42+
import com.google.gson.stream.JsonWriter;
43+
import io.swagger.annotations.ApiModel;
44+
import io.swagger.annotations.ApiModelProperty;
45+
46+
/**
47+
* Request on changing of protection.
48+
*/
49+
@ApiModel(description = "Request on changing of protection.")
50+
public abstract class ProtectionRequestBase implements ModelIfc {
51+
52+
public ProtectionRequestBase() {
53+
}
54+
55+
/*
56+
* Gets files content.
57+
*
58+
* @param resultFilesContent List<FileReference> instance.
59+
*/
60+
@Override
61+
public void getFilesContent(List<FileReference> resultFilesContent) {
62+
}
63+
64+
/*
65+
* Validate required properties.
66+
*
67+
* @throws ApiException If fails to validate required properties.
68+
*/
69+
@Override
70+
public void validate() throws ApiException {
71+
}
72+
73+
@Override
74+
public boolean equals(java.lang.Object o) {
75+
if (this == o) {
76+
return true;
77+
}
78+
if (o == null || getClass() != o.getClass()) {
79+
return false;
80+
}
81+
82+
return true;
83+
}
84+
85+
@Override
86+
public int hashCode() {
87+
return Objects.hash();
88+
}
89+
90+
@Override
91+
public String toString() {
92+
StringBuilder sb = new StringBuilder();
93+
sb.append("class ProtectionRequestBase {\n");
94+
sb.append("}");
95+
return sb.toString();
96+
}
97+
98+
/**
99+
* Convert the given object to string with each line indented by 4 spaces
100+
* (except the first line).
101+
*/
102+
private String toIndentedString(java.lang.Object o) {
103+
if (o == null) {
104+
return "null";
105+
}
106+
return o.toString().replace("\n", "\n ");
107+
}
108+
}

0 commit comments

Comments
 (0)