Skip to content

Commit f3663e2

Browse files
authored
Release 24.4 (#86)
* Add ScanBarcode endpoint * Version 24.4.0 * Drop outdated 'netcoreapp3.1' support * Update examples
1 parent 9aed71f commit f3663e2

File tree

132 files changed

+429
-2518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+429
-2518
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
# and https://github.com/dotnet/core/blob/main/releases.md
1717
# for versions
1818
include:
19-
- dotnet-version: 3.1.x
20-
framework: netcoreapp3.1
2119
- dotnet-version: 6.0.x
2220
framework: net6.0
2321
- dotnet-version: 7.0.x

.github/workflows/net-framework.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
$ErrorActionPreference = "Stop"
4343
VSTest.Console.exe /Framework:".NETFramework,Version=${{ matrix.net-version }}" /ResultsDirectory:Tests\Results /Logger:"trx;LogFileName=test.log" Tests\bin\Release\${{ matrix.framework }}\Aspose.BarCode.Cloud.Sdk.Tests.dll
44-
if( ([xml](Get-Content Tests\Results\test.log)).TestRun.ResultSummary.Counters.total -ne 26 ){ throw "Not all tests were explored or added new tests" }
44+
if( ([xml](Get-Content Tests\Results\test.log)).TestRun.ResultSummary.Counters.total -ne 28 ){ throw "Not all tests were explored or added new tests" }
4545
4646
env:
4747
TEST_CONFIGURATION_JWT_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}

README.md

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Nuget](https://img.shields.io/nuget/v/Aspose.BarCode-Cloud)](https://www.nuget.org/packages/Aspose.BarCode-Cloud/)
77

88
- API version: 3.0
9-
- SDK version: 24.3.0
9+
- SDK version: 24.4.0
1010

1111
## Demo applications
1212

@@ -69,6 +69,7 @@ using Aspose.BarCode.Cloud.Sdk.Interfaces;
6969
using Aspose.BarCode.Cloud.Sdk.Model;
7070
using Aspose.BarCode.Cloud.Sdk.Model.Requests;
7171
using System;
72+
using System.Collections.Generic;
7273
using System.IO;
7374
using System.Reflection;
7475
using System.Threading.Tasks;
@@ -79,7 +80,7 @@ internal static class Program
7980
{
8081
private static Configuration MakeConfiguration()
8182
{
82-
Configuration config = new Configuration();
83+
var config = new Configuration();
8384

8485
string? envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
8586
if (string.IsNullOrEmpty(envToken))
@@ -97,18 +98,15 @@ internal static class Program
9798

9899
private static async Task<string> ReadQR(IBarcodeApi api, string fileName)
99100
{
100-
await using (FileStream imageStream = File.OpenRead(fileName))
101-
{
102-
BarcodeResponseList recognized = await api.PostBarcodeRecognizeFromUrlOrContentAsync(
103-
new PostBarcodeRecognizeFromUrlOrContentRequest(image: imageStream)
104-
{
105-
Type = DecodeBarcodeType.QR.ToString(),
106-
Preset = PresetType.HighPerformance.ToString(),
107-
}
108-
);
109-
110-
return recognized.Barcodes[0].BarcodeValue;
111-
}
101+
await using FileStream imageStream = File.OpenRead(fileName);
102+
BarcodeResponseList recognized = await api.ScanBarcodeAsync(
103+
new ScanBarcodeRequest(imageStream)
104+
{
105+
decodeTypes = new List<DecodeBarcodeType> { DecodeBarcodeType.QR }
106+
}
107+
);
108+
109+
return recognized.Barcodes[0].BarcodeValue;
112110
}
113111

114112
public static async Task Main(string[] args)
@@ -119,7 +117,7 @@ internal static class Program
119117
"qr.png"
120118
));
121119

122-
BarcodeApi api = new BarcodeApi(MakeConfiguration());
120+
var api = new BarcodeApi(MakeConfiguration());
123121

124122
string result = await ReadQR(api, fileName);
125123
Console.WriteLine($"File '{fileName}' recognized, result: '{result}'");
@@ -148,7 +146,7 @@ internal static class Program
148146
{
149147
private static Configuration MakeConfiguration()
150148
{
151-
Configuration config = new Configuration();
149+
var config = new Configuration();
152150

153151
string? envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
154152
if (string.IsNullOrEmpty(envToken))
@@ -166,21 +164,16 @@ internal static class Program
166164

167165
private static async Task GenerateQR(IBarcodeApi api, string fileName)
168166
{
169-
await using (Stream generated = await api.GetBarcodeGenerateAsync(
170-
new GetBarcodeGenerateRequest(
171-
EncodeBarcodeType.QR.ToString(),
172-
"QR code text")
173-
{
174-
TextLocation = "None",
175-
format = "png"
176-
})
177-
)
178-
{
179-
await using (FileStream stream = File.Create(fileName))
167+
await using Stream generated = await api.GetBarcodeGenerateAsync(
168+
new GetBarcodeGenerateRequest(
169+
EncodeBarcodeType.QR.ToString(),
170+
"QR code text")
180171
{
181-
await generated.CopyToAsync(stream);
182-
}
183-
}
172+
TextLocation = CodeLocation.None.ToString(),
173+
format = "png"
174+
});
175+
await using FileStream stream = File.Create(fileName);
176+
await generated.CopyToAsync(stream);
184177
}
185178

186179
public static async Task Main(string[] args)
@@ -230,6 +223,7 @@ Class | Method | HTTP request | Description
230223
*BarcodeApi* | [**PutBarcodeGenerateFile**](docs/BarcodeApi.md#putbarcodegeneratefile) | **PUT** /barcode/{name}/generate | Generate barcode and save on server (from query params or from file with json or xml content)
231224
*BarcodeApi* | [**PutBarcodeRecognizeFromBody**](docs/BarcodeApi.md#putbarcoderecognizefrombody) | **PUT** /barcode/{name}/recognize | Recognition of a barcode from file on server with parameters in body.
232225
*BarcodeApi* | [**PutGenerateMultiple**](docs/BarcodeApi.md#putgeneratemultiple) | **PUT** /barcode/{name}/generateMultiple | Generate image with multiple barcodes and put new file on server
226+
*BarcodeApi* | [**ScanBarcode**](docs/BarcodeApi.md#scanbarcode) | **POST** /barcode/scan | Quickly scan a barcode from an image.
233227
*FileApi* | [**CopyFile**](docs/FileApi.md#copyfile) | **PUT** /barcode/storage/file/copy/{srcPath} | Copy file
234228
*FileApi* | [**DeleteFile**](docs/FileApi.md#deletefile) | **DELETE** /barcode/storage/file/{path} | Delete file
235229
*FileApi* | [**DownloadFile**](docs/FileApi.md#downloadfile) | **GET** /barcode/storage/file/{path} | Download file

Tests/ApiExceptionTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using Aspose.BarCode.Cloud.Sdk.Model;
33
using Aspose.BarCode.Cloud.Sdk.Model.Requests;
44
using NUnit.Framework;
5-
using System;
6-
using System.Threading.Tasks;
75

86
namespace Aspose.BarCode.Cloud.Sdk.Tests
97
{
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
3-
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net462;net480;net481;net6.0;net7.0;net8.0</TargetFrameworks>
5-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
6-
<IsTestProject>true</IsTestProject>
7-
<LangVersion>8.0</LangVersion>
8-
</PropertyGroup>
9-
<ItemGroup>
10-
<Compile Remove="TestResults\**" />
11-
<EmbeddedResource Remove="TestResults\**" />
12-
<None Remove="TestResults\**" />
13-
</ItemGroup>
14-
<ItemGroup>
15-
<PackageReference Include="Moq" Version="4.20.70" />
16-
<PackageReference Include="NUnit" Version="3.14.0" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
19-
<PackageReference Include="System.Net.Http" Version="4.3.4" />
20-
</ItemGroup>
21-
<ItemGroup>
22-
<ProjectReference Include="..\src\Aspose.BarCode.Cloud.Sdk.csproj" />
23-
</ItemGroup>
3+
<PropertyGroup>
4+
<TargetFrameworks>net462;net480;net481;net6.0;net7.0;net8.0</TargetFrameworks>
5+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
6+
<IsTestProject>true</IsTestProject>
7+
<LangVersion>8.0</LangVersion>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<Compile Remove="TestResults\**"/>
11+
<EmbeddedResource Remove="TestResults\**"/>
12+
<None Remove="TestResults\**"/>
13+
</ItemGroup>
14+
<ItemGroup>
15+
<PackageReference Include="Moq" Version="4.20.70"/>
16+
<PackageReference Include="NUnit" Version="3.14.0"/>
17+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
19+
<PackageReference Include="System.Net.Http" Version="4.3.4"/>
20+
</ItemGroup>
21+
<ItemGroup>
22+
<ProjectReference Include="..\src\Aspose.BarCode.Cloud.Sdk.csproj"/>
23+
</ItemGroup>
2424
</Project>

Tests/BarcodeApiTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public async Task PostBarcodeRecognizeFromUrlOrContentAsyncTest()
157157
{
158158
ChecksumValidation = ChecksumValidation.Off.ToString(),
159159
Preset = PresetType.HighPerformance.ToString(),
160-
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.Code11 },
160+
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.Code11 }
161161
}
162162
);
163163

Tests/Configuration.template.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"ClientId": "Client Id from https://dashboard.aspose.cloud/applications",
3-
"ClientSecret": "Client Secret from https://dashboard.aspose.cloud/applications",
4-
"ApiBaseUrl": "https://api.aspose.cloud",
5-
"TokenUrl":"https://api.aspose.cloud/connect/token"
2+
"ClientId": "Client Id from https://dashboard.aspose.cloud/applications",
3+
"ClientSecret": "Client Secret from https://dashboard.aspose.cloud/applications",
4+
"ApiBaseUrl": "https://api.aspose.cloud",
5+
"TokenUrl": "https://api.aspose.cloud/connect/token"
66
}

Tests/JWTRequestHandlerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public void TestTokenFetched()
4949

5050
// assert
5151
Assert.Contains("Authorization", request.Headers.Keys);
52-
var auth = request.Headers["Authorization"];
52+
string auth = request.Headers["Authorization"];
5353
Assert.Greater(auth.Length, "Bearer ".Length);
54-
var token = auth.Substring("Bearer ".Length);
54+
string token = auth.Substring("Bearer ".Length);
5555
AssertTokenIsValid(token);
5656
}
5757

Tests/JwtAuthTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public async Task CanUseExternalTokenWithAsync()
5050
var api = new BarcodeApi(configWithToken);
5151
using Stream generated = await api.GetBarcodeGenerateAsync(
5252
new GetBarcodeGenerateRequest(
53-
EncodeBarcodeType.QR.ToString(), "Test")
54-
);
53+
EncodeBarcodeType.QR.ToString(), "Test")
54+
);
5555
Assert.Greater(generated.Length, 0);
5656
}
5757
}

Tests/RecognizeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task RecognizeQrAsyncTest()
3636
new PostBarcodeRecognizeFromUrlOrContentRequest(image)
3737
{
3838
Preset = PresetType.HighPerformance.ToString(),
39-
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.QR },
39+
Types = new List<DecodeBarcodeType> { DecodeBarcodeType.QR }
4040
}
4141
);
4242

0 commit comments

Comments
 (0)