diff --git a/codegen/Templates/java/ApiClient.mustache b/codegen/Templates/java/ApiClient.mustache index fd2b127..dbde05c 100644 --- a/codegen/Templates/java/ApiClient.mustache +++ b/codegen/Templates/java/ApiClient.mustache @@ -1,19 +1,19 @@ package {{invokerPackage}}; import com.aspose.barcode.cloud.model.ApiErrorResponse; -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Callback; -import com.squareup.okhttp.FormEncodingBuilder; -import com.squareup.okhttp.Headers; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.MultipartBuilder; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.Response; -import com.squareup.okhttp.internal.http.HttpMethod; -import com.squareup.okhttp.logging.HttpLoggingInterceptor; -import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.FormBody; +import okhttp3.Headers; +import okhttp3.MediaType; +import okhttp3.MultipartBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.internal.http.HttpMethod; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; import okio.BufferedSink; import okio.Okio; {{#joda}} @@ -65,21 +65,17 @@ public class ApiClient { private boolean debugging = false; private final Map defaultHeaderMap = new HashMap<>(); private String tempFolderPath = null; - private final OkHttpClient httpClient; + private OkHttpClient httpClient; private final JSON json; private HttpLoggingInterceptor loggingInterceptor; private String accessToken; - /** - * Constructor for ApiClient with clientId and clientSecret - */ + /** Constructor for ApiClient with clientId and clientSecret */ public ApiClient(String clientId, String clientSecret) { this(clientId, clientSecret, null, null); } - /** - * Constructor for ApiClient with accessToken - */ + /** Constructor for ApiClient with accessToken */ public ApiClient(String accessToken) { this(); this.setAccessToken(accessToken); @@ -98,22 +94,23 @@ public class ApiClient { } } - protected ApiClient() { - httpClient = new OkHttpClient(); - - {{#useGzipFeature}} - // Enable gzip request compression - httpClient.interceptors().add(new GzipRequestInterceptor()); - {{/useGzipFeature}} + /** Constructor for ApiClient with readTimeout */ + protected ApiClient(long readTimeoutMillis) { + httpClient = new OkHttpClient.Builder() + .readTimeout(readTimeoutMillis, TimeUnit.MILLISECONDS) + .build(); json = new JSON(); // Set default User-Agent. - setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + setUserAgent("Swagger-Codegen/24.10.0/java"); addDefaultHeader("x-aspose-client", "java sdk"); addDefaultHeader("x-aspose-client-version", clientVersion); - setReadTimeout(60_000); + } + + protected ApiClient() { + this(60_000); } /** @@ -204,11 +201,12 @@ public class ApiClient { } /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. + * The path of temporary folder used to store downloaded files from endpoints with file + * response. The default value is null, i.e. using the system's default temporary + * folder. * - * @see createTempFile + * @see createTempFile * @return Temporary folder path */ public String getTempFolderPath() { @@ -230,19 +228,9 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getConnectTimeout() { - return httpClient.getConnectTimeout(); + return httpClient.connectTimeoutMillis(); } - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - */ - public void setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); - } /** * Get read timeout (in milliseconds). @@ -250,18 +238,17 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getReadTimeout() { - return httpClient.getReadTimeout(); + return httpClient.readTimeoutMillis(); } /** - * Sets the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must + * be between 1 and {@link Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds */ public void setReadTimeout(int readTimeout) { - httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); + httpClient = new OkHttpClient.Builder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); } /** @@ -270,19 +257,9 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getWriteTimeout() { - return httpClient.getWriteTimeout(); + return httpClient.writeTimeoutMillis(); } - /** - * Sets the write timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - */ - public void setWriteTimeout(int writeTimeout) { - httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); - } /** * Format the given parameter object into string. @@ -293,13 +270,15 @@ public class ApiClient { public String parameterToString(Object param) { if (param == null) { return ""; - } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { - //Serialize to json string and remove the " enclosing characters + } else if (param instanceof Date + || param instanceof OffsetDateTime + || param instanceof LocalDate) { + // Serialize to json string and remove the " enclosing characters String jsonStr = json.serialize(param); return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { + for (Object o : (Collection) param) { if (b.length() > 0) { b.append(","); } @@ -314,7 +293,7 @@ public class ApiClient { /** * Formats the specified query parameter to a list containing a single {@code Pair} object. * - * Note that {@code value} must not be a collection. + *

Note that {@code value} must not be a collection. * * @param name The name of the parameter. * @param value The value of the parameter. @@ -335,7 +314,7 @@ public class ApiClient { /** * Formats the specified collection query parameters to a list of {@code Pair} objects. * - * Note that the values of each of the returned Pair objects are percent-encoded. + *

Note that the values of each of the returned Pair objects are percent-encoded. * * @param collectionFormat The collection format of the parameter. * @param name The name of the parameter. @@ -371,7 +350,7 @@ public class ApiClient { delimiter = escapeString("|"); } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); @@ -383,8 +362,7 @@ public class ApiClient { } /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif + * Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif * * @param filename The filename to be sanitized * @return The sanitized filename @@ -394,29 +372,25 @@ public class ApiClient { } /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON + * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json + * application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also + * default to JSON + * * @param mime MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) + * Select the Accept header's value from the given accepts array: if JSON exists in the given + * array, use it; otherwise use all of them (joining into a string) * * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). + * @return The Accept header to use. If the given array is empty, null will be returned (not to + * set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { if (accepts.length == 0) { @@ -431,17 +405,16 @@ public class ApiClient { } /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. + * Select the Content-Type header's value from the given array: if JSON exists in the given + * array, use it; otherwise use the first one of the array. * * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * or matches "any", JSON will be used. + * @return The Content-Type header to use. If the given array is empty, or matches "any", JSON + * will be used. */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; + return "application/json"; } for (String contentType : contentTypes) { if (isJsonMime(contentType)) { @@ -466,14 +439,14 @@ public class ApiClient { } /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. + * Deserialize response body to Java object, according to the return type and the Content-Type + * response header. * * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body or + * the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") public T deserialize(Response response, Type returnType) throws ApiException { @@ -528,8 +501,8 @@ public class ApiClient { } /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. + * Serialize the given Java object into request body according to the object's class and the + * request Content-Type. * * @param obj The Java object * @param contentType The request Content-Type @@ -539,10 +512,10 @@ public class ApiClient { public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { // Binary (byte array) body parameter support. - return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); + return RequestBody.create((byte[]) obj,MediaType.parse(contentType)); } else if (obj instanceof File) { // File body parameter support. - return RequestBody.create(MediaType.parse(contentType), (File) obj); + return RequestBody.create((File) obj, MediaType.parse(contentType)); } else if (isJsonMime(contentType)) { String content; if (obj != null) { @@ -550,7 +523,7 @@ public class ApiClient { } else { content = null; } - return RequestBody.create(MediaType.parse(contentType), content); + return RequestBody.create(content, MediaType.parse(contentType)); } else { throw new ApiException("Content type \"" + contentType + "\" is not supported"); } @@ -615,8 +588,7 @@ public class ApiClient { if (tempFolderPath == null) { return File.createTempFile(prefix, suffix); - } - else { + } else { return File.createTempFile(prefix, suffix, new File(tempFolderPath)); } } @@ -637,9 +609,8 @@ public class ApiClient { * * @param returnType The return type used to deserialize HTTP response body * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. + * @return ApiResponse object containing response status, headers and data, which is a Java + * object deserialized from response body and would be null when returnType is null. * @throws ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { @@ -666,30 +637,31 @@ public class ApiClient { * Execute HTTP call asynchronously. * * @see #execute(Call, Type) - * * @param call The callback to be executed when the API call finishes * @param returnType Return type * @param callback ApiCallback */ public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Request request, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } + call.enqueue( + new okhttp3.Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } - @Override - public void onResponse(Response response) { - T result; - try { - result = handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); + @Override + public void onResponse(Call call, Response response) { + T result; + try { + result = handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess( + result, response.code(), response.headers().toMultimap()); + } + }); } /** @@ -698,7 +670,8 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or fail to deserialize the response body + * @throws ApiException If the response has an unsuccessful status code or fail to deserialize + * the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -708,8 +681,12 @@ public class ApiClient { if (response.body() != null) { try { response.body().close(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } catch (Exception e) { + throw new ApiException( + response.message(), + e, + response.code(), + response.headers().toMultimap()); } } return null; @@ -719,12 +696,13 @@ public class ApiClient { if (response.body() == null) { throw new ApiException(response.message(), response.code()); } + ApiErrorResponse errorResponse; try { errorResponse = deserialize(response, ApiErrorResponse.class); } catch (Exception e) { throw new ApiException( - response.message(), e, response.code(), response.headers().toMultimap()); + response.message(), e, response.code(), response.headers().toMultimap()); } throw new ApiException(response.message(), response.code(), errorResponse); @@ -734,7 +712,8 @@ public class ApiClient { * Build HTTP call with the given options. * * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and + * "DELETE" * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters * @param body The request body object @@ -744,8 +723,26 @@ public class ApiClient { * @return The HTTP call * @throws ApiException If fail to serialize the request body object */ - public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, progressRequestListener); + public Call buildCall( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map formParams, + ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { + Request request = + buildRequest( + path, + method, + queryParams, + collectionQueryParams, + body, + headerParams, + formParams, + progressRequestListener); return httpClient.newCall(request); } @@ -754,7 +751,8 @@ public class ApiClient { * Build an HTTP request with the given options. * * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and + * "DELETE" * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters * @param body The request body object @@ -764,7 +762,16 @@ public class ApiClient { * @return The HTTP request * @throws ApiException If fail to serialize the request body object */ - public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public Request buildRequest( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map formParams, + ProgressRequestBody.ProgressRequestListener progressRequestListener) + throws ApiException { addOAuthAuthentication(headerParams); final String url = buildUrl(path, queryParams, collectionQueryParams); @@ -781,7 +788,7 @@ public class ApiClient { if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); + reqBody = buildRequestBodyForm(formParams); } else if ("multipart/form-data".equals(contentType)) { reqBody = buildRequestBodyMultipart(formParams); } else if (body == null) { @@ -790,7 +797,7 @@ public class ApiClient { reqBody = null; } else { // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create(MediaType.parse(contentType), ""); + reqBody = RequestBody.create( "", MediaType.parse(contentType)); } } else { reqBody = serialize(body, contentType); @@ -798,8 +805,9 @@ public class ApiClient { Request request = null; - if(progressRequestListener != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); + if (progressRequestListener != null && reqBody != null) { + ProgressRequestBody progressRequestBody = + new ProgressRequestBody(reqBody, progressRequestListener); request = reqBuilder.method(method, progressRequestBody).build(); } else { request = reqBuilder.method(method, reqBody).build(); @@ -832,7 +840,9 @@ public class ApiClient { url.append("&"); } String value = parameterToString(param.getValue()); - url.append(escapeString(param.getKey())).append("=").append(escapeString(value)); + url.append(escapeString(param.getKey())) + .append("=") + .append(escapeString(value)); } } } @@ -880,8 +890,8 @@ public class ApiClient { * @param formParams Form parameters in the form of Map * @return RequestBody */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + public RequestBody buildRequestBodyForm(Map formParams) { + FormBody.Builder formBuilder = new FormBody.Builder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -889,21 +899,28 @@ public class ApiClient { } /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. + * Build a multipart (file uploading) request body with the given form parameters, which could + * contain text fields and file fields. * * @param formParams Form parameters in the form of Map * @return RequestBody */ public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); for (Entry param : formParams.entrySet()) { Object paramValue = param.getValue(); if (paramValue instanceof File) { File file = (File) paramValue; - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + Headers partHeaders = + Headers.of( + "Content-Disposition", + "form-data; name=\"" + + param.getKey() + + "\"; filename=\"" + + file.getName() + + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); } else if (paramValue instanceof Collection) { Collection collection = (Collection) paramValue; for (Object item : collection) { @@ -912,11 +929,15 @@ public class ApiClient { "Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); mpBuilder.addPart( - partHeaders, RequestBody.create(null, parameterToString(item))); + partHeaders, RequestBody.create(parameterToString(item), null)); } } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(paramValue))); + Headers partHeaders = + Headers.of( + "Content-Disposition", + "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart( + partHeaders, RequestBody.create(parameterToString(paramValue), null)); } } return mpBuilder.build(); @@ -937,7 +958,7 @@ public class ApiClient { } } - /** + /** * Request OAuth token. * * @throws ApiException If authorization is failed @@ -945,7 +966,7 @@ public class ApiClient { public void requestToken() throws ApiException { try { RequestBody requestBody = - new FormEncodingBuilder() + new FormBody.Builder() .addEncoded("grant_type", "client_credentials") .addEncoded("client_id", clientId) .addEncoded("client_secret", clientSecret) diff --git a/codegen/Templates/java/api.mustache b/codegen/Templates/java/api.mustache index 739d32e..7e15d74 100644 --- a/codegen/Templates/java/api.mustache +++ b/codegen/Templates/java/api.mustache @@ -73,7 +73,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} @SuppressWarnings("removal") - protected com.squareup.okhttp.Call {{operationId}}Call({{operationIdCamelCase}}Request request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + protected okhttp3.Call {{operationId}}Call({{operationIdCamelCase}}Request request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object {{localVariablePrefix}}postBody = {{#bodyParam}}request.{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; // create path and map variables @@ -112,10 +112,10 @@ public class {{classname}} { {{localVariablePrefix}}headerParams.put("Content-Type", {{localVariablePrefix}}contentType); if(progressListener != null) { - {{localVariablePrefix}}apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + {{localVariablePrefix}}apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException { + okhttp3.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -129,7 +129,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - private com.squareup.okhttp.Call {{operationId}}ValidateBeforeCall({{operationIdCamelCase}}Request request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private okhttp3.Call {{operationId}}ValidateBeforeCall({{operationIdCamelCase}}Request request, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { {{^performBeanValidation}} {{#allParams}}{{#required}} // verify the required parameter 'request.{{paramName}}' is set @@ -140,7 +140,7 @@ public class {{classname}} { } {{/required}}{{/allParams}} - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}Call(request, progressListener, progressRequestListener); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}Call(request, progressListener, progressRequestListener); return {{localVariablePrefix}}call; {{/performBeanValidation}} @@ -155,7 +155,7 @@ public class {{classname}} { parameterValues); if (violations.size() == 0) { - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}Call(request, progressListener, progressRequestListener); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}Call(request, progressListener, progressRequestListener); return {{localVariablePrefix}}call; } else { @@ -212,7 +212,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{operationIdCamelCase}}Request request) throws ApiException { - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall(request, null, null); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall(request, null, null); {{#returnType}}Type {{localVariablePrefix}}returnType = new TypeToken<{{{returnType}}}>(){}.getType(); return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}returnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}} } @@ -235,7 +235,7 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public com.squareup.okhttp.Call {{operationId}}Async({{operationIdCamelCase}}Request request, final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> callback) throws ApiException { + public okhttp3.Call {{operationId}}Async({{operationIdCamelCase}}Request request, final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -256,7 +256,7 @@ public class {{classname}} { }; } - com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall(request, progressListener, progressRequestListener); + okhttp3.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall(request, progressListener, progressRequestListener); {{#returnType}}Type {{localVariablePrefix}}returnType = new TypeToken<{{{returnType}}}>(){}.getType(); {{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}returnType, callback);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, callback);{{/returnType}} return {{localVariablePrefix}}call; diff --git a/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache index a5c5cb5..4b47e91 100644 --- a/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ b/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -2,8 +2,8 @@ package {{invokerPackage}}; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.RequestBody; +import okhttp3.MediaType; +import okhttp3.RequestBody; import java.io.IOException; diff --git a/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache index a04c619..5f87514 100644 --- a/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache +++ b/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -4,8 +4,8 @@ package {{invokerPackage}}; import java.io.IOException; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.ResponseBody; +import okhttp3.MediaType; +import okhttp3.ResponseBody; import okio.Buffer; import okio.BufferedSource; @@ -40,12 +40,12 @@ public class ProgressResponseBody extends ResponseBody { } @Override - public long contentLength() throws IOException { + public long contentLength() { return responseBody.contentLength(); } @Override - public BufferedSource source() throws IOException { + public BufferedSource source() { if (bufferedSource == null) { bufferedSource = Okio.buffer(source(responseBody.source())); } diff --git a/codegen/Templates/java/pom.mustache b/codegen/Templates/java/pom.mustache index 9a1dcbd..decc07b 100644 --- a/codegen/Templates/java/pom.mustache +++ b/codegen/Templates/java/pom.mustache @@ -160,12 +160,12 @@ ${swagger-core-version} - com.squareup.okhttp + com.squareup.okhttp3 okhttp ${okhttp-version} - com.squareup.okhttp + com.squareup.okhttp3 logging-interceptor ${okhttp-version} @@ -247,7 +247,7 @@ {{! Check version compatibility with gson-fire }} 2.11.0 1.6.14 - 2.7.5 + 4.12.0 {{#joda}} 2.9.9 {{/joda}} diff --git a/codegen/config-android.json b/codegen/config-android.json index cbaa407..c453c6c 100644 --- a/codegen/config-android.json +++ b/codegen/config-android.json @@ -4,7 +4,7 @@ "androidSdkVersion": "33", "apiPackage": "com.aspose.barcode.cloud.demo_app", "artifactId": "Android Application for Barcode Processing in the Cloud via REST API", - "artifactVersion": "24.9.0", + "artifactVersion": "24.10.0", "groupId": "com.aspose", "invokerPackage": "com.aspose.barcode.cloud.demo_app", "modelPackage": "com.aspose.barcode.cloud.demo_app.model" diff --git a/codegen/config-dart.json b/codegen/config-dart.json index 990432b..5e73531 100644 --- a/codegen/config-dart.json +++ b/codegen/config-dart.json @@ -3,6 +3,6 @@ "browserClient": false, "pubDescription": "This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily", "pubName": "aspose_barcode_cloud", - "pubVersion": "1.24.9", + "pubVersion": "1.24.10", "useEnumExtension": true } \ No newline at end of file diff --git a/codegen/config-go.json b/codegen/config-go.json index b9e8692..27ed314 100644 --- a/codegen/config-go.json +++ b/codegen/config-go.json @@ -1,4 +1,4 @@ { "packageName": "barcode", - "packageVersion": "1.2409.0" + "packageVersion": "1.2410.0" } \ No newline at end of file diff --git a/codegen/config-java.json b/codegen/config-java.json index c8aec82..145b414 100644 --- a/codegen/config-java.json +++ b/codegen/config-java.json @@ -3,7 +3,7 @@ "artifactDescription": "Aspose.BarCode Cloud SDK for Java", "artifactId": "aspose-barcode-cloud", "artifactUrl": "https://www.aspose.cloud", - "artifactVersion": "24.9.0", + "artifactVersion": "24.10.0", "developerEmail": "denis.averin@aspose.com", "developerName": "Denis Averin", "developerOrganization": "Aspose", diff --git a/codegen/config-php.json b/codegen/config-php.json index 21bb264..76e8865 100644 --- a/codegen/config-php.json +++ b/codegen/config-php.json @@ -1,4 +1,4 @@ { - "artifactVersion": "24.9.0", + "artifactVersion": "24.10.0", "invokerPackage": "Aspose\\BarCode" } \ No newline at end of file diff --git a/codegen/config-python.json b/codegen/config-python.json index edb60f8..e7a8be5 100644 --- a/codegen/config-python.json +++ b/codegen/config-python.json @@ -1,6 +1,6 @@ { "packageName": "aspose_barcode_cloud", "packageUrl": "https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-python", - "packageVersion": "24.9.0", + "packageVersion": "24.10.0", "projectName": "aspose-barcode-cloud" } \ No newline at end of file diff --git a/codegen/config.json b/codegen/config.json index 7ffbd5a..5657ee4 100644 --- a/codegen/config.json +++ b/codegen/config.json @@ -1,8 +1,9 @@ { "artifactVersion": "23.7.0", "npmName": "aspose-barcode-cloud-node", - "npmVersion": "24.9.0", + "npmVersion": "24.10.0", "packageName": "Aspose.BarCode.Cloud.Sdk", - "packageVersion": "24.9.0", - "supportsES6": true + "packageVersion": "24.10.0", + "supportsES6": true, + "targetFramework": "netstandard2.0" } \ No newline at end of file diff --git a/submodules/android b/submodules/android index 76b739a..160b1e2 160000 --- a/submodules/android +++ b/submodules/android @@ -1 +1 @@ -Subproject commit 76b739aa728d77003031a8a6d823ea86c5d1523a +Subproject commit 160b1e2710eb4046bd7467acdba00780e3bf4cc7 diff --git a/submodules/dart b/submodules/dart index a0dfa27..38b46d0 160000 --- a/submodules/dart +++ b/submodules/dart @@ -1 +1 @@ -Subproject commit a0dfa27fe0cbcbf68382ef442e26ffdcfb2b4816 +Subproject commit 38b46d0116dab5131e33e7865df5944bc998c465 diff --git a/submodules/dotnet b/submodules/dotnet index c2ea698..b10a83f 160000 --- a/submodules/dotnet +++ b/submodules/dotnet @@ -1 +1 @@ -Subproject commit c2ea698b342e63567ef308cfb278fba077100275 +Subproject commit b10a83f413ba6b839a10ebf82c62ab74d839605d diff --git a/submodules/go b/submodules/go index 19860f2..95ebd38 160000 --- a/submodules/go +++ b/submodules/go @@ -1 +1 @@ -Subproject commit 19860f2bfd2a1df2b3c1bd0239beb542fcf148e3 +Subproject commit 95ebd38e685461bb09999da3db51a19685946839 diff --git a/submodules/java b/submodules/java index d181a6f..b2cca72 160000 --- a/submodules/java +++ b/submodules/java @@ -1 +1 @@ -Subproject commit d181a6f228a0332cae34ae294fd982f1dfbcd50f +Subproject commit b2cca720e941e04defd35eb34e75bc57959f4be2 diff --git a/submodules/node b/submodules/node index 6190fd8..cd51b6b 160000 --- a/submodules/node +++ b/submodules/node @@ -1 +1 @@ -Subproject commit 6190fd85ae5c1617f64d2009baea8eebe120bc11 +Subproject commit cd51b6b63ea5aa6e8395194473036256f222a261 diff --git a/submodules/php b/submodules/php index b90eee2..12faecc 160000 --- a/submodules/php +++ b/submodules/php @@ -1 +1 @@ -Subproject commit b90eee21425442ad73dbb07eb95a76df782841f1 +Subproject commit 12faecc26925707fa59f0107f87bcae09b246d25 diff --git a/submodules/python b/submodules/python index 76df3b8..632cc4f 160000 --- a/submodules/python +++ b/submodules/python @@ -1 +1 @@ -Subproject commit 76df3b83ef1dd180a10d708da42197bcea972c5d +Subproject commit 632cc4ff8178c120e035b360d80711c1b5d8f449