|
33 | 33 | import com.volcengine.tis.model.GetAccessTokenResponse; |
34 | 34 | import com.volcengine.tis.model.GetQuotaInfoRequest; |
35 | 35 | import com.volcengine.tis.model.GetQuotaInfoResponse; |
| 36 | +import com.volcengine.tis.model.TopActionDispatchRequest; |
| 37 | +import com.volcengine.tis.model.TopActionDispatchResponse; |
36 | 38 |
|
37 | 39 | import java.lang.reflect.Type; |
38 | 40 | import java.util.ArrayList; |
@@ -431,4 +433,128 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don |
431 | 433 | apiClient.executeAsync(call, localVarReturnType, callback); |
432 | 434 | return call; |
433 | 435 | } |
| 436 | + /** |
| 437 | + * Build call for topActionDispatch |
| 438 | + * @param body (required) |
| 439 | + * @param progressListener Progress listener |
| 440 | + * @param progressRequestListener Progress request listener |
| 441 | + * @return Call to execute |
| 442 | + * @throws ApiException If fail to serialize the request body object |
| 443 | + */ |
| 444 | + public com.squareup.okhttp.Call topActionDispatchCall(TopActionDispatchRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 445 | + Object localVarPostBody = body; |
| 446 | + |
| 447 | + // create path and map variables |
| 448 | + String localVarPath = "/TopActionDispatch/2024-07-31/tis/post/application_json/"; |
| 449 | + |
| 450 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 451 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 452 | + |
| 453 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 454 | + |
| 455 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 456 | + |
| 457 | + final String[] localVarAccepts = { |
| 458 | + "application/json" |
| 459 | + }; |
| 460 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 461 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 462 | + |
| 463 | + final String[] localVarContentTypes = { |
| 464 | + "text/plain" |
| 465 | + }; |
| 466 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 467 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 468 | + |
| 469 | + if(progressListener != null) { |
| 470 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 471 | + @Override |
| 472 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 473 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 474 | + return originalResponse.newBuilder() |
| 475 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 476 | + .build(); |
| 477 | + } |
| 478 | + }); |
| 479 | + } |
| 480 | + |
| 481 | + String[] localVarAuthNames = new String[] { "volcengineSign" }; |
| 482 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 483 | + } |
| 484 | + |
| 485 | + @SuppressWarnings("rawtypes") |
| 486 | + private com.squareup.okhttp.Call topActionDispatchValidateBeforeCall(TopActionDispatchRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 487 | + // verify the required parameter 'body' is set |
| 488 | + if (body == null) { |
| 489 | + throw new ApiException("Missing the required parameter 'body' when calling topActionDispatch(Async)"); |
| 490 | + } |
| 491 | + |
| 492 | + com.squareup.okhttp.Call call = topActionDispatchCall(body, progressListener, progressRequestListener); |
| 493 | + return call; |
| 494 | + |
| 495 | + |
| 496 | + |
| 497 | + |
| 498 | + |
| 499 | + } |
| 500 | + |
| 501 | + /** |
| 502 | + * |
| 503 | + * |
| 504 | + * @param body (required) |
| 505 | + * @return TopActionDispatchResponse |
| 506 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 507 | + */ |
| 508 | + public TopActionDispatchResponse topActionDispatch(TopActionDispatchRequest body) throws ApiException { |
| 509 | + ApiResponse<TopActionDispatchResponse> resp = topActionDispatchWithHttpInfo(body); |
| 510 | + return resp.getData(); |
| 511 | + } |
| 512 | + |
| 513 | + /** |
| 514 | + * |
| 515 | + * |
| 516 | + * @param body (required) |
| 517 | + * @return ApiResponse<TopActionDispatchResponse> |
| 518 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 519 | + */ |
| 520 | + public ApiResponse<TopActionDispatchResponse> topActionDispatchWithHttpInfo( @NotNull TopActionDispatchRequest body) throws ApiException { |
| 521 | + com.squareup.okhttp.Call call = topActionDispatchValidateBeforeCall(body, null, null); |
| 522 | + Type localVarReturnType = new TypeToken<TopActionDispatchResponse>(){}.getType(); |
| 523 | + return apiClient.execute(call, localVarReturnType); |
| 524 | + } |
| 525 | + |
| 526 | + /** |
| 527 | + * (asynchronously) |
| 528 | + * |
| 529 | + * @param body (required) |
| 530 | + * @param callback The callback to be executed when the API call finishes |
| 531 | + * @return The request call |
| 532 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 533 | + */ |
| 534 | + public com.squareup.okhttp.Call topActionDispatchAsync(TopActionDispatchRequest body, final ApiCallback<TopActionDispatchResponse> callback) throws ApiException { |
| 535 | + |
| 536 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 537 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 538 | + |
| 539 | + if (callback != null) { |
| 540 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 541 | + @Override |
| 542 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 543 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 544 | + } |
| 545 | + }; |
| 546 | + |
| 547 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 548 | + @Override |
| 549 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 550 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 551 | + } |
| 552 | + }; |
| 553 | + } |
| 554 | + |
| 555 | + com.squareup.okhttp.Call call = topActionDispatchValidateBeforeCall(body, progressListener, progressRequestListener); |
| 556 | + Type localVarReturnType = new TypeToken<TopActionDispatchResponse>(){}.getType(); |
| 557 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 558 | + return call; |
| 559 | + } |
434 | 560 | } |
0 commit comments