|
| 1 | +/* |
| 2 | + * rcs_5g |
| 3 | + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) |
| 4 | + * |
| 5 | + * OpenAPI spec version: common-version |
| 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.volcengine.rcs5g; |
| 14 | + |
| 15 | +import com.volcengine.ApiCallback; |
| 16 | +import com.volcengine.ApiClient; |
| 17 | +import com.volcengine.ApiException; |
| 18 | +import com.volcengine.ApiResponse; |
| 19 | +import com.volcengine.Configuration; |
| 20 | +import com.volcengine.Pair; |
| 21 | +import com.volcengine.ProgressRequestBody; |
| 22 | +import com.volcengine.ProgressResponseBody; |
| 23 | + |
| 24 | +import com.google.gson.reflect.TypeToken; |
| 25 | + |
| 26 | +import java.io.IOException; |
| 27 | + |
| 28 | +import javax.validation.constraints.*; |
| 29 | + |
| 30 | +import com.volcengine.rcs5g.model.SendBatchRcsRequest; |
| 31 | +import com.volcengine.rcs5g.model.SendBatchRcsResponse; |
| 32 | +import com.volcengine.rcs5g.model.SendRcsRequest; |
| 33 | +import com.volcengine.rcs5g.model.SendRcsResponse; |
| 34 | + |
| 35 | +import java.lang.reflect.Type; |
| 36 | +import java.util.ArrayList; |
| 37 | +import java.util.HashMap; |
| 38 | +import java.util.List; |
| 39 | +import java.util.Map; |
| 40 | + |
| 41 | +public class Rcs5GApi { |
| 42 | + private ApiClient apiClient; |
| 43 | + |
| 44 | + public Rcs5GApi() { |
| 45 | + this(Configuration.getDefaultApiClient()); |
| 46 | + } |
| 47 | + |
| 48 | + public Rcs5GApi(ApiClient apiClient) { |
| 49 | + this.apiClient = apiClient; |
| 50 | + } |
| 51 | + |
| 52 | + public ApiClient getApiClient() { |
| 53 | + return apiClient; |
| 54 | + } |
| 55 | + |
| 56 | + public void setApiClient(ApiClient apiClient) { |
| 57 | + this.apiClient = apiClient; |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Build call for sendBatchRcs |
| 62 | + * @param body (required) |
| 63 | + * @param progressListener Progress listener |
| 64 | + * @param progressRequestListener Progress request listener |
| 65 | + * @return Call to execute |
| 66 | + * @throws ApiException If fail to serialize the request body object |
| 67 | + */ |
| 68 | + public com.squareup.okhttp.Call sendBatchRcsCall(SendBatchRcsRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 69 | + Object localVarPostBody = body; |
| 70 | + |
| 71 | + // create path and map variables |
| 72 | + String localVarPath = "/SendBatchRcs/2025-11-17/rcs_5g/post/application_json/"; |
| 73 | + |
| 74 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 75 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 76 | + |
| 77 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 78 | + |
| 79 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 80 | + |
| 81 | + final String[] localVarAccepts = { |
| 82 | + "application/json" |
| 83 | + }; |
| 84 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 85 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 86 | + |
| 87 | + final String[] localVarContentTypes = { |
| 88 | + "text/plain" |
| 89 | + }; |
| 90 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 91 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 92 | + |
| 93 | + if(progressListener != null) { |
| 94 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 95 | + @Override |
| 96 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 97 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 98 | + return originalResponse.newBuilder() |
| 99 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 100 | + .build(); |
| 101 | + } |
| 102 | + }); |
| 103 | + } |
| 104 | + |
| 105 | + String[] localVarAuthNames = new String[] { "volcengineSign" }; |
| 106 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 107 | + } |
| 108 | + |
| 109 | + @SuppressWarnings("rawtypes") |
| 110 | + private com.squareup.okhttp.Call sendBatchRcsValidateBeforeCall(SendBatchRcsRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 111 | + // verify the required parameter 'body' is set |
| 112 | + if (body == null) { |
| 113 | + throw new ApiException("Missing the required parameter 'body' when calling sendBatchRcs(Async)"); |
| 114 | + } |
| 115 | + |
| 116 | + com.squareup.okhttp.Call call = sendBatchRcsCall(body, progressListener, progressRequestListener); |
| 117 | + return call; |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * |
| 127 | + * |
| 128 | + * @param body (required) |
| 129 | + * @return SendBatchRcsResponse |
| 130 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 131 | + */ |
| 132 | + public SendBatchRcsResponse sendBatchRcs(SendBatchRcsRequest body) throws ApiException { |
| 133 | + ApiResponse<SendBatchRcsResponse> resp = sendBatchRcsWithHttpInfo(body); |
| 134 | + return resp.getData(); |
| 135 | + } |
| 136 | + |
| 137 | + /** |
| 138 | + * |
| 139 | + * |
| 140 | + * @param body (required) |
| 141 | + * @return ApiResponse<SendBatchRcsResponse> |
| 142 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 143 | + */ |
| 144 | + public ApiResponse<SendBatchRcsResponse> sendBatchRcsWithHttpInfo( @NotNull SendBatchRcsRequest body) throws ApiException { |
| 145 | + com.squareup.okhttp.Call call = sendBatchRcsValidateBeforeCall(body, null, null); |
| 146 | + Type localVarReturnType = new TypeToken<SendBatchRcsResponse>(){}.getType(); |
| 147 | + return apiClient.execute(call, localVarReturnType); |
| 148 | + } |
| 149 | + |
| 150 | + /** |
| 151 | + * (asynchronously) |
| 152 | + * |
| 153 | + * @param body (required) |
| 154 | + * @param callback The callback to be executed when the API call finishes |
| 155 | + * @return The request call |
| 156 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 157 | + */ |
| 158 | + public com.squareup.okhttp.Call sendBatchRcsAsync(SendBatchRcsRequest body, final ApiCallback<SendBatchRcsResponse> callback) throws ApiException { |
| 159 | + |
| 160 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 161 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 162 | + |
| 163 | + if (callback != null) { |
| 164 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 165 | + @Override |
| 166 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 167 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 168 | + } |
| 169 | + }; |
| 170 | + |
| 171 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 172 | + @Override |
| 173 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 174 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 175 | + } |
| 176 | + }; |
| 177 | + } |
| 178 | + |
| 179 | + com.squareup.okhttp.Call call = sendBatchRcsValidateBeforeCall(body, progressListener, progressRequestListener); |
| 180 | + Type localVarReturnType = new TypeToken<SendBatchRcsResponse>(){}.getType(); |
| 181 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 182 | + return call; |
| 183 | + } |
| 184 | + /** |
| 185 | + * Build call for sendRcs |
| 186 | + * @param body (required) |
| 187 | + * @param progressListener Progress listener |
| 188 | + * @param progressRequestListener Progress request listener |
| 189 | + * @return Call to execute |
| 190 | + * @throws ApiException If fail to serialize the request body object |
| 191 | + */ |
| 192 | + public com.squareup.okhttp.Call sendRcsCall(SendRcsRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 193 | + Object localVarPostBody = body; |
| 194 | + |
| 195 | + // create path and map variables |
| 196 | + String localVarPath = "/SendRcs/2025-11-17/rcs_5g/post/application_json/"; |
| 197 | + |
| 198 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 199 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 200 | + |
| 201 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 202 | + |
| 203 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 204 | + |
| 205 | + final String[] localVarAccepts = { |
| 206 | + "application/json" |
| 207 | + }; |
| 208 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 209 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 210 | + |
| 211 | + final String[] localVarContentTypes = { |
| 212 | + "text/plain" |
| 213 | + }; |
| 214 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 215 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 216 | + |
| 217 | + if(progressListener != null) { |
| 218 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 219 | + @Override |
| 220 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 221 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 222 | + return originalResponse.newBuilder() |
| 223 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 224 | + .build(); |
| 225 | + } |
| 226 | + }); |
| 227 | + } |
| 228 | + |
| 229 | + String[] localVarAuthNames = new String[] { "volcengineSign" }; |
| 230 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 231 | + } |
| 232 | + |
| 233 | + @SuppressWarnings("rawtypes") |
| 234 | + private com.squareup.okhttp.Call sendRcsValidateBeforeCall(SendRcsRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 235 | + // verify the required parameter 'body' is set |
| 236 | + if (body == null) { |
| 237 | + throw new ApiException("Missing the required parameter 'body' when calling sendRcs(Async)"); |
| 238 | + } |
| 239 | + |
| 240 | + com.squareup.okhttp.Call call = sendRcsCall(body, progressListener, progressRequestListener); |
| 241 | + return call; |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + } |
| 248 | + |
| 249 | + /** |
| 250 | + * |
| 251 | + * |
| 252 | + * @param body (required) |
| 253 | + * @return SendRcsResponse |
| 254 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 255 | + */ |
| 256 | + public SendRcsResponse sendRcs(SendRcsRequest body) throws ApiException { |
| 257 | + ApiResponse<SendRcsResponse> resp = sendRcsWithHttpInfo(body); |
| 258 | + return resp.getData(); |
| 259 | + } |
| 260 | + |
| 261 | + /** |
| 262 | + * |
| 263 | + * |
| 264 | + * @param body (required) |
| 265 | + * @return ApiResponse<SendRcsResponse> |
| 266 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 267 | + */ |
| 268 | + public ApiResponse<SendRcsResponse> sendRcsWithHttpInfo( @NotNull SendRcsRequest body) throws ApiException { |
| 269 | + com.squareup.okhttp.Call call = sendRcsValidateBeforeCall(body, null, null); |
| 270 | + Type localVarReturnType = new TypeToken<SendRcsResponse>(){}.getType(); |
| 271 | + return apiClient.execute(call, localVarReturnType); |
| 272 | + } |
| 273 | + |
| 274 | + /** |
| 275 | + * (asynchronously) |
| 276 | + * |
| 277 | + * @param body (required) |
| 278 | + * @param callback The callback to be executed when the API call finishes |
| 279 | + * @return The request call |
| 280 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 281 | + */ |
| 282 | + public com.squareup.okhttp.Call sendRcsAsync(SendRcsRequest body, final ApiCallback<SendRcsResponse> callback) throws ApiException { |
| 283 | + |
| 284 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 285 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 286 | + |
| 287 | + if (callback != null) { |
| 288 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 289 | + @Override |
| 290 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 291 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 292 | + } |
| 293 | + }; |
| 294 | + |
| 295 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 296 | + @Override |
| 297 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 298 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 299 | + } |
| 300 | + }; |
| 301 | + } |
| 302 | + |
| 303 | + com.squareup.okhttp.Call call = sendRcsValidateBeforeCall(body, progressListener, progressRequestListener); |
| 304 | + Type localVarReturnType = new TypeToken<SendRcsResponse>(){}.getType(); |
| 305 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 306 | + return call; |
| 307 | + } |
| 308 | +} |
0 commit comments