AsyncTaskDownloadV2Api.java 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * Oceanengine Open Api
  3. * 巨量引擎开放平台 Open Api
  4. *
  5. * The version of the OpenAPI document: 1.1.19
  6. *
  7. *
  8. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  9. * https://openapi-generator.tech
  10. * Do not edit the class manually.
  11. */
  12. package com.bytedance.ads.api;
  13. import com.bytedance.ads.ApiCallback;
  14. import com.bytedance.ads.ApiClient;
  15. import com.bytedance.ads.ApiException;
  16. import com.bytedance.ads.ApiResponse;
  17. import com.bytedance.ads.Configuration;
  18. import com.bytedance.ads.Pair;
  19. import com.google.gson.reflect.TypeToken;
  20. import com.bytedance.ads.model.AsyncTaskDownloadV2Response;
  21. import java.lang.reflect.Type;
  22. import java.util.ArrayList;
  23. import java.util.HashMap;
  24. import java.util.List;
  25. import java.util.Map;
  26. public class AsyncTaskDownloadV2Api {
  27. private ApiClient localVarApiClient;
  28. private int localHostIndex;
  29. private String localCustomBaseUrl;
  30. public AsyncTaskDownloadV2Api() {
  31. this(Configuration.getDefaultApiClient());
  32. }
  33. public AsyncTaskDownloadV2Api(ApiClient apiClient) {
  34. this.localVarApiClient = apiClient;
  35. }
  36. public ApiClient getApiClient() {
  37. return localVarApiClient;
  38. }
  39. public void setApiClient(ApiClient apiClient) {
  40. this.localVarApiClient = apiClient;
  41. }
  42. public int getHostIndex() {
  43. return localHostIndex;
  44. }
  45. public void setHostIndex(int hostIndex) {
  46. this.localHostIndex = hostIndex;
  47. }
  48. public String getCustomBaseUrl() {
  49. return localCustomBaseUrl;
  50. }
  51. public void setCustomBaseUrl(String customBaseUrl) {
  52. this.localCustomBaseUrl = customBaseUrl;
  53. }
  54. /**
  55. * Build call for openApi2AsyncTaskDownloadGet
  56. * @param advertiserId (required)
  57. * @param taskId (required)
  58. * @param rangeFrom (optional, default to 0)
  59. * @param rangeTo (optional, default to -1)
  60. * @param _callback Callback for upload/download progress
  61. * @return Call to execute
  62. * @throws ApiException If fail to serialize the request body object
  63. * @http.response.details
  64. <table summary="Response Details" border="1">
  65. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  66. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  67. </table>
  68. */
  69. public okhttp3.Call openApi2AsyncTaskDownloadGetCall(Long advertiserId, Long taskId, Long rangeFrom, Long rangeTo, final ApiCallback _callback) throws ApiException {
  70. String basePath = null;
  71. // Operation Servers
  72. String[] localBasePaths = new String[] { };
  73. // Determine Base Path to Use
  74. if (localCustomBaseUrl != null){
  75. basePath = localCustomBaseUrl;
  76. } else if ( localBasePaths.length > 0 ) {
  77. basePath = localBasePaths[localHostIndex];
  78. } else {
  79. basePath = null;
  80. }
  81. Object localVarPostBody = null;
  82. // create path and map variables
  83. String localVarPath = "/open_api/2/async_task/download/";
  84. List<Pair> localVarQueryParams = new ArrayList<Pair>();
  85. List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
  86. Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  87. Map<String, String> localVarCookieParams = new HashMap<String, String>();
  88. Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  89. if (advertiserId != null) {
  90. localVarQueryParams.addAll(localVarApiClient.parameterToPair("advertiser_id", advertiserId));
  91. }
  92. if (taskId != null) {
  93. localVarQueryParams.addAll(localVarApiClient.parameterToPair("task_id", taskId));
  94. }
  95. if (rangeFrom != null) {
  96. localVarQueryParams.addAll(localVarApiClient.parameterToPair("range_from", rangeFrom));
  97. }
  98. if (rangeTo != null) {
  99. localVarQueryParams.addAll(localVarApiClient.parameterToPair("range_to", rangeTo));
  100. }
  101. final String[] localVarAccepts = {
  102. "application/json"
  103. };
  104. final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
  105. if (localVarAccept != null) {
  106. localVarHeaderParams.put("Accept", localVarAccept);
  107. }
  108. final String[] localVarContentTypes = {
  109. };
  110. final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
  111. if (localVarContentType != null) {
  112. localVarHeaderParams.put("Content-Type", localVarContentType);
  113. }
  114. String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
  115. return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
  116. }
  117. @SuppressWarnings("rawtypes")
  118. private okhttp3.Call openApi2AsyncTaskDownloadGetValidateBeforeCall(Long advertiserId, Long taskId, Long rangeFrom, Long rangeTo, final ApiCallback _callback) throws ApiException {
  119. // verify the required parameter 'advertiserId' is set
  120. if (advertiserId == null) {
  121. throw new ApiException("Missing the required parameter 'advertiserId' when calling openApi2AsyncTaskDownloadGet(Async)");
  122. }
  123. // verify the required parameter 'taskId' is set
  124. if (taskId == null) {
  125. throw new ApiException("Missing the required parameter 'taskId' when calling openApi2AsyncTaskDownloadGet(Async)");
  126. }
  127. return openApi2AsyncTaskDownloadGetCall(advertiserId, taskId, rangeFrom, rangeTo, _callback);
  128. }
  129. /**
  130. *
  131. *
  132. * @param advertiserId (required)
  133. * @param taskId (required)
  134. * @param rangeFrom (optional, default to 0)
  135. * @param rangeTo (optional, default to -1)
  136. * @return AsyncTaskDownloadV2Response
  137. * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
  138. * @http.response.details
  139. <table summary="Response Details" border="1">
  140. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  141. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  142. </table>
  143. */
  144. public AsyncTaskDownloadV2Response openApi2AsyncTaskDownloadGet(Long advertiserId, Long taskId, Long rangeFrom, Long rangeTo) throws ApiException {
  145. ApiResponse<AsyncTaskDownloadV2Response> localVarResp = openApi2AsyncTaskDownloadGetWithHttpInfo(advertiserId, taskId, rangeFrom, rangeTo);
  146. return localVarResp.getData();
  147. }
  148. /**
  149. *
  150. *
  151. * @param advertiserId (required)
  152. * @param taskId (required)
  153. * @param rangeFrom (optional, default to 0)
  154. * @param rangeTo (optional, default to -1)
  155. * @return ApiResponse&lt;AsyncTaskDownloadV2Response&gt;
  156. * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
  157. * @http.response.details
  158. <table summary="Response Details" border="1">
  159. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  160. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  161. </table>
  162. */
  163. public ApiResponse<AsyncTaskDownloadV2Response> openApi2AsyncTaskDownloadGetWithHttpInfo(Long advertiserId, Long taskId, Long rangeFrom, Long rangeTo) throws ApiException {
  164. okhttp3.Call localVarCall = openApi2AsyncTaskDownloadGetValidateBeforeCall(advertiserId, taskId, rangeFrom, rangeTo, null);
  165. Type localVarReturnType = new TypeToken<AsyncTaskDownloadV2Response>(){}.getType();
  166. return localVarApiClient.execute(localVarCall, localVarReturnType);
  167. }
  168. /**
  169. * (asynchronously)
  170. *
  171. * @param advertiserId (required)
  172. * @param taskId (required)
  173. * @param rangeFrom (optional, default to 0)
  174. * @param rangeTo (optional, default to -1)
  175. * @param _callback The callback to be executed when the API call finishes
  176. * @return The request call
  177. * @throws ApiException If fail to process the API call, e.g. serializing the request body object
  178. * @http.response.details
  179. <table summary="Response Details" border="1">
  180. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  181. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  182. </table>
  183. */
  184. public okhttp3.Call openApi2AsyncTaskDownloadGetAsync(Long advertiserId, Long taskId, Long rangeFrom, Long rangeTo, final ApiCallback<AsyncTaskDownloadV2Response> _callback) throws ApiException {
  185. okhttp3.Call localVarCall = openApi2AsyncTaskDownloadGetValidateBeforeCall(advertiserId, taskId, rangeFrom, rangeTo, _callback);
  186. Type localVarReturnType = new TypeToken<AsyncTaskDownloadV2Response>(){}.getType();
  187. localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
  188. return localVarCall;
  189. }
  190. }