Skip to content

Commit f4f692e

Browse files
author
BitsAdmin
committed
Merge branch 'translate-Java-2025-03-01-online-1169-2025_05_15_17_30_03' into 'integration_2025-05-22_910511046914'
feat: [development task] translate-1169-Java (1243989) See merge request iaasng/volcengine-java-sdk!492
2 parents 99717be + 4518701 commit f4f692e

File tree

4 files changed

+492
-0
lines changed

4 files changed

+492
-0
lines changed

volcengine-java-sdk-translate20250301/src/main/java/com/volcengine/translate20250301/Translate20250301Api.java

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

2828
import javax.validation.constraints.*;
2929

30+
import com.volcengine.translate20250301.model.GetUsageRequest;
31+
import com.volcengine.translate20250301.model.GetUsageResponse;
3032
import com.volcengine.translate20250301.model.LangDetectRequest;
3133
import com.volcengine.translate20250301.model.LangDetectResponse;
3234
import com.volcengine.translate20250301.model.QueryAudioRequest;
@@ -63,6 +65,130 @@ public void setApiClient(ApiClient apiClient) {
6365
this.apiClient = apiClient;
6466
}
6567

68+
/**
69+
* Build call for getUsage
70+
* @param body (required)
71+
* @param progressListener Progress listener
72+
* @param progressRequestListener Progress request listener
73+
* @return Call to execute
74+
* @throws ApiException If fail to serialize the request body object
75+
*/
76+
public com.squareup.okhttp.Call getUsageCall(GetUsageRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
77+
Object localVarPostBody = body;
78+
79+
// create path and map variables
80+
String localVarPath = "/GetUsage/2025-03-01/translate/post/application_json/";
81+
82+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
83+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
84+
85+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
86+
87+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
88+
89+
final String[] localVarAccepts = {
90+
"application/json"
91+
};
92+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
93+
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
94+
95+
final String[] localVarContentTypes = {
96+
"text/plain"
97+
};
98+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
99+
localVarHeaderParams.put("Content-Type", localVarContentType);
100+
101+
if(progressListener != null) {
102+
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
103+
@Override
104+
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
105+
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
106+
return originalResponse.newBuilder()
107+
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
108+
.build();
109+
}
110+
});
111+
}
112+
113+
String[] localVarAuthNames = new String[] { "volcengineSign" };
114+
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
115+
}
116+
117+
@SuppressWarnings("rawtypes")
118+
private com.squareup.okhttp.Call getUsageValidateBeforeCall(GetUsageRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
119+
// verify the required parameter 'body' is set
120+
if (body == null) {
121+
throw new ApiException("Missing the required parameter 'body' when calling getUsage(Async)");
122+
}
123+
124+
com.squareup.okhttp.Call call = getUsageCall(body, progressListener, progressRequestListener);
125+
return call;
126+
127+
128+
129+
130+
131+
}
132+
133+
/**
134+
*
135+
*
136+
* @param body (required)
137+
* @return GetUsageResponse
138+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
139+
*/
140+
public GetUsageResponse getUsage(GetUsageRequest body) throws ApiException {
141+
ApiResponse<GetUsageResponse> resp = getUsageWithHttpInfo(body);
142+
return resp.getData();
143+
}
144+
145+
/**
146+
*
147+
*
148+
* @param body (required)
149+
* @return ApiResponse&lt;GetUsageResponse&gt;
150+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
151+
*/
152+
public ApiResponse<GetUsageResponse> getUsageWithHttpInfo( @NotNull GetUsageRequest body) throws ApiException {
153+
com.squareup.okhttp.Call call = getUsageValidateBeforeCall(body, null, null);
154+
Type localVarReturnType = new TypeToken<GetUsageResponse>(){}.getType();
155+
return apiClient.execute(call, localVarReturnType);
156+
}
157+
158+
/**
159+
* (asynchronously)
160+
*
161+
* @param body (required)
162+
* @param callback The callback to be executed when the API call finishes
163+
* @return The request call
164+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
165+
*/
166+
public com.squareup.okhttp.Call getUsageAsync(GetUsageRequest body, final ApiCallback<GetUsageResponse> callback) throws ApiException {
167+
168+
ProgressResponseBody.ProgressListener progressListener = null;
169+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
170+
171+
if (callback != null) {
172+
progressListener = new ProgressResponseBody.ProgressListener() {
173+
@Override
174+
public void update(long bytesRead, long contentLength, boolean done) {
175+
callback.onDownloadProgress(bytesRead, contentLength, done);
176+
}
177+
};
178+
179+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
180+
@Override
181+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
182+
callback.onUploadProgress(bytesWritten, contentLength, done);
183+
}
184+
};
185+
}
186+
187+
com.squareup.okhttp.Call call = getUsageValidateBeforeCall(body, progressListener, progressRequestListener);
188+
Type localVarReturnType = new TypeToken<GetUsageResponse>(){}.getType();
189+
apiClient.executeAsync(call, localVarReturnType, callback);
190+
return call;
191+
}
66192
/**
67193
* Build call for langDetect
68194
* @param body (required)
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
* translate20250301
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.translate20250301.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+
* GetUsageRequest
28+
*/
29+
30+
31+
32+
public class GetUsageRequest {
33+
@SerializedName("From")
34+
private Integer from = null;
35+
36+
@SerializedName("Service")
37+
private String service = null;
38+
39+
@SerializedName("To")
40+
private Integer to = null;
41+
42+
public GetUsageRequest from(Integer from) {
43+
this.from = from;
44+
return this;
45+
}
46+
47+
/**
48+
* Get from
49+
* @return from
50+
**/
51+
@NotNull
52+
@Schema(required = true, description = "")
53+
public Integer getFrom() {
54+
return from;
55+
}
56+
57+
public void setFrom(Integer from) {
58+
this.from = from;
59+
}
60+
61+
public GetUsageRequest service(String service) {
62+
this.service = service;
63+
return this;
64+
}
65+
66+
/**
67+
* Get service
68+
* @return service
69+
**/
70+
@NotNull
71+
@Schema(required = true, description = "")
72+
public String getService() {
73+
return service;
74+
}
75+
76+
public void setService(String service) {
77+
this.service = service;
78+
}
79+
80+
public GetUsageRequest to(Integer to) {
81+
this.to = to;
82+
return this;
83+
}
84+
85+
/**
86+
* Get to
87+
* @return to
88+
**/
89+
@NotNull
90+
@Schema(required = true, description = "")
91+
public Integer getTo() {
92+
return to;
93+
}
94+
95+
public void setTo(Integer to) {
96+
this.to = to;
97+
}
98+
99+
100+
@Override
101+
public boolean equals(java.lang.Object o) {
102+
if (this == o) {
103+
return true;
104+
}
105+
if (o == null || getClass() != o.getClass()) {
106+
return false;
107+
}
108+
GetUsageRequest getUsageRequest = (GetUsageRequest) o;
109+
return Objects.equals(this.from, getUsageRequest.from) &&
110+
Objects.equals(this.service, getUsageRequest.service) &&
111+
Objects.equals(this.to, getUsageRequest.to);
112+
}
113+
114+
@Override
115+
public int hashCode() {
116+
return Objects.hash(from, service, to);
117+
}
118+
119+
120+
@Override
121+
public String toString() {
122+
StringBuilder sb = new StringBuilder();
123+
sb.append("class GetUsageRequest {\n");
124+
125+
sb.append(" from: ").append(toIndentedString(from)).append("\n");
126+
sb.append(" service: ").append(toIndentedString(service)).append("\n");
127+
sb.append(" to: ").append(toIndentedString(to)).append("\n");
128+
sb.append("}");
129+
return sb.toString();
130+
}
131+
132+
/**
133+
* Convert the given object to string with each line indented by 4 spaces
134+
* (except the first line).
135+
*/
136+
private String toIndentedString(java.lang.Object o) {
137+
if (o == null) {
138+
return "null";
139+
}
140+
return o.toString().replace("\n", "\n ");
141+
}
142+
143+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* translate20250301
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.translate20250301.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 com.volcengine.translate20250301.model.PointForGetUsageOutput;
23+
import io.swagger.v3.oas.annotations.media.Schema;
24+
import java.io.IOException;
25+
import java.util.ArrayList;
26+
import java.util.List;
27+
import javax.validation.constraints.*;
28+
import javax.validation.Valid;
29+
/**
30+
* GetUsageResponse
31+
*/
32+
33+
34+
35+
public class GetUsageResponse extends com.volcengine.model.AbstractResponse {
36+
@SerializedName("Points")
37+
private List<PointForGetUsageOutput> points = null;
38+
39+
public GetUsageResponse points(List<PointForGetUsageOutput> points) {
40+
this.points = points;
41+
return this;
42+
}
43+
44+
public GetUsageResponse addPointsItem(PointForGetUsageOutput pointsItem) {
45+
if (this.points == null) {
46+
this.points = new ArrayList<PointForGetUsageOutput>();
47+
}
48+
this.points.add(pointsItem);
49+
return this;
50+
}
51+
52+
/**
53+
* Get points
54+
* @return points
55+
**/
56+
@Valid
57+
@Schema(description = "")
58+
public List<PointForGetUsageOutput> getPoints() {
59+
return points;
60+
}
61+
62+
public void setPoints(List<PointForGetUsageOutput> points) {
63+
this.points = points;
64+
}
65+
66+
67+
@Override
68+
public boolean equals(java.lang.Object o) {
69+
if (this == o) {
70+
return true;
71+
}
72+
if (o == null || getClass() != o.getClass()) {
73+
return false;
74+
}
75+
GetUsageResponse getUsageResponse = (GetUsageResponse) o;
76+
return Objects.equals(this.points, getUsageResponse.points);
77+
}
78+
79+
@Override
80+
public int hashCode() {
81+
return Objects.hash(points);
82+
}
83+
84+
85+
@Override
86+
public String toString() {
87+
StringBuilder sb = new StringBuilder();
88+
sb.append("class GetUsageResponse {\n");
89+
90+
sb.append(" points: ").append(toIndentedString(points)).append("\n");
91+
sb.append("}");
92+
return sb.toString();
93+
}
94+
95+
/**
96+
* Convert the given object to string with each line indented by 4 spaces
97+
* (except the first line).
98+
*/
99+
private String toIndentedString(java.lang.Object o) {
100+
if (o == null) {
101+
return "null";
102+
}
103+
return o.toString().replace("\n", "\n ");
104+
}
105+
106+
}

0 commit comments

Comments
 (0)