Skip to content

Commit 5344ad7

Browse files
committed
Updated sources
1 parent 283cdc3 commit 5344ad7

File tree

5 files changed

+329
-3
lines changed

5 files changed

+329
-3
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:21.10'
28+
implementation 'com.groupdocs:groupdocs-viewer-cloud-android:21.12'
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>21.10</version>
8+
<version>21.12</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>
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
/**
2+
* --------------------------------------------------------------------------------------------------------------------
3+
* <copyright company="Aspose Pty Ltd" file="LicenseApi.java">
4+
* Copyright (c) 2003-2021 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.api;
29+
30+
import java.io.File;
31+
import java.io.IOException;
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+
import com.google.gson.reflect.TypeToken;
39+
import com.groupdocs.cloud.viewer.client.*;
40+
import com.groupdocs.cloud.viewer.model.*;
41+
import com.groupdocs.cloud.viewer.model.requests.*;
42+
43+
public class LicenseApi {
44+
private ApiClient apiClient;
45+
46+
/**
47+
* Initializes new instance of LicenseApi
48+
* @param appSid Application identifier (App SID)
49+
* @param appKey Application private key (App Key)
50+
*/
51+
public LicenseApi(String appSid, String appKey) {
52+
this(new Configuration(appSid, appKey));
53+
}
54+
55+
/**
56+
* Initializes new instance of LicenseApi
57+
* @param configuration Configuration The configuration
58+
*/
59+
public LicenseApi(Configuration configuration) {
60+
this.apiClient = new ApiClient(configuration);
61+
}
62+
63+
/**
64+
* Gets ApiClient
65+
*
66+
* @return ApiClient The Api client
67+
*/
68+
public ApiClient getApiClient() {
69+
return apiClient;
70+
}
71+
72+
/**
73+
* Sets ApiClient
74+
*
75+
* @param apiClient The Api client
76+
*/
77+
public void setApiClient(ApiClient apiClient) {
78+
this.apiClient = apiClient;
79+
}
80+
81+
/**
82+
* Build call for getConsumptionCredit
83+
* @param progressListener Progress listener
84+
* @param progressRequestListener Progress request listener
85+
* @return Call to execute
86+
* @throws ApiException If fail to serialize the request body object
87+
*/
88+
public com.squareup.okhttp.Call getConsumptionCreditCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
89+
Object localVarPostBody = null;
90+
91+
// create path and map variables
92+
String localVarPath = "/viewer/consumption";
93+
94+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
95+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
96+
97+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
98+
99+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
100+
101+
final String[] localVarAccepts = {
102+
"application/json"
103+
};
104+
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
105+
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
106+
107+
final String[] localVarContentTypes = {
108+
"application/json"
109+
};
110+
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
111+
localVarHeaderParams.put("Content-Type", localVarContentType);
112+
113+
if(progressListener != null) {
114+
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
115+
@Override
116+
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
117+
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
118+
return originalResponse.newBuilder()
119+
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
120+
.build();
121+
}
122+
});
123+
}
124+
125+
String[] localVarAuthNames = new String[] { "JWT" };
126+
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
127+
}
128+
129+
@SuppressWarnings("rawtypes")
130+
private com.squareup.okhttp.Call getConsumptionCreditValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
131+
132+
133+
com.squareup.okhttp.Call call = getConsumptionCreditCall(progressListener, progressRequestListener);
134+
return call;
135+
136+
}
137+
138+
/**
139+
* Get license consumption
140+
*
141+
* @return ConsumptionResult
142+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
143+
*/
144+
public ConsumptionResult getConsumptionCredit() throws ApiException {
145+
ApiResponse<ConsumptionResult> resp = getConsumptionCreditWithHttpInfo();
146+
return resp.getData();
147+
}
148+
149+
/**
150+
* Get license consumption
151+
*
152+
* @return ApiResponse&lt;ConsumptionResult&gt;
153+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
154+
*/
155+
public ApiResponse<ConsumptionResult> getConsumptionCreditWithHttpInfo() throws ApiException {
156+
com.squareup.okhttp.Call call = getConsumptionCreditValidateBeforeCall(null, null);
157+
Type localVarReturnType = new TypeToken<ConsumptionResult>(){}.getType();
158+
return apiClient.execute(call, localVarReturnType);
159+
}
160+
161+
/**
162+
* Get license consumption (asynchronously)
163+
*
164+
* @param callback The callback to be executed when the API call finishes
165+
* @return The request call
166+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
167+
*/
168+
public com.squareup.okhttp.Call getConsumptionCreditAsync(final ApiCallback<ConsumptionResult> callback) throws ApiException {
169+
170+
ProgressResponseBody.ProgressListener progressListener = null;
171+
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
172+
173+
if (callback != null) {
174+
progressListener = new ProgressResponseBody.ProgressListener() {
175+
@Override
176+
public void update(long bytesRead, long contentLength, boolean done) {
177+
callback.onDownloadProgress(bytesRead, contentLength, done);
178+
}
179+
};
180+
181+
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
182+
@Override
183+
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
184+
callback.onUploadProgress(bytesWritten, contentLength, done);
185+
}
186+
};
187+
}
188+
189+
com.squareup.okhttp.Call call = getConsumptionCreditValidateBeforeCall(progressListener, progressRequestListener);
190+
Type localVarReturnType = new TypeToken<ConsumptionResult>(){}.getType();
191+
apiClient.executeAsync(call, localVarReturnType, callback);
192+
return call;
193+
}
194+
}
195+

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/21.10");
100+
setUserAgent("java-sdk/21.12");
101101

102102
// Set connection timeout
103103
setConnectTimeout(configuration.getTimeout());
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/**
2+
* --------------------------------------------------------------------------------------------------------------------
3+
* <copyright company="Aspose Pty Ltd" file="ConsumptionResult.java">
4+
* Copyright (c) 2003-2021 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 io.swagger.annotations.ApiModel;
37+
import io.swagger.annotations.ApiModelProperty;
38+
import java.io.IOException;
39+
import java.math.BigDecimal;
40+
41+
/**
42+
* Metered license consumption information
43+
*/
44+
@ApiModel(description = "Metered license consumption information")
45+
public class ConsumptionResult {
46+
@SerializedName("credit")
47+
private BigDecimal credit = null;
48+
49+
@SerializedName("quantity")
50+
private BigDecimal quantity = null;
51+
52+
public ConsumptionResult credit(BigDecimal credit) {
53+
this.credit = credit;
54+
return this;
55+
}
56+
57+
/**
58+
* Amount of used credits
59+
* @return credit
60+
**/
61+
@ApiModelProperty(required = true, value = "Amount of used credits")
62+
public BigDecimal getCredit() {
63+
return credit;
64+
}
65+
66+
public void setCredit(BigDecimal credit) {
67+
this.credit = credit;
68+
}
69+
70+
public ConsumptionResult quantity(BigDecimal quantity) {
71+
this.quantity = quantity;
72+
return this;
73+
}
74+
75+
/**
76+
* Amount of MBs processed
77+
* @return quantity
78+
**/
79+
@ApiModelProperty(required = true, value = "Amount of MBs processed")
80+
public BigDecimal getQuantity() {
81+
return quantity;
82+
}
83+
84+
public void setQuantity(BigDecimal quantity) {
85+
this.quantity = quantity;
86+
}
87+
88+
89+
@Override
90+
public boolean equals(java.lang.Object o) {
91+
if (this == o) {
92+
return true;
93+
}
94+
if (o == null || getClass() != o.getClass()) {
95+
return false;
96+
}
97+
ConsumptionResult consumptionResult = (ConsumptionResult) o;
98+
return Objects.equals(this.credit, consumptionResult.credit) &&
99+
Objects.equals(this.quantity, consumptionResult.quantity);
100+
}
101+
102+
@Override
103+
public int hashCode() {
104+
return Objects.hash(credit, quantity);
105+
}
106+
107+
108+
@Override
109+
public String toString() {
110+
StringBuilder sb = new StringBuilder();
111+
sb.append("class ConsumptionResult {\n");
112+
113+
sb.append(" credit: ").append(toIndentedString(credit)).append("\n");
114+
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
115+
sb.append("}");
116+
return sb.toString();
117+
}
118+
119+
/**
120+
* Convert the given object to string with each line indented by 4 spaces
121+
* (except the first line).
122+
*/
123+
private String toIndentedString(java.lang.Object o) {
124+
if (o == null) {
125+
return "null";
126+
}
127+
return o.toString().replace("\n", "\n ");
128+
}
129+
130+
}
131+

0 commit comments

Comments
 (0)