From 6030ad9d4a0997d1655c9448131cc1d897ebda0c Mon Sep 17 00:00:00 2001 From: Denis Averin <59285247+Denis-Averin@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:38:29 +0700 Subject: [PATCH] Release 24.4 (#99) * Version 24.4.0 * Fix script start-release.bash * Fix cleanup in generate-* scripts * Update submodules * Fix broken url check --- LICENSE | 2 +- codegen/Templates/LICENSE | 21 ------ .../Templates/csharp/Configuration.mustache | 5 -- codegen/Templates/csharp/api.mustache | 22 ++++-- codegen/Templates/csharp/api_test.mustache | 26 +++++++ codegen/Templates/csharp/model.mustache | 4 -- .../Templates/csharp/requestModel.mustache | 5 +- codegen/Templates/dart/api.mustache | 29 +++++--- codegen/Templates/dart/api_client.mustache | 7 +- codegen/Templates/dart/enum.mustache | 7 +- codegen/Templates/dart/pubspec.mustache | 2 +- codegen/Templates/go/api.mustache | 30 +++++--- codegen/Templates/go/client.mustache | 4 +- codegen/Templates/go/configuration.mustache | 1 - codegen/Templates/go/model.mustache | 1 - codegen/Templates/go/response.mustache | 3 +- codegen/Templates/java/ApiClient.mustache | 19 +++-- codegen/Templates/java/Configuration.mustache | 2 - codegen/Templates/java/JSON.mustache | 2 - codegen/Templates/java/Pair.mustache | 2 - codegen/Templates/java/StringUtil.mustache | 2 - codegen/Templates/java/apiException.mustache | 2 - codegen/Templates/java/model.mustache | 37 ++++++++++ codegen/Templates/java/pojo.mustache | 4 +- codegen/Templates/nodejs/api.mustache | 54 +++++++------- .../Templates/nodejs/docs/tsconfig.mustache | 17 ++--- codegen/Templates/nodejs/git_push.sh.mustache | 3 - codegen/Templates/php/ApiException.mustache | 4 +- codegen/Templates/php/Configuration.mustache | 4 +- codegen/Templates/php/HeaderSelector.mustache | 4 +- .../Templates/php/ObjectSerializer.mustache | 4 +- codegen/Templates/php/api.mustache | 39 +++++++---- codegen/Templates/php/model.mustache | 4 -- codegen/Templates/php/requestModel.mustache | 22 ------ .../Templates/python/__init__model.mustache | 9 +++ .../Templates/python/__init__package.mustache | 4 +- codegen/Templates/python/api.mustache | 1 - codegen/Templates/python/api_client.mustache | 2 +- .../Templates/python/configuration.mustache | 3 +- codegen/Templates/python/model.mustache | 2 - codegen/Templates/python/rest.mustache | 1 - codegen/Templates/python/setup.mustache | 1 - codegen/config-android.json | 2 +- codegen/config-dart.json | 7 +- codegen/config-go.json | 2 +- codegen/config-java.json | 2 +- codegen/config-php.json | 2 +- codegen/config-python.json | 2 +- codegen/config.json | 4 +- codegen/generate-android.bash | 4 +- codegen/generate-dart.bash | 3 +- codegen/generate-dotnet.bash | 13 +++- codegen/generate-go.bash | 4 +- codegen/generate-java.bash | 10 +-- codegen/generate-node.bash | 6 +- codegen/generate-php.bash | 2 +- codegen/generate-python.bash | 2 +- scripts/check-urls.py | 18 +++-- scripts/echo_server.bash | 10 +++ scripts/start-release.bash | 2 +- scripts/update_swagger_spec.bash | 1 + spec/aspose-barcode-cloud.json | 70 +++++++++++++++++-- submodules/android | 2 +- submodules/dart | 2 +- submodules/dotnet | 2 +- submodules/go | 2 +- submodules/java | 2 +- submodules/node | 2 +- submodules/php | 2 +- submodules/python | 2 +- 70 files changed, 358 insertions(+), 241 deletions(-) delete mode 100644 codegen/Templates/LICENSE create mode 100644 codegen/Templates/csharp/api_test.mustache create mode 100644 codegen/Templates/java/model.mustache create mode 100644 codegen/Templates/python/__init__model.mustache create mode 100755 scripts/echo_server.bash diff --git a/LICENSE b/LICENSE index e16b0db..efcf55b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Aspose Pty Ltd +Copyright (c) 2024 Aspose Pty Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/codegen/Templates/LICENSE b/codegen/Templates/LICENSE deleted file mode 100644 index efcf55b..0000000 --- a/codegen/Templates/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 Aspose Pty Ltd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/codegen/Templates/csharp/Configuration.mustache b/codegen/Templates/csharp/Configuration.mustache index 5ac14ee..d819be4 100644 --- a/codegen/Templates/csharp/Configuration.mustache +++ b/codegen/Templates/csharp/Configuration.mustache @@ -1,8 +1,3 @@ -{{>partial_header}} -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// - using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/codegen/Templates/csharp/api.mustache b/codegen/Templates/csharp/api.mustache index 3fdefca..fa03a19 100644 --- a/codegen/Templates/csharp/api.mustache +++ b/codegen/Templates/csharp/api.mustache @@ -1,9 +1,6 @@ {{>partial_header}} -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// - using System.Collections.Generic; +using System.Net.Http; using System.Text.RegularExpressions; using System.Threading.Tasks; using {{packageName}}.Interfaces; @@ -89,7 +86,7 @@ namespace {{packageName}}.Api {{#-first}}var headerParams = new Dictionary();{{/-first}} {{/headerParams}} {{#formParams}} - {{#-first}}var formParams = new Dictionary();{{/-first}} + {{#-first}}var formParams = new MultipartFormDataContent();{{/-first}} {{/formParams}} {{#pathParams}} resourcePath = UrlHelper.AddPathParameter(resourcePath, "{{paramName}}", request.{{baseName}}); @@ -104,8 +101,19 @@ namespace {{packageName}}.Api if (request.{{baseName}} != null) { {{#isFile}} - formParams.Add("{{paramName}}", ApiInvoker.ToFileInfo(request.{{baseName}}, "{{baseName}}")); - {{/isFile}}{{^isFile}}formParams.Add("{{baseName}}", request.{{baseName}}); // form parameter{{/isFile}} + formParams.Add(new StreamContent(request.{{baseName}}), "{{baseName}}", "{{paramName}}.png"); + {{/isFile}} + {{^isFile}} + {{#isCollectionFormatMulti}} + foreach (var oneParam in request.{{baseName}}) + { + formParams.Add(new StringContent(oneParam.ToString()), "{{baseName}}"); + } + {{/isCollectionFormatMulti}} + {{#isPrimitiveType}} + formParams.Add(new StringContent(request.{{baseName}}.ToString()), "{{baseName}}"); + {{/isPrimitiveType}} + {{/isFile}} } {{/formParams}} {{#vendorExtensions}}{{#x-binary-result}} return await _apiInvoker.InvokeBinaryApiAsync( diff --git a/codegen/Templates/csharp/api_test.mustache b/codegen/Templates/csharp/api_test.mustache new file mode 100644 index 0000000..8092daf --- /dev/null +++ b/codegen/Templates/csharp/api_test.mustache @@ -0,0 +1,26 @@ +{{! Used as Interfaces.cs }} +using System.Threading.Tasks; +using {{packageName}}.Model; +using {{packageName}}.Model.Requests; + +namespace {{packageName}}.Interfaces +{ {{#operations}} + /// + /// {{classname}} interface + /// + public interface I{{classname}} + { + {{#operation}} + + /// + /// {{summary}} {{notes}} + /// + /// Request. + /// + /// A task representing the asynchronous operation.{{#returnType}} The result is a .{{/returnType}} + /// + {{#returnType}}Task<{{{returnType}}}>{{/returnType}}{{^returnType}}Task{{/returnType}} {{nickname}}Async({{nickname}}Request request); + {{/operation}} + } + {{/operations}} +} diff --git a/codegen/Templates/csharp/model.mustache b/codegen/Templates/csharp/model.mustache index 025d5b6..4b8ddb6 100644 --- a/codegen/Templates/csharp/model.mustache +++ b/codegen/Templates/csharp/model.mustache @@ -1,9 +1,5 @@ {{#models}} {{#model}} -{{>partial_header}} -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// {{^isEnum}} using System; diff --git a/codegen/Templates/csharp/requestModel.mustache b/codegen/Templates/csharp/requestModel.mustache index a4c919a..2fa2e19 100644 --- a/codegen/Templates/csharp/requestModel.mustache +++ b/codegen/Templates/csharp/requestModel.mustache @@ -25,17 +25,16 @@ // // -------------------------------------------------------------------------------------------------------------------- -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace {{packageName}}.Model.Requests { /// /// Request model for operation. /// + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] public class {{nickname}}Request{{#vendorExtensions}}{{#x-csharp-implements}} : {{x-csharp-implements}}{{/x-csharp-implements}}{{/vendorExtensions}} { {{#hasParams}} diff --git a/codegen/Templates/dart/api.mustache b/codegen/Templates/dart/api.mustache index 3fc11b3..abd2903 100644 --- a/codegen/Templates/dart/api.mustache +++ b/codegen/Templates/dart/api.mustache @@ -1,7 +1,8 @@ import 'dart:typed_data' show Uint8List; -import 'package:http/http.dart' show MultipartFile, MultipartRequest; +import 'package:http/http.dart' show MultipartFile; +import '../http/multipart_request_plus.dart'; import '../../aspose_barcode_cloud.dart'; import '../api_helper.dart'; @@ -52,20 +53,30 @@ class {{classname}} { {{#hasFormParams}} if(contentType.startsWith("multipart/form-data")) { bool hasFields = false; - MultipartRequest? mp; + MultipartRequestPlus? mp; {{#formParams}}{{#notFile}} if ({{paramName}} != null) { hasFields = true; - mp.fields['{{baseName}}'] = parameterToString({{paramName}}); + {{#isCollectionFormatMulti}} + final List stringValues = {{paramName}}.map((i) => parameterToString(i)).toList(); + mp.fields['{{baseName}}'] = stringValues; + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + mp.fields['{{baseName}}'] = [parameterToString({{paramName}})]; + {{/isCollectionFormatMulti}} } {{/notFile}}{{#isFile}} - mp = MultipartRequest('{{httpMethod}}', Uri.parse(requestPath)); - // ignore: unnecessary_null_comparison + mp = MultipartRequestPlus('{{httpMethod}}', Uri.parse(requestPath)); + {{#required}} + hasFields = true; + mp.files.add({{paramName}}); + {{/required}} + {{^required}} if ({{paramName}} != null) { hasFields = true; - mp.fields['{{baseName}}'] = {{paramName}}.field; mp.files.add({{paramName}}); } + {{/required}} {{/isFile}}{{/formParams}} if (hasFields) { @@ -73,9 +84,9 @@ class {{classname}} { } } else { - {{#formParams}}{{#notFile}}if ({{paramName}} != null) - formParams['{{baseName}}'] = parameterToString({{paramName}});{{/notFile}} - {{/formParams}} + {{#formParams}}{{#notFile}}if ({{paramName}} != null) + formParams['{{baseName}}'] = parameterToString({{paramName}});{{/notFile}} + {{/formParams}} } {{/hasFormParams}} diff --git a/codegen/Templates/dart/api_client.mustache b/codegen/Templates/dart/api_client.mustache index ed56bca..78b2570 100644 --- a/codegen/Templates/dart/api_client.mustache +++ b/codegen/Templates/dart/api_client.mustache @@ -2,8 +2,9 @@ import 'dart:convert' show json; -import 'package:http/http.dart' as Http show Client, MultipartRequest, Response; +import 'package:http/http.dart' as Http show Client, Response; +import 'http/multipart_request_plus.dart'; import '../aspose_barcode_cloud.dart'; import 'api_helper.dart'; import 'auth/authentication.dart'; @@ -140,8 +141,8 @@ class ApiClient { headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; - if(body is Http.MultipartRequest) { - final request = Http.MultipartRequest(method, Uri.parse(url)); + if(body is MultipartRequestPlus) { + final request = MultipartRequestPlus(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); request.headers.addAll(body.headers); diff --git a/codegen/Templates/dart/enum.mustache b/codegen/Templates/dart/enum.mustache index ab3112f..4427f87 100644 --- a/codegen/Templates/dart/enum.mustache +++ b/codegen/Templates/dart/enum.mustache @@ -7,12 +7,13 @@ class {{classname}} { {{classname}}._internal(this._value); {{#allowableValues}} - {{#enumVars}} + {{#values}} {{#description}} /// {{description}} {{/description}} - static {{classname}} {{name}} = {{classname}}._internal({{{value}}}); - {{/enumVars}} + // ignore: non_constant_identifier_names + static final {{classname}} {{.}} = {{classname}}._internal("{{.}}"); + {{/values}} {{/allowableValues}} /// Creates a {{classname}} instance from a JSON representation. diff --git a/codegen/Templates/dart/pubspec.mustache b/codegen/Templates/dart/pubspec.mustache index e264f47..f7609e5 100644 --- a/codegen/Templates/dart/pubspec.mustache +++ b/codegen/Templates/dart/pubspec.mustache @@ -11,7 +11,7 @@ platforms: windows: environment: - sdk: ">=2.12.0 <4.0.0" + sdk: ">=2.17.0 <4.0.0" dependencies: http: '>=0.13.0 <2.0.0' diff --git a/codegen/Templates/go/api.mustache b/codegen/Templates/go/api.mustache index 40caa51..e195619 100644 --- a/codegen/Templates/go/api.mustache +++ b/codegen/Templates/go/api.mustache @@ -1,10 +1,9 @@ -{{>partial_header}} package {{packageName}} {{#operations}} import ( "context" - "io/ioutil" + "io" "net/http" "net/url" "reflect" @@ -44,6 +43,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} httpMethod = strings.ToUpper("{{httpMethod}}") postBody interface{} fileName string + fileFieldName string fileBytes []byte {{#returnType}}returnValue {{#isResponseFile}}[]byte{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/returnType}} ) @@ -159,24 +159,25 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} {{#hasFormParams}} {{#formParams}} {{#isFile}} -{{#required}} + {{#required}} requestFile := {{paramName}} if requestFile != nil { fileName = requestFile.Name() + fileFieldName = "{{baseName}}" var err error - fileBytes, err = ioutil.ReadAll(requestFile) + fileBytes, err = io.ReadAll(io.Reader(requestFile)) if err != nil { return returnValue, nil, err } } -{{/required}} -{{^required}} + {{/required}} + {{^required}} if optionals != nil && optionals.{{vendorExtensions.x-exportParamName}}.IsSet() { if requestFile, fileOk := optionals.{{vendorExtensions.x-exportParamName}}.Value().({{dataType}}); fileOk { fileName = requestFile.Name() var err error - fileBytes, err = ioutil.ReadAll(requestFile) + fileBytes, err = io.ReadAll(io.Reader(requestFile)) if err != nil { return returnValue, nil, err } @@ -187,7 +188,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} return {{#returnType}}returnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}} or []byte") } } -{{/required}} + {{/required}} {{/isFile}} {{^isFile}} {{#required}} @@ -195,7 +196,16 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} {{/required}} {{^required}} if optionals != nil && optionals.{{vendorExtensions.x-exportParamName}}.IsSet() { + {{#isCollectionFormatMulti}} + values := reflect.ValueOf(optionals.{{vendorExtensions.x-exportParamName}}.Value()); + for i := 0; i < values.Len(); i++ { + item := values.Index(i) + formParams.Add("{{baseName}}", parameterToString(item, "")) + } + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} formParams.Add("{{baseName}}", parameterToString(optionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) + {{/isCollectionFormatMulti}} } {{/required}} {{/isFile}} @@ -235,7 +245,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} } {{/isApiKey}} {{/authMethods}} - r, err := a.client.prepareRequest(ctx, requestPath, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes) + r, err := a.client.prepareRequest(ctx, requestPath, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileFieldName, fileBytes) if err != nil { return {{#returnType}}returnValue, {{/returnType}}nil, err } @@ -245,7 +255,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} return {{#returnType}}returnValue, {{/returnType}}httpResponse, err } - responseBody, err := ioutil.ReadAll(httpResponse.Body) + responseBody, err := io.ReadAll(io.Reader(httpResponse.Body)) httpResponse.Body.Close() if err != nil { return {{#returnType}}returnValue, {{/returnType}}httpResponse, err diff --git a/codegen/Templates/go/client.mustache b/codegen/Templates/go/client.mustache index 2673086..ff95a28 100644 --- a/codegen/Templates/go/client.mustache +++ b/codegen/Templates/go/client.mustache @@ -1,4 +1,3 @@ -{{>partial_header}} package {{packageName}} import ( @@ -152,6 +151,7 @@ func (c *APIClient) prepareRequest( queryParams netUrl.Values, formParams netUrl.Values, fileName string, + fileFieldName string, fileBytes []byte) (httpReq *http.Request, err error) { var body *bytes.Buffer @@ -196,7 +196,7 @@ func (c *APIClient) prepareRequest( if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) - part, err := w.CreateFormFile("file", filepath.Base(fileName)) + part, err := w.CreateFormFile(fileFieldName, filepath.Base(fileName)) if err != nil { return nil, err } diff --git a/codegen/Templates/go/configuration.mustache b/codegen/Templates/go/configuration.mustache index d3348d7..369aee4 100644 --- a/codegen/Templates/go/configuration.mustache +++ b/codegen/Templates/go/configuration.mustache @@ -1,4 +1,3 @@ -{{>partial_header}} package {{packageName}} import ( diff --git a/codegen/Templates/go/model.mustache b/codegen/Templates/go/model.mustache index 1a00735..e1b3ad9 100644 --- a/codegen/Templates/go/model.mustache +++ b/codegen/Templates/go/model.mustache @@ -1,4 +1,3 @@ -{{>partial_header}} package {{packageName}} {{#models}}{{#imports}} import ({{/imports}}{{#imports}} diff --git a/codegen/Templates/go/response.mustache b/codegen/Templates/go/response.mustache index bfac0bb..3d00a2b 100644 --- a/codegen/Templates/go/response.mustache +++ b/codegen/Templates/go/response.mustache @@ -7,7 +7,6 @@ import ( "fmt" "golang.org/x/oauth2" "io" - "io/ioutil" "net/url" "time" ) @@ -86,7 +85,7 @@ func (js jwtSource) Token() (*oauth2.Token, error) { return nil, fmt.Errorf("jwt: cannot fetch token: %v", err) } defer resp.Body.Close() - body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20)) + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) if err != nil { return nil, fmt.Errorf("jwt: cannot read token: %v", err) } diff --git a/codegen/Templates/java/ApiClient.mustache b/codegen/Templates/java/ApiClient.mustache index c2cc97b..fd2b127 100644 --- a/codegen/Templates/java/ApiClient.mustache +++ b/codegen/Templates/java/ApiClient.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import com.aspose.barcode.cloud.model.ApiErrorResponse; @@ -900,14 +898,25 @@ public class ApiClient { public RequestBody buildRequestBodyMultipart(Map formParams) { MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); + Object paramValue = param.getValue(); + if (paramValue instanceof File) { + File file = (File) paramValue; Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + } else if (paramValue instanceof Collection) { + Collection collection = (Collection) paramValue; + for (Object item : collection) { + Headers partHeaders = + Headers.of( + "Content-Disposition", + "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart( + partHeaders, RequestBody.create(null, parameterToString(item))); + } } else { Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(paramValue))); } } return mpBuilder.build(); diff --git a/codegen/Templates/java/Configuration.mustache b/codegen/Templates/java/Configuration.mustache index c2162f4..db41e45 100644 --- a/codegen/Templates/java/Configuration.mustache +++ b/codegen/Templates/java/Configuration.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import java.io.File; diff --git a/codegen/Templates/java/JSON.mustache b/codegen/Templates/java/JSON.mustache index 7757fc9..b3c9ad5 100644 --- a/codegen/Templates/java/JSON.mustache +++ b/codegen/Templates/java/JSON.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import com.google.gson.Gson; diff --git a/codegen/Templates/java/Pair.mustache b/codegen/Templates/java/Pair.mustache index 2ad217e..246b1c6 100644 --- a/codegen/Templates/java/Pair.mustache +++ b/codegen/Templates/java/Pair.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import java.util.AbstractMap; diff --git a/codegen/Templates/java/StringUtil.mustache b/codegen/Templates/java/StringUtil.mustache index 829c946..587a55a 100644 --- a/codegen/Templates/java/StringUtil.mustache +++ b/codegen/Templates/java/StringUtil.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; /** diff --git a/codegen/Templates/java/apiException.mustache b/codegen/Templates/java/apiException.mustache index ecc3512..f671308 100644 --- a/codegen/Templates/java/apiException.mustache +++ b/codegen/Templates/java/apiException.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import com.aspose.barcode.cloud.model.ApiErrorResponse; diff --git a/codegen/Templates/java/model.mustache b/codegen/Templates/java/model.mustache new file mode 100644 index 0000000..ee00ecf --- /dev/null +++ b/codegen/Templates/java/model.mustache @@ -0,0 +1,37 @@ +package {{package}}; + +{{^supportJava6}} +import java.util.Objects; +import java.util.Arrays; +{{/supportJava6}} +{{#supportJava6}} +import org.apache.commons.lang3.ObjectUtils; +{{/supportJava6}} +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#jackson}} +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{/jackson}} +{{#withXml}} +import javax.xml.bind.annotation.*; +{{/withXml}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/codegen/Templates/java/pojo.mustache b/codegen/Templates/java/pojo.mustache index ea768b2..3152049 100644 --- a/codegen/Templates/java/pojo.mustache +++ b/codegen/Templates/java/pojo.mustache @@ -126,7 +126,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{/isReadOnly}} /** {{#description}} - * {{unescapedDescription}} + * {{description}} {{/description}} {{^description}} * Get {{name}} @@ -138,7 +138,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela * maximum: {{maximum}} {{/maximum}} * @return {{name}} - **/ + */ {{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{nameInCamelCase}}}") {{#vendorExtensions.extraAnnotation}} {{{vendorExtensions.extraAnnotation}}} diff --git a/codegen/Templates/nodejs/api.mustache b/codegen/Templates/nodejs/api.mustache index 689a62f..b23b1a1 100644 --- a/codegen/Templates/nodejs/api.mustache +++ b/codegen/Templates/nodejs/api.mustache @@ -1,13 +1,6 @@ -{{>licenseInfo}} - - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - - import { Configuration } from './Configuration'; import { HttpClient, HttpOptions, HttpResponse, HttpResult } from './httpClient'; +import { Multipart, FormFile, FormParamsType } from './multipart'; export * from './models'; @@ -216,8 +209,13 @@ export class {{classname}} { ){{/pathParams}}; let queryParameters: any = {}; let headerParams: any = (Object as any).assign({}, this.defaultHeaders); +{{#hasFormParams}} + const formParams: FormParamsType = []; +{{/hasFormParams}} {{#formParams}} - let formParams: any = {}; + {{#isFile}} + const fileToUpload = (request.{{paramName}}==null) ? null : new FormFile('{{paramName}}', '{{paramName}}.png', request.{{paramName}}); + {{/isFile}} {{/formParams}} {{#allParams}} @@ -240,26 +238,25 @@ export class {{classname}} { {{/headerParams}} {{#formParams}} + {{^isFile}} if (request.{{paramName}} != null) { - {{#isFile}} - formParams['{{baseName}}'] = request.{{paramName}}; - {{/isFile}} - {{^isFile}} - formParams['{{baseName}}'] = ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}'); - {{/isFile}} + {{^isListContainer}} + formParams.push(['{{baseName}}', ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}')]); + {{/isListContainer}} + {{#isListContainer}} + for (const oneParam of request.{{paramName}}) { + formParams.push(['{{baseName}}', ObjectSerializer.serialize(oneParam, '{{{baseType}}}')]); + } + {{/isListContainer}} } + {{/isFile}} {{/formParams}} - let requestOptions: HttpOptions = { + const requestOptions: HttpOptions = { method: '{{httpMethod}}', qs: queryParameters, headers: headerParams, uri: requestPath, -{{#formParams}} -{{#isFile}} - body: request.{{paramName}}, -{{/isFile}} -{{/formParams}} {{#bodyParam}} body: ObjectSerializer.serialize(request.{{paramName}}, '{{{dataType}}}'), json: true, @@ -268,16 +265,15 @@ export class {{classname}} { encoding: null, {{/isResponseFile}} }; +{{#formParams}} +{{#isFile}} + const multipartForm = new Multipart(formParams, fileToUpload == null ? [] : [fileToUpload]); + requestOptions.body = multipartForm.body; + requestOptions.headers = {...requestOptions.headers, ...multipartForm.headers} +{{/isFile}} +{{/formParams}} await this._configuration.authentication.applyToRequestAsync(requestOptions); - {{#formParams}}{{^isFile}} - if (Object.keys(formParams).length) { - if (useFormData) { - (requestOptions as any).formData = formParams; - } else { - requestOptions.form = formParams; - } - }{{/isFile}}{{/formParams}} const result: HttpResult = await this._client.requestAsync(requestOptions); diff --git a/codegen/Templates/nodejs/docs/tsconfig.mustache b/codegen/Templates/nodejs/docs/tsconfig.mustache index 1855ea3..4e814ca 100644 --- a/codegen/Templates/nodejs/docs/tsconfig.mustache +++ b/codegen/Templates/nodejs/docs/tsconfig.mustache @@ -53,8 +53,8 @@ async function generateBarcode(api) { const request = new Barcode.GetBarcodeGenerateRequest( Barcode.EncodeBarcodeType.QR, 'Aspose.BarCode for Cloud Sample'); - request.textLocation = "None"; - + request.textLocation = Barcode.CodeLocation.None; + const oneBarcode = await api.getBarcodeGenerate(request); const fileName = 'QR.png' @@ -63,14 +63,11 @@ async function generateBarcode(api) { return fileName; } -async function recognizeBarcode(api, fileName) { - const request = new Barcode.PostBarcodeRecognizeFromUrlOrContentRequest(); - request.image = fs.readFileSync(fileName); - request.type = Barcode.DecodeBarcodeType.QR; - request.preset = Barcode.PresetType.HighPerformance; - request.fastScanOnly = true; +async function scanBarcode(api, fileName) { + const request = new Barcode.ScanBarcodeRequest(fs.readFileSync(fileName)); + request.decodeTypes = [Barcode.DecodeBarcodeType.QR]; - const result = await api.postBarcodeRecognizeFromUrlOrContent(request); + const result = await api.scanBarcode(request); return result.body.barcodes; } @@ -83,7 +80,7 @@ generateBarcode(api) console.log('Barcode saved to ' + fileName); console.log('Trying to recognize barcode...'); - recognizeBarcode(api, fileName) + scanBarcode(api, fileName) .then(barcodes => { console.log('Recognized barcodes are:'); console.log(JSON.stringify(barcodes, null, 2)); diff --git a/codegen/Templates/nodejs/git_push.sh.mustache b/codegen/Templates/nodejs/git_push.sh.mustache index 1257427..07280f1 100644 --- a/codegen/Templates/nodejs/git_push.sh.mustache +++ b/codegen/Templates/nodejs/git_push.sh.mustache @@ -1,7 +1,4 @@ {{! Used as models.ts}} -{{>licenseInfo}} - - {{#models}} {{#model}} {{#description}} diff --git a/codegen/Templates/php/ApiException.mustache b/codegen/Templates/php/ApiException.mustache index b07376c..123667b 100644 --- a/codegen/Templates/php/ApiException.mustache +++ b/codegen/Templates/php/ApiException.mustache @@ -1,7 +1,5 @@ licenseInfo}} -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// + namespace Aspose\BarCode; use GuzzleHttp\Client; @@ -366,19 +364,28 @@ use RuntimeException; $resourcePath = $this->_parseURL($resourcePath, $queryParams); {{#formParams}} - // form params + {{#-first}}// form params{{/-first}} {{#isFile}} $multipart = true; $filename = ObjectSerializer::toFormValue($request->{{paramName}}); $handle = fopen($filename, 'rb'); $fsize = filesize($filename); $contents = fread($handle, $fsize); - $formParams['{{paramName}}'] = $contents; + $formParams['{{baseName}}'][] = $contents; {{/isFile}} {{^isFile}} - if (isset($request->{{paramName}})) { - $formParams['{{paramName}}'] = ObjectSerializer::toFormValue($request->{{paramName}}); - } + {{#isCollectionFormatMulti}} + foreach($request->{{paramName}} as $item) { + $formParams['{{baseName}}'][] = ObjectSerializer::toFormValue($item); + } + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + if (isset($request->{{paramName}})) { + $formParams['{{baseName}}'][] = ObjectSerializer::toFormValue($request->{{paramName}}); + } + {{/isCollectionFormatMulti}} {{/isFile}} {{/formParams}} // body params @@ -416,12 +423,14 @@ use RuntimeException; {{#hasFormParams}} if ($multipart) { $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue, - 'filename' => $filename - ]; + foreach ($formParams as $formParamName => $formParamValues) { + foreach ($formParamValues as $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue, + 'filename' => $filename + ]; + } } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); @@ -431,7 +440,7 @@ use RuntimeException; }{{#formParams}}{{#isFile}} else { // for HTTP post (form) - $httpBody = $formParams['{{paramName}}']; + $httpBody = $formParams['{{baseName}}'][0]; }{{/isFile}}{{/formParams}} {{/hasFormParams}} diff --git a/codegen/Templates/php/model.mustache b/codegen/Templates/php/model.mustache index db03634..4135257 100644 --- a/codegen/Templates/php/model.mustache +++ b/codegen/Templates/php/model.mustache @@ -1,10 +1,6 @@ {{#models}} {{#model}} licenseInfo}} -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// namespace Aspose\BarCode\Model; {{^isEnum}} diff --git a/codegen/Templates/php/requestModel.mustache b/codegen/Templates/php/requestModel.mustache index 76f64b1..103666f 100644 --- a/codegen/Templates/php/requestModel.mustache +++ b/codegen/Templates/php/requestModel.mustache @@ -5,30 +5,8 @@ * * Copyright (c) 2024 Aspose Pty Ltd * - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * * -------------------------------------------------------------------------------------------------------------------- */ -// -// This source code was auto-generated by AsposeBarcodeCloudCodegen. -// declare(strict_types=1); diff --git a/codegen/Templates/python/__init__model.mustache b/codegen/Templates/python/__init__model.mustache new file mode 100644 index 0000000..0e2b028 --- /dev/null +++ b/codegen/Templates/python/__init__model.mustache @@ -0,0 +1,9 @@ +# coding: utf-8 + +# flake8: noqa + +from __future__ import absolute_import + +# import models into model package +{{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}{{/model}} +{{/models}} diff --git a/codegen/Templates/python/__init__package.mustache b/codegen/Templates/python/__init__package.mustache index b0291ec..a86ff63 100644 --- a/codegen/Templates/python/__init__package.mustache +++ b/codegen/Templates/python/__init__package.mustache @@ -2,8 +2,6 @@ # flake8: noqa: F401 -{{>partial_header}} - from __future__ import absolute_import from {{packageName}}.rest import ApiException @@ -16,4 +14,4 @@ from {{packageName}}.api_client import ApiClient from {{packageName}}.configuration import Configuration # import models into sdk package {{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}} -{{/model}}{{/models}} \ No newline at end of file +{{/model}}{{/models}} diff --git a/codegen/Templates/python/api.mustache b/codegen/Templates/python/api.mustache index a93f2db..2b8a1fd 100644 --- a/codegen/Templates/python/api.mustache +++ b/codegen/Templates/python/api.mustache @@ -1,6 +1,5 @@ # coding: utf-8 -{{>partial_header}} from __future__ import absolute_import, division import re # noqa: F401 diff --git a/codegen/Templates/python/api_client.mustache b/codegen/Templates/python/api_client.mustache index af7606d..79a900f 100644 --- a/codegen/Templates/python/api_client.mustache +++ b/codegen/Templates/python/api_client.mustache @@ -1,5 +1,5 @@ # coding: utf-8 -{{>partial_header}} + from __future__ import absolute_import, division import datetime diff --git a/codegen/Templates/python/configuration.mustache b/codegen/Templates/python/configuration.mustache index 6ea5e49..dacb002 100644 --- a/codegen/Templates/python/configuration.mustache +++ b/codegen/Templates/python/configuration.mustache @@ -1,6 +1,5 @@ # coding: utf-8 -{{>partial_header}} from __future__ import absolute_import, division import contextlib @@ -304,5 +303,5 @@ class Configuration(object): js_data = json.loads(response.data) access_token = js_data["access_token"] - + return access_token diff --git a/codegen/Templates/python/model.mustache b/codegen/Templates/python/model.mustache index 7780891..a1a8b52 100644 --- a/codegen/Templates/python/model.mustache +++ b/codegen/Templates/python/model.mustache @@ -1,7 +1,5 @@ # coding: utf-8 -{{>partial_header}} - import pprint import re # noqa: F401 import warnings # noqa: F401 diff --git a/codegen/Templates/python/rest.mustache b/codegen/Templates/python/rest.mustache index 751507f..15a054a 100644 --- a/codegen/Templates/python/rest.mustache +++ b/codegen/Templates/python/rest.mustache @@ -1,6 +1,5 @@ # coding: utf-8 -{{>partial_header}} from __future__ import absolute_import, division import io diff --git a/codegen/Templates/python/setup.mustache b/codegen/Templates/python/setup.mustache index b55658b..3118c42 100644 --- a/codegen/Templates/python/setup.mustache +++ b/codegen/Templates/python/setup.mustache @@ -1,6 +1,5 @@ # coding: utf-8 -{{>partial_header}} import os from setuptools import setup, find_packages diff --git a/codegen/config-android.json b/codegen/config-android.json index 38b5481..6a2c4f7 100644 --- a/codegen/config-android.json +++ b/codegen/config-android.json @@ -4,7 +4,7 @@ "androidSdkVersion": "33", "apiPackage": "com.aspose.barcode.cloud.demo_app", "artifactId": "Android Application for Barcode Processing in the Cloud via REST API", - "artifactVersion": "24.3.0", + "artifactVersion": "24.4.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 f772466..bca0966 100644 --- a/codegen/config-dart.json +++ b/codegen/config-dart.json @@ -2,6 +2,7 @@ "browserClient": false, "pubDescription": "This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily", "pubName": "aspose_barcode_cloud", - "pubVersion": "1.24.3", - "useEnumExtension": true -} \ No newline at end of file + "pubVersion": "1.24.4", + "useEnumExtension": true, + "allowUnicodeIdentifiers": true +} diff --git a/codegen/config-go.json b/codegen/config-go.json index 197be0a..cf73d25 100644 --- a/codegen/config-go.json +++ b/codegen/config-go.json @@ -1,4 +1,4 @@ { "packageName": "barcode", - "packageVersion": "1.2403.0" + "packageVersion": "1.2404.0" } \ No newline at end of file diff --git a/codegen/config-java.json b/codegen/config-java.json index b47f1a5..63a69cb 100644 --- a/codegen/config-java.json +++ b/codegen/config-java.json @@ -3,7 +3,7 @@ "artifactDescription": "Aspose.BarCode Cloud SDK for Java", "artifactId": "aspose-barcode-cloud", "artifactUrl": "https://www.aspose.cloud", - "artifactVersion": "24.3.0", + "artifactVersion": "24.4.0", "developerEmail": "denis.averin@aspose.com", "developerName": "Denis Averin", "developerOrganization": "Aspose", diff --git a/codegen/config-php.json b/codegen/config-php.json index b347815..43155b2 100644 --- a/codegen/config-php.json +++ b/codegen/config-php.json @@ -1,4 +1,4 @@ { - "artifactVersion": "24.3.0", + "artifactVersion": "24.4.0", "invokerPackage": "Aspose\\BarCode" } \ No newline at end of file diff --git a/codegen/config-python.json b/codegen/config-python.json index afdd327..505f3b9 100644 --- a/codegen/config-python.json +++ b/codegen/config-python.json @@ -1,6 +1,6 @@ { "packageName": "aspose_barcode_cloud", "packageUrl": "https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-python", - "packageVersion": "24.3.0", + "packageVersion": "24.4.0", "projectName": "aspose-barcode-cloud" } \ No newline at end of file diff --git a/codegen/config.json b/codegen/config.json index 42e1e8b..a0c03a2 100644 --- a/codegen/config.json +++ b/codegen/config.json @@ -1,8 +1,8 @@ { "artifactVersion": "23.7.0", "npmName": "aspose-barcode-cloud-node", - "npmVersion": "24.3.0", + "npmVersion": "24.4.0", "packageName": "Aspose.BarCode.Cloud.Sdk", - "packageVersion": "24.3.0", + "packageVersion": "24.4.0", "supportsES6": true } \ No newline at end of file diff --git a/codegen/generate-android.bash b/codegen/generate-android.bash index 7aff467..4f5321b 100755 --- a/codegen/generate-android.bash +++ b/codegen/generate-android.bash @@ -25,10 +25,10 @@ mv "$tempDir/gradlew" "$targetDir/app/build.gradle" mv "$tempDir/src/main/AndroidManifest.xml" "$targetDir/app/src/main/" exampleDir="$targetDir/app/src/main/java/com/aspose/barcode/cloud/demo_app" -rm -rf "${exampleDir:?}/*" +rm -rf ${exampleDir:?}/* mkdir -p "$exampleDir" || true mv "$tempDir/src/main/java/com/aspose/barcode/cloud/demo_app/ApiException.java" "$exampleDir/MainActivity.kt" -cp Templates/LICENSE "$targetDir/" +cp ../LICENSE "$targetDir/" rm -rf $tempDir diff --git a/codegen/generate-dart.bash b/codegen/generate-dart.bash index 9a671ba..c9f5c5c 100755 --- a/codegen/generate-dart.bash +++ b/codegen/generate-dart.bash @@ -28,6 +28,7 @@ mkdir -p "$targetDir/lib/src/" || true mv $tempDir/lib/*.dart $targetDir/lib/src/ mkdir -p "$targetDir/lib/src/model/" +rm -rf "$targetDir/lib/src/model/"*.dart mv $tempDir/lib/model/*.dart $targetDir/lib/src/model/ mkdir -p "$targetDir/lib/src/api/" @@ -44,7 +45,7 @@ mv $tempDir/docs/*Api.md $targetDir/doc/api/ mkdir -p "$targetDir/doc/models/" mv $tempDir/docs/*.md $targetDir/doc/models/ -cp Templates/LICENSE "$targetDir/" +cp ../LICENSE "$targetDir/" cp ../scripts/check-badges.bash "$targetDir/scripts/" # Cleanup diff --git a/codegen/generate-dotnet.bash b/codegen/generate-dotnet.bash index 16d28d1..4b84983 100755 --- a/codegen/generate-dotnet.bash +++ b/codegen/generate-dotnet.bash @@ -11,6 +11,7 @@ then rm -rf $tempDir fi +# Templates src https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources/csharp # Generate Operations and Models for Debug purposes # java -DdebugOperations -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l csharp -t Templates/csharp -o $tempDir -c config.json > debugOperations.cs.json ; exit # java -DdebugModels -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l csharp -t Templates/csharp -o $tempDir -c config.json > debugModels.cs.json ; exit @@ -21,8 +22,8 @@ python Tools/split-cs-file.py $tempDir/src/Aspose.BarCode.Cloud.Sdk/Api/FileApi. python Tools/split-cs-file.py $tempDir/src/Aspose.BarCode.Cloud.Sdk/Api/FolderApi.cs $tempDir/src/Aspose.BarCode.Cloud.Sdk/Model/Requests/ python Tools/split-cs-file.py $tempDir/src/Aspose.BarCode.Cloud.Sdk/Api/StorageApi.cs $tempDir/src/Aspose.BarCode.Cloud.Sdk/Model/Requests/ -cp Templates/LICENSE "$targetDir/" -cp Templates/LICENSE "$targetDir/src/LICENSE.txt" +cp ../LICENSE "$targetDir/" +cp ../LICENSE "$targetDir/src/LICENSE.txt" cp ../scripts/check-badges.bash "$targetDir/scripts/" rm -rf "$targetDir/src/Model/" @@ -30,6 +31,12 @@ mv "$tempDir/src/Aspose.BarCode.Cloud.Sdk/Model" "$targetDir/src" rm -rf $targetDir/src/Api/*Api.cs mv $tempDir/src/Aspose.BarCode.Cloud.Sdk/Api/*.cs $targetDir/src/Api/ + +for ifile in "$tempDir/src/Aspose.BarCode.Cloud.Sdk.Test/Api/"*.cs; do + new_name=$targetDir/src/Interfaces/I$(basename "$ifile" | sed 's/Tests//') + mv "$ifile" "$new_name" +done + mv $tempDir/src/Aspose.BarCode.Cloud.Sdk/Client/Configuration.cs $targetDir/src/Api/ rm -rf "$targetDir/docs" @@ -38,7 +45,7 @@ mv "$tempDir/docs" "$targetDir/" mv "$tempDir/README.md" "$targetDir/README.template" mv "$tempDir/src/Aspose.BarCode.Cloud.Sdk/Aspose.BarCode.Cloud.Sdk.csproj" "$targetDir/src/Aspose.BarCode.Cloud.Sdk.csproj" cp "$tempDir/src/Aspose.BarCode.Cloud.Sdk.Test/Aspose.BarCode.Cloud.Sdk.Test.csproj" "$targetDir/examples/GenerateQR/GenerateQR.csproj" -cp "$tempDir/src/Aspose.BarCode.Cloud.Sdk.Test/Aspose.BarCode.Cloud.Sdk.Test.csproj" "$targetDir/examples/ReadQR/ReadQR.csproj" +mv "$tempDir/src/Aspose.BarCode.Cloud.Sdk.Test/Aspose.BarCode.Cloud.Sdk.Test.csproj" "$targetDir/examples/ReadQR/ReadQR.csproj" rm -rf $tempDir diff --git a/codegen/generate-go.bash b/codegen/generate-go.bash index 1b9c4d8..1049332 100755 --- a/codegen/generate-go.bash +++ b/codegen/generate-go.bash @@ -23,10 +23,10 @@ mv "$tempDir/response.go" "$targetDir/barcode/jwt/jwt.go" mv $tempDir/*.go $targetDir/barcode/ -rm -rf "$targetDir/docs/*" +rm -rf $targetDir/docs/* mv $tempDir/docs/* $targetDir/docs/ mv "$tempDir/README.md" "$targetDir/README.md" -cp Templates/LICENSE "$targetDir/" +cp ../LICENSE "$targetDir/" cp ../scripts/check-badges.bash "$targetDir/scripts/" rm -rf $tempDir diff --git a/codegen/generate-java.bash b/codegen/generate-java.bash index b10c603..c7d824c 100755 --- a/codegen/generate-java.bash +++ b/codegen/generate-java.bash @@ -21,11 +21,11 @@ python Tools/split-java-file.py $tempDir/src/main/java/com/aspose/barcode/cloud/ python Tools/split-java-file.py $tempDir/src/main/java/com/aspose/barcode/cloud/api/FolderApi.java $tempDir/src/main/java/com/aspose/barcode/cloud/requests/ python Tools/split-java-file.py $tempDir/src/main/java/com/aspose/barcode/cloud/api/StorageApi.java $tempDir/src/main/java/com/aspose/barcode/cloud/requests/ -rm -rf "$targetDir/src/main/java/com/aspose/barcode/cloud/api/*" +rm -rf $targetDir/src/main/java/com/aspose/barcode/cloud/api/* mv $tempDir/src/main/java/com/aspose/barcode/cloud/api/* $targetDir/src/main/java/com/aspose/barcode/cloud/api -rm -rf "$targetDir/src/main/java/com/aspose/barcode/cloud/model/*" +rm -rf $targetDir/src/main/java/com/aspose/barcode/cloud/model/* mv $tempDir/src/main/java/com/aspose/barcode/cloud/model/* $targetDir/src/main/java/com/aspose/barcode/cloud/model -rm -rf "$targetDir/src/main/java/com/aspose/barcode/cloud/requests/*" +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 @@ -33,12 +33,12 @@ 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/*" +rm -rf ${targetDir}/docs/* mv $tempDir/docs/* $targetDir/docs mv $tempDir/README.md $targetDir mv $tempDir/pom.xml $targetDir -cp Templates/LICENSE $targetDir +cp ../LICENSE $targetDir cp ../scripts/check-badges.bash "$targetDir/scripts/" rm -rf $tempDir diff --git a/codegen/generate-node.bash b/codegen/generate-node.bash index 701b385..6bed491 100755 --- a/codegen/generate-node.bash +++ b/codegen/generate-node.bash @@ -22,13 +22,13 @@ mv "$tempDir/git_push.sh" "$targetDir/src/models.ts" # Use typescript-node one more time because typescript-node does not generate docs java -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json -# java -DdebugModels -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json > debugModels.docs.json -# java -DdebugOperations -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json > debugOperations.docs.json +#java -DdebugModels -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json > debugModels.node.json +#java -DdebugOperations -jar Tools/swagger-codegen-cli.jar generate -i "$specSource" -l typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json > debugOperations.node.json mv "$tempDir/docs/api.ts" "$targetDir/docs/index.md" mv "$tempDir/docs/git_push.sh" "$targetDir/docs/models.md" mv "$tempDir/docs/tsconfig.json" "$targetDir/README.md" -cp Templates/LICENSE "$targetDir/" +cp ../LICENSE "$targetDir/" cp ../scripts/check-badges.bash "$targetDir/scripts/" rm -rf $tempDir diff --git a/codegen/generate-php.bash b/codegen/generate-php.bash index f953c9a..9e13f7b 100755 --- a/codegen/generate-php.bash +++ b/codegen/generate-php.bash @@ -34,7 +34,7 @@ rm -rf "${targetDir}/docs/"* mv "${tempDir}/SwaggerClient-php/docs/"* "${targetDir}/docs" mv "${tempDir}/SwaggerClient-php/README.md" "${targetDir}/" -cp Templates/LICENSE "${targetDir}/" +cp ../LICENSE "${targetDir}/" cp ../scripts/check-badges.bash "$targetDir/scripts/" diff --git a/codegen/generate-python.bash b/codegen/generate-python.bash index d4eeb9c..19042ea 100755 --- a/codegen/generate-python.bash +++ b/codegen/generate-python.bash @@ -27,7 +27,7 @@ cp "$tempDir/test-requirements.txt" "$targetDir/test-requirements.txt" cp "$tempDir/tox.ini" "$targetDir/tox.ini" cp "$tempDir/README.md" "$targetDir/README.md" -cp Templates/LICENSE "$targetDir/" +cp ../LICENSE "$targetDir/" cp ../scripts/check-badges.bash "$targetDir/scripts/" rm -rf $tempDir diff --git a/scripts/check-urls.py b/scripts/check-urls.py index 42ff23e..1c5e1bb 100644 --- a/scripts/check-urls.py +++ b/scripts/check-urls.py @@ -52,21 +52,29 @@ class Curl: URLS_TO_IGNORE = frozenset( [ "http://|https://|ftp://", + "http://localhost:$port/", "http://localhost:12345", "http://localhost:12345/v3.0", + "http://localhost:47972/v3.0/barcode/swagger/spec", "http://some", + "http://tools.ietf.org/html/rfc1341.html", + "http://tools.ietf.org/html/rfc2046", + "http://tools.ietf.org/html/rfc2388", "http://urllib3.readthedocs.io/en/latest/advanced-usage.html", "https://api-qa.aspose.cloud", + "https://api-qa.aspose.cloud/connect/token", + "https://api.aspose.cloud/v3.0/barcode/scan", "https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dotnet/releases/tag/v{{packageVersion}}", "https://img.shields.io/badge/api-v{{appVersion}}-lightgrey", "https://pypi.org/project/{{projectName}}/", "https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.14/swagger-codegen-cli-2.4.14.jar", + "https://tools.ietf.org/html/rfc1521", "https://unknown", "https://www.aspose.cloud/404", ] ) -URL_END_CHARS = r"\)\"'<>\*\s\\" +URL_END_CHARS = r",#\)\"'<>\*\s\\" URL_RE_PATTERN = r"(https*://[^%s]+)[%s]?" % (URL_END_CHARS, URL_END_CHARS) # print(URL_RE_PATTERN) URL_REGEX = re.compile(URL_RE_PATTERN, re.MULTILINE) @@ -184,6 +192,7 @@ def process_finished_task(task) -> None: def url_checker(num_workers=8): + next_report_age_sec = 5 workers: list[Optional[Task]] = [None for _ in range(num_workers)] queue_is_empty = False @@ -195,15 +204,16 @@ def url_checker(num_workers=8): if not task.running: process_finished_task(task) workers[i] = None - elif task.age > 5: + elif task.age > next_report_age_sec: print("Long request: '%s' %.2fs" % (task.url, task.age)) + next_report_age_sec += 3 if not queue_is_empty: for i in (i for (i, w) in enumerate(workers) if w is None): item = WORKER_QUEUE.get() if item is None: queue_is_empty = True - print("Stop queue") + print("URL queue is over") break url = item workers[i] = create_new_task(url) @@ -218,7 +228,7 @@ def main(files): for filename, text in text_extractor(files): for url in url_extractor(text, filename): # print("In:", url) - WORKER_QUEUE.put_nowait((url)) + WORKER_QUEUE.put_nowait(url) WORKER_QUEUE.put_nowait(None) checker.join() diff --git a/scripts/echo_server.bash b/scripts/echo_server.bash new file mode 100755 index 0000000..558c09e --- /dev/null +++ b/scripts/echo_server.bash @@ -0,0 +1,10 @@ +#!/bin/bash +set -euo pipefail + +# This is a simple echo server script. +# It uses netcat (nc) to listen on localhost port. +# For each incoming connection, it starts a loop that reads lines from the connection and echoes them back. + +port=47972 +echo "Starting echo server http://localhost:$port/" +nc localhost $port -lc 'while true; do read line; echo "$line"; done' diff --git a/scripts/start-release.bash b/scripts/start-release.bash index 88e04ed..b8f55e1 100755 --- a/scripts/start-release.bash +++ b/scripts/start-release.bash @@ -37,5 +37,5 @@ for d in */ ; do done popd >/dev/null -python "new-version.py" "${major}" "${minor}" +python "./scripts/new-version.py" "${major}" "${minor}" popd >/dev/null diff --git a/scripts/update_swagger_spec.bash b/scripts/update_swagger_spec.bash index e84bc2c..cf199d0 100755 --- a/scripts/update_swagger_spec.bash +++ b/scripts/update_swagger_spec.bash @@ -3,5 +3,6 @@ set -euo pipefail SWAGGER_SPEC_URL="https://api.aspose.cloud/v3.0/barcode/swagger/spec" # SWAGGER_SPEC_URL="https://barcode.qa.aspose.cloud/v3.0/barcode/swagger/spec" +# SWAGGER_SPEC_URL="http://localhost:47972/v3.0/barcode/swagger/spec" curl "${SWAGGER_SPEC_URL}" > spec/aspose-barcode-cloud.json diff --git a/spec/aspose-barcode-cloud.json b/spec/aspose-barcode-cloud.json index 84029d4..60f388a 100644 --- a/spec/aspose-barcode-cloud.json +++ b/spec/aspose-barcode-cloud.json @@ -1416,7 +1416,7 @@ "type": "number", "name": "Similarity", "in": "query", - "description": "Similarity coefficient depends on how homogeneous barcodes are.\nUse high value for for clear barcodes.\nUse low values to detect barcodes that ara partly damaged or not lighten evenly.\nSimilarity coefficient must be between [0.5, 0.9]", + "description": "Similarity coefficient depends on how homogeneous barcodes are.\nUse high value for clear barcodes.\nUse low values to detect barcodes that ara partly damaged or not lighten evenly.\nSimilarity coefficient must be between [0.5, 0.9]", "format": "double", "x-nullable": true }, @@ -1997,7 +1997,7 @@ "type": "number", "name": "Similarity", "in": "query", - "description": "Similarity coefficient depends on how homogeneous barcodes are.\nUse high value for for clear barcodes.\nUse low values to detect barcodes that ara partly damaged or not lighten evenly.\nSimilarity coefficient must be between [0.5, 0.9]", + "description": "Similarity coefficient depends on how homogeneous barcodes are.\nUse high value for clear barcodes.\nUse low values to detect barcodes that ara partly damaged or not lighten evenly.\nSimilarity coefficient must be between [0.5, 0.9]", "format": "double", "x-nullable": true }, @@ -2067,6 +2067,68 @@ ] } }, + "/barcode/scan": { + "post": { + "tags": [ + "Barcode" + ], + "summary": "Quickly scan a barcode from an image.", + "operationId": "ScanBarcode", + "consumes": [ + "multipart/form-data" + ], + "parameters": [ + { + "type": "file", + "name": "imageFile", + "in": "formData", + "required": true, + "description": "Image as file", + "x-nullable": true + }, + { + "type": "array", + "name": "decodeTypes", + "in": "formData", + "description": "Types of barcode to recognize", + "collectionFormat": "multi", + "x-nullable": true, + "items": { + "$ref": "#/definitions/DecodeBarcodeType" + } + }, + { + "type": "integer", + "name": "timeout", + "in": "formData", + "description": "Timeout of recognition process in milliseconds.\n Default value is 15_000 (15 seconds).\n Maximum value is 30_000 (1/2 minute).\n In case of a timeout RequestTimeout (408) status will be returned.\n Try reducing the image size to avoid timeout.", + "format": "int32", + "x-nullable": true + } + ], + "responses": { + "200": { + "x-nullable": true, + "description": "BarcodeResponseList with barcode data.", + "schema": { + "$ref": "#/definitions/BarcodeResponseList" + } + }, + "400": { + "x-nullable": true, + "description": "Error", + "schema": { + "$ref": "#/definitions/ApiErrorResponse" + } + } + }, + "security": [ + { + "JWT": [] + } + ] + } + }, "/barcode/storage/file/{path}": { "get": { "tags": [ @@ -3448,7 +3510,7 @@ "additionalProperties": false, "properties": { "EncodingTable": { - "description": "Interpreting type for the Customer Information of AustralianPost, default to CustomerInformationInterpretingType.Other\"", + "description": "Interpreting type for the Customer Information of AustralianPost, default to CustomerInformationInterpretingType.Other", "$ref": "#/definitions/CustomerInformationInterpretingType" }, "ShortBarHeight": { @@ -5259,7 +5321,7 @@ }, "Similarity": { "type": "number", - "description": "Similarity coefficient depends on how homogeneous barcodes are.\nUse high value for for clear barcodes.\nUse low values to detect barcodes that ara partly damaged or not lighten evenly.\nSimilarity coefficient must be between [0.5, 0.9]", + "description": "Similarity coefficient depends on how homogeneous barcodes are.\nUse high value for clear barcodes.\nUse low values to detect barcodes that ara partly damaged or not lighten evenly.\nSimilarity coefficient must be between [0.5, 0.9]", "format": "double" }, "SkipDiagonalSearch": { diff --git a/submodules/android b/submodules/android index 4d870c2..f391c49 160000 --- a/submodules/android +++ b/submodules/android @@ -1 +1 @@ -Subproject commit 4d870c24b10434bf5f4f549df0ec13d5c7d2879f +Subproject commit f391c49cf4b727d7940ce9c0bdd1df715cb1ecec diff --git a/submodules/dart b/submodules/dart index ce2b932..3c1ebce 160000 --- a/submodules/dart +++ b/submodules/dart @@ -1 +1 @@ -Subproject commit ce2b9321ac1357989d9e2b4f6754c84e96558630 +Subproject commit 3c1ebceb24518763134b78fc092abe4b4e035765 diff --git a/submodules/dotnet b/submodules/dotnet index 9aed71f..f3663e2 160000 --- a/submodules/dotnet +++ b/submodules/dotnet @@ -1 +1 @@ -Subproject commit 9aed71fa677694e7cf294adc1d1c9333dc320652 +Subproject commit f3663e24ef9fe3ed223961628143918613f45051 diff --git a/submodules/go b/submodules/go index 7e9de2c..640d344 160000 --- a/submodules/go +++ b/submodules/go @@ -1 +1 @@ -Subproject commit 7e9de2ca202b1d053d120cc5bf62063cba3eb396 +Subproject commit 640d344567438783beaba350eb49cba42c46a3ae diff --git a/submodules/java b/submodules/java index 46aa4a0..94419f2 160000 --- a/submodules/java +++ b/submodules/java @@ -1 +1 @@ -Subproject commit 46aa4a0b9e852511c15444c7a8428b03f07f82a5 +Subproject commit 94419f254fcf060bb73c0c80251688a691537280 diff --git a/submodules/node b/submodules/node index dd19e2f..63c5cd2 160000 --- a/submodules/node +++ b/submodules/node @@ -1 +1 @@ -Subproject commit dd19e2f76d2afb1c66af691f288c0c0be96d81de +Subproject commit 63c5cd2ae2bac8f3ca082546dfb653c36cf6350c diff --git a/submodules/php b/submodules/php index b50dd25..89207d7 160000 --- a/submodules/php +++ b/submodules/php @@ -1 +1 @@ -Subproject commit b50dd2561d5b706dd4d94297570236a00e563f10 +Subproject commit 89207d78e333ba255f316d1ed517f7ce2324c68f diff --git a/submodules/python b/submodules/python index 2e7a133..1540b5a 160000 --- a/submodules/python +++ b/submodules/python @@ -1 +1 @@ -Subproject commit 2e7a133a8f2d47971e8f31980458d7e0aae73b7f +Subproject commit 1540b5a2c2e31ddcabce4688272343e0cb0f7ab9