Skip to content

Commit 3c16f3c

Browse files
committed
Updated sources
1 parent ef42f35 commit 3c16f3c

File tree

10 files changed

+580
-13
lines changed

10 files changed

+580
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repositories {
2525
...
2626
dependencies {
2727
...
28-
implementation 'com.groupdocs:groupdocs-viewer-cloud-android:24.2'
28+
implementation 'com.groupdocs:groupdocs-viewer-cloud-android:24.3'
2929
}
3030
```
3131

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>groupdocs-viewer-cloud-android</artifactId>
66
<packaging>jar</packaging>
77
<name>groupdocs-viewer-cloud-android</name>
8-
<version>24.2</version>
8+
<version>24.3</version>
99
<url>https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-android</url>
1010
<description>Java library for communicating with the GroupDocs.Viewer Cloud API</description>
1111
<scm>

src/main/java/com/groupdocs/cloud/viewer/api/ViewApi.java

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,141 @@ public void setApiClient(ApiClient apiClient) {
7878
this.apiClient = apiClient;
7979
}
8080

81+
/**
82+
* Build call for convertAndDownload
83+
* @param request The request model
84+
* @param progressListener Progress listener
85+
* @param progressRequestListener Progress request listener
86+
* @return Call to execute
87+
* @throws ApiException If fail to serialize the request body object
88+
*/
89+
public com.squareup.okhttp.Call convertAndDownloadCall(ConvertAndDownloadRequest request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
90+
Object localVarPostBody = null;
91+
92+
// create path and map variables
93+
String localVarPath = "/viewer/convertAndDownload";
94+
95+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
96+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
97+
if (request.getformat() != null)
98+
localVarQueryParams.addAll(apiClient.parameterToPair("format", request.getformat()));
99+
if (request.getpages() != null)
100+
localVarQueryParams.addAll(apiClient.parameterToPair("pages", request.getpages()));
101+
if (request.getpassword() != null)
102+
localVarQueryParams.addAll(apiClient.parameterToPair("password", request.getpassword()));
103+
104+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
105+
106+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
107+
if (request.getFile() != null)
108+
localVarFormParams.put("File", request.getFile());
109+
110+
final String[] localVarAccepts = {
111+
"application/json"
112+
};
113+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
114+
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
115+
116+
final String[] localVarContentTypes = {
117+
"multipart/form-data"
118+
};
119+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
120+
localVarHeaderParams.put("Content-Type", localVarContentType);
121+
122+
if(progressListener != null) {
123+
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
124+
@Override
125+
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
126+
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
127+
return originalResponse.newBuilder()
128+
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
129+
.build();
130+
}
131+
});
132+
}
133+
134+
String[] localVarAuthNames = new String[] { "JWT" };
135+
return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
136+
}
137+
138+
@SuppressWarnings("rawtypes")
139+
private com.squareup.okhttp.Call convertAndDownloadValidateBeforeCall(ConvertAndDownloadRequest request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
140+
141+
// verify the required parameter 'format' is set
142+
if (request.getformat() == null) {
143+
throw new ApiException("Missing the required parameter 'format' when calling convertAndDownload(Async)");
144+
}
145+
146+
// verify the required parameter 'file' is set
147+
if (request.getFile() == null) {
148+
throw new ApiException("Missing the required parameter 'file' when calling convertAndDownload(Async)");
149+
}
150+
151+
152+
com.squareup.okhttp.Call call = convertAndDownloadCall(request, progressListener, progressRequestListener);
153+
return call;
154+
155+
}
156+
157+
/**
158+
* Converts input document file to format specified
159+
*
160+
* @param request The request model
161+
* @return File
162+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
163+
*/
164+
public File convertAndDownload(ConvertAndDownloadRequest request) throws ApiException {
165+
ApiResponse<File> resp = convertAndDownloadWithHttpInfo(request);
166+
return resp.getData();
167+
}
168+
169+
/**
170+
* Converts input document file to format specified
171+
*
172+
* @param request The request model
173+
* @return ApiResponse&lt;File&gt;
174+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
175+
*/
176+
public ApiResponse<File> convertAndDownloadWithHttpInfo(ConvertAndDownloadRequest request) throws ApiException {
177+
com.squareup.okhttp.Call call = convertAndDownloadValidateBeforeCall(request, null, null);
178+
Type localVarReturnType = new TypeToken<File>(){}.getType();
179+
return apiClient.execute(call, localVarReturnType);
180+
}
181+
182+
/**
183+
* Converts input document file to format specified (asynchronously)
184+
*
185+
* @param request The request model
186+
* @param callback The callback to be executed when the API call finishes
187+
* @return The request call
188+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
189+
*/
190+
public com.squareup.okhttp.Call convertAndDownloadAsync(ConvertAndDownloadRequest request, final ApiCallback<File> callback) throws ApiException {
191+
192+
ProgressResponseBody.ProgressListener progressListener = null;
193+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
194+
195+
if (callback != null) {
196+
progressListener = new ProgressResponseBody.ProgressListener() {
197+
@Override
198+
public void update(long bytesRead, long contentLength, boolean done) {
199+
callback.onDownloadProgress(bytesRead, contentLength, done);
200+
}
201+
};
202+
203+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
204+
@Override
205+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
206+
callback.onUploadProgress(bytesWritten, contentLength, done);
207+
}
208+
};
209+
}
210+
211+
com.squareup.okhttp.Call call = convertAndDownloadValidateBeforeCall(request, progressListener, progressRequestListener);
212+
Type localVarReturnType = new TypeToken<File>(){}.getType();
213+
apiClient.executeAsync(call, localVarReturnType, callback);
214+
return call;
215+
}
81216
/**
82217
* Build call for createView
83218
* @param request The request model

src/main/java/com/groupdocs/cloud/viewer/client/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public ApiClient(Configuration configuration) {
9797
this.json = new JSON();
9898

9999
// Set default User-Agent.
100-
setUserAgent("java-sdk/24.2");
100+
setUserAgent("java-sdk/24.3");
101101

102102
// Set connection timeout
103103
setConnectTimeout(configuration.getTimeout());
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/**
2+
* --------------------------------------------------------------------------------------------------------------------
3+
* <copyright company="Aspose Pty Ltd" file="ApiErrorResponse.java">
4+
* Copyright (c) 2003-2024 Aspose Pty Ltd
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------------------------------------------
26+
*/
27+
28+
package com.groupdocs.cloud.viewer.model;
29+
30+
import java.util.Objects;
31+
import com.google.gson.TypeAdapter;
32+
import com.google.gson.annotations.JsonAdapter;
33+
import com.google.gson.annotations.SerializedName;
34+
import com.google.gson.stream.JsonReader;
35+
import com.google.gson.stream.JsonWriter;
36+
import com.groupdocs.cloud.viewer.model.ApiError;
37+
import io.swagger.annotations.ApiModel;
38+
import io.swagger.annotations.ApiModelProperty;
39+
import java.io.IOException;
40+
41+
/**
42+
* ApiErrorResponse
43+
*/
44+
public class ApiErrorResponse {
45+
@SerializedName("requestId")
46+
private String requestId = null;
47+
48+
@SerializedName("error")
49+
private ApiError error = null;
50+
51+
public ApiErrorResponse requestId(String requestId) {
52+
this.requestId = requestId;
53+
return this;
54+
}
55+
56+
/**
57+
* Get requestId
58+
* @return requestId
59+
**/
60+
@ApiModelProperty(value = "")
61+
public String getRequestId() {
62+
return requestId;
63+
}
64+
65+
public void setRequestId(String requestId) {
66+
this.requestId = requestId;
67+
}
68+
69+
public ApiErrorResponse error(ApiError error) {
70+
this.error = error;
71+
return this;
72+
}
73+
74+
/**
75+
* Get error
76+
* @return error
77+
**/
78+
@ApiModelProperty(value = "")
79+
public ApiError getError() {
80+
return error;
81+
}
82+
83+
public void setError(ApiError error) {
84+
this.error = error;
85+
}
86+
87+
88+
@Override
89+
public boolean equals(java.lang.Object o) {
90+
if (this == o) {
91+
return true;
92+
}
93+
if (o == null || getClass() != o.getClass()) {
94+
return false;
95+
}
96+
ApiErrorResponse apiErrorResponse = (ApiErrorResponse) o;
97+
return Objects.equals(this.requestId, apiErrorResponse.requestId) &&
98+
Objects.equals(this.error, apiErrorResponse.error);
99+
}
100+
101+
@Override
102+
public int hashCode() {
103+
return Objects.hash(requestId, error);
104+
}
105+
106+
107+
@Override
108+
public String toString() {
109+
StringBuilder sb = new StringBuilder();
110+
sb.append("class ApiErrorResponse {\n");
111+
112+
sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n");
113+
sb.append(" error: ").append(toIndentedString(error)).append("\n");
114+
sb.append("}");
115+
return sb.toString();
116+
}
117+
118+
/**
119+
* Convert the given object to string with each line indented by 4 spaces
120+
* (except the first line).
121+
*/
122+
private String toIndentedString(java.lang.Object o) {
123+
if (o == null) {
124+
return "null";
125+
}
126+
return o.toString().replace("\n", "\n ");
127+
}
128+
129+
}
130+

0 commit comments

Comments
 (0)