|
71 | 71 | import com.volcengine.mcdn.model.ListVendorContentTaskResponse; |
72 | 72 | import com.volcengine.mcdn.model.ListViewsRequest; |
73 | 73 | import com.volcengine.mcdn.model.ListViewsResponse; |
| 74 | +import com.volcengine.mcdn.model.SubmitOverseaPreloadTaskRequest; |
| 75 | +import com.volcengine.mcdn.model.SubmitOverseaPreloadTaskResponse; |
74 | 76 | import com.volcengine.mcdn.model.SubmitPreloadTaskRequest; |
75 | 77 | import com.volcengine.mcdn.model.SubmitPreloadTaskResponse; |
76 | 78 | import com.volcengine.mcdn.model.SubmitRefreshTaskRequest; |
@@ -2831,6 +2833,130 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don |
2831 | 2833 | apiClient.executeAsync(call, localVarReturnType, callback); |
2832 | 2834 | return call; |
2833 | 2835 | } |
| 2836 | + /** |
| 2837 | + * Build call for submitOverseaPreloadTask |
| 2838 | + * @param body (required) |
| 2839 | + * @param progressListener Progress listener |
| 2840 | + * @param progressRequestListener Progress request listener |
| 2841 | + * @return Call to execute |
| 2842 | + * @throws ApiException If fail to serialize the request body object |
| 2843 | + */ |
| 2844 | + public com.squareup.okhttp.Call submitOverseaPreloadTaskCall(SubmitOverseaPreloadTaskRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 2845 | + Object localVarPostBody = body; |
| 2846 | + |
| 2847 | + // create path and map variables |
| 2848 | + String localVarPath = "/SubmitOverseaPreloadTask/2022-03-01/mcdn/post/application_json/"; |
| 2849 | + |
| 2850 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 2851 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 2852 | + |
| 2853 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 2854 | + |
| 2855 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 2856 | + |
| 2857 | + final String[] localVarAccepts = { |
| 2858 | + "application/json" |
| 2859 | + }; |
| 2860 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 2861 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 2862 | + |
| 2863 | + final String[] localVarContentTypes = { |
| 2864 | + "text/plain" |
| 2865 | + }; |
| 2866 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 2867 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 2868 | + |
| 2869 | + if(progressListener != null) { |
| 2870 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 2871 | + @Override |
| 2872 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 2873 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 2874 | + return originalResponse.newBuilder() |
| 2875 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 2876 | + .build(); |
| 2877 | + } |
| 2878 | + }); |
| 2879 | + } |
| 2880 | + |
| 2881 | + String[] localVarAuthNames = new String[] { "volcengineSign" }; |
| 2882 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 2883 | + } |
| 2884 | + |
| 2885 | + @SuppressWarnings("rawtypes") |
| 2886 | + private com.squareup.okhttp.Call submitOverseaPreloadTaskValidateBeforeCall(SubmitOverseaPreloadTaskRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 2887 | + // verify the required parameter 'body' is set |
| 2888 | + if (body == null) { |
| 2889 | + throw new ApiException("Missing the required parameter 'body' when calling submitOverseaPreloadTask(Async)"); |
| 2890 | + } |
| 2891 | + |
| 2892 | + com.squareup.okhttp.Call call = submitOverseaPreloadTaskCall(body, progressListener, progressRequestListener); |
| 2893 | + return call; |
| 2894 | + |
| 2895 | + |
| 2896 | + |
| 2897 | + |
| 2898 | + |
| 2899 | + } |
| 2900 | + |
| 2901 | + /** |
| 2902 | + * |
| 2903 | + * |
| 2904 | + * @param body (required) |
| 2905 | + * @return SubmitOverseaPreloadTaskResponse |
| 2906 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 2907 | + */ |
| 2908 | + public SubmitOverseaPreloadTaskResponse submitOverseaPreloadTask(SubmitOverseaPreloadTaskRequest body) throws ApiException { |
| 2909 | + ApiResponse<SubmitOverseaPreloadTaskResponse> resp = submitOverseaPreloadTaskWithHttpInfo(body); |
| 2910 | + return resp.getData(); |
| 2911 | + } |
| 2912 | + |
| 2913 | + /** |
| 2914 | + * |
| 2915 | + * |
| 2916 | + * @param body (required) |
| 2917 | + * @return ApiResponse<SubmitOverseaPreloadTaskResponse> |
| 2918 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 2919 | + */ |
| 2920 | + public ApiResponse<SubmitOverseaPreloadTaskResponse> submitOverseaPreloadTaskWithHttpInfo( @NotNull SubmitOverseaPreloadTaskRequest body) throws ApiException { |
| 2921 | + com.squareup.okhttp.Call call = submitOverseaPreloadTaskValidateBeforeCall(body, null, null); |
| 2922 | + Type localVarReturnType = new TypeToken<SubmitOverseaPreloadTaskResponse>(){}.getType(); |
| 2923 | + return apiClient.execute(call, localVarReturnType); |
| 2924 | + } |
| 2925 | + |
| 2926 | + /** |
| 2927 | + * (asynchronously) |
| 2928 | + * |
| 2929 | + * @param body (required) |
| 2930 | + * @param callback The callback to be executed when the API call finishes |
| 2931 | + * @return The request call |
| 2932 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 2933 | + */ |
| 2934 | + public com.squareup.okhttp.Call submitOverseaPreloadTaskAsync(SubmitOverseaPreloadTaskRequest body, final ApiCallback<SubmitOverseaPreloadTaskResponse> callback) throws ApiException { |
| 2935 | + |
| 2936 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 2937 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 2938 | + |
| 2939 | + if (callback != null) { |
| 2940 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 2941 | + @Override |
| 2942 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 2943 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 2944 | + } |
| 2945 | + }; |
| 2946 | + |
| 2947 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 2948 | + @Override |
| 2949 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 2950 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 2951 | + } |
| 2952 | + }; |
| 2953 | + } |
| 2954 | + |
| 2955 | + com.squareup.okhttp.Call call = submitOverseaPreloadTaskValidateBeforeCall(body, progressListener, progressRequestListener); |
| 2956 | + Type localVarReturnType = new TypeToken<SubmitOverseaPreloadTaskResponse>(){}.getType(); |
| 2957 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 2958 | + return call; |
| 2959 | + } |
2834 | 2960 | /** |
2835 | 2961 | * Build call for submitPreloadTask |
2836 | 2962 | * @param body (required) |
|
0 commit comments