From 569f3a84dd4b02762af7b0a942924e66efc03b0a Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Thu, 21 Sep 2023 19:05:27 +0700 Subject: [PATCH 01/14] Go: Add client and version headers --- codegen/Templates/go/client.mustache | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/codegen/Templates/go/client.mustache b/codegen/Templates/go/client.mustache index b629c3e..2673086 100644 --- a/codegen/Templates/go/client.mustache +++ b/codegen/Templates/go/client.mustache @@ -21,6 +21,13 @@ import ( "golang.org/x/oauth2" ) +const ( + PACKAGE_VERSION = "{{packageVersion}}" + PACKAGE_NAME = "go sdk" + X_ASPOSE_CLIENT = "x-aspose-client" + X_ASPOSE_CLIENT_VERSION = "x-aspose-client-version" +) + var ( jsonCheck = regexp.MustCompile("(?i:(?:application|text)/json)") xmlCheck = regexp.MustCompile("(?i:(?:application|text)/xml)") @@ -97,7 +104,7 @@ func selectHeaderAccept(accepts []string) string { // contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } @@ -262,6 +269,8 @@ func (c *APIClient) prepareRequest( // Add the user agent to the request. httpReq.Header.Add("User-Agent", c.cfg.UserAgent) + httpReq.Header.Add(X_ASPOSE_CLIENT, PACKAGE_NAME) + httpReq.Header.Add(X_ASPOSE_CLIENT_VERSION, PACKAGE_VERSION) if ctx != nil { // add context to the request From cb5b1848c24464a19209ac49834c4e88c30a806d Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Wed, 6 Sep 2023 19:38:50 +0700 Subject: [PATCH 02/14] Dart: Generate client with SDK header and version --- codegen/Templates/dart/README.mustache | 2 +- codegen/Templates/dart/api_client.mustache | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/codegen/Templates/dart/README.mustache b/codegen/Templates/dart/README.mustache index ca1275a..2bba4e4 100644 --- a/codegen/Templates/dart/README.mustache +++ b/codegen/Templates/dart/README.mustache @@ -1,6 +1,6 @@ # Aspose.BarCode Cloud SDK for Dart -[![Dart test](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dart/actions/workflows/dart-compile.yml/badge.svg?branch=main)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dart/actions/workflows/dart-compile.yml) +[![Dart test](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dart/actions/workflows/dart.yml/badge.svg?branch=main)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dart/actions/workflows/dart.yml) - API version: {{appVersion}} - SDK version: {{pubVersion}} diff --git a/codegen/Templates/dart/api_client.mustache b/codegen/Templates/dart/api_client.mustache index a6c47c0..4a3821f 100644 --- a/codegen/Templates/dart/api_client.mustache +++ b/codegen/Templates/dart/api_client.mustache @@ -1,5 +1,7 @@ part of {{pubName}}.api; +const String SDK_VERSION = "{{pubVersion}}"; + class QueryParam { String name; String value; @@ -12,7 +14,15 @@ class ApiClient { String basePath; final client = new {{#browserClient}}Browser{{/browserClient}}Client(); - Map _defaultHeaderMap = {}; + static const String API_SDK_HEADER = "x-aspose-client"; + static const String SDK_NAME = "dart sdk"; + static const String API_CLIENT_VERSION_HEADER = "x-aspose-client-version"; + + Map _defaultHeaderMap = { + API_SDK_HEADER: SDK_NAME, + API_CLIENT_VERSION_HEADER: SDK_VERSION, + }; + late Authentication _authentication; final _regList = new RegExp(r'^List<(.*)>$'); From 19057eb428898e664ea4e101ff84857f0e44fe90 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Fri, 8 Sep 2023 23:38:36 +0700 Subject: [PATCH 03/14] Dart: client with Configuration Export Configuration from api --- codegen/Templates/dart/README.mustache | 2 +- codegen/Templates/dart/api.mustache | 6 +-- codegen/Templates/dart/api_client.mustache | 52 +++++++++---------- codegen/Templates/dart/api_doc.mustache | 4 +- codegen/Templates/dart/api_helper.mustache | 6 +-- codegen/Templates/dart/apilib.mustache | 11 ++-- .../Templates/dart/auth/api_key_auth.mustache | 2 +- codegen/Templates/dart/auth/oauth.mustache | 4 +- codegen/Templates/dart/class.mustache | 8 +-- codegen/Templates/dart/gitignore.mustache | 2 + 10 files changed, 50 insertions(+), 47 deletions(-) diff --git a/codegen/Templates/dart/README.mustache b/codegen/Templates/dart/README.mustache index 2bba4e4..d9218eb 100644 --- a/codegen/Templates/dart/README.mustache +++ b/codegen/Templates/dart/README.mustache @@ -65,7 +65,7 @@ Future main() async { Uint8List? generated = await api.getBarcodeGenerate("QR", "text", textLocation: "None"); // Save generated image to file - await new File(fileName).writeAsBytes(generated!); + await File(fileName).writeAsBytes(generated!); print("Generated image saved to " + fileName); // Recognize generated image diff --git a/codegen/Templates/dart/api.mustache b/codegen/Templates/dart/api.mustache index 1bc0a0c..408fdcf 100644 --- a/codegen/Templates/dart/api.mustache +++ b/codegen/Templates/dart/api.mustache @@ -53,7 +53,7 @@ class {{classname}} { mp.fields['{{baseName}}'] = parameterToString({{paramName}}); } {{/notFile}}{{#isFile}} - mp = new MultipartRequest('{{httpMethod}}', Uri.parse(requestPath)); + mp = MultipartRequest('{{httpMethod}}', Uri.parse(requestPath)); // ignore: unnecessary_null_comparison if ({{paramName}} != null) { hasFields = true; @@ -83,7 +83,7 @@ class {{classname}} { authNames); if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); + throw ApiException(response.statusCode, response.body); } else { return {{#isListContainer}} @@ -91,7 +91,7 @@ class {{classname}} { {{/isListContainer}} {{^isListContainer}} {{#isMapContainer}} - {{#returnType}}new {{{returnType}}}.from(apiClient.deserialize(response.body, '{{{returnType}}}')) {{/returnType}}; + {{#returnType}}{{{returnType}}}.from(apiClient.deserialize(response.body, '{{{returnType}}}')) {{/returnType}}; {{/isMapContainer}} {{^isMapContainer}} {{#isResponseFile}} diff --git a/codegen/Templates/dart/api_client.mustache b/codegen/Templates/dart/api_client.mustache index 4a3821f..0f5cb31 100644 --- a/codegen/Templates/dart/api_client.mustache +++ b/codegen/Templates/dart/api_client.mustache @@ -11,8 +11,8 @@ class QueryParam { class ApiClient { - String basePath; - final client = new {{#browserClient}}Browser{{/browserClient}}Client(); + late final String basePath; + final httpClient = {{#browserClient}}Browser{{/browserClient}}Client(); static const String API_SDK_HEADER = "x-aspose-client"; static const String SDK_NAME = "dart sdk"; @@ -25,20 +25,16 @@ class ApiClient { late Authentication _authentication; - final _regList = new RegExp(r'^List<(.*)>$'); - final _regMap = new RegExp(r'^Map$'); - - ApiClient( - {String? clientId, - String? clientSecret, - String? accessToken, - tokenUrl = "https://api.aspose.cloud/connect/token", - this.basePath = "https://api.aspose.cloud/v3.0"}) { - _authentication = new OAuth( - clientId: clientId, - clientSecret: clientSecret, - accessToken: accessToken, - tokenUrl: tokenUrl); + final _regList = RegExp(r'^List<(.*)>$'); + final _regMap = RegExp(r'^Map$'); + + ApiClient(Configuration config) { + this.basePath = config.basePath; + _authentication = OAuth( + clientId: config.clientId, + clientSecret: config.clientSecret, + accessToken: config.accessToken, + tokenUrl: config.tokenUrl); } void addDefaultHeader(String key, String value) { @@ -60,10 +56,10 @@ class ApiClient { {{#model}} case '{{classname}}': {{#isEnum}} - return new {{classname}}.fromJson(value); + return {{classname}}.fromJson(value); {{/isEnum}} {{^isEnum}} - return new {{classname}}.fromJson(value); + return {{classname}}.fromJson(value); {{/isEnum}} {{/model}} {{/models}} @@ -77,15 +73,15 @@ class ApiClient { } else if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { final newTargetType = match![1]; - return new Map.fromIterables(value.keys, + return Map.fromIterables(value.keys, value.values.map((v) => _deserialize(v, newTargetType!))); } } } } on Exception catch (e, stack) { - throw new ApiException.withInner(0, 'Exception during deserialization.', e, stack); + throw ApiException.withInner(0, 'Exception during deserialization.', e, stack); } - throw new ApiException(0, 'Could not find a suitable class for deserialization'); + throw ApiException(0, 'Could not find a suitable class for deserialization'); } dynamic deserialize(String jsonVal, String targetType) { @@ -134,26 +130,26 @@ class ApiClient { headerParams['Content-Type'] = contentType; if(body is MultipartRequest) { - final request = new MultipartRequest(method, Uri.parse(url)); + final request = MultipartRequest(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); request.headers.addAll(body.headers); request.headers.addAll(headerParams); - final response = await client.send(request); + final response = await httpClient.send(request); return Response.fromStream(response); } else { final msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); switch(method) { case "POST": - return client.post(Uri.parse(url), headers: headerParams, body: msgBody); + return httpClient.post(Uri.parse(url), headers: headerParams, body: msgBody); case "PUT": - return client.put(Uri.parse(url), headers: headerParams, body: msgBody); + return httpClient.put(Uri.parse(url), headers: headerParams, body: msgBody); case "DELETE": - return client.delete(Uri.parse(url), headers: headerParams); + return httpClient.delete(Uri.parse(url), headers: headerParams); case "PATCH": - return client.patch(Uri.parse(url), headers: headerParams, body: msgBody); + return httpClient.patch(Uri.parse(url), headers: headerParams, body: msgBody); default: - return client.get(Uri.parse(url), headers: headerParams); + return httpClient.get(Uri.parse(url), headers: headerParams); } } } diff --git a/codegen/Templates/dart/api_doc.mustache b/codegen/Templates/dart/api_doc.mustache index 7237009..9e1d31a 100644 --- a/codegen/Templates/dart/api_doc.mustache +++ b/codegen/Templates/dart/api_doc.mustache @@ -45,9 +45,9 @@ import 'package:{{pubName}}/api.dart'; {{/authMethods}} {{/hasAuthMethods}} -final api_instance = new {{classname}}(); +final api_instance = {{classname}}(); {{#allParams}} -final {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +final {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}{{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { diff --git a/codegen/Templates/dart/api_helper.mustache b/codegen/Templates/dart/api_helper.mustache index 8ca6211..9e800a6 100644 --- a/codegen/Templates/dart/api_helper.mustache +++ b/codegen/Templates/dart/api_helper.mustache @@ -13,7 +13,7 @@ Iterable _convertParametersForCollectionFormat( } if (value is! List) { - params.add(new QueryParam(name, parameterToString(value))); + params.add(QueryParam(name, parameterToString(value))); return params; } @@ -23,12 +23,12 @@ Iterable _convertParametersForCollectionFormat( collectionFormat = collectionFormat.isEmpty ? "csv" : collectionFormat; // default: csv if (collectionFormat == "multi") { - return values.map((v) => new QueryParam(name, parameterToString(v))); + return values.map((v) => QueryParam(name, parameterToString(v))); } final String delimiter = _delimiters[collectionFormat] ?? ","; - params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); + params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); return params; } diff --git a/codegen/Templates/dart/apilib.mustache b/codegen/Templates/dart/apilib.mustache index 7ffd645..aac01ab 100644 --- a/codegen/Templates/dart/apilib.mustache +++ b/codegen/Templates/dart/apilib.mustache @@ -1,10 +1,15 @@ library {{pubName}}.api; +export './configuration.dart' show Configuration; + import 'dart:async'; import 'dart:convert'; -import 'dart:typed_data';{{#browserClient}} -import 'package:http/browser_client.dart';{{/browserClient}} -import 'package:http/http.dart'; +import 'dart:typed_data'; + +{{#browserClient}}import 'package:http/browser_client.dart';{{/browserClient}} +import 'package:http/http.dart' show Client, MultipartFile, MultipartRequest, Response; + +import './configuration.dart' show Configuration; part 'api_client.dart'; part 'api_helper.dart'; diff --git a/codegen/Templates/dart/auth/api_key_auth.mustache b/codegen/Templates/dart/auth/api_key_auth.mustache index 97e0856..7954a49 100644 --- a/codegen/Templates/dart/auth/api_key_auth.mustache +++ b/codegen/Templates/dart/auth/api_key_auth.mustache @@ -19,7 +19,7 @@ class ApiKeyAuth implements Authentication { } if (location == 'query' && value != null) { - queryParams.add(new QueryParam(paramName, value)); + queryParams.add(QueryParam(paramName, value)); } else if (location == 'header' && value != null) { headerParams[paramName] = value; } diff --git a/codegen/Templates/dart/auth/oauth.mustache b/codegen/Templates/dart/auth/oauth.mustache index cdccb8b..f577d6d 100644 --- a/codegen/Templates/dart/auth/oauth.mustache +++ b/codegen/Templates/dart/auth/oauth.mustache @@ -25,12 +25,12 @@ class OAuth implements Authentication { if (clientId != null && clientSecret != null) { await fetchToken(clientId!, clientSecret!); } else { - throw new ApiException(0, "clientId or clientSecret not defined"); + throw ApiException(0, "clientId or clientSecret not defined"); } } if (accessToken == null) { - throw new ApiException(0, "accessToken is null"); + throw ApiException(0, "accessToken is null"); } headerParams["Authorization"] = "Bearer " + accessToken!; } diff --git a/codegen/Templates/dart/class.mustache b/codegen/Templates/dart/class.mustache index 3ed6132..dc83c84 100644 --- a/codegen/Templates/dart/class.mustache +++ b/codegen/Templates/dart/class.mustache @@ -22,7 +22,7 @@ class {{classname}} { {{#complexType}} {{#isListContainer}}{{complexType}}.listFromJson(json['{{name}}']){{/isListContainer}}{{^isListContainer}} {{#isMapContainer}}{{complexType}}.mapFromJson(json['{{name}}']){{/isMapContainer}} - {{^isMapContainer}}new {{complexType}}.fromJson(json['{{name}}']){{/isMapContainer}}{{/isListContainer}} + {{^isMapContainer}}{{complexType}}.fromJson(json['{{name}}']){{/isMapContainer}}{{/isListContainer}} {{/complexType}} {{^complexType}} {{#isListContainer}} @@ -50,13 +50,13 @@ class {{classname}} { } static List<{{classname}}> listFromJson(List json) { - return json.map((value) => new {{classname}}.fromJson(value)).toList(); + return json.map((value) => {{classname}}.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { - final map = new Map(); + final map = Map(); if (json.isNotEmpty) { - json.forEach((String key, Map value) => map[key] = new {{classname}}.fromJson(value)); + json.forEach((String key, Map value) => map[key] = {{classname}}.fromJson(value)); } return map; } diff --git a/codegen/Templates/dart/gitignore.mustache b/codegen/Templates/dart/gitignore.mustache index 836ce19..2512216 100644 --- a/codegen/Templates/dart/gitignore.mustache +++ b/codegen/Templates/dart/gitignore.mustache @@ -27,3 +27,5 @@ pubspec.lock !.vscode/launch.json coverage/ +test/configuration*.json +!test/configuration.example.json From 65e21285064c964bb6dd9cfda2267486733b5a78 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Sat, 9 Sep 2023 02:39:43 +0700 Subject: [PATCH 04/14] Dart: remove 'part' directive and 'part of' header Move everything to src dir Fix linting error by renaming api.dart to aspose_barcode_cloud.dart Make SDK_VERSION public --- codegen/Templates/dart/README.mustache | 2 +- codegen/Templates/dart/api.mustache | 10 +++++--- codegen/Templates/dart/api_client.mustache | 24 +++++++++---------- codegen/Templates/dart/api_doc.mustache | 4 ++-- codegen/Templates/dart/api_exception.mustache | 2 -- codegen/Templates/dart/api_helper.mustache | 11 +++++++-- codegen/Templates/dart/apilib.mustache | 23 ++++-------------- .../Templates/dart/auth/api_key_auth.mustache | 2 -- .../dart/auth/authentication.mustache | 2 +- .../dart/auth/http_basic_auth.mustache | 2 -- codegen/Templates/dart/auth/oauth.mustache | 8 ++++++- codegen/Templates/dart/class.mustache | 2 ++ codegen/Templates/dart/model.mustache | 5 ++++ codegen/Templates/dart/object_doc.mustache | 2 +- codegen/generate-dart.bash | 21 +++++++++------- 15 files changed, 64 insertions(+), 56 deletions(-) create mode 100644 codegen/Templates/dart/model.mustache diff --git a/codegen/Templates/dart/README.mustache b/codegen/Templates/dart/README.mustache index d9218eb..0a03dab 100644 --- a/codegen/Templates/dart/README.mustache +++ b/codegen/Templates/dart/README.mustache @@ -44,7 +44,7 @@ dependencies: The examples below show how you can generate QR barcode and save it into a local file and then recognize using **{{pubName}}**: ```dart -import 'package:aspose_barcode_cloud/api.dart' as barcode; +import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart' as barcode; import 'dart:typed_data'; import 'dart:io'; diff --git a/codegen/Templates/dart/api.mustache b/codegen/Templates/dart/api.mustache index 408fdcf..5eb4deb 100644 --- a/codegen/Templates/dart/api.mustache +++ b/codegen/Templates/dart/api.mustache @@ -1,7 +1,11 @@ -part of {{pubName}}.api; +import 'dart:typed_data' show Uint8List; -{{#operations}} +import 'package:http/http.dart' show MultipartFile, MultipartRequest; + +import '../../aspose_barcode_cloud.dart'; +import '../api_helper.dart'; +{{#operations}} class {{classname}} { {{classname}}(this.apiClient) {} @@ -30,7 +34,7 @@ class {{classname}} { {{^required}} if({{paramName}} != null) { {{/required}} - queryParams.addAll(_convertParametersForCollectionFormat("{{collectionFormat}}", "{{baseName}}", {{paramName}})); + queryParams.addAll(convertParametersForCollectionFormat("{{collectionFormat}}", "{{baseName}}", {{paramName}})); {{^required}} } {{/required}} diff --git a/codegen/Templates/dart/api_client.mustache b/codegen/Templates/dart/api_client.mustache index 0f5cb31..8469f13 100644 --- a/codegen/Templates/dart/api_client.mustache +++ b/codegen/Templates/dart/api_client.mustache @@ -1,18 +1,18 @@ -part of {{pubName}}.api; +import 'dart:convert' show json; -const String SDK_VERSION = "{{pubVersion}}"; +import 'package:http/http.dart' as Http show Client, MultipartRequest, Response; -class QueryParam { - String name; - String value; +import '../aspose_barcode_cloud.dart'; +import 'api_helper.dart'; +import 'auth/authentication.dart'; +import 'auth/oauth.dart'; - QueryParam(this.name, this.value); -} +const String SDK_VERSION = "{{pubVersion}}"; class ApiClient { late final String basePath; - final httpClient = {{#browserClient}}Browser{{/browserClient}}Client(); + final httpClient = Http.Client(); static const String API_SDK_HEADER = "x-aspose-client"; static const String SDK_NAME = "dart sdk"; @@ -108,7 +108,7 @@ class ApiClient { // We don't use a Map for queryParams. // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String path, + Future invokeAPI(String path, String method, List queryParams, Object? body, @@ -129,14 +129,14 @@ class ApiClient { headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; - if(body is MultipartRequest) { - final request = MultipartRequest(method, Uri.parse(url)); + if(body is Http.MultipartRequest) { + final request = Http.MultipartRequest(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); request.headers.addAll(body.headers); request.headers.addAll(headerParams); final response = await httpClient.send(request); - return Response.fromStream(response); + return Http.Response.fromStream(response); } else { final msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); switch(method) { diff --git a/codegen/Templates/dart/api_doc.mustache b/codegen/Templates/dart/api_doc.mustache index 9e1d31a..14c9f64 100644 --- a/codegen/Templates/dart/api_doc.mustache +++ b/codegen/Templates/dart/api_doc.mustache @@ -3,7 +3,7 @@ ## Load the API package ```dart -import 'package:{{pubName}}/api.dart'; +import 'package:{{pubName}}/aspose_barcode_cloud.dart'; ``` All URIs are relative to *{{basePath}}* @@ -24,7 +24,7 @@ Method | HTTP request | Description ### Example ```dart -import 'package:{{pubName}}/api.dart'; +import 'package:{{pubName}}/aspose_barcode_cloud.dart'; {{#hasAuthMethods}} {{#authMethods}} {{#isBasic}} diff --git a/codegen/Templates/dart/api_exception.mustache b/codegen/Templates/dart/api_exception.mustache index f2b7756..db136d2 100644 --- a/codegen/Templates/dart/api_exception.mustache +++ b/codegen/Templates/dart/api_exception.mustache @@ -1,5 +1,3 @@ -part of {{pubName}}.api; - class ApiException implements Exception { int code = 0; String? message = null; diff --git a/codegen/Templates/dart/api_helper.mustache b/codegen/Templates/dart/api_helper.mustache index 9e800a6..7c2f998 100644 --- a/codegen/Templates/dart/api_helper.mustache +++ b/codegen/Templates/dart/api_helper.mustache @@ -1,9 +1,16 @@ -part of {{pubName}}.api; +import '../aspose_barcode_cloud.dart'; const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +class QueryParam { + String name; + String value; + + QueryParam(this.name, this.value); +} + // port from Java version -Iterable _convertParametersForCollectionFormat( +Iterable convertParametersForCollectionFormat( String collectionFormat, String name, dynamic value) { final params = []; diff --git a/codegen/Templates/dart/apilib.mustache b/codegen/Templates/dart/apilib.mustache index aac01ab..1b3f59a 100644 --- a/codegen/Templates/dart/apilib.mustache +++ b/codegen/Templates/dart/apilib.mustache @@ -1,23 +1,10 @@ library {{pubName}}.api; -export './configuration.dart' show Configuration; +export 'src/configuration.dart' show Configuration; +export 'src/api_client.dart' show ApiClient, SDK_VERSION; +export 'src/api_exception.dart' show ApiException; -import 'dart:async'; -import 'dart:convert'; -import 'dart:typed_data'; - -{{#browserClient}}import 'package:http/browser_client.dart';{{/browserClient}} -import 'package:http/http.dart' show Client, MultipartFile, MultipartRequest, Response; - -import './configuration.dart' show Configuration; - -part 'api_client.dart'; -part 'api_helper.dart'; -part 'api_exception.dart'; -part 'auth/authentication.dart'; -part 'auth/oauth.dart'; - -{{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart'; +{{#apiInfo}}{{#apis}}export 'src/api/{{classFilename}}.dart' show {{classname}}; {{/apis}}{{/apiInfo}} -{{#models}}{{#model}}part 'model/{{classFilename}}.dart'; +{{#models}}{{#model}}export 'src/model/{{classFilename}}.dart' show {{classname}}; {{/model}}{{/models}} diff --git a/codegen/Templates/dart/auth/api_key_auth.mustache b/codegen/Templates/dart/auth/api_key_auth.mustache index 7954a49..e0f227a 100644 --- a/codegen/Templates/dart/auth/api_key_auth.mustache +++ b/codegen/Templates/dart/auth/api_key_auth.mustache @@ -1,5 +1,3 @@ -part of {{pubName}}.api; - class ApiKeyAuth implements Authentication { final String location; diff --git a/codegen/Templates/dart/auth/authentication.mustache b/codegen/Templates/dart/auth/authentication.mustache index 4fd3b80..8867e52 100644 --- a/codegen/Templates/dart/auth/authentication.mustache +++ b/codegen/Templates/dart/auth/authentication.mustache @@ -1,4 +1,4 @@ -part of {{pubName}}.api; +import '../api_helper.dart'; abstract class Authentication { diff --git a/codegen/Templates/dart/auth/http_basic_auth.mustache b/codegen/Templates/dart/auth/http_basic_auth.mustache index 36c7a2f..faa4177 100644 --- a/codegen/Templates/dart/auth/http_basic_auth.mustache +++ b/codegen/Templates/dart/auth/http_basic_auth.mustache @@ -1,5 +1,3 @@ -part of {{pubName}}.api; - class HttpBasicAuth implements Authentication { String? username; diff --git a/codegen/Templates/dart/auth/oauth.mustache b/codegen/Templates/dart/auth/oauth.mustache index f577d6d..9b0c221 100644 --- a/codegen/Templates/dart/auth/oauth.mustache +++ b/codegen/Templates/dart/auth/oauth.mustache @@ -1,4 +1,10 @@ -part of {{pubName}}.api; +import 'dart:convert' show jsonDecode; + +import 'package:http/http.dart' show MultipartRequest; + +import '../api_exception.dart'; +import '../api_helper.dart'; +import 'authentication.dart'; class OAuth implements Authentication { String? clientId; diff --git a/codegen/Templates/dart/class.mustache b/codegen/Templates/dart/class.mustache index dc83c84..8a02f63 100644 --- a/codegen/Templates/dart/class.mustache +++ b/codegen/Templates/dart/class.mustache @@ -1,5 +1,7 @@ // ignore_for_file: non_constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package +import '../../aspose_barcode_cloud.dart'; + class {{classname}} { {{#vars}}{{#description}}/* {{{description}}} */{{/description}} {{{datatype}}}? {{name}} = {{{defaultValue}}}; diff --git a/codegen/Templates/dart/model.mustache b/codegen/Templates/dart/model.mustache new file mode 100644 index 0000000..c2320e6 --- /dev/null +++ b/codegen/Templates/dart/model.mustache @@ -0,0 +1,5 @@ +{{#models}} +{{#model}} +{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/codegen/Templates/dart/object_doc.mustache b/codegen/Templates/dart/object_doc.mustache index 5a821a2..744912d 100644 --- a/codegen/Templates/dart/object_doc.mustache +++ b/codegen/Templates/dart/object_doc.mustache @@ -3,7 +3,7 @@ ## Load the model package ```dart -import 'package:{{pubName}}/api.dart'; +import 'package:{{pubName}}/aspose_barcode_cloud.dart'; ``` {{#description}} {{description}} diff --git a/codegen/generate-dart.bash b/codegen/generate-dart.bash index c7b3781..9a671ba 100755 --- a/codegen/generate-dart.bash +++ b/codegen/generate-dart.bash @@ -21,18 +21,21 @@ mv "$tempDir/.gitignore" "$targetDir/" mv "$tempDir/pubspec.yaml" "$targetDir/" -rm -rf "${targetDir:?}/lib/*" || mkdir -p "$targetDir/lib/" -mv $tempDir/lib/*.dart $targetDir/lib/ +rm -rf "${targetDir:?}/lib/"*.dart || true +mv $tempDir/lib/api.dart $targetDir/lib/aspose_barcode_cloud.dart -mkdir -p "$targetDir/lib/model/" -mv $tempDir/lib/model/*.dart $targetDir/lib/model/ +mkdir -p "$targetDir/lib/src/" || true +mv $tempDir/lib/*.dart $targetDir/lib/src/ -mkdir -p "$targetDir/lib/api/" -mv $tempDir/lib/api/*.dart $targetDir/lib/api/ +mkdir -p "$targetDir/lib/src/model/" +mv $tempDir/lib/model/*.dart $targetDir/lib/src/model/ -mkdir -p "$targetDir/lib/auth/" -mv "$tempDir/lib/auth/authentication.dart" "$targetDir/lib/auth/" -mv "$tempDir/lib/auth/oauth.dart" "$targetDir/lib/auth/" +mkdir -p "$targetDir/lib/src/api/" +mv $tempDir/lib/api/*.dart $targetDir/lib/src/api/ + +mkdir -p "$targetDir/lib/src/auth/" +mv "$tempDir/lib/auth/authentication.dart" "$targetDir/lib/src/auth/" +mv "$tempDir/lib/auth/oauth.dart" "$targetDir/lib/src/auth/" rm -rf "$targetDir/doc/" mkdir -p "$targetDir/doc/api/" From 0757a3a4ac23bb19744ff6c5c0a1dac0fc8a0115 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 12 Sep 2023 17:49:41 +0700 Subject: [PATCH 05/14] Node: rename applyToRequest -> applyToRequestAsync --- codegen/Templates/nodejs/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/Templates/nodejs/api.mustache b/codegen/Templates/nodejs/api.mustache index 2513ae7..a430737 100644 --- a/codegen/Templates/nodejs/api.mustache +++ b/codegen/Templates/nodejs/api.mustache @@ -266,7 +266,7 @@ export class {{classname}} { {{/isResponseFile}} }; - await this._configuration.authentication.applyToRequest(requestOptions); + await this._configuration.authentication.applyToRequestAsync(requestOptions); {{#formParams}}{{^isFile}} if (Object.keys(requestFormParams).length) { if (requestUseFormData) { From 56eaa15f368f914922519e2ed113b826e34cc45f Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Wed, 13 Sep 2023 14:39:47 +0700 Subject: [PATCH 06/14] Node: Add defaultHeaders Remove request prefix from local variables --- codegen/Templates/nodejs/api.mustache | 31 +++++++++++++++------------ 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/codegen/Templates/nodejs/api.mustache b/codegen/Templates/nodejs/api.mustache index a430737..689a62f 100644 --- a/codegen/Templates/nodejs/api.mustache +++ b/codegen/Templates/nodejs/api.mustache @@ -186,7 +186,10 @@ let typeMap: { [index: string]: any } = { {{/description}} export class {{classname}} { - protected defaultHeaders: any = {}; + protected defaultHeaders: any = { + 'x-aspose-client': 'nodejs sdk', + 'x-aspose-client-version': '{{npmVersion}}' + }; protected _configuration: Configuration; private _client: HttpClient; @@ -211,10 +214,10 @@ export class {{classname}} { '{' + '{{baseName}}' + '}', String(request.{{paramName}}) ){{/pathParams}}; - let requestQueryParameters: any = {}; - let requestHeaderParams: any = (Object as any).assign({}, this.defaultHeaders); + let queryParameters: any = {}; + let headerParams: any = (Object as any).assign({}, this.defaultHeaders); {{#formParams}} - let requestFormParams: any = {}; + let formParams: any = {}; {{/formParams}} {{#allParams}} @@ -228,29 +231,29 @@ export class {{classname}} { {{/allParams}} {{#queryParams}} if (request.{{paramName}} != null) { - requestQueryParameters['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, "{{{dataType}}}"); + queryParameters['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, "{{{dataType}}}"); } {{/queryParams}} {{#headerParams}} - requestHeaderParams['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}'); + headerParams['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}'); {{/headerParams}} {{#formParams}} if (request.{{paramName}} != null) { {{#isFile}} - requestFormParams['{{baseName}}'] = request.{{paramName}}; + formParams['{{baseName}}'] = request.{{paramName}}; {{/isFile}} {{^isFile}} - requestFormParams['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}'); + formParams['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}'); {{/isFile}} } {{/formParams}} let requestOptions: HttpOptions = { method: '{{httpMethod}}', - qs: requestQueryParameters, - headers: requestHeaderParams, + qs: queryParameters, + headers: headerParams, uri: requestPath, {{#formParams}} {{#isFile}} @@ -268,11 +271,11 @@ export class {{classname}} { await this._configuration.authentication.applyToRequestAsync(requestOptions); {{#formParams}}{{^isFile}} - if (Object.keys(requestFormParams).length) { - if (requestUseFormData) { - (requestOptions as any).formData = requestFormParams; + if (Object.keys(formParams).length) { + if (useFormData) { + (requestOptions as any).formData = formParams; } else { - requestOptions.form = requestFormParams; + requestOptions.form = formParams; } }{{/isFile}}{{/formParams}} From 1baf63ff9ff460dbfd2d6a70841f67a113034dd2 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Mon, 18 Sep 2023 23:12:58 +0700 Subject: [PATCH 07/14] Java: Fix linting Java: Add missing comments final ApiClient --- codegen/Templates/java/ApiClient.mustache | 154 ++++++++---------- codegen/Templates/java/Configuration.mustache | 30 ++++ codegen/Templates/java/JSON.mustache | 15 +- codegen/Templates/java/Pair.mustache | 18 +- codegen/Templates/java/StringUtil.mustache | 31 ++++ codegen/Templates/java/api.mustache | 43 ++--- codegen/Templates/java/apiException.mustache | 37 +++-- .../okhttp-gson/ApiResponse.mustache | 42 +++++ .../okhttp-gson/ProgressRequestBody.mustache | 72 ++++++++ .../okhttp-gson/ProgressResponseBody.mustache | 69 ++++++++ codegen/Templates/java/modelEnum.mustache | 8 +- codegen/Templates/java/pojo.mustache | 13 +- codegen/generate-java.bash | 3 +- codegen/generate-node.bash | 1 - scripts/generate-all.bash | 4 +- 15 files changed, 403 insertions(+), 137 deletions(-) create mode 100644 codegen/Templates/java/Configuration.mustache create mode 100644 codegen/Templates/java/StringUtil.mustache create mode 100644 codegen/Templates/java/libraries/okhttp-gson/ApiResponse.mustache create mode 100644 codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache create mode 100644 codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache diff --git a/codegen/Templates/java/ApiClient.mustache b/codegen/Templates/java/ApiClient.mustache index 6002d31..2bcf790 100644 --- a/codegen/Templates/java/ApiClient.mustache +++ b/codegen/Templates/java/ApiClient.mustache @@ -3,7 +3,16 @@ package {{invokerPackage}}; import com.aspose.barcode.cloud.model.ApiErrorResponse; -import com.squareup.okhttp.*; +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; @@ -28,61 +37,55 @@ import java.lang.reflect.Type; import java.net.URLConnection; import java.net.URLEncoder; import java.security.GeneralSecurityException; -import java.text.DateFormat; {{#java8}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; {{/java8}} -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * ApiClient. + */ public class ApiClient { - public final String apiVersion = "v{{appVersion}}"; public final String clientVersion = "{{artifactVersion}}"; + private String baseUrl = "{{hostWithoutBasePath}}"; private String clientId; private String clientSecret; private boolean debugging = false; private final Map defaultHeaderMap = new HashMap<>(); private String tempFolderPath = null; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - private OkHttpClient httpClient; private JSON json; - private HttpLoggingInterceptor loggingInterceptor; private String accessToken; - public ApiClient(String clientId, String clientSecret, String baseUrl) { - this(); - this.clientId = clientId; - this.clientSecret = clientSecret; - if (baseUrl != null) { - this.baseUrl = baseUrl; - } - } - + /** + * Constructor for ApiClient with clientId and clientSecret + */ public ApiClient(String clientId, String clientSecret) { this(clientId, clientSecret, null); } + /** + * Constructor for ApiClient with accessToken + */ public ApiClient(String accessToken) { this(); this.setAccessToken(accessToken); } - /* - * Constructor for ApiClient - */ protected ApiClient() { httpClient = new OkHttpClient(); @@ -101,8 +104,17 @@ public class ApiClient { setReadTimeout(60_000); } + private ApiClient(String clientId, String clientSecret, String baseUrl) { + this(); + this.clientId = clientId; + this.clientSecret = clientSecret; + if (baseUrl != null) { + this.baseUrl = baseUrl; + } + } + /** - * Get base path + * Get base path. * * @return Base path */ @@ -111,7 +123,7 @@ public class ApiClient { } /** - * Get HTTP client + * Get HTTP client. * * @return An instance of OkHttpClient */ @@ -120,14 +132,12 @@ public class ApiClient { } /** - * Set HTTP client + * Set HTTP client. * * @param httpClient An instance of OkHttpClient - * @return Api Client */ - public ApiClient setHttpClient(OkHttpClient httpClient) { + public void setHttpClient(OkHttpClient httpClient) { this.httpClient = httpClient; - return this; } /** @@ -143,26 +153,18 @@ public class ApiClient { * Set JSON * * @param json JSON object - * @return Api client */ - public ApiClient setJSON(JSON json) { + public void setJSON(JSON json) { this.json = json; - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; } {{#joda}} - public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) { + public void setDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setDateTimeFormat(dateFormat); - return this; } - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + public void setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); - return this; } {{/joda}} @@ -182,11 +184,9 @@ public class ApiClient { * Set the User-Agent header's value (by adding to the default header map). * * @param userAgent HTTP request's user agent - * @return ApiClient */ - public ApiClient setUserAgent(String userAgent) { + public void setUserAgent(String userAgent) { addDefaultHeader("User-Agent", userAgent); - return this; } /** @@ -194,11 +194,9 @@ public class ApiClient { * * @param key The header's key * @param value The header's value - * @return ApiClient */ - public ApiClient addDefaultHeader(String key, String value) { + public void addDefaultHeader(String key, String value) { defaultHeaderMap.put(key, value); - return this; } /** @@ -214,9 +212,8 @@ public class ApiClient { * Enable/disable debugging for this API client. * * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient */ - public ApiClient setDebugging(boolean debugging) { + public void setDebugging(boolean debugging) { if (debugging != this.debugging) { if (debugging) { loggingInterceptor = new HttpLoggingInterceptor(); @@ -228,7 +225,6 @@ public class ApiClient { } } this.debugging = debugging; - return this; } /** @@ -247,11 +243,9 @@ public class ApiClient { * Set the temporary folder path (for downloading files) * * @param tempFolderPath Temporary folder path - * @return ApiClient */ - public ApiClient setTempFolderPath(String tempFolderPath) { + public void setTempFolderPath(String tempFolderPath) { this.tempFolderPath = tempFolderPath; - return this; } /** @@ -269,11 +263,9 @@ public class ApiClient { * {@link Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds - * @return Api client */ - public ApiClient setConnectTimeout(int connectionTimeout) { + public void setConnectTimeout(int connectionTimeout) { httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); - return this; } /** @@ -291,11 +283,9 @@ public class ApiClient { * {@link Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds - * @return Api client */ - public ApiClient setReadTimeout(int readTimeout) { + public void setReadTimeout(int readTimeout) { httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); - return this; } /** @@ -313,11 +303,9 @@ public class ApiClient { * {@link Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds - * @return Api client */ - public ApiClient setWriteTimeout(int writeTimeout) { + public void setWriteTimeout(int writeTimeout) { httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); - return this; } /** @@ -360,7 +348,9 @@ public class ApiClient { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } params.add(new Pair(name, parameterToString(value))); return params; @@ -503,7 +493,6 @@ public class ApiClient { * Deserialize response body to Java object, according to the return type and * the Content-Type response header. * - * @param Type * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object @@ -530,10 +519,11 @@ public class ApiClient { String respBody; try { - if (response.body() != null) + if (response.body() != null) { respBody = response.body().string(); - else + } else { respBody = null; + } } catch (IOException e) { throw new ApiException(e); } @@ -594,8 +584,8 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk * @return Downloaded file + * @throws ApiException If fail to read file content from response and write to disk */ public File downloadFileFromResponse(Response response) throws ApiException { try { @@ -610,11 +600,11 @@ public class ApiClient { } /** - * Prepare file for download + * Prepare file for download. * * @param response An instance of the Response object - * @throws IOException If fail to prepare file for download * @return Prepared file for the download + * @throws IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -642,23 +632,25 @@ public class ApiClient { suffix = filename.substring(pos); } // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) + if (prefix.length() < 3) { prefix = "download-"; + } } - if (tempFolderPath == null) + if (tempFolderPath == null) { return File.createTempFile(prefix, suffix); - else + } + else { return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } } /** - * {@link #execute(Call, Type)} + * Override {@link #execute(Call, Type)}. * - * @param Type * @param call An instance of the Call object - * @throws ApiException If fail to execute the call * @return ApiResponse<T> + * @throws ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -668,7 +660,6 @@ public class ApiClient { * Execute HTTP call and deserialize the HTTP response body into the given return type. * * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType * @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 @@ -686,9 +677,8 @@ public class ApiClient { } /** - * {@link #executeAsync(Call, Type, ApiCallback)} + * Override {@link #executeAsync(Call, Type, ApiCallback)} * - * @param Type * @param call An instance of the Call object * @param callback ApiCallback<T> */ @@ -700,7 +690,7 @@ public class ApiClient { * Execute HTTP call asynchronously. * * @see #execute(Call, Type) - * @param Type + * * @param call The callback to be executed when the API call finishes * @param returnType Return type * @param callback ApiCallback @@ -729,12 +719,10 @@ public class ApiClient { /** * Handle the given response, return the deserialized object when the response is successful. * - * @param Type * @param response Response * @param returnType Return type - * @throws ApiException If the response has a unsuccessful status code or - * fail to deserialize the response body * @return Type + * @throws ApiException If the response has a unsuccessful status code or fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -963,7 +951,7 @@ public class ApiClient { } /** - * Request OAuth token + * Request OAuth token. * * @throws ApiException If authorization is failed */ @@ -1005,7 +993,7 @@ public class ApiClient { headerParams.put("Authorization", "Bearer " + accessToken); } - /** GetAccessTokenResult class */ + /** GetAccessTokenResult class for deserialization. */ @SuppressWarnings({"unused", "InnerClassMayBeStatic"}) private class GetAccessTokenResult { public String access_token; diff --git a/codegen/Templates/java/Configuration.mustache b/codegen/Templates/java/Configuration.mustache new file mode 100644 index 0000000..6caf1b1 --- /dev/null +++ b/codegen/Templates/java/Configuration.mustache @@ -0,0 +1,30 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +/** + * Class for storing configuration of the SDK. + */ +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/codegen/Templates/java/JSON.mustache b/codegen/Templates/java/JSON.mustache index a72aeab..41b2416 100644 --- a/codegen/Templates/java/JSON.mustache +++ b/codegen/Templates/java/JSON.mustache @@ -43,6 +43,9 @@ import java.util.Date; import java.util.Map; import java.util.HashMap; +/** + * JSON utility class for serialization/deserialization. + */ public class JSON { private Gson gson; private boolean isLenientOnJson = false; @@ -57,7 +60,7 @@ public class JSON { private final LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); {{/jsr310}} - public static GsonBuilder createGson() { + private static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder(); GsonBuilder builder = fireBuilder.createGsonBuilder(); {{#disableHtmlEscaping}} @@ -66,6 +69,9 @@ public class JSON { return builder; } + /** + * Constructor. + */ public JSON() { ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); gson = createGson() @@ -118,7 +124,6 @@ public class JSON { /** * Deserialize the given JSON string to Java object. * - * @param Type * @param body The JSON string * @param returnType The type to deserialize into * @return The deserialized Java object @@ -136,9 +141,11 @@ public class JSON { } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; - if (returnType.equals(String.class)) + if (returnType.equals(String.class)) { return (T) body; - else throw (e); + } else { + throw (e); + } } } diff --git a/codegen/Templates/java/Pair.mustache b/codegen/Templates/java/Pair.mustache index 49bd85c..2eead07 100644 --- a/codegen/Templates/java/Pair.mustache +++ b/codegen/Templates/java/Pair.mustache @@ -2,7 +2,9 @@ package {{invokerPackage}}; -{{>generatedAnnotation}} +/** + * Name-value pair. + */ public class Pair { private String name = ""; private String value = ""; @@ -13,13 +15,17 @@ public class Pair { } private void setName(String name) { - if (IsNullOrEmpty(name)) return; + if (isNullOrEmpty(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (IsNullOrEmpty(value)) return; + if (isNullOrEmpty(value)) { + return; + } this.value = value; } @@ -32,8 +38,10 @@ public class Pair { return this.value; } - private static boolean IsNullOrEmpty(String arg) { - if (arg == null) return true; + private static boolean isNullOrEmpty(String arg) { + if (arg == null) { + return true; + } return arg.trim().isEmpty(); } } diff --git a/codegen/Templates/java/StringUtil.mustache b/codegen/Templates/java/StringUtil.mustache new file mode 100644 index 0000000..829c946 --- /dev/null +++ b/codegen/Templates/java/StringUtil.mustache @@ -0,0 +1,31 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +/** + * String Utilities. + */ +public class StringUtil { + + /** + * Join an array of strings with the given separator. + *

TODO: Replace with String.join after update to Java 8+

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/codegen/Templates/java/api.mustache b/codegen/Templates/java/api.mustache index 4304ed5..2779183 100644 --- a/codegen/Templates/java/api.mustache +++ b/codegen/Templates/java/api.mustache @@ -44,8 +44,11 @@ import java.util.Map; {{/fullJavaUtil}} {{#operations}} +/** + * {{classname}}. + */ public class {{classname}} { - private ApiClient {{localVariablePrefix}}apiClient; + private final ApiClient {{localVariablePrefix}}apiClient; public {{classname}}() { this(Configuration.getDefaultApiClient()); @@ -55,14 +58,6 @@ public class {{classname}} { this.{{localVariablePrefix}}apiClient = apiClient; } - public ApiClient getApiClient() { - return {{localVariablePrefix}}apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.{{localVariablePrefix}}apiClient = apiClient; - } - {{#operation}} /** * Build call for {{operationId}} @@ -92,22 +87,28 @@ public class {{classname}} { {{javaUtilPrefix}}List {{localVariablePrefix}}queryParams = new {{javaUtilPrefix}}ArrayList<>(); {{javaUtilPrefix}}List {{localVariablePrefix}}collectionQueryParams = new {{javaUtilPrefix}}ArrayList<>();{{#queryParams}} - if (request.{{paramName}} != null) - {{localVariablePrefix}}{{#collectionFormat}}collectionQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}queryParams.addAll({{localVariablePrefix}}apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", request.{{paramName}}));{{/queryParams}} + if (request.{{paramName}} != null) { + {{localVariablePrefix}}{{#collectionFormat}}collectionQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}queryParams.addAll({{localVariablePrefix}}apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", request.{{paramName}})); + } + {{/queryParams}} {{javaUtilPrefix}}Map {{localVariablePrefix}}headerParams = new {{javaUtilPrefix}}HashMap<>();{{#headerParams}} if (request.{{paramName}} != null) {{localVariablePrefix}}headerParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString(request.{{paramName}}));{{/headerParams}} {{javaUtilPrefix}}Map {{localVariablePrefix}}formParams = new {{javaUtilPrefix}}HashMap<>();{{#formParams}} - if (request.{{paramName}} != null) - {{localVariablePrefix}}formParams.put("{{baseName}}", request.{{paramName}});{{/formParams}} + if (request.{{paramName}} != null) { + {{localVariablePrefix}}formParams.put("{{baseName}}", request.{{paramName}}); + } + {{/formParams}} final String[] {{localVariablePrefix}}accepts = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }; final String {{localVariablePrefix}}accept = {{localVariablePrefix}}apiClient.selectHeaderAccept({{localVariablePrefix}}accepts); - if ({{localVariablePrefix}}accept != null) {{localVariablePrefix}}headerParams.put("Accept", {{localVariablePrefix}}accept); + if ({{localVariablePrefix}}accept != null) { + {{localVariablePrefix}}headerParams.put("Accept", {{localVariablePrefix}}accept); + } final String[] {{localVariablePrefix}}contentTypes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} @@ -138,7 +139,9 @@ public class {{classname}} { {{#allParams}}{{#required}} // verify the required parameter 'request.{{paramName}}' is set if (request.{{paramName}} == null) { - throw new ApiException("Missing the required parameter 'request.{{paramName}}' when calling {{operationId}}(Async)"); + throw new ApiException( + "Missing the required parameter 'request.{{paramName}}'" + + " when calling {{operationId}}(...)"); } {{/required}}{{/allParams}} @@ -294,9 +297,6 @@ public class {{classname}} { // // -------------------------------------------------------------------------------------------------------------------- -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// package com.aspose.barcode.cloud.requests; @@ -311,13 +311,16 @@ import com.aspose.barcode.cloud.model.ReaderParams; public class {{operationIdCamelCase}}Request { {{#allParams}} /** - * {{{unescapedDescription}}} + * {{{unescapedDescription}}}. */ public {{#required}}final{{/required}} {{{dataType}}} {{paramName}} {{^required}}{{#defaultValue}}={{{example}}}{{/defaultValue}}{{/required}}; {{/allParams}} {{#requiredParams.0}} - /**{{#requiredParams}} + /** + * {{{summary}}}. + * + * {{#requiredParams}} * @param {{paramName}} {{{unescapedDescription}}} {{/requiredParams}}*/ public {{operationIdCamelCase}}Request({{#requiredParams}} {{{dataType}}} {{paramName}} {{#hasMore}},{{/hasMore}} {{/requiredParams}}) { diff --git a/codegen/Templates/java/apiException.mustache b/codegen/Templates/java/apiException.mustache index 1503251..ecc3512 100644 --- a/codegen/Templates/java/apiException.mustache +++ b/codegen/Templates/java/apiException.mustache @@ -8,9 +8,11 @@ import com.aspose.barcode.cloud.model.ApiError; import java.util.Map; import java.util.List; -{{>generatedAnnotation}} +/** + * ApiException. + */ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ - private int code = 0; + private int httpCode = 0; private Map> responseHeaders = null; private String responseBody = null; private ApiErrorResponse response = null; @@ -23,33 +25,42 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us super(message); } - public ApiException(String httpMessage, int httpCode) { - super(httpMessage); - this.code = httpCode; + public ApiException(String message, int httpCode) { + super(message); + this.httpCode = httpCode; } + /** + * Constructor for ApiException with message, httpCode, responseHeaders, responseBody + */ public ApiException( String message, - int code, + int httpCode, Map> responseHeaders, String responseBody) { - this(message, code); + this(message, httpCode); this.responseHeaders = responseHeaders; this.responseBody = responseBody; } + /** + * Constructor for ApiException with message, throwable, httpCode, responseHeaders + */ public ApiException( String message, Throwable throwable, - int code, + int httpCode, Map> responseHeaders) { super(message, throwable); - this.code = code; + this.httpCode = httpCode; this.responseHeaders = responseHeaders; } - public ApiException(String httpMessage, int httpCode, ApiErrorResponse errorResponse) { - this(httpMessage, httpCode); + /** + * Constructor for ApiException with message, httpCode, errorResponse + */ + public ApiException(String message, int httpCode, ApiErrorResponse errorResponse) { + this(message, httpCode); this.response = errorResponse; } @@ -58,8 +69,8 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us * * @return HTTP status code */ - public int getCode() { - return code; + public int getHttpCode() { + return httpCode; } /** diff --git a/codegen/Templates/java/libraries/okhttp-gson/ApiResponse.mustache b/codegen/Templates/java/libraries/okhttp-gson/ApiResponse.mustache new file mode 100644 index 0000000..6960f6d --- /dev/null +++ b/codegen/Templates/java/libraries/okhttp-gson/ApiResponse.mustache @@ -0,0 +1,42 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * Create a new API response. + * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache new file mode 100644 index 0000000..a5c5cb5 --- /dev/null +++ b/codegen/Templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -0,0 +1,72 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +/** + * ProgressRequestBody. + */ +public class ProgressRequestBody extends RequestBody { + + /** + * ProgressRequestListener. + */ + public interface ProgressRequestListener { + void onRequestProgress(long bytesWritten, long contentLength, boolean done); + } + + private final RequestBody requestBody; + + private final ProgressRequestListener progressListener; + + public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) { + this.requestBody = requestBody; + this.progressListener = progressListener; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache new file mode 100644 index 0000000..a04c619 --- /dev/null +++ b/codegen/Templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -0,0 +1,69 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.io.IOException; + +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.ResponseBody; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +/** + * Display progress while download body. + */ +public class ProgressResponseBody extends ResponseBody { + + /** + * Interface for progress update. + */ + public interface ProgressListener { + void update(long bytesRead, long contentLength, boolean done); + } + + private final ResponseBody responseBody; + private final ProgressListener progressListener; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) { + this.responseBody = responseBody; + this.progressListener = progressListener; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() throws IOException { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/codegen/Templates/java/modelEnum.mustache b/codegen/Templates/java/modelEnum.mustache index b558bda..b43586b 100644 --- a/codegen/Templates/java/modelEnum.mustache +++ b/codegen/Templates/java/modelEnum.mustache @@ -11,7 +11,7 @@ import com.google.gson.stream.JsonWriter; {{/gson}} /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + * {{classname}}. {{^description}}Gets or Sets {{{name}}}.{{/description}}{{#description}}{{description}}{{/description}} */ {{#gson}} @JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) @@ -42,6 +42,9 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum {{#jackson}} @JsonCreator {{/jackson}} + /** + * Create {{classname}} from String. + */ public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) { for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { if (String.valueOf(b.value).equals(text)) { @@ -52,6 +55,9 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum } {{#gson}} + /** + * Class for JsonAdapter. + */ public static class Adapter extends TypeAdapter<{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { @Override public void write(final JsonWriter jsonWriter, final {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException { diff --git a/codegen/Templates/java/pojo.mustache b/codegen/Templates/java/pojo.mustache index 7a3a1c8..ea768b2 100644 --- a/codegen/Templates/java/pojo.mustache +++ b/codegen/Templates/java/pojo.mustache @@ -99,33 +99,34 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{^isReadOnly}} {{#isListContainer}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + /** + * Add {{#complexType}}{{complexType}}{{/complexType}}{{^complexType}}{{nameInCamelCase}} item{{/complexType}}. + */ + public void add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{^required}} if (this.{{name}} == null) { this.{{name}} = {{{defaultValue}}}; } {{/required}} this.{{name}}.add({{name}}Item); - return this; } {{/isListContainer}} {{#isMapContainer}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public void put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{^required}} if (this.{{name}} == null) { this.{{name}} = {{{defaultValue}}}; } {{/required}} this.{{name}}.put(key, {{name}}Item); - return this; } {{/isMapContainer}} {{/isReadOnly}} /** {{#description}} - * {{description}} + * {{unescapedDescription}} {{/description}} {{^description}} * Get {{name}} @@ -138,7 +139,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{/maximum}} * @return {{name}} **/ -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{nameInCamelCase}}}") {{#vendorExtensions.extraAnnotation}} {{{vendorExtensions.extraAnnotation}}} {{/vendorExtensions.extraAnnotation}} diff --git a/codegen/generate-java.bash b/codegen/generate-java.bash index d8655d1..7bb5ac6 100755 --- a/codegen/generate-java.bash +++ b/codegen/generate-java.bash @@ -2,7 +2,6 @@ set -euo pipefail specSource="../spec/aspose-barcode-cloud.json" - tempDir=".generated/java" targetDir="../submodules/java" @@ -29,6 +28,8 @@ mv $tempDir/src/main/java/com/aspose/barcode/cloud/model/* $targetDir/src/main/j rm -rf "$targetDir/src/main/java/com/aspose/barcode/cloud/requests/*" mv $tempDir/src/main/java/com/aspose/barcode/cloud/requests/* $targetDir/src/main/java/com/aspose/barcode/cloud/requests rm -f $targetDir/src/main/java/com/aspose/barcode/cloud/*.java +# Ignore some files +rm "$tempDir/src/main/java/com/aspose/barcode/cloud/GzipRequestInterceptor.java" mv $tempDir/src/main/java/com/aspose/barcode/cloud/*.java $targetDir/src/main/java/com/aspose/barcode/cloud rm -rf "$targetDir/docs/*" diff --git a/codegen/generate-node.bash b/codegen/generate-node.bash index c96935b..701b385 100755 --- a/codegen/generate-node.bash +++ b/codegen/generate-node.bash @@ -2,7 +2,6 @@ set -euo pipefail specSource="../spec/aspose-barcode-cloud.json" - tempDir=".generated/node" targetDir="../submodules/node" diff --git a/scripts/generate-all.bash b/scripts/generate-all.bash index a7c5b27..d1145bf 100755 --- a/scripts/generate-all.bash +++ b/scripts/generate-all.bash @@ -2,9 +2,7 @@ set -euo pipefail -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - -pushd "${SCRIPT_DIR}/../codegen" +pushd "$( dirname "${BASH_SOURCE[0]}" )/../codegen" for gen in generate-*.bash do From 14b7e80ad72fee3c2c10c536fe3197d45a331218 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 19 Sep 2023 17:10:59 +0700 Subject: [PATCH 08/14] Java: Configuration added --- codegen/Templates/java/ApiClient.mustache | 69 +++++++------------ codegen/Templates/java/Configuration.mustache | 38 +++++----- codegen/Templates/java/JSON.mustache | 50 ++------------ codegen/Templates/java/api.mustache | 5 -- codegen/Templates/java/pom.mustache | 8 +++ codegen/generate-java.bash | 1 + 6 files changed, 59 insertions(+), 112 deletions(-) diff --git a/codegen/Templates/java/ApiClient.mustache b/codegen/Templates/java/ApiClient.mustache index 2bcf790..40eabe8 100644 --- a/codegen/Templates/java/ApiClient.mustache +++ b/codegen/Templates/java/ApiClient.mustache @@ -61,13 +61,14 @@ public class ApiClient { public final String clientVersion = "{{artifactVersion}}"; private String baseUrl = "{{hostWithoutBasePath}}"; + private String tokenUrl = baseUrl + "/connect/token"; private String clientId; private String clientSecret; private boolean debugging = false; private final Map defaultHeaderMap = new HashMap<>(); private String tempFolderPath = null; - private OkHttpClient httpClient; - private JSON json; + private final OkHttpClient httpClient; + private final JSON json; private HttpLoggingInterceptor loggingInterceptor; private String accessToken; @@ -75,7 +76,7 @@ public class ApiClient { * Constructor for ApiClient with clientId and clientSecret */ public ApiClient(String clientId, String clientSecret) { - this(clientId, clientSecret, null); + this(clientId, clientSecret, null, null); } /** @@ -86,6 +87,19 @@ public class ApiClient { this.setAccessToken(accessToken); } + /** Constructor for ApiClient with clientId, clientSecret, baseUrl and tokenUrl */ + public ApiClient(String clientId, String clientSecret, String baseUrl, String tokenUrl) { + this(); + this.clientId = clientId; + this.clientSecret = clientSecret; + if (baseUrl != null) { + this.baseUrl = baseUrl; + } + if (tokenUrl != null) { + this.tokenUrl = tokenUrl; + } + } + protected ApiClient() { httpClient = new OkHttpClient(); @@ -104,15 +118,6 @@ public class ApiClient { setReadTimeout(60_000); } - private ApiClient(String clientId, String clientSecret, String baseUrl) { - this(); - this.clientId = clientId; - this.clientSecret = clientSecret; - if (baseUrl != null) { - this.baseUrl = baseUrl; - } - } - /** * Get base path. * @@ -131,33 +136,6 @@ public class ApiClient { return httpClient; } - /** - * Set HTTP client. - * - * @param httpClient An instance of OkHttpClient - */ - public void setHttpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - */ - public void setJSON(JSON json) { - this.json = json; - } - {{#joda}} public void setDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setDateTimeFormat(dateFormat); @@ -230,7 +208,7 @@ 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 tempopary folder. + * the system's default temporary folder. * * @see createTempFile * @return Temporary folder path @@ -451,7 +429,7 @@ public class ApiClient { return accept; } } - return StringUtil.join(accepts, ","); + return String.join(",", accepts); } /** @@ -528,7 +506,7 @@ public class ApiClient { throw new ApiException(e); } - if (respBody == null || "".equals(respBody)) { + if (respBody == null || respBody.isEmpty()) { return null; } @@ -609,7 +587,7 @@ public class ApiClient { public File prepareDownloadFile(Response response) throws IOException { String filename = null; String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { + if (contentDisposition != null && !contentDisposition.isEmpty()) { // Get filename from the Content-Disposition header. Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); Matcher matcher = pattern.matcher(contentDisposition); @@ -722,7 +700,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has a 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()) { @@ -964,10 +942,9 @@ public class ApiClient { .addEncoded("client_secret", clientSecret) .build(); - String url = baseUrl + "/connect/token"; Request request = new Request.Builder() - .url(url) + .url(tokenUrl) .post(requestBody) .addHeader("Content-Type", " application/x-www-form-urlencoded") .build(); diff --git a/codegen/Templates/java/Configuration.mustache b/codegen/Templates/java/Configuration.mustache index 6caf1b1..c2162f4 100644 --- a/codegen/Templates/java/Configuration.mustache +++ b/codegen/Templates/java/Configuration.mustache @@ -2,29 +2,33 @@ package {{invokerPackage}}; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + /** * Class for storing configuration of the SDK. */ public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + public String ClientId = "Client Id from https://dashboard.aspose.cloud/applications"; + public String ClientSecret = "Client Secret from https://dashboard.aspose.cloud/applications"; + public String ApiBaseUrl = "{{hostWithoutBasePath}}"; + public String TokenUrl = ApiBaseUrl + "/connect/token"; + public String AccessToken = null; - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; + /** Build ApiClient from configuration. */ + public ApiClient buildApiClient() { + if (AccessToken != null) { + return new ApiClient(AccessToken); + } + return new ApiClient(ClientId, ClientSecret, ApiBaseUrl, TokenUrl); } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; + /** Load configuration from file. */ + public static Configuration loadFromFile(File file) throws IOException { + String content = String.join("\n", Files.readAllLines(file.toPath())); + Configuration loadedConfig = new JSON().deserialize(content, Configuration.class); + + return loadedConfig; } } diff --git a/codegen/Templates/java/JSON.mustache b/codegen/Templates/java/JSON.mustache index 41b2416..7757fc9 100644 --- a/codegen/Templates/java/JSON.mustache +++ b/codegen/Templates/java/JSON.mustache @@ -29,7 +29,6 @@ import org.threeten.bp.format.DateTimeFormatter; import okio.ByteString; import java.io.IOException; -import java.io.StringReader; import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; @@ -48,17 +47,6 @@ import java.util.HashMap; */ public class JSON { private Gson gson; - private boolean isLenientOnJson = false; - private final DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private final SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - {{#joda}} - private DateTimeTypeAdapter dateTimeTypeAdapter = new DateTimeTypeAdapter(); - private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - {{/joda}} - {{#jsr310}} - private final OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private final LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - {{/jsr310}} private static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder(); @@ -66,6 +54,7 @@ public class JSON { {{#disableHtmlEscaping}} builder.disableHtmlEscaping(); {{/disableHtmlEscaping}} + builder.setPrettyPrinting().create(); return builder; } @@ -75,15 +64,15 @@ public class JSON { public JSON() { ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); gson = createGson() - .registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(Date.class, new DateTypeAdapter()) + .registerTypeAdapter(java.sql.Date.class, new SqlDateTypeAdapter()) {{#joda}} .registerTypeAdapter(DateTime.class, dateTimeTypeAdapter) .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) {{/joda}} {{#jsr310}} - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) {{/jsr310}} .registerTypeAdapter(byte[].class, byteArrayAdapter) .create(); @@ -107,10 +96,6 @@ public class JSON { this.gson = gson; } - public void setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - } - /** * Serialize the given Java object into JSON string. * @@ -131,13 +116,7 @@ public class JSON { @SuppressWarnings("unchecked") public T deserialize(String body, Type returnType) { try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } + return gson.fromJson(body, returnType); } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; @@ -347,14 +326,6 @@ public class JSON { } } - public void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - } - - public void setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - } - {{/jsr310}} /** * Gson TypeAdapter for java.sql.Date type @@ -454,13 +425,4 @@ public class JSON { } } } - - public void setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - } - - public void setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - } - } diff --git a/codegen/Templates/java/api.mustache b/codegen/Templates/java/api.mustache index 2779183..cb0973d 100644 --- a/codegen/Templates/java/api.mustache +++ b/codegen/Templates/java/api.mustache @@ -6,7 +6,6 @@ import {{invokerPackage}}.ApiCallback; import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiResponse; -import {{invokerPackage}}.Configuration; import {{invokerPackage}}.Pair; import {{invokerPackage}}.ProgressRequestBody; import {{invokerPackage}}.ProgressResponseBody; @@ -50,10 +49,6 @@ import java.util.Map; public class {{classname}} { private final ApiClient {{localVariablePrefix}}apiClient; - public {{classname}}() { - this(Configuration.getDefaultApiClient()); - } - public {{classname}}(ApiClient apiClient) { this.{{localVariablePrefix}}apiClient = apiClient; } diff --git a/codegen/Templates/java/pom.mustache b/codegen/Templates/java/pom.mustache index 63113e5..de9d2af 100644 --- a/codegen/Templates/java/pom.mustache +++ b/codegen/Templates/java/pom.mustache @@ -49,6 +49,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + org.apache.maven.plugins maven-enforcer-plugin diff --git a/codegen/generate-java.bash b/codegen/generate-java.bash index 7bb5ac6..b10c603 100755 --- a/codegen/generate-java.bash +++ b/codegen/generate-java.bash @@ -30,6 +30,7 @@ mv $tempDir/src/main/java/com/aspose/barcode/cloud/requests/* $targetDir/src/mai rm -f $targetDir/src/main/java/com/aspose/barcode/cloud/*.java # Ignore some files rm "$tempDir/src/main/java/com/aspose/barcode/cloud/GzipRequestInterceptor.java" +rm "$tempDir/src/main/java/com/aspose/barcode/cloud/StringUtil.java" mv $tempDir/src/main/java/com/aspose/barcode/cloud/*.java $targetDir/src/main/java/com/aspose/barcode/cloud rm -rf "$targetDir/docs/*" From 078f501f9e61a31910604218d5c9dc0ddb0dbf42 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 19 Sep 2023 23:15:45 +0700 Subject: [PATCH 09/14] Update Maven plugin versions Remove attach test jar --- codegen/Templates/java/pom.mustache | 43 ++++------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/codegen/Templates/java/pom.mustache b/codegen/Templates/java/pom.mustache index de9d2af..cb91bc8 100644 --- a/codegen/Templates/java/pom.mustache +++ b/codegen/Templates/java/pom.mustache @@ -52,6 +52,7 @@ org.apache.maven.plugins maven-compiler-plugin + 3.11.0 8 8 @@ -60,7 +61,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.4.1 enforce-maven @@ -70,29 +71,13 @@ - 2.2.0 + 3.8.1 - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - maven-dependency-plugin @@ -107,28 +92,10 @@ - - - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - - - - jar - test-jar - - - - - - - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.4.0 add_sources @@ -163,7 +130,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.3.0 attach-sources From 32166a2c6c92660ce1e48fa64d087d287d5a1550 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Thu, 21 Sep 2023 19:33:32 +0700 Subject: [PATCH 10/14] New Swagger spec --- spec/aspose-barcode-cloud.json | 195 ++++++++++++++++++++------------- 1 file changed, 120 insertions(+), 75 deletions(-) diff --git a/spec/aspose-barcode-cloud.json b/spec/aspose-barcode-cloud.json index 052a0c6..df2430c 100644 --- a/spec/aspose-barcode-cloud.json +++ b/spec/aspose-barcode-cloud.json @@ -113,7 +113,8 @@ "Mailmark", "GS1DotCode", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec" ] }, { @@ -560,7 +561,8 @@ "Mailmark", "GS1DotCode", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec" ] }, { @@ -1156,7 +1158,9 @@ "HIBCDataMatrixPAS", "HIBCQRPAS", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec", + "GS1CompositeBar" ] }, { @@ -1581,7 +1585,9 @@ "HIBCDataMatrixPAS", "HIBCQRPAS", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec", + "GS1CompositeBar" ] }, { @@ -1718,7 +1724,9 @@ "HIBCDataMatrixPAS", "HIBCQRPAS", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec", + "GS1CompositeBar" ] }, { @@ -2821,7 +2829,8 @@ "Mailmark", "GS1DotCode", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec" ], "enum": [ "Codabar", @@ -2893,7 +2902,8 @@ "Mailmark", "GS1DotCode", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec" ] }, "CodeLocation": { @@ -3451,7 +3461,24 @@ }, "TextEncoding": { "type": "string", - "description": "Sets the encoding of codetext." + "description": "DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array.\n Sets the encoding of codetext." + }, + "EncodeMode": { + "description": "Encoding mode for Aztec barcodes.\nDefault value: Auto", + "$ref": "#/definitions/AztecEncodeMode" + }, + "ECIEncoding": { + "description": "Identifies ECI encoding. Used when AztecEncodeMode is Auto. Default value: ISO-8859-1.", + "$ref": "#/definitions/ECIEncodings" + }, + "IsReaderInitialization": { + "type": "boolean", + "description": "Used to instruct the reader to interpret the data contained within the symbol\nas programming for reader initialization." + }, + "LayersCount": { + "type": "integer", + "description": "Gets or sets layers count of Aztec symbol. Layers count should be in range from\n1 to 3 for Compact mode and in range from 1 to 32 for Full Range mode. Default\nvalue: 0 (auto).", + "format": "int32" } } }, @@ -3471,6 +3498,82 @@ "Rune" ] }, + "AztecEncodeMode": { + "type": "string", + "description": "", + "x-enumNames": [ + "Auto", + "Bytes", + "ExtendedCodetext" + ], + "enum": [ + "Auto", + "Bytes", + "ExtendedCodetext" + ] + }, + "ECIEncodings": { + "type": "string", + "description": "", + "x-enumNames": [ + "NONE", + "ISO_8859_1", + "ISO_8859_2", + "ISO_8859_3", + "ISO_8859_4", + "ISO_8859_5", + "ISO_8859_6", + "ISO_8859_7", + "ISO_8859_8", + "ISO_8859_9", + "ISO_8859_10", + "ISO_8859_11", + "ISO_8859_13", + "ISO_8859_14", + "ISO_8859_15", + "ISO_8859_16", + "Shift_JIS", + "Win1250", + "Win1251", + "Win1252", + "Win1256", + "UTF16BE", + "UTF8", + "US_ASCII", + "Big5", + "GB18030", + "EUC_KR" + ], + "enum": [ + "NONE", + "ISO_8859_1", + "ISO_8859_2", + "ISO_8859_3", + "ISO_8859_4", + "ISO_8859_5", + "ISO_8859_6", + "ISO_8859_7", + "ISO_8859_8", + "ISO_8859_9", + "ISO_8859_10", + "ISO_8859_11", + "ISO_8859_13", + "ISO_8859_14", + "ISO_8859_15", + "ISO_8859_16", + "Shift_JIS", + "Win1250", + "Win1251", + "Win1252", + "Win1256", + "UTF16BE", + "UTF8", + "US_ASCII", + "Big5", + "GB18030", + "EUC_KR" + ] + }, "CodabarParams": { "type": "object", "description": "Codabar parameters.", @@ -3616,7 +3719,7 @@ }, "TextEncoding": { "type": "string", - "description": "Encoding of codetext." + "description": "DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array.\n Sets the encoding of codetext." }, "Columns": { "type": "integer", @@ -3906,68 +4009,6 @@ "ExtendedCodetext" ] }, - "ECIEncodings": { - "type": "string", - "description": "", - "x-enumNames": [ - "NONE", - "ISO_8859_1", - "ISO_8859_2", - "ISO_8859_3", - "ISO_8859_4", - "ISO_8859_5", - "ISO_8859_6", - "ISO_8859_7", - "ISO_8859_8", - "ISO_8859_9", - "ISO_8859_10", - "ISO_8859_11", - "ISO_8859_13", - "ISO_8859_14", - "ISO_8859_15", - "ISO_8859_16", - "Shift_JIS", - "Win1250", - "Win1251", - "Win1252", - "Win1256", - "UTF16BE", - "UTF8", - "US_ASCII", - "Big5", - "GB18030", - "EUC_KR" - ], - "enum": [ - "NONE", - "ISO_8859_1", - "ISO_8859_2", - "ISO_8859_3", - "ISO_8859_4", - "ISO_8859_5", - "ISO_8859_6", - "ISO_8859_7", - "ISO_8859_8", - "ISO_8859_9", - "ISO_8859_10", - "ISO_8859_11", - "ISO_8859_13", - "ISO_8859_14", - "ISO_8859_15", - "ISO_8859_16", - "Shift_JIS", - "Win1250", - "Win1251", - "Win1252", - "Win1256", - "UTF16BE", - "UTF8", - "US_ASCII", - "Big5", - "GB18030", - "EUC_KR" - ] - }, "ITFParams": { "type": "object", "description": "ITF parameters.", @@ -4071,7 +4112,7 @@ }, "TextEncoding": { "type": "string", - "description": "Encoding of codetext." + "description": "DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array.\n Sets the encoding of codetext." }, "Columns": { "type": "integer", @@ -4255,7 +4296,7 @@ }, "TextEncoding": { "type": "string", - "description": "Encoding of codetext." + "description": "DEPRECATED: This property is obsolete and will be removed in future releases. Unicode symbols detection and encoding will be processed in Auto mode with Extended Channel Interpretation charset designator. Using of own encodings requires manual CodeText encoding into byte[] array.\n Sets the encoding of codetext." }, "EncodeType": { "description": "QR / MicroQR selector mode. Select ForceQR for standard QR symbols, Auto for MicroQR.", @@ -4901,7 +4942,9 @@ "HIBCDataMatrixPAS", "HIBCQRPAS", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec", + "GS1CompositeBar" ], "enum": [ "all", @@ -4984,7 +5027,9 @@ "HIBCDataMatrixPAS", "HIBCQRPAS", "HanXin", - "GS1HanXin" + "GS1HanXin", + "GS1Aztec", + "GS1CompositeBar" ] }, "ChecksumValidation": { From e6f3174cf7d2f91e4f093eb7d225bf51eb2837c0 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Thu, 21 Sep 2023 19:33:56 +0700 Subject: [PATCH 11/14] Fix start-release.bash script --- scripts/start-release.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start-release.bash b/scripts/start-release.bash index 9223b59..fae4a0e 100755 --- a/scripts/start-release.bash +++ b/scripts/start-release.bash @@ -18,7 +18,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd "${SCRIPT_DIR}/.." echo "Update Swagger specification..." -./update_swagger_spec.bash +./scripts/update_swagger_spec.bash echo "Switching to ${branch_name}" git switch --create "${branch_name}" || git switch "${branch_name}" From 959d6df432e1c1d261be643ec1e0deaac9112770 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Thu, 21 Sep 2023 19:34:18 +0700 Subject: [PATCH 12/14] Release 23.9 --- codegen/config-android.json | 2 +- codegen/config-dart.json | 2 +- codegen/config-go.json | 2 +- codegen/config-java.json | 2 +- codegen/config-php.json | 2 +- codegen/config-python.json | 2 +- codegen/config.json | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/codegen/config-android.json b/codegen/config-android.json index 6af275c..f91dc17 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": "23.8.0", + "artifactVersion": "23.9.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 39e0c4e..e8df6ec 100644 --- a/codegen/config-dart.json +++ b/codegen/config-dart.json @@ -2,6 +2,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": "0.23.8", + "pubVersion": "0.23.9", "useEnumExtension": true } \ No newline at end of file diff --git a/codegen/config-go.json b/codegen/config-go.json index b776e59..85cb416 100644 --- a/codegen/config-go.json +++ b/codegen/config-go.json @@ -1,4 +1,4 @@ { "packageName": "barcode", - "packageVersion": "0.2308.0" + "packageVersion": "0.2309.0" } \ No newline at end of file diff --git a/codegen/config-java.json b/codegen/config-java.json index b3c454a..2600ab8 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": "23.8.0", + "artifactVersion": "23.9.0", "developerEmail": "denis.averin@aspose.com", "developerName": "Denis Averin", "developerOrganization": "Aspose", diff --git a/codegen/config-php.json b/codegen/config-php.json index 28599e6..c2b9813 100644 --- a/codegen/config-php.json +++ b/codegen/config-php.json @@ -1,4 +1,4 @@ { - "artifactVersion": "23.8.0", + "artifactVersion": "23.9.0", "invokerPackage": "Aspose\\BarCode" } \ No newline at end of file diff --git a/codegen/config-python.json b/codegen/config-python.json index b2549f2..d5d7e7f 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": "23.8.0", + "packageVersion": "23.9.0", "projectName": "aspose-barcode-cloud" } \ No newline at end of file diff --git a/codegen/config.json b/codegen/config.json index 895a539..b0b8970 100644 --- a/codegen/config.json +++ b/codegen/config.json @@ -1,8 +1,8 @@ { "artifactVersion": "23.7.0", "npmName": "aspose-barcode-cloud-node", - "npmVersion": "23.8.0", + "npmVersion": "23.9.0", "packageName": "Aspose.BarCode.Cloud.Sdk", - "packageVersion": "23.8.0", + "packageVersion": "23.9.0", "supportsES6": true } \ No newline at end of file From 61a147da9ee5b75935f0f713cb4b3435c8064556 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Fri, 22 Sep 2023 15:14:12 +0700 Subject: [PATCH 13/14] Java 8 (JDK 1.8) --- codegen/Templates/java/README.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/Templates/java/README.mustache b/codegen/Templates/java/README.mustache index 832ac0c..734165b 100644 --- a/codegen/Templates/java/README.mustache +++ b/codegen/Templates/java/README.mustache @@ -23,7 +23,7 @@ This repository contains Aspose.BarCode Cloud SDK for Java source code. This SDK Building the API client library requires: -1. Java 1.7+ +1. Java 8 (JDK 1.8) 2. Maven ## Prerequisites From 36c5a7a302e6c50d9496db17e6f2c411f3789fdd Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Fri, 22 Sep 2023 15:27:03 +0700 Subject: [PATCH 14/14] All SDKs were released --- submodules/android | 2 +- submodules/dart | 2 +- submodules/dotnet | 2 +- submodules/go | 2 +- submodules/java | 2 +- submodules/node | 2 +- submodules/php | 2 +- submodules/python | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/submodules/android b/submodules/android index 4a0e83a..7d5cdc7 160000 --- a/submodules/android +++ b/submodules/android @@ -1 +1 @@ -Subproject commit 4a0e83afbf73e30363492fd5e60fa0f7ab7271d9 +Subproject commit 7d5cdc793cf04afef4594d11e6f40d1b2b301a67 diff --git a/submodules/dart b/submodules/dart index 0b1880e..147b0f5 160000 --- a/submodules/dart +++ b/submodules/dart @@ -1 +1 @@ -Subproject commit 0b1880e71f0c40fe9a5013ceb41825314c42379d +Subproject commit 147b0f5d27308dc27891e947983c528e3543d306 diff --git a/submodules/dotnet b/submodules/dotnet index e69d0bc..54c8bb9 160000 --- a/submodules/dotnet +++ b/submodules/dotnet @@ -1 +1 @@ -Subproject commit e69d0bcaa0053172e395084803930e66f95f5e37 +Subproject commit 54c8bb93c5cfb062c4c2eb6a1c22165710d23bdc diff --git a/submodules/go b/submodules/go index 452a23c..f226804 160000 --- a/submodules/go +++ b/submodules/go @@ -1 +1 @@ -Subproject commit 452a23ca13e6055fabb6a1d4654e6fa3426850ed +Subproject commit f226804216e637cff4228dbde335398b23a82882 diff --git a/submodules/java b/submodules/java index 5decb48..bd8256f 160000 --- a/submodules/java +++ b/submodules/java @@ -1 +1 @@ -Subproject commit 5decb48d641a06d87603114e35afd4ae100fc580 +Subproject commit bd8256ff446ccd05b822c28489ec9f5ada3526e0 diff --git a/submodules/node b/submodules/node index aa561da..a700c3f 160000 --- a/submodules/node +++ b/submodules/node @@ -1 +1 @@ -Subproject commit aa561daca6728d30eb17b35ff125ecaed2b49469 +Subproject commit a700c3f8a983ab9eaaf4000d548b69067525e788 diff --git a/submodules/php b/submodules/php index 8d0276b..c966cb6 160000 --- a/submodules/php +++ b/submodules/php @@ -1 +1 @@ -Subproject commit 8d0276b3799df26782ae48aadd9389e73ac5d68d +Subproject commit c966cb6f3020db56f28ba26a11881579773d8088 diff --git a/submodules/python b/submodules/python index 6a72adc..919e9f1 160000 --- a/submodules/python +++ b/submodules/python @@ -1 +1 @@ -Subproject commit 6a72adca5a61cd522293d11633ac9995217e8a7b +Subproject commit 919e9f10b395734ceac6578b907ae73b709317cd