|
65 | 65 | import com.volcengine.mlplatform20240701.model.GetDevInstanceResponse; |
66 | 66 | import com.volcengine.mlplatform20240701.model.GetInstanceTypeRequest; |
67 | 67 | import com.volcengine.mlplatform20240701.model.GetInstanceTypeResponse; |
| 68 | +import com.volcengine.mlplatform20240701.model.GetJobRequest; |
| 69 | +import com.volcengine.mlplatform20240701.model.GetJobResponse; |
68 | 70 | import com.volcengine.mlplatform20240701.model.GetResourceGroupRequest; |
69 | 71 | import com.volcengine.mlplatform20240701.model.GetResourceGroupResponse; |
70 | 72 | import com.volcengine.mlplatform20240701.model.GetResourceQueueRequest; |
@@ -2531,6 +2533,130 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don |
2531 | 2533 | apiClient.executeAsync(call, localVarReturnType, callback); |
2532 | 2534 | return call; |
2533 | 2535 | } |
| 2536 | + /** |
| 2537 | + * Build call for getJob |
| 2538 | + * @param body (required) |
| 2539 | + * @param progressListener Progress listener |
| 2540 | + * @param progressRequestListener Progress request listener |
| 2541 | + * @return Call to execute |
| 2542 | + * @throws ApiException If fail to serialize the request body object |
| 2543 | + */ |
| 2544 | + public com.squareup.okhttp.Call getJobCall(GetJobRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 2545 | + Object localVarPostBody = body; |
| 2546 | + |
| 2547 | + // create path and map variables |
| 2548 | + String localVarPath = "/GetJob/2024-07-01/ml_platform/post/application_json/"; |
| 2549 | + |
| 2550 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 2551 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 2552 | + |
| 2553 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 2554 | + |
| 2555 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 2556 | + |
| 2557 | + final String[] localVarAccepts = { |
| 2558 | + "application/json" |
| 2559 | + }; |
| 2560 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 2561 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 2562 | + |
| 2563 | + final String[] localVarContentTypes = { |
| 2564 | + "text/plain" |
| 2565 | + }; |
| 2566 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 2567 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 2568 | + |
| 2569 | + if(progressListener != null) { |
| 2570 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 2571 | + @Override |
| 2572 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 2573 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 2574 | + return originalResponse.newBuilder() |
| 2575 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 2576 | + .build(); |
| 2577 | + } |
| 2578 | + }); |
| 2579 | + } |
| 2580 | + |
| 2581 | + String[] localVarAuthNames = new String[] { "volcengineSign" }; |
| 2582 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 2583 | + } |
| 2584 | + |
| 2585 | + @SuppressWarnings("rawtypes") |
| 2586 | + private com.squareup.okhttp.Call getJobValidateBeforeCall(GetJobRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 2587 | + // verify the required parameter 'body' is set |
| 2588 | + if (body == null) { |
| 2589 | + throw new ApiException("Missing the required parameter 'body' when calling getJob(Async)"); |
| 2590 | + } |
| 2591 | + |
| 2592 | + com.squareup.okhttp.Call call = getJobCall(body, progressListener, progressRequestListener); |
| 2593 | + return call; |
| 2594 | + |
| 2595 | + |
| 2596 | + |
| 2597 | + |
| 2598 | + |
| 2599 | + } |
| 2600 | + |
| 2601 | + /** |
| 2602 | + * |
| 2603 | + * |
| 2604 | + * @param body (required) |
| 2605 | + * @return GetJobResponse |
| 2606 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 2607 | + */ |
| 2608 | + public GetJobResponse getJob(GetJobRequest body) throws ApiException { |
| 2609 | + ApiResponse<GetJobResponse> resp = getJobWithHttpInfo(body); |
| 2610 | + return resp.getData(); |
| 2611 | + } |
| 2612 | + |
| 2613 | + /** |
| 2614 | + * |
| 2615 | + * |
| 2616 | + * @param body (required) |
| 2617 | + * @return ApiResponse<GetJobResponse> |
| 2618 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 2619 | + */ |
| 2620 | + public ApiResponse<GetJobResponse> getJobWithHttpInfo( @NotNull GetJobRequest body) throws ApiException { |
| 2621 | + com.squareup.okhttp.Call call = getJobValidateBeforeCall(body, null, null); |
| 2622 | + Type localVarReturnType = new TypeToken<GetJobResponse>(){}.getType(); |
| 2623 | + return apiClient.execute(call, localVarReturnType); |
| 2624 | + } |
| 2625 | + |
| 2626 | + /** |
| 2627 | + * (asynchronously) |
| 2628 | + * |
| 2629 | + * @param body (required) |
| 2630 | + * @param callback The callback to be executed when the API call finishes |
| 2631 | + * @return The request call |
| 2632 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 2633 | + */ |
| 2634 | + public com.squareup.okhttp.Call getJobAsync(GetJobRequest body, final ApiCallback<GetJobResponse> callback) throws ApiException { |
| 2635 | + |
| 2636 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 2637 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 2638 | + |
| 2639 | + if (callback != null) { |
| 2640 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 2641 | + @Override |
| 2642 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 2643 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 2644 | + } |
| 2645 | + }; |
| 2646 | + |
| 2647 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 2648 | + @Override |
| 2649 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 2650 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 2651 | + } |
| 2652 | + }; |
| 2653 | + } |
| 2654 | + |
| 2655 | + com.squareup.okhttp.Call call = getJobValidateBeforeCall(body, progressListener, progressRequestListener); |
| 2656 | + Type localVarReturnType = new TypeToken<GetJobResponse>(){}.getType(); |
| 2657 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 2658 | + return call; |
| 2659 | + } |
2534 | 2660 | /** |
2535 | 2661 | * Build call for getResourceGroup |
2536 | 2662 | * @param body (required) |
|
0 commit comments