AdvertiserAvatarUploadV2Api.java 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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.AdvertiserAvatarUploadV2Response;
  21. import java.io.File;
  22. import java.lang.reflect.Type;
  23. import java.util.ArrayList;
  24. import java.util.HashMap;
  25. import java.util.List;
  26. import java.util.Map;
  27. public class AdvertiserAvatarUploadV2Api {
  28. private ApiClient localVarApiClient;
  29. private int localHostIndex;
  30. private String localCustomBaseUrl;
  31. public AdvertiserAvatarUploadV2Api() {
  32. this(Configuration.getDefaultApiClient());
  33. }
  34. public AdvertiserAvatarUploadV2Api(ApiClient apiClient) {
  35. this.localVarApiClient = apiClient;
  36. }
  37. public ApiClient getApiClient() {
  38. return localVarApiClient;
  39. }
  40. public void setApiClient(ApiClient apiClient) {
  41. this.localVarApiClient = apiClient;
  42. }
  43. public int getHostIndex() {
  44. return localHostIndex;
  45. }
  46. public void setHostIndex(int hostIndex) {
  47. this.localHostIndex = hostIndex;
  48. }
  49. public String getCustomBaseUrl() {
  50. return localCustomBaseUrl;
  51. }
  52. public void setCustomBaseUrl(String customBaseUrl) {
  53. this.localCustomBaseUrl = customBaseUrl;
  54. }
  55. /**
  56. * Build call for openApi2AdvertiserAvatarUploadPost
  57. * @param advertiserId (required)
  58. * @param imageFile (required)
  59. * @param _callback Callback for upload/download progress
  60. * @return Call to execute
  61. * @throws ApiException If fail to serialize the request body object
  62. * @http.response.details
  63. <table summary="Response Details" border="1">
  64. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  65. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  66. </table>
  67. */
  68. public okhttp3.Call openApi2AdvertiserAvatarUploadPostCall(Long advertiserId, File imageFile, final ApiCallback _callback) throws ApiException {
  69. String basePath = null;
  70. // Operation Servers
  71. String[] localBasePaths = new String[] { };
  72. // Determine Base Path to Use
  73. if (localCustomBaseUrl != null){
  74. basePath = localCustomBaseUrl;
  75. } else if ( localBasePaths.length > 0 ) {
  76. basePath = localBasePaths[localHostIndex];
  77. } else {
  78. basePath = null;
  79. }
  80. Object localVarPostBody = null;
  81. // create path and map variables
  82. String localVarPath = "/open_api/2/advertiser/avatar/upload/";
  83. List<Pair> localVarQueryParams = new ArrayList<Pair>();
  84. List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
  85. Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  86. Map<String, String> localVarCookieParams = new HashMap<String, String>();
  87. Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  88. if (advertiserId != null) {
  89. localVarFormParams.put("advertiser_id", advertiserId);
  90. }
  91. if (imageFile != null) {
  92. localVarFormParams.put("image_file", imageFile);
  93. }
  94. final String[] localVarAccepts = {
  95. "application/json"
  96. };
  97. final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
  98. if (localVarAccept != null) {
  99. localVarHeaderParams.put("Accept", localVarAccept);
  100. }
  101. final String[] localVarContentTypes = {
  102. "multipart/form-data"
  103. };
  104. final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
  105. if (localVarContentType != null) {
  106. localVarHeaderParams.put("Content-Type", localVarContentType);
  107. }
  108. String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
  109. return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
  110. }
  111. @SuppressWarnings("rawtypes")
  112. private okhttp3.Call openApi2AdvertiserAvatarUploadPostValidateBeforeCall(Long advertiserId, File imageFile, final ApiCallback _callback) throws ApiException {
  113. // verify the required parameter 'advertiserId' is set
  114. if (advertiserId == null) {
  115. throw new ApiException("Missing the required parameter 'advertiserId' when calling openApi2AdvertiserAvatarUploadPost(Async)");
  116. }
  117. // verify the required parameter 'imageFile' is set
  118. if (imageFile == null) {
  119. throw new ApiException("Missing the required parameter 'imageFile' when calling openApi2AdvertiserAvatarUploadPost(Async)");
  120. }
  121. return openApi2AdvertiserAvatarUploadPostCall(advertiserId, imageFile, _callback);
  122. }
  123. /**
  124. *
  125. *
  126. * @param advertiserId (required)
  127. * @param imageFile (required)
  128. * @return AdvertiserAvatarUploadV2Response
  129. * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
  130. * @http.response.details
  131. <table summary="Response Details" border="1">
  132. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  133. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  134. </table>
  135. */
  136. public AdvertiserAvatarUploadV2Response openApi2AdvertiserAvatarUploadPost(Long advertiserId, File imageFile) throws ApiException {
  137. ApiResponse<AdvertiserAvatarUploadV2Response> localVarResp = openApi2AdvertiserAvatarUploadPostWithHttpInfo(advertiserId, imageFile);
  138. return localVarResp.getData();
  139. }
  140. /**
  141. *
  142. *
  143. * @param advertiserId (required)
  144. * @param imageFile (required)
  145. * @return ApiResponse&lt;AdvertiserAvatarUploadV2Response&gt;
  146. * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
  147. * @http.response.details
  148. <table summary="Response Details" border="1">
  149. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  150. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  151. </table>
  152. */
  153. public ApiResponse<AdvertiserAvatarUploadV2Response> openApi2AdvertiserAvatarUploadPostWithHttpInfo(Long advertiserId, File imageFile) throws ApiException {
  154. okhttp3.Call localVarCall = openApi2AdvertiserAvatarUploadPostValidateBeforeCall(advertiserId, imageFile, null);
  155. Type localVarReturnType = new TypeToken<AdvertiserAvatarUploadV2Response>(){}.getType();
  156. return localVarApiClient.execute(localVarCall, localVarReturnType);
  157. }
  158. /**
  159. * (asynchronously)
  160. *
  161. * @param advertiserId (required)
  162. * @param imageFile (required)
  163. * @param _callback The callback to be executed when the API call finishes
  164. * @return The request call
  165. * @throws ApiException If fail to process the API call, e.g. serializing the request body object
  166. * @http.response.details
  167. <table summary="Response Details" border="1">
  168. <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
  169. <tr><td> 200 </td><td> OK </td><td> - </td></tr>
  170. </table>
  171. */
  172. public okhttp3.Call openApi2AdvertiserAvatarUploadPostAsync(Long advertiserId, File imageFile, final ApiCallback<AdvertiserAvatarUploadV2Response> _callback) throws ApiException {
  173. okhttp3.Call localVarCall = openApi2AdvertiserAvatarUploadPostValidateBeforeCall(advertiserId, imageFile, _callback);
  174. Type localVarReturnType = new TypeToken<AdvertiserAvatarUploadV2Response>(){}.getType();
  175. localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
  176. return localVarCall;
  177. }
  178. }