|
29 | 29 |
|
30 | 30 | import com.volcengine.waf.model.AddIpGroupRequest; |
31 | 31 | import com.volcengine.waf.model.AddIpGroupResponse; |
| 32 | +import com.volcengine.waf.model.CheckLLMPromptRequest; |
| 33 | +import com.volcengine.waf.model.CheckLLMPromptResponse; |
32 | 34 | import com.volcengine.waf.model.CreateAllowRuleRequest; |
33 | 35 | import com.volcengine.waf.model.CreateAllowRuleResponse; |
34 | 36 | import com.volcengine.waf.model.CreateBlockRuleRequest; |
@@ -271,6 +273,130 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don |
271 | 273 | apiClient.executeAsync(call, localVarReturnType, callback); |
272 | 274 | return call; |
273 | 275 | } |
| 276 | + /** |
| 277 | + * Build call for checkLLMPrompt |
| 278 | + * @param body (required) |
| 279 | + * @param progressListener Progress listener |
| 280 | + * @param progressRequestListener Progress request listener |
| 281 | + * @return Call to execute |
| 282 | + * @throws ApiException If fail to serialize the request body object |
| 283 | + */ |
| 284 | + public com.squareup.okhttp.Call checkLLMPromptCall(CheckLLMPromptRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 285 | + Object localVarPostBody = body; |
| 286 | + |
| 287 | + // create path and map variables |
| 288 | + String localVarPath = "/CheckLLMPrompt/2023-12-25/waf/post/application_json/"; |
| 289 | + |
| 290 | + List<Pair> localVarQueryParams = new ArrayList<Pair>(); |
| 291 | + List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); |
| 292 | + |
| 293 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 294 | + |
| 295 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 296 | + |
| 297 | + final String[] localVarAccepts = { |
| 298 | + "application/json" |
| 299 | + }; |
| 300 | + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
| 301 | + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); |
| 302 | + |
| 303 | + final String[] localVarContentTypes = { |
| 304 | + "text/plain" |
| 305 | + }; |
| 306 | + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); |
| 307 | + localVarHeaderParams.put("Content-Type", localVarContentType); |
| 308 | + |
| 309 | + if(progressListener != null) { |
| 310 | + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { |
| 311 | + @Override |
| 312 | + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { |
| 313 | + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); |
| 314 | + return originalResponse.newBuilder() |
| 315 | + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) |
| 316 | + .build(); |
| 317 | + } |
| 318 | + }); |
| 319 | + } |
| 320 | + |
| 321 | + String[] localVarAuthNames = new String[] { "volcengineSign" }; |
| 322 | + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
| 323 | + } |
| 324 | + |
| 325 | + @SuppressWarnings("rawtypes") |
| 326 | + private com.squareup.okhttp.Call checkLLMPromptValidateBeforeCall(CheckLLMPromptRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { |
| 327 | + // verify the required parameter 'body' is set |
| 328 | + if (body == null) { |
| 329 | + throw new ApiException("Missing the required parameter 'body' when calling checkLLMPrompt(Async)"); |
| 330 | + } |
| 331 | + |
| 332 | + com.squareup.okhttp.Call call = checkLLMPromptCall(body, progressListener, progressRequestListener); |
| 333 | + return call; |
| 334 | + |
| 335 | + |
| 336 | + |
| 337 | + |
| 338 | + |
| 339 | + } |
| 340 | + |
| 341 | + /** |
| 342 | + * |
| 343 | + * |
| 344 | + * @param body (required) |
| 345 | + * @return CheckLLMPromptResponse |
| 346 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 347 | + */ |
| 348 | + public CheckLLMPromptResponse checkLLMPrompt(CheckLLMPromptRequest body) throws ApiException { |
| 349 | + ApiResponse<CheckLLMPromptResponse> resp = checkLLMPromptWithHttpInfo(body); |
| 350 | + return resp.getData(); |
| 351 | + } |
| 352 | + |
| 353 | + /** |
| 354 | + * |
| 355 | + * |
| 356 | + * @param body (required) |
| 357 | + * @return ApiResponse<CheckLLMPromptResponse> |
| 358 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 359 | + */ |
| 360 | + public ApiResponse<CheckLLMPromptResponse> checkLLMPromptWithHttpInfo( @NotNull CheckLLMPromptRequest body) throws ApiException { |
| 361 | + com.squareup.okhttp.Call call = checkLLMPromptValidateBeforeCall(body, null, null); |
| 362 | + Type localVarReturnType = new TypeToken<CheckLLMPromptResponse>(){}.getType(); |
| 363 | + return apiClient.execute(call, localVarReturnType); |
| 364 | + } |
| 365 | + |
| 366 | + /** |
| 367 | + * (asynchronously) |
| 368 | + * |
| 369 | + * @param body (required) |
| 370 | + * @param callback The callback to be executed when the API call finishes |
| 371 | + * @return The request call |
| 372 | + * @throws ApiException If fail to process the API call, e.g. serializing the request body object |
| 373 | + */ |
| 374 | + public com.squareup.okhttp.Call checkLLMPromptAsync(CheckLLMPromptRequest body, final ApiCallback<CheckLLMPromptResponse> callback) throws ApiException { |
| 375 | + |
| 376 | + ProgressResponseBody.ProgressListener progressListener = null; |
| 377 | + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; |
| 378 | + |
| 379 | + if (callback != null) { |
| 380 | + progressListener = new ProgressResponseBody.ProgressListener() { |
| 381 | + @Override |
| 382 | + public void update(long bytesRead, long contentLength, boolean done) { |
| 383 | + callback.onDownloadProgress(bytesRead, contentLength, done); |
| 384 | + } |
| 385 | + }; |
| 386 | + |
| 387 | + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { |
| 388 | + @Override |
| 389 | + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { |
| 390 | + callback.onUploadProgress(bytesWritten, contentLength, done); |
| 391 | + } |
| 392 | + }; |
| 393 | + } |
| 394 | + |
| 395 | + com.squareup.okhttp.Call call = checkLLMPromptValidateBeforeCall(body, progressListener, progressRequestListener); |
| 396 | + Type localVarReturnType = new TypeToken<CheckLLMPromptResponse>(){}.getType(); |
| 397 | + apiClient.executeAsync(call, localVarReturnType, callback); |
| 398 | + return call; |
| 399 | + } |
274 | 400 | /** |
275 | 401 | * Build call for createAllowRule |
276 | 402 | * @param body (required) |
|
0 commit comments