|
127 | 127 | import com.aspose.asposecloudpdf.model.RadioButtonField; |
128 | 128 | import com.aspose.asposecloudpdf.model.RadioButtonFieldResponse; |
129 | 129 | import com.aspose.asposecloudpdf.model.RadioButtonFieldsResponse; |
| 130 | +import com.aspose.asposecloudpdf.model.Rectangle; |
130 | 131 | import com.aspose.asposecloudpdf.model.RedactionAnnotation; |
131 | 132 | import com.aspose.asposecloudpdf.model.RedactionAnnotationResponse; |
132 | 133 | import com.aspose.asposecloudpdf.model.RedactionAnnotationsResponse; |
@@ -33261,6 +33262,180 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don |
33261 | 33262 | apiClient.executeAsync(call, localVarReturnType, callback); |
33262 | 33263 | return call; |
33263 | 33264 | } |
| 33265 | + /** |
| 33266 | + * Build call for postDocumentPagesCrop |
| 33267 | + * @param name The document name. (required) |
| 33268 | + * @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required) |
| 33269 | + * @param rect Rectangle of document area. (required) |
| 33270 | + * @param storage The document storage. (optional) |
| 33271 | + * @param folder The document folder. (optional) |
| 33272 | + * @param password Base64 encoded password. (optional) |
| 33273 | + * @param progressListener Progress listener |
| 33274 | + * @param progressRequestListener Progress request listener |
| 33275 | + * @return Call to execute |
| 33276 | + * @throws ApiException If fail to serialize the request body object |
| 33277 | + */ |
| 33278 | + public com.squareup.okhttp.Call postDocumentPagesCropCall(String name, String pages, Rectangle rect, String storage, String folder, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 33279 | + Object localVarPostBody = rect; |
| 33280 | + |
| 33281 | + // create path and map variables |
| 33282 | + String localVarPath = "/pdf/{name}/crop" |
| 33283 | + .replaceAll("\\{" + "name" + "\\}", apiClient.escapePathSegmentString(name.toString())); |
| 33284 | + |
| 33285 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 33286 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 33287 | + if (pages != null) |
| 33288 | + localVarQueryParams.addAll(apiClient.parameterToPair("pages", pages)); |
| 33289 | + if (storage != null) |
| 33290 | + localVarQueryParams.addAll(apiClient.parameterToPair("storage", storage)); |
| 33291 | + if (folder != null) |
| 33292 | + localVarQueryParams.addAll(apiClient.parameterToPair("folder", folder)); |
| 33293 | + if (password != null) |
| 33294 | + localVarQueryParams.addAll(apiClient.parameterToPair("password", password)); |
| 33295 | + |
| 33296 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 33297 | + |
| 33298 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 33299 | + |
| 33300 | + final String[] localVarAccepts = { |
| 33301 | + "application/json" |
| 33302 | + }; |
| 33303 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 33304 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 33305 | + |
| 33306 | + final String[] localVarContentTypes = { |
| 33307 | + "application/json" |
| 33308 | + }; |
| 33309 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 33310 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 33311 | + |
| 33312 | + if(progressListener != null) { |
| 33313 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 33314 | + @Override |
| 33315 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 33316 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 33317 | + return originalResponse.newBuilder() |
| 33318 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 33319 | + .build(); |
| 33320 | + } |
| 33321 | + }); |
| 33322 | + } |
| 33323 | + |
| 33324 | + String[] localVarAuthNames = new String[] { "JWT" }; |
| 33325 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 33326 | + } |
| 33327 | + |
| 33328 | + @SuppressWarnings("rawtypes") |
| 33329 | + private com.squareup.okhttp.Call postDocumentPagesCropValidateBeforeCall(String name, String pages, Rectangle rect, String storage, String folder, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 33330 | + |
| 33331 | + // verify the required parameter 'name' is set |
| 33332 | + if (name == null) { |
| 33333 | + throw new ApiException("Missing the required parameter 'name' when calling postDocumentPagesCrop(Async)"); |
| 33334 | + } |
| 33335 | + |
| 33336 | + // verify the required parameter 'pages' is set |
| 33337 | + if (pages == null) { |
| 33338 | + throw new ApiException("Missing the required parameter 'pages' when calling postDocumentPagesCrop(Async)"); |
| 33339 | + } |
| 33340 | + |
| 33341 | + // verify the required parameter 'rect' is set |
| 33342 | + if (rect == null) { |
| 33343 | + throw new ApiException("Missing the required parameter 'rect' when calling postDocumentPagesCrop(Async)"); |
| 33344 | + } |
| 33345 | + |
| 33346 | + |
| 33347 | + com.squareup.okhttp.Call call = postDocumentPagesCropCall(name, pages, rect, storage, folder, password, progressListener, progressRequestListener); |
| 33348 | + return call; |
| 33349 | + |
| 33350 | + } |
| 33351 | + |
| 33352 | + /** |
| 33353 | + * Crop PDF document pages. |
| 33354 | + * |
| 33355 | + * @param name The document name. (required) |
| 33356 | + * @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required) |
| 33357 | + * @param rect Rectangle of document area. (required) |
| 33358 | + * @param storage The document storage. (optional) |
| 33359 | + * @param folder The document folder. (optional) |
| 33360 | + * @param password Base64 encoded password. (optional) |
| 33361 | + * @return AsposeResponse |
| 33362 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 33363 | + */ |
| 33364 | + public AsposeResponse postDocumentPagesCrop(String name, String pages, Rectangle rect, String storage, String folder, String password) throws ApiException { |
| 33365 | + try |
| 33366 | + { |
| 33367 | + ApiResponse<AsposeResponse> resp = postDocumentPagesCropWithHttpInfo(name, pages, rect, storage, folder, password); |
| 33368 | + return resp.getData(); |
| 33369 | + } |
| 33370 | + catch (ApiException ex) |
| 33371 | + { |
| 33372 | + if (ex.getCode() == 401) |
| 33373 | + { |
| 33374 | + apiClient.requestToken(); |
| 33375 | + ApiResponse<AsposeResponse> resp = postDocumentPagesCropWithHttpInfo(name, pages, rect, storage, folder, password); |
| 33376 | + return resp.getData(); |
| 33377 | + } |
| 33378 | + throw ex; |
| 33379 | + } |
| 33380 | + } |
| 33381 | + |
| 33382 | + /** |
| 33383 | + * Crop PDF document pages. |
| 33384 | + * |
| 33385 | + * @param name The document name. (required) |
| 33386 | + * @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required) |
| 33387 | + * @param rect Rectangle of document area. (required) |
| 33388 | + * @param storage The document storage. (optional) |
| 33389 | + * @param folder The document folder. (optional) |
| 33390 | + * @param password Base64 encoded password. (optional) |
| 33391 | + * @return ApiResponse<AsposeResponse> |
| 33392 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 33393 | + */ |
| 33394 | + public ApiResponse<AsposeResponse> postDocumentPagesCropWithHttpInfo(String name, String pages, Rectangle rect, String storage, String folder, String password) throws ApiException { |
| 33395 | + com.squareup.okhttp.Call call = postDocumentPagesCropValidateBeforeCall(name, pages, rect, storage, folder, password, null, null); |
| 33396 | + Type localVarReturnType = new TypeToken<AsposeResponse>(){}.getType(); |
| 33397 | + return apiClient.execute(call, localVarReturnType); |
| 33398 | + } |
| 33399 | + |
| 33400 | + /** |
| 33401 | + * Crop PDF document pages. (asynchronously) |
| 33402 | + * |
| 33403 | + * @param name The document name. (required) |
| 33404 | + * @param pages Comma separated list of pages and page ranges. (Example: 1,3-5,8) (required) |
| 33405 | + * @param rect Rectangle of document area. (required) |
| 33406 | + * @param storage The document storage. (optional) |
| 33407 | + * @param folder The document folder. (optional) |
| 33408 | + * @param password Base64 encoded password. (optional) |
| 33409 | + * @param callback The callback to be executed when the API call finishes |
| 33410 | + * @return The request call |
| 33411 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 33412 | + */ |
| 33413 | + public com.squareup.okhttp.Call postDocumentPagesCropAsync(String name, String pages, Rectangle rect, String storage, String folder, String password, final ApiCallback<AsposeResponse> callback) throws ApiException { |
| 33414 | + |
| 33415 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 33416 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 33417 | + |
| 33418 | + if (callback != null) { |
| 33419 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 33420 | + @Override |
| 33421 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 33422 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 33423 | + } |
| 33424 | + }; |
| 33425 | + |
| 33426 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 33427 | + @Override |
| 33428 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 33429 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 33430 | + } |
| 33431 | + }; |
| 33432 | + } |
| 33433 | + |
| 33434 | + com.squareup.okhttp.Call call = postDocumentPagesCropValidateBeforeCall(name, pages, rect, storage, folder, password, progressListener, progressRequestListener); |
| 33435 | + Type localVarReturnType = new TypeToken<AsposeResponse>(){}.getType(); |
| 33436 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 33437 | + return call; |
| 33438 | + } |
33264 | 33439 | /** |
33265 | 33440 | * Build call for postDocumentPagesResize |
33266 | 33441 | * @param name The document name. (required) |
|
0 commit comments