|
| 1 | +/* |
| 2 | + * Marketing API |
| 3 | + * Marketing API |
| 4 | + * |
| 5 | + * OpenAPI spec version: 3.0 |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by the swagger code generator program. |
| 9 | + * https://github.com/swagger-api/swagger-codegen.git |
| 10 | + * Do not edit the class manually. |
| 11 | + */ |
| 12 | + |
| 13 | +package com.tencent.ads.api.v3; |
| 14 | + |
| 15 | +import com.google.gson.reflect.TypeToken; |
| 16 | +import com.tencent.ads.ApiCallback; |
| 17 | +import com.tencent.ads.ApiClient; |
| 18 | +import com.tencent.ads.ApiException; |
| 19 | +import com.tencent.ads.ApiResponse; |
| 20 | +import com.tencent.ads.Configuration; |
| 21 | +import com.tencent.ads.Pair; |
| 22 | +import com.tencent.ads.ProgressRequestBody; |
| 23 | +import com.tencent.ads.ProgressResponseBody; |
| 24 | +import com.tencent.ads.model.v3.MuseAudiosGetRequest; |
| 25 | +import com.tencent.ads.model.v3.MuseAudiosGetResponse; |
| 26 | +import java.io.IOException; |
| 27 | +import java.lang.reflect.Type; |
| 28 | +import java.util.ArrayList; |
| 29 | +import java.util.HashMap; |
| 30 | +import java.util.List; |
| 31 | +import java.util.Map; |
| 32 | + |
| 33 | +public class MuseAudiosApi { |
| 34 | + private ApiClient apiClient; |
| 35 | + |
| 36 | + public MuseAudiosApi() { |
| 37 | + this(Configuration.getV3DefaultApiClient()); |
| 38 | + } |
| 39 | + |
| 40 | + public MuseAudiosApi(ApiClient apiClient) { |
| 41 | + this.apiClient = apiClient; |
| 42 | + } |
| 43 | + |
| 44 | + public ApiClient getApiClient() { |
| 45 | + return apiClient; |
| 46 | + } |
| 47 | + |
| 48 | + public void setApiClient(ApiClient apiClient) { |
| 49 | + this.apiClient = apiClient; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Build call for museAudiosGet |
| 54 | + * |
| 55 | + * @param data (required) |
| 56 | + * @param progressListener Progress listener |
| 57 | + * @param progressRequestListener Progress request listener |
| 58 | + * @return Call to execute |
| 59 | + * @throws ApiException If fail to serialize the request body object |
| 60 | + */ |
| 61 | + public com.squareup.okhttp.Call museAudiosGetCall( |
| 62 | + MuseAudiosGetRequest data, |
| 63 | + final ProgressResponseBody.ProgressListener progressListener, |
| 64 | + final ProgressRequestBody.ProgressRequestListener progressRequestListener, |
| 65 | + Pair... headerPair) |
| 66 | + throws ApiException { |
| 67 | + |
| 68 | + Object localVarPostBody = data; |
| 69 | + |
| 70 | + // create path and map variables |
| 71 | + String localVarPath = "/muse_audios/get"; |
| 72 | + |
| 73 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 74 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 75 | + |
| 76 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 77 | + |
| 78 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 79 | + |
| 80 | + final String[] localVarAccepts = {"application/json"}; |
| 81 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 82 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 83 | + |
| 84 | + final String[] localVarContentTypes = {"application/json", "application/xml"}; |
| 85 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 86 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 87 | + |
| 88 | + if (headerPair != null && headerPair.length > 0) { |
| 89 | + for (int i = 0; i < headerPair.length; i++) { |
| 90 | + localVarHeaderParams.put(headerPair[i].getName(), headerPair[i].getValue()); |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + if (progressListener != null) { |
| 95 | + apiClient |
| 96 | + .getHttpClient() |
| 97 | + .networkInterceptors() |
| 98 | + .add( |
| 99 | + new com.squareup.okhttp.Interceptor() { |
| 100 | + @Override |
| 101 | + public com.squareup.okhttp.Response intercept( |
| 102 | + com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 103 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 104 | + return originalResponse |
| 105 | + .newBuilder() |
| 106 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 107 | + .build(); |
| 108 | + } |
| 109 | + }); |
| 110 | + } |
| 111 | + |
| 112 | + String[] localVarAuthNames = new String[] {"accessToken", "nonce", "timestamp"}; |
| 113 | + return apiClient.buildCall( |
| 114 | + localVarPath, |
| 115 | + "POST", |
| 116 | + localVarQueryParams, |
| 117 | + localVarCollectionQueryParams, |
| 118 | + localVarPostBody, |
| 119 | + localVarHeaderParams, |
| 120 | + localVarFormParams, |
| 121 | + localVarAuthNames, |
| 122 | + progressRequestListener); |
| 123 | + } |
| 124 | + |
| 125 | + @SuppressWarnings("rawtypes") |
| 126 | + private com.squareup.okhttp.Call museAudiosGetValidateBeforeCall( |
| 127 | + MuseAudiosGetRequest data, |
| 128 | + final ProgressResponseBody.ProgressListener progressListener, |
| 129 | + final ProgressRequestBody.ProgressRequestListener progressRequestListener, |
| 130 | + Pair... headerPair) |
| 131 | + throws ApiException { |
| 132 | + |
| 133 | + // verify the required parameter 'data' is set |
| 134 | + if (data == null) { |
| 135 | + throw new ApiException( |
| 136 | + "Missing the required parameter 'data' when calling museAudiosGet(Async)"); |
| 137 | + } |
| 138 | + |
| 139 | + com.squareup.okhttp.Call call = |
| 140 | + museAudiosGetCall(data, progressListener, progressRequestListener, headerPair); |
| 141 | + return call; |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * 获取妙思版权音频列表 |
| 146 | + * |
| 147 | + * @param data (required) |
| 148 | + * @return MuseAudiosGetResponse |
| 149 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the |
| 150 | + * response body |
| 151 | + */ |
| 152 | + public MuseAudiosGetResponse museAudiosGet(MuseAudiosGetRequest data, Pair... headerPair) |
| 153 | + throws ApiException { |
| 154 | + ApiResponse<MuseAudiosGetResponse> resp = museAudiosGetWithHttpInfo(data, headerPair); |
| 155 | + return resp.getData(); |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * 获取妙思版权音频列表 |
| 160 | + * |
| 161 | + * @param data (required) |
| 162 | + * @return ApiResponse<MuseAudiosGetResponse> |
| 163 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the |
| 164 | + * response body |
| 165 | + */ |
| 166 | + public ApiResponse<MuseAudiosGetResponse> museAudiosGetWithHttpInfo( |
| 167 | + MuseAudiosGetRequest data, Pair... headerPair) throws ApiException { |
| 168 | + com.squareup.okhttp.Call call = museAudiosGetValidateBeforeCall(data, null, null, headerPair); |
| 169 | + Type localVarReturnType = new TypeToken<MuseAudiosGetResponse>() {}.getType(); |
| 170 | + return apiClient.execute(call, localVarReturnType); |
| 171 | + } |
| 172 | + |
| 173 | + /** |
| 174 | + * 获取妙思版权音频列表 (asynchronously) |
| 175 | + * |
| 176 | + * @param data (required) |
| 177 | + * @param callback The callback to be executed when the API call finishes |
| 178 | + * @return The request call |
| 179 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 180 | + */ |
| 181 | + public com.squareup.okhttp.Call museAudiosGetAsync( |
| 182 | + MuseAudiosGetRequest data, |
| 183 | + final ApiCallback<MuseAudiosGetResponse> callback, |
| 184 | + Pair... headerPair) |
| 185 | + throws ApiException { |
| 186 | + |
| 187 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 188 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 189 | + |
| 190 | + if (callback != null) { |
| 191 | + progressListener = |
| 192 | + new ProgressResponseBody.ProgressListener() { |
| 193 | + @Override |
| 194 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 195 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 196 | + } |
| 197 | + }; |
| 198 | + |
| 199 | + progressRequestListener = |
| 200 | + new ProgressRequestBody.ProgressRequestListener() { |
| 201 | + @Override |
| 202 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 203 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 204 | + } |
| 205 | + }; |
| 206 | + } |
| 207 | + |
| 208 | + com.squareup.okhttp.Call call = |
| 209 | + museAudiosGetValidateBeforeCall( |
| 210 | + data, progressListener, progressRequestListener, headerPair); |
| 211 | + Type localVarReturnType = new TypeToken<MuseAudiosGetResponse>() {}.getType(); |
| 212 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 213 | + return call; |
| 214 | + } |
| 215 | +} |
0 commit comments