@@ -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));
0 commit comments