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