Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 24.1 #32

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 1.24.1

* "types" param for multiple barcode types to read added.
* mostCommonlyUsed decode type added.

## 0.23.12

* December 2023 release
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 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
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.PHONY: all
all: test lint

.PHONY: init
init:
dart pub get

.PHONY: lint
lint:
dart analyze lib example
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![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: 3.0
- SDK version: 0.23.12
- SDK version: 1.24.1

This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily

Expand Down Expand Up @@ -34,7 +34,7 @@ Add this dependency to your *pubspec.yaml*:

```yaml
dependencies:
aspose_barcode_cloud: 0.23.12
aspose_barcode_cloud: 1.24.1
```

## Sample usage
Expand Down
12 changes: 8 additions & 4 deletions doc/api/BarcodeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Name | Type | Description | Notes


# **getBarcodeRecognize**
> BarcodeResponseList getBarcodeRecognize(name, type, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, storage, folder)
> BarcodeResponseList getBarcodeRecognize(name, type, types, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, storage, folder)

Recognize barcode from a file on server.

Expand All @@ -144,6 +144,7 @@ import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';
final api_instance = BarcodeApi();
final name = name_example; // String | The image file name.
final type = type_example; // String | The type of barcode to read.
final types = []; // List<DecodeBarcodeType> | Multiple barcode types to read.
final checksumValidation = checksumValidation_example; // String | Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies
final detectEncoding = true; // bool | A flag which force engine to detect codetext encoding for Unicode.
final preset = preset_example; // String | Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality.
Expand Down Expand Up @@ -182,7 +183,7 @@ final storage = storage_example; // String | The image storage.
final folder = folder_example; // String | The image folder.

try {
final result = api_instance.getBarcodeRecognize(name, type, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, storage, folder);
final result = api_instance.getBarcodeRecognize(name, type, types, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, storage, folder);
print(result);
} catch (e) {
print("Exception when calling BarcodeApi->getBarcodeRecognize: $e\n");
Expand All @@ -195,6 +196,7 @@ Name | Type | Description | Notes
---- | ---- | ------------ | -----
**name** | **String**| The image file name. |
**type** | **String**| The type of barcode to read. | [optional]
**types** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md)| Multiple barcode types to read. | [optional]
**checksumValidation** | **String**| Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies | [optional]
**detectEncoding** | **bool**| A flag which force engine to detect codetext encoding for Unicode. | [optional]
**preset** | **String**| Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. | [optional]
Expand Down Expand Up @@ -247,7 +249,7 @@ Name | Type | Description | Notes


# **postBarcodeRecognizeFromUrlOrContent**
> BarcodeResponseList postBarcodeRecognizeFromUrlOrContent(type, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, url, image)
> BarcodeResponseList postBarcodeRecognizeFromUrlOrContent(type, types, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, url, image)

Recognize barcode from an url or from request body. Request body can contain raw data bytes of the image with content-type \"application/octet-stream\". An image can also be passed as a form field.

Expand All @@ -259,6 +261,7 @@ import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';

final api_instance = BarcodeApi();
final type = type_example; // String | The type of barcode to read.
final types = []; // List<DecodeBarcodeType> | Multiple barcode types to read.
final checksumValidation = checksumValidation_example; // String | Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies
final detectEncoding = true; // bool | A flag which force engine to detect codetext encoding for Unicode.
final preset = preset_example; // String | Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality.
Expand Down Expand Up @@ -297,7 +300,7 @@ final url = url_example; // String | The image file url.
final image = /path/to/file.txt; // MultipartFile | Image data

try {
final result = api_instance.postBarcodeRecognizeFromUrlOrContent(type, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, url, image);
final result = api_instance.postBarcodeRecognizeFromUrlOrContent(type, types, checksumValidation, detectEncoding, preset, rectX, rectY, rectWidth, rectHeight, stripFNC, timeout, medianSmoothingWindowSize, allowMedianSmoothing, allowComplexBackground, allowDatamatrixIndustrialBarcodes, allowDecreasedImage, allowDetectScanGap, allowIncorrectBarcodes, allowInvertImage, allowMicroWhiteSpotsRemoving, allowOneDFastBarcodesDetector, allowOneDWipedBarsRestoration, allowQRMicroQrRestoration, allowRegularImage, allowSaltAndPepperFiltering, allowWhiteSpotsRemoving, checkMore1DVariants, fastScanOnly, allowAdditionalRestorations, regionLikelihoodThresholdPercent, scanWindowSizes, similarity, skipDiagonalSearch, readTinyBarcodes, australianPostEncodingTable, ignoreEndingFillingPatternsForCTable, url, image);
print(result);
} catch (e) {
print("Exception when calling BarcodeApi->postBarcodeRecognizeFromUrlOrContent: $e\n");
Expand All @@ -309,6 +312,7 @@ try {
Name | Type | Description | Notes
---- | ---- | ------------ | -----
**type** | **String**| The type of barcode to read. | [optional]
**types** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md)| Multiple barcode types to read. | [optional]
**checksumValidation** | **String**| Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies | [optional]
**detectEncoding** | **bool**| A flag which force engine to detect codetext encoding for Unicode. | [optional]
**preset** | **String**| Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. | [optional]
Expand Down
1 change: 1 addition & 0 deletions doc/models/DecodeBarcodeType.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ See DecodeType
* DecodeBarcodeType.gS1Aztec_
* DecodeBarcodeType.gS1CompositeBar_
* DecodeBarcodeType.gS1MicroPdf417_
* DecodeBarcodeType.mostCommonlyUsed_

1 change: 1 addition & 0 deletions doc/models/ReaderParams.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Represents BarcodeReader object.
Name | Type | Description | Notes
---- | ---- | ----------- | -----
**type** | [**DecodeBarcodeType**](DecodeBarcodeType.md) | The type of barcode to read. | [optional] [default to null]
**types** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md) | Multiple barcode types to read. | [optional] [default to []]
**checksumValidation** | [**ChecksumValidation**](ChecksumValidation.md) | Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies | [optional] [default to null]
**detectEncoding** | **bool** | A flag which force engine to detect codetext encoding for Unicode. | [optional] [default to null]
**preset** | [**PresetType**](PresetType.md) | Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. | [optional] [default to null]
Expand Down
6 changes: 5 additions & 1 deletion example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Future<void> main() async {
// Generate image with barcode
final Uint8List generated =
await api.getBarcodeGenerate("QR", "text", textLocation: "None");

// Save generated image to file
File(fileName).writeAsBytesSync(generated);
print("Generated image saved to " + fileName);
Expand All @@ -26,7 +27,10 @@ Future<void> main() async {
final formFile = MultipartFile.fromBytes("image", generated.toList(),
filename: "barcode.png");
final BarcodeResponseList recognized =
await api.postBarcodeRecognizeFromUrlOrContent(image: formFile);
await api.postBarcodeRecognizeFromUrlOrContent(
image: formFile,
preset: PresetType.highPerformance_.value,
);

if (recognized.barcodes != null && recognized.barcodes!.isNotEmpty) {
print("Recognized Type: " + recognized.barcodes![0].type!);
Expand Down
1 change: 1 addition & 0 deletions lib/aspose_barcode_cloud.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ library aspose_barcode_cloud.api;
export 'src/configuration.dart' show Configuration;
export 'src/api_client.dart' show ApiClient, SDK_VERSION;
export 'src/api_exception.dart' show ApiException;
export 'src/auth/oauth.dart' show OAuth;

export 'src/api/barcode_api.dart' show BarcodeApi;
export 'src/api/file_api.dart' show FileApi;
Expand Down
10 changes: 10 additions & 0 deletions lib/src/api/barcode_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class BarcodeApi {
///
Future<BarcodeResponseList> getBarcodeRecognize(String name,
{String? type,
List<DecodeBarcodeType>? types,
String? checksumValidation,
bool? detectEncoding,
String? preset,
Expand Down Expand Up @@ -271,6 +272,10 @@ class BarcodeApi {
queryParams
.addAll(convertParametersForCollectionFormat("", "Type", type));
}
if (types != null) {
queryParams.addAll(
convertParametersForCollectionFormat("multi", "Types", types));
}
if (checksumValidation != null) {
queryParams.addAll(convertParametersForCollectionFormat(
"", "ChecksumValidation", checksumValidation));
Expand Down Expand Up @@ -444,6 +449,7 @@ class BarcodeApi {
///
Future<BarcodeResponseList> postBarcodeRecognizeFromUrlOrContent(
{String? type,
List<DecodeBarcodeType>? types,
String? checksumValidation,
bool? detectEncoding,
String? preset,
Expand Down Expand Up @@ -495,6 +501,10 @@ class BarcodeApi {
queryParams
.addAll(convertParametersForCollectionFormat("", "Type", type));
}
if (types != null) {
queryParams.addAll(
convertParametersForCollectionFormat("multi", "Types", types));
}
if (checksumValidation != null) {
queryParams.addAll(convertParametersForCollectionFormat(
"", "ChecksumValidation", checksumValidation));
Expand Down
3 changes: 1 addition & 2 deletions lib/src/api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import 'package:http/http.dart' as Http show Client, MultipartRequest, Response;
import '../aspose_barcode_cloud.dart';
import 'api_helper.dart';
import 'auth/authentication.dart';
import 'auth/oauth.dart';

const String SDK_VERSION = "0.23.12";
const String SDK_VERSION = "1.24.1";

class ApiClient {
late final String basePath;
Expand Down
10 changes: 5 additions & 5 deletions lib/src/auth/oauth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OAuth implements Authentication {
List<QueryParam> queryParams, Map<String, String> headerParams) async {
if (accessToken == null && tokenExpiration == null) {
if (clientId != null && clientSecret != null) {
await fetchToken(clientId!, clientSecret!);
accessToken = await fetchToken();
} else {
throw ApiException(0, "clientId or clientSecret not defined");
}
Expand All @@ -41,11 +41,11 @@ class OAuth implements Authentication {
headerParams["Authorization"] = "Bearer " + accessToken!;
}

Future fetchToken(String clientId, String clientSecret) async {
Future<String> fetchToken() async {
final request = MultipartRequest('POST', Uri.parse(tokenUrl))
..fields['grant_type'] = 'client_credentials'
..fields['client_id'] = clientId
..fields['client_secret'] = clientSecret;
..fields['client_id'] = this.clientId!
..fields['client_secret'] = this.clientSecret!;

final response = await request.send();
final responseText = await response.stream.bytesToString();
Expand All @@ -56,7 +56,7 @@ class OAuth implements Authentication {
final data = jsonDecode(responseText);
final int expiresIn = data['expires_in'];

accessToken = data['access_token'];
tokenExpiration = DateTime.now().add(Duration(seconds: expiresIn));
return data['access_token'];
}
}
11 changes: 11 additions & 0 deletions lib/src/model/decode_barcode_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ class DecodeBarcodeType {
static DecodeBarcodeType gS1MicroPdf417_ =
DecodeBarcodeType._internal("GS1MicroPdf417");

/// See DecodeType
static DecodeBarcodeType mostCommonlyUsed_ =
DecodeBarcodeType._internal("mostCommonlyUsed");

DecodeBarcodeType.fromJson(dynamic data) {
switch (data) {
case "all":
Expand Down Expand Up @@ -555,6 +559,9 @@ class DecodeBarcodeType {
case "GS1MicroPdf417":
value = data;
break;
case "mostCommonlyUsed":
value = data;
break;
default:
throw Exception('Unknown enum value to decode: $data');
}
Expand All @@ -571,4 +578,8 @@ class DecodeBarcodeType {
String toString() {
return value == null ? "null" : value.toString();
}

static List<DecodeBarcodeType> listFromJson(List<dynamic> json) {
return json.map((value) => DecodeBarcodeType.fromJson(value)).toList();
}
}
Loading
Loading