Skip to content

Commit 68684a2

Browse files
author
BitsAdmin
committed
Merge branch 'waf-Java-2023-12-25-online-582-2024_07_16_00_06_02' into 'integration_2024-07-18_327673148930'
feat: [development task] waf-582-Java (722473) See merge request iaasng/volcengine-java-sdk!223
2 parents 7ebcad7 + 3c579f0 commit 68684a2

File tree

4 files changed

+585
-0
lines changed

4 files changed

+585
-0
lines changed

volcengine-java-sdk-waf/src/main/java/com/volcengine/waf/WafApi.java

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
import com.volcengine.waf.model.AddIpGroupRequest;
3131
import com.volcengine.waf.model.AddIpGroupResponse;
32+
import com.volcengine.waf.model.CheckLLMPromptRequest;
33+
import com.volcengine.waf.model.CheckLLMPromptResponse;
3234
import com.volcengine.waf.model.CreateAllowRuleRequest;
3335
import com.volcengine.waf.model.CreateAllowRuleResponse;
3436
import com.volcengine.waf.model.CreateBlockRuleRequest;
@@ -271,6 +273,130 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
271273
apiClient.executeAsync(call, localVarReturnType, callback);
272274
return call;
273275
}
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&lt;CheckLLMPromptResponse&gt;
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+
}
274400
/**
275401
* Build call for createAllowRule
276402
* @param body (required)
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/*
2+
* waf
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.waf.model;
14+
15+
import java.util.Objects;
16+
import java.util.Arrays;
17+
import com.google.gson.TypeAdapter;
18+
import com.google.gson.annotations.JsonAdapter;
19+
import com.google.gson.annotations.SerializedName;
20+
import com.google.gson.stream.JsonReader;
21+
import com.google.gson.stream.JsonWriter;
22+
import io.swagger.v3.oas.annotations.media.Schema;
23+
import java.io.IOException;
24+
import javax.validation.constraints.*;
25+
import javax.validation.Valid;
26+
/**
27+
* CheckLLMPromptRequest
28+
*/
29+
30+
31+
32+
public class CheckLLMPromptRequest {
33+
@SerializedName("Content")
34+
private String content = null;
35+
36+
@SerializedName("ContentType")
37+
private Integer contentType = null;
38+
39+
@SerializedName("Host")
40+
private String host = null;
41+
42+
@SerializedName("MsgClass")
43+
private Integer msgClass = null;
44+
45+
@SerializedName("Region")
46+
private String region = null;
47+
48+
public CheckLLMPromptRequest content(String content) {
49+
this.content = content;
50+
return this;
51+
}
52+
53+
/**
54+
* Get content
55+
* @return content
56+
**/
57+
@NotNull
58+
@Schema(required = true, description = "")
59+
public String getContent() {
60+
return content;
61+
}
62+
63+
public void setContent(String content) {
64+
this.content = content;
65+
}
66+
67+
public CheckLLMPromptRequest contentType(Integer contentType) {
68+
this.contentType = contentType;
69+
return this;
70+
}
71+
72+
/**
73+
* Get contentType
74+
* @return contentType
75+
**/
76+
@NotNull
77+
@Schema(required = true, description = "")
78+
public Integer getContentType() {
79+
return contentType;
80+
}
81+
82+
public void setContentType(Integer contentType) {
83+
this.contentType = contentType;
84+
}
85+
86+
public CheckLLMPromptRequest host(String host) {
87+
this.host = host;
88+
return this;
89+
}
90+
91+
/**
92+
* Get host
93+
* @return host
94+
**/
95+
@NotNull
96+
@Schema(required = true, description = "")
97+
public String getHost() {
98+
return host;
99+
}
100+
101+
public void setHost(String host) {
102+
this.host = host;
103+
}
104+
105+
public CheckLLMPromptRequest msgClass(Integer msgClass) {
106+
this.msgClass = msgClass;
107+
return this;
108+
}
109+
110+
/**
111+
* Get msgClass
112+
* @return msgClass
113+
**/
114+
@Schema(description = "")
115+
public Integer getMsgClass() {
116+
return msgClass;
117+
}
118+
119+
public void setMsgClass(Integer msgClass) {
120+
this.msgClass = msgClass;
121+
}
122+
123+
public CheckLLMPromptRequest region(String region) {
124+
this.region = region;
125+
return this;
126+
}
127+
128+
/**
129+
* Get region
130+
* @return region
131+
**/
132+
@NotNull
133+
@Schema(required = true, description = "")
134+
public String getRegion() {
135+
return region;
136+
}
137+
138+
public void setRegion(String region) {
139+
this.region = region;
140+
}
141+
142+
143+
@Override
144+
public boolean equals(java.lang.Object o) {
145+
if (this == o) {
146+
return true;
147+
}
148+
if (o == null || getClass() != o.getClass()) {
149+
return false;
150+
}
151+
CheckLLMPromptRequest checkLLMPromptRequest = (CheckLLMPromptRequest) o;
152+
return Objects.equals(this.content, checkLLMPromptRequest.content) &&
153+
Objects.equals(this.contentType, checkLLMPromptRequest.contentType) &&
154+
Objects.equals(this.host, checkLLMPromptRequest.host) &&
155+
Objects.equals(this.msgClass, checkLLMPromptRequest.msgClass) &&
156+
Objects.equals(this.region, checkLLMPromptRequest.region);
157+
}
158+
159+
@Override
160+
public int hashCode() {
161+
return Objects.hash(content, contentType, host, msgClass, region);
162+
}
163+
164+
165+
@Override
166+
public String toString() {
167+
StringBuilder sb = new StringBuilder();
168+
sb.append("class CheckLLMPromptRequest {\n");
169+
170+
sb.append(" content: ").append(toIndentedString(content)).append("\n");
171+
sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n");
172+
sb.append(" host: ").append(toIndentedString(host)).append("\n");
173+
sb.append(" msgClass: ").append(toIndentedString(msgClass)).append("\n");
174+
sb.append(" region: ").append(toIndentedString(region)).append("\n");
175+
sb.append("}");
176+
return sb.toString();
177+
}
178+
179+
/**
180+
* Convert the given object to string with each line indented by 4 spaces
181+
* (except the first line).
182+
*/
183+
private String toIndentedString(java.lang.Object o) {
184+
if (o == null) {
185+
return "null";
186+
}
187+
return o.toString().replace("\n", "\n ");
188+
}
189+
190+
}

0 commit comments

Comments
 (0)