Skip to content
Open
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
12 changes: 7 additions & 5 deletions Examples/GenerateAndScan/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ print("Generating QR barcode...")
let imageData = try await GenerateAPI.generate(
barcodeType: .qr,
data: barcodeValue,
imageFormat: .png,
qrEncodeMode: .auto,
qrErrorLevel: .levelM,
qrVersion: .auto,
qrAspectRatio: 0.75,
barcodeImageParams: BarcodeImageParams(imageFormat: .png),
qrParams: QrParams(
qrEncodeMode: .auto,
qrErrorLevel: .levelM,
qrVersion: .auto,
qrAspectRatio: 0.75
),
apiConfiguration: client.apiConfiguration
)
try imageData.write(to: URL(fileURLWithPath: "QR.png"))
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ print("Generating QR barcode...")
let imageData = try await GenerateAPI.generate(
barcodeType: .qr,
data: barcodeValue,
imageFormat: .png,
qrEncodeMode: .auto,
qrErrorLevel: .levelM,
qrVersion: .auto,
qrAspectRatio: 0.75,
barcodeImageParams: BarcodeImageParams(imageFormat: .png),
qrParams: QrParams(
qrEncodeMode: .auto,
qrErrorLevel: .levelM,
qrVersion: .auto,
qrAspectRatio: 0.75
),
apiConfiguration: client.apiConfiguration
)
try imageData.write(to: URL(fileURLWithPath: "QR.png"))
Expand Down
228 changes: 114 additions & 114 deletions Sources/AsposeBarcodeCloud/APIs/GenerateAPI.swift

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Sources/AsposeBarcodeCloud/APIs/RecognizeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ open class RecognizeAPI {
/**
Recognize a barcode from a file in the request body using a POST request with multipart form parameters.

- parameter barcodeType: (form)
- parameter barcodeType: (form) See https://reference.aspose.com/barcode/net/aspose.barcode.barcoderecognition/decodetype/
- parameter file: (form) Barcode image file.
- parameter recognitionMode: (form) (optional)
- parameter recognitionImageKind: (form) (optional)
- parameter recognitionMode: (form) Recognition mode. (optional)
- parameter recognitionImageKind: (form) Image kind for recognition. (optional)
- parameter apiConfiguration: The configuration for the http request.
- parameter completion: completion handler to receive the data and the error objects
*/
Expand All @@ -162,10 +162,10 @@ open class RecognizeAPI {
/**
Recognize a barcode from a file in the request body using a POST request with multipart form parameters.

- parameter barcodeType: (form)
- parameter barcodeType: (form) See https://reference.aspose.com/barcode/net/aspose.barcode.barcoderecognition/decodetype/
- parameter file: (form) Barcode image file.
- parameter recognitionMode: (form) (optional)
- parameter recognitionImageKind: (form) (optional)
- parameter recognitionMode: (form) Recognition mode. (optional)
- parameter recognitionImageKind: (form) Image kind for recognition. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: BarcodeResponseList
*/
Expand All @@ -179,10 +179,10 @@ open class RecognizeAPI {
- OAuth:
- type: oauth2
- name: JWT
- parameter barcodeType: (form)
- parameter barcodeType: (form) See https://reference.aspose.com/barcode/net/aspose.barcode.barcoderecognition/decodetype/
- parameter file: (form) Barcode image file.
- parameter recognitionMode: (form) (optional)
- parameter recognitionImageKind: (form) (optional)
- parameter recognitionMode: (form) Recognition mode. (optional)
- parameter recognitionImageKind: (form) Image kind for recognition. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<BarcodeResponseList>
*/
Expand Down
1 change: 1 addition & 0 deletions Sources/AsposeBarcodeCloud/Models/ApiError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public final class ApiError: @unchecked Sendable, Codable, Hashable {
public var description: String?
/** Gets or sets server datetime. */
public var dateTime: Date?
/** Gets or sets inner error. */
public var innerError: ApiError?

public init(code: String?, message: String?, description: String? = nil, dateTime: Date? = nil, innerError: ApiError? = nil) {
Expand Down
1 change: 1 addition & 0 deletions Sources/AsposeBarcodeCloud/Models/ApiErrorResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Foundation
public final class ApiErrorResponse: @unchecked Sendable, Codable, Hashable {
/** Gets or sets request Id. */
public var requestId: String?
/** Gets or sets error. */
public var error: ApiError

public init(requestId: String?, error: ApiError) {
Expand Down
3 changes: 3 additions & 0 deletions Sources/AsposeBarcodeCloud/Models/BarcodeImageParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import Foundation
/** Optional barcode image parameters. */
public final class BarcodeImageParams: @unchecked Sendable, Codable, Hashable {
public static let resolutionRule = NumericRule<Float>(minimum: 1, exclusiveMinimum: false, maximum: 100_000, exclusiveMaximum: false, multipleOf: nil)
/** Barcode output image format. Default value: png. */
public var imageFormat: BarcodeImageFormat?
/** Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. */
public var textLocation: CodeLocation?
/** Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. */
public var foregroundColor: String? = "Black"
/** Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. */
public var backgroundColor: String? = "White"
/** Common units for all measurements. Default units: pixels. */
public var units: GraphicsUnit?
/** Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. */
public var resolution: Float?
Expand Down
1 change: 1 addition & 0 deletions Sources/AsposeBarcodeCloud/Models/Code128Params.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation

/** Optional Code128 barcode generation parameters. */
public final class Code128Params: @unchecked Sendable, Codable, Hashable {
/** Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. */
public var code128EncodeMode: Code128EncodeMode?

public init(code128EncodeMode: Code128EncodeMode? = nil) {
Expand Down
1 change: 1 addition & 0 deletions Sources/AsposeBarcodeCloud/Models/EncodeData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
/** Data to encode in a barcode. */
public final class EncodeData: @unchecked Sendable, Codable, Hashable {
public static let dataRule = StringRule(minLength: 1, maxLength: nil, pattern: nil)
/** Type of data to encode. Default value: StringData. */
public var dataType: EncodeDataType?
/** String that represents the data to encode. */
public var data: String
Expand Down
6 changes: 6 additions & 0 deletions Sources/AsposeBarcodeCloud/Models/GenerateParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ import Foundation

/** Barcode generation parameters. */
public final class GenerateParams: @unchecked Sendable, Codable, Hashable {
/** Barcode type. */
public var barcodeType: EncodeBarcodeType
/** Data to encode into a barcode. */
public var encodeData: EncodeData
/** Optional barcode image parameters. */
public var barcodeImageParams: BarcodeImageParams?
/** Optional QR barcode generation parameters. */
public var qrParams: QrParams?
/** Optional Code128 barcode generation parameters. */
public var code128Params: Code128Params?
/** Optional PDF417 barcode generation parameters. */
public var pdf417Params: Pdf417Params?

public init(barcodeType: EncodeBarcodeType, encodeData: EncodeData, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil) {
Expand Down
4 changes: 4 additions & 0 deletions Sources/AsposeBarcodeCloud/Models/Pdf417Params.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public final class Pdf417Params: @unchecked Sendable, Codable, Hashable {
public static let pdf417ColumnsRule = NumericRule<Int>(minimum: 0, exclusiveMinimum: false, maximum: 30, exclusiveMaximum: false, multipleOf: nil)
public static let pdf417RowsRule = NumericRule<Int>(minimum: 0, exclusiveMinimum: false, maximum: 90, exclusiveMaximum: false, multipleOf: nil)
public static let pdf417AspectRatioRule = NumericRule<Float>(minimum: 2, exclusiveMinimum: false, maximum: 10, exclusiveMaximum: false, multipleOf: nil)
/** PDF417 barcode encode mode. */
public var pdf417EncodeMode: Pdf417EncodeMode?
/** PDF417 barcode error correction level. */
public var pdf417ErrorLevel: Pdf417ErrorLevel?
/** Whether to use truncated PDF417 format (removes right-side stop pattern). */
public var pdf417Truncate: Bool?
Expand All @@ -22,9 +24,11 @@ public final class Pdf417Params: @unchecked Sendable, Codable, Hashable {
public var pdf417Rows: Int?
/** PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. */
public var pdf417AspectRatio: Float?
/** ECI encoding for PDF417 barcode data. */
public var pdf417ECIEncoding: ECIEncodings?
/** Whether the barcode is used for reader initialization (programming). */
public var pdf417IsReaderInitialization: Bool?
/** Macro character to prepend (structured append). */
public var pdf417MacroCharacters: MacroCharacter?
/** Whether to use linked mode (for MicroPdf417). */
public var pdf417IsLinked: Bool?
Expand Down
6 changes: 6 additions & 0 deletions Sources/AsposeBarcodeCloud/Models/QrParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ import Foundation
/** Optional QR barcode generation parameters. Applies to QR, GS1QR, MicroQR, and RectMicroQR barcode types. */
public final class QrParams: @unchecked Sendable, Codable, Hashable {
public static let qrAspectRatioRule = NumericRule<Float>(minimum: 0.001, exclusiveMinimum: false, maximum: 1, exclusiveMaximum: false, multipleOf: nil)
/** QR barcode encode mode. */
public var qrEncodeMode: QREncodeMode?
/** QR barcode error correction level. */
public var qrErrorLevel: QRErrorLevel?
/** QR barcode version. Automatically selects the smallest version that fits the data. */
public var qrVersion: QRVersion?
/** ECI encoding for QR barcode data. */
public var qrECIEncoding: ECIEncodings?
/** QR barcode aspect ratio. Values: 0 to 1. */
public var qrAspectRatio: Float?
/** MicroQR barcode version. Used when BarcodeType is MicroQR. */
public var microQRVersion: MicroQRVersion?
/** RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. */
public var rectMicroQrVersion: RectMicroQRVersion?

public init(qrEncodeMode: QREncodeMode? = nil, qrErrorLevel: QRErrorLevel? = nil, qrVersion: QRVersion? = nil, qrECIEncoding: ECIEncodings? = nil, qrAspectRatio: Float? = nil, microQRVersion: MicroQRVersion? = nil, rectMicroQrVersion: RectMicroQRVersion? = nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public final class RecognizeBase64Request: @unchecked Sendable, Codable, Hashabl
public var barcodeTypes: [DecodeBarcodeType]
/** Barcode image bytes encoded as base-64. */
public var fileBase64: String
/** Barcode recognition mode. */
public var recognitionMode: RecognitionMode?
/** Image kind for recognition. */
public var recognitionImageKind: RecognitionImageKind?

public init(barcodeTypes: [DecodeBarcodeType], fileBase64: String, recognitionMode: RecognitionMode? = nil, recognitionImageKind: RecognitionImageKind? = nil) {
Expand Down
4 changes: 2 additions & 2 deletions Tests/AsposeBarcodeCloudTests/AsposeBarcodeCloudTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ final class AsposeBarcodeCloudTests: XCTestCase {
let data = try await GenerateAPI.generate(
barcodeType: .qr,
data: "Aspose.BarCode Swift SDK",
imageFormat: .png,
barcodeImageParams: BarcodeImageParams(imageFormat: .png),
apiConfiguration: client.apiConfiguration
)
XCTAssertGreaterThan(data.count, 0)
Expand All @@ -141,7 +141,7 @@ final class AsposeBarcodeCloudTests: XCTestCase {
barcodeType: .qr,
data: "54657374",
dataType: .hexBytes,
backgroundColor: "0xffe",
barcodeImageParams: BarcodeImageParams(backgroundColor: "0xffe"),
apiConfiguration: client.apiConfiguration
)
XCTAssertGreaterThan(data.count, 0)
Expand Down
6 changes: 2 additions & 4 deletions Tests/AsposeBarcodeCloudTests/RequestBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ final class RequestBuilderTests: XCTestCase {
barcodeType: .qr,
data: "hello world",
dataType: .stringData,
imageFormat: .png,
textLocation: ._none,
barcodeImageParams: BarcodeImageParams(imageFormat: .png, textLocation: ._none),
apiConfiguration: client.apiConfiguration
)

Expand Down Expand Up @@ -67,8 +66,7 @@ final class RequestBuilderTests: XCTestCase {
barcodeType: .qr,
data: "payload",
dataType: .stringData,
imageFormat: .png,
textLocation: ._none
barcodeImageParams: BarcodeImageParams(imageFormat: .png, textLocation: ._none)
)

XCTAssertEqual(builder.method, "POST")
Expand Down
2 changes: 1 addition & 1 deletion docs/ApiError.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
**message** | **String** | Gets or sets error message. |
**description** | **String** | Gets or sets error description. | [optional]
**dateTime** | **Date** | Gets or sets server datetime. | [optional]
**innerError** | [**ApiError**](ApiError.md) | | [optional]
**innerError** | [**ApiError**](ApiError.md) | Gets or sets inner error. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/ApiErrorResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**requestId** | **String** | Gets or sets request Id. |
**error** | [**ApiError**](ApiError.md) | |
**error** | [**ApiError**](ApiError.md) | Gets or sets error. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
6 changes: 3 additions & 3 deletions docs/BarcodeImageParams.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**imageFormat** | [**BarcodeImageFormat**](BarcodeImageFormat.md) | | [optional]
**textLocation** | [**CodeLocation**](CodeLocation.md) | | [optional]
**imageFormat** | [**BarcodeImageFormat**](BarcodeImageFormat.md) | Barcode output image format. Default value: png. | [optional]
**textLocation** | [**CodeLocation**](CodeLocation.md) | Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. | [optional]
**foregroundColor** | **String** | Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. | [optional] [default to "Black"]
**backgroundColor** | **String** | Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. | [optional] [default to "White"]
**units** | [**GraphicsUnit**](GraphicsUnit.md) | | [optional]
**units** | [**GraphicsUnit**](GraphicsUnit.md) | Common units for all measurements. Default units: pixels. | [optional]
**resolution** | **Float** | Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. | [optional]
**imageHeight** | **Float** | Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. | [optional]
**imageWidth** | **Float** | Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. | [optional]
Expand Down
2 changes: 1 addition & 1 deletion docs/Code128Params.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code128EncodeMode** | [**Code128EncodeMode**](Code128EncodeMode.md) | | [optional]
**code128EncodeMode** | [**Code128EncodeMode**](Code128EncodeMode.md) | Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/EncodeData.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**dataType** | [**EncodeDataType**](EncodeDataType.md) | | [optional]
**dataType** | [**EncodeDataType**](EncodeDataType.md) | Type of data to encode. Default value: StringData. | [optional]
**data** | **String** | String that represents the data to encode. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Loading