Skip to content

Commit 950554c

Browse files
SDK regenerated by CI server [ci skip]
1 parent 6aa5667 commit 950554c

File tree

12 files changed

+1166
-4
lines changed

12 files changed

+1166
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This repository contains Aspose.Words Cloud SDK for Java source code. This SDK a
1616
## Enhancements in Version 22.7
1717

1818
- 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.
1920

2021

2122
## Enhancements in Version 22.6
@@ -230,7 +231,7 @@ Add this dependency to your project's POM:
230231
<dependency>
231232
<groupId>com.aspose</groupId>
232233
<artifactId>aspose-words-cloud</artifactId>
233-
<version>22.6.0</version>
234+
<version>22.7.0</version>
234235
</dependency>
235236
</dependencies>
236237
```
232 KB
Binary file not shown.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>aspose-words-cloud</artifactId>
55
<packaging>jar</packaging>
66
<name>AsposeWordsCloud</name>
7-
<version>22.6.0</version>
7+
<version>22.7.0</version>
88
<url>https://www.aspose.cloud/</url>
99
<description>Aspose Words Java SDK</description>
1010
<scm>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class ApiClient {
5858
private String apiVersion = "v4.0";
5959
private String baseUrl = "https://api.aspose.cloud";
6060
private String basePath = baseUrl + "/" + apiVersion;
61-
private String clientVersion = "22.6";
61+
private String clientVersion = "22.7";
6262
private boolean debugging = false;
6363
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
6464
private String tempFolderPath = null;

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

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,152 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
10161016
return call;
10171017
}
10181018

1019+
@SuppressWarnings("rawtypes")
1020+
private com.squareup.okhttp.Call compressDocumentValidateBeforeCall(CompressDocumentRequest request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, IOException {
1021+
return apiClient.buildCall(request.buildHttpRequest(apiClient, progressListener, progressRequestListener, true));
1022+
}
1023+
1024+
/**
1025+
* The default settings allows to reduce the size of the document without any visible degradation of images quality.
1026+
* @param request Request object
1027+
* @return CompressResponse
1028+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1029+
* @throws IOException If fail to serialize the request body object
1030+
*/
1031+
public CompressResponse compressDocument(CompressDocumentRequest request) throws ApiException, MessagingException, IOException {
1032+
try {
1033+
ApiResponse< CompressResponse > resp = compressDocumentWithHttpInfo(request);
1034+
return resp.getData();
1035+
}
1036+
catch (ApiException ex) {
1037+
if (ex.getCode() == apiClient.getNotAuthCode()) {
1038+
apiClient.requestToken();
1039+
ApiResponse< CompressResponse > resp = compressDocumentWithHttpInfo(request);
1040+
return resp.getData();
1041+
}
1042+
throw ex;
1043+
}
1044+
}
1045+
1046+
/**
1047+
* The default settings allows to reduce the size of the document without any visible degradation of images quality.
1048+
* @param request Request object
1049+
* @return ApiResponse< CompressResponse >;
1050+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1051+
* @throws IOException If fail to serialize the request body object
1052+
*/
1053+
private ApiResponse< CompressResponse > compressDocumentWithHttpInfo(CompressDocumentRequest request) throws ApiException, MessagingException, IOException {
1054+
com.squareup.okhttp.Call call = compressDocumentValidateBeforeCall(request, null, null);
1055+
return apiClient.execute(call, request);
1056+
}
1057+
1058+
/**
1059+
* The default settings allows to reduce the size of the document without any visible degradation of images quality. (asynchronously)
1060+
* @param request Request object
1061+
* @param callback The callback to be executed when the API call finishes
1062+
* @return The request call
1063+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
1064+
* @throws IOException If fail to serialize the request body object
1065+
*/
1066+
public com.squareup.okhttp.Call compressDocumentAsync(CompressDocumentRequest request, final ApiCallback< CompressResponse > callback) throws ApiException, MessagingException, IOException {
1067+
1068+
ProgressResponseBody.ProgressListener progressListener = null;
1069+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
1070+
1071+
if (callback != null) {
1072+
progressListener = new ProgressResponseBody.ProgressListener() {
1073+
@Override
1074+
public void update(long bytesRead, long contentLength, boolean done) {
1075+
callback.onDownloadProgress(bytesRead, contentLength, done);
1076+
}
1077+
};
1078+
1079+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
1080+
@Override
1081+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
1082+
callback.onUploadProgress(bytesWritten, contentLength, done);
1083+
}
1084+
};
1085+
}
1086+
1087+
com.squareup.okhttp.Call call = compressDocumentValidateBeforeCall(request, progressListener, progressRequestListener);
1088+
apiClient.executeAsync(call, request, callback);
1089+
return call;
1090+
}
1091+
1092+
@SuppressWarnings("rawtypes")
1093+
private com.squareup.okhttp.Call compressDocumentOnlineValidateBeforeCall(CompressDocumentOnlineRequest request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, IOException {
1094+
return apiClient.buildCall(request.buildHttpRequest(apiClient, progressListener, progressRequestListener, true));
1095+
}
1096+
1097+
/**
1098+
* Compress and resize images inside the document.
1099+
* @param request Request object
1100+
* @return CompressDocumentOnlineResponse
1101+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1102+
* @throws IOException If fail to serialize the request body object
1103+
*/
1104+
public CompressDocumentOnlineResponse compressDocumentOnline(CompressDocumentOnlineRequest request) throws ApiException, MessagingException, IOException {
1105+
try {
1106+
ApiResponse< CompressDocumentOnlineResponse > resp = compressDocumentOnlineWithHttpInfo(request);
1107+
return resp.getData();
1108+
}
1109+
catch (ApiException ex) {
1110+
if (ex.getCode() == apiClient.getNotAuthCode()) {
1111+
apiClient.requestToken();
1112+
ApiResponse< CompressDocumentOnlineResponse > resp = compressDocumentOnlineWithHttpInfo(request);
1113+
return resp.getData();
1114+
}
1115+
throw ex;
1116+
}
1117+
}
1118+
1119+
/**
1120+
* Compress and resize images inside the document.
1121+
* @param request Request object
1122+
* @return ApiResponse< CompressDocumentOnlineResponse >;
1123+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1124+
* @throws IOException If fail to serialize the request body object
1125+
*/
1126+
private ApiResponse< CompressDocumentOnlineResponse > compressDocumentOnlineWithHttpInfo(CompressDocumentOnlineRequest request) throws ApiException, MessagingException, IOException {
1127+
com.squareup.okhttp.Call call = compressDocumentOnlineValidateBeforeCall(request, null, null);
1128+
return apiClient.execute(call, request);
1129+
}
1130+
1131+
/**
1132+
* Compress and resize images inside the document. (asynchronously)
1133+
* @param request Request object
1134+
* @param callback The callback to be executed when the API call finishes
1135+
* @return The request call
1136+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
1137+
* @throws IOException If fail to serialize the request body object
1138+
*/
1139+
public com.squareup.okhttp.Call compressDocumentOnlineAsync(CompressDocumentOnlineRequest request, final ApiCallback< CompressDocumentOnlineResponse > callback) throws ApiException, MessagingException, IOException {
1140+
1141+
ProgressResponseBody.ProgressListener progressListener = null;
1142+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
1143+
1144+
if (callback != null) {
1145+
progressListener = new ProgressResponseBody.ProgressListener() {
1146+
@Override
1147+
public void update(long bytesRead, long contentLength, boolean done) {
1148+
callback.onDownloadProgress(bytesRead, contentLength, done);
1149+
}
1150+
};
1151+
1152+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
1153+
@Override
1154+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
1155+
callback.onUploadProgress(bytesWritten, contentLength, done);
1156+
}
1157+
};
1158+
}
1159+
1160+
com.squareup.okhttp.Call call = compressDocumentOnlineValidateBeforeCall(request, progressListener, progressRequestListener);
1161+
apiClient.executeAsync(call, request, callback);
1162+
return call;
1163+
}
1164+
10191165
@SuppressWarnings("rawtypes")
10201166
private com.squareup.okhttp.Call convertDocumentValidateBeforeCall(ConvertDocumentRequest request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, IOException {
10211167
return apiClient.buildCall(request.buildHttpRequest(apiClient, progressListener, progressRequestListener, true));
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="CompressOptions.java">
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+
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.model.*;
37+
import com.google.gson.TypeAdapter;
38+
import com.google.gson.annotations.JsonAdapter;
39+
import com.google.gson.annotations.SerializedName;
40+
import com.google.gson.stream.JsonReader;
41+
import com.google.gson.stream.JsonWriter;
42+
import io.swagger.annotations.ApiModel;
43+
import io.swagger.annotations.ApiModelProperty;
44+
45+
/**
46+
* Options of document compress.
47+
*/
48+
@ApiModel(description = "Options of document compress.")
49+
public class CompressOptions {
50+
@SerializedName("ImagesQuality")
51+
protected Integer imagesQuality;
52+
53+
@SerializedName("ImagesReduceSizeFactor")
54+
protected Integer imagesReduceSizeFactor;
55+
/**
56+
* Gets or sets the quality level of images from 0 to 100. Default value is 75.
57+
* @return imagesQuality
58+
**/
59+
@ApiModelProperty(value = "Gets or sets the quality level of images from 0 to 100. Default value is 75.")
60+
public Integer getImagesQuality() {
61+
return imagesQuality;
62+
}
63+
64+
public CompressOptions imagesQuality(Integer imagesQuality) {
65+
this.imagesQuality = imagesQuality;
66+
return this;
67+
}
68+
69+
public void setImagesQuality(Integer imagesQuality) {
70+
this.imagesQuality = imagesQuality;
71+
}
72+
73+
74+
/**
75+
* Gets or sets the resize factor of images.
76+
* This value determines how many times the size of the images in the document will be reduced.
77+
* The parameter value must be greater than 1 for resizing. Default value is 1 and has no effect on images size.
78+
* @return imagesReduceSizeFactor
79+
**/
80+
@ApiModelProperty(value = "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.")
81+
public Integer getImagesReduceSizeFactor() {
82+
return imagesReduceSizeFactor;
83+
}
84+
85+
public CompressOptions imagesReduceSizeFactor(Integer imagesReduceSizeFactor) {
86+
this.imagesReduceSizeFactor = imagesReduceSizeFactor;
87+
return this;
88+
}
89+
90+
public void setImagesReduceSizeFactor(Integer imagesReduceSizeFactor) {
91+
this.imagesReduceSizeFactor = imagesReduceSizeFactor;
92+
}
93+
94+
95+
public CompressOptions() {
96+
this.imagesQuality = null;
97+
this.imagesReduceSizeFactor = null;
98+
}
99+
100+
@Override
101+
public boolean equals(java.lang.Object o) {
102+
if (this == o) {
103+
return true;
104+
}
105+
if (o == null || getClass() != o.getClass()) {
106+
return false;
107+
}
108+
109+
CompressOptions compressOptions = (CompressOptions) o;
110+
return
111+
Objects.equals(this.imagesQuality, compressOptions.imagesQuality) &&
112+
Objects.equals(this.imagesReduceSizeFactor, compressOptions.imagesReduceSizeFactor);
113+
}
114+
115+
@Override
116+
public int hashCode() {
117+
return Objects.hash(imagesQuality, imagesReduceSizeFactor);
118+
}
119+
120+
@Override
121+
public String toString() {
122+
StringBuilder sb = new StringBuilder();
123+
sb.append("class CompressOptions {\n");
124+
sb.append(" imagesQuality: ").append(toIndentedString(getImagesQuality())).append("\n");
125+
sb.append(" imagesReduceSizeFactor: ").append(toIndentedString(getImagesReduceSizeFactor())).append("\n");
126+
sb.append("}");
127+
return sb.toString();
128+
}
129+
130+
/**
131+
* Convert the given object to string with each line indented by 4 spaces
132+
* (except the first line).
133+
*/
134+
private String toIndentedString(java.lang.Object o) {
135+
if (o == null) {
136+
return "null";
137+
}
138+
return o.toString().replace("\n", "\n ");
139+
}
140+
}

0 commit comments

Comments
 (0)