Skip to content

Release 24.6 #38

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

Merged
merged 3 commits into from
Jun 27, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.24.6

* June 2024 Release

## 1.24.5

* May 2024 Release
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ fix: init
dart fix --apply

.PHONY: after-gen
after-gen: fix
after-gen: fix insert-example
./scripts/annotate-deprecated.bash
@dart format .

.PHONY: insert-example
insert-example:
./scripts/insert-example.bash

.PHONY: update
update:
dart pub upgrade
Expand Down
49 changes: 30 additions & 19 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: 1.24.5
- SDK version: 1.24.6

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: 1.24.5
aspose_barcode_cloud: 1.24.6
```

## Sample usage
Expand All @@ -44,44 +44,55 @@ dependencies:
The examples below show how you can generate QR barcode and save it into a local file and then recognize using **aspose_barcode_cloud**:

```dart
import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart' as barcode;

import 'dart:typed_data';
import 'dart:io';
import 'dart:typed_data';

import 'package:http/http.dart';
import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';
import 'package:http/http.dart' show MultipartFile;

Future<void> main() async {
const fileName = "qr.png";
// Setup
final apiClient = barcode.ApiClient(

final api = BarcodeApi(ApiClient(Configuration(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret:
"Client Secret from https://dashboard.aspose.cloud/applications",
);
final api = barcode.BarcodeApi(apiClient);
// For testing only
accessToken: Platform.environment["TEST_CONFIGURATION_ACCESS_TOKEN"],
)));

// Generate image with barcode
Uint8List? generated =
await api.getBarcodeGenerate("QR", "text", textLocation: "None");
final Uint8List generated = await api.getBarcodeGenerate(
EncodeBarcodeType.QR.toString(),
"text",
textLocation: CodeLocation.None.toString(),
);

// Save generated image to file
await File(fileName).writeAsBytes(generated!);
print("Generated image saved to " + fileName);
File(fileName).writeAsBytesSync(generated);
print("Generated image saved to '$fileName'");

// Recognize generated image
final formFile = MultipartFile.fromBytes("image", generated.toList(),
filename: "barcode.png");
barcode.BarcodeResponseList? recognized =
await api.postBarcodeRecognizeFromUrlOrContent(image: formFile);
final BarcodeResponseList recognized = await api.scanBarcode(
formFile,
decodeTypes: [DecodeBarcodeType.QR],
);

print("Recognized Type: " + recognized!.barcodes![0].type!);
print("Recognized Value: " + recognized.barcodes![0].barcodeValue!);
if (recognized.barcodes != null && recognized.barcodes!.isNotEmpty) {
print("Recognized Type: ${recognized.barcodes![0].type!}");
print("Recognized Value: ${recognized.barcodes![0].barcodeValue!}");
} else {
print("No barcode found");
}
}

```

## Dependencies

- http: '>=0.13.0 <0.14.0'
- http: '>=0.13.0 <2.0.0'

## Licensing

Expand Down
2 changes: 1 addition & 1 deletion lib/src/api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'api_helper.dart';
import 'auth/authentication.dart';

/// Current SDK Version
const SDK_VERSION = "1.24.5";
const SDK_VERSION = "1.24.6";

/// ApiClient is responsible for making HTTP requests to the API.
class ApiClient {
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: aspose_barcode_cloud
description: This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily
version: 1.24.5
version: 1.24.6
homepage: https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dart

platforms:
Expand All @@ -17,5 +17,5 @@ dependencies:
http: '>=0.13.0 <2.0.0'

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.1
8 changes: 8 additions & 0 deletions scripts/insert-example.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

dart run "${SCRIPT_DIR}/insert-example.dart"

rm "README.template"
41 changes: 41 additions & 0 deletions scripts/insert-example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'dart:io';

void main() async {
final templateFile = File('README.template');
final outputFile = File('README.md');

// Read the template file
if (!await templateFile.exists()) {
throw Exception('Error: $templateFile does not exist.');
}
String templateContent = await templateFile.readAsString();

// Regex to find the %insert path/to/file.dart% pattern
final regex = RegExp(r'%insert ([^%]+)%');

// Function to replace the placeholders
String replacePlaceholders(String content) {
return content.replaceAllMapped(regex, (match) {
final path = match.group(1);
if (path == null || path.isEmpty) {
throw Exception('Incorrect value $path');
}

final file = File(path);
if (!file.existsSync()) {
throw Exception('Error: File $path does not exist.');
}

final fileContent = file.readAsStringSync();
return fileContent;
});
}

// Replace placeholders in the template content
String modifiedContent = replacePlaceholders(templateContent);

// Write the modified content to the output file
await outputFile.writeAsString(modifiedContent);

print('README.md file has been generated.');
}