getBarcodeRecognize method

Future<BarcodeResponseList> getBarcodeRecognize(
  1. String name, {
  2. String? type,
  3. List<DecodeBarcodeType>? types,
  4. String? checksumValidation,
  5. bool? detectEncoding,
  6. String? preset,
  7. int? rectX,
  8. int? rectY,
  9. int? rectWidth,
  10. int? rectHeight,
  11. bool? stripFNC,
  12. int? timeout,
  13. int? medianSmoothingWindowSize,
  14. bool? allowMedianSmoothing,
  15. bool? allowComplexBackground,
  16. bool? allowDatamatrixIndustrialBarcodes,
  17. bool? allowDecreasedImage,
  18. bool? allowDetectScanGap,
  19. bool? allowIncorrectBarcodes,
  20. bool? allowInvertImage,
  21. bool? allowMicroWhiteSpotsRemoving,
  22. bool? allowOneDFastBarcodesDetector,
  23. bool? allowOneDWipedBarsRestoration,
  24. bool? allowQRMicroQrRestoration,
  25. bool? allowRegularImage,
  26. bool? allowSaltAndPepperFiltering,
  27. bool? allowWhiteSpotsRemoving,
  28. bool? checkMore1DVariants,
  29. bool? fastScanOnly,
  30. bool? allowAdditionalRestorations,
  31. double? regionLikelihoodThresholdPercent,
  32. List<int>? scanWindowSizes,
  33. double? similarity,
  34. bool? skipDiagonalSearch,
  35. bool? readTinyBarcodes,
  36. String? australianPostEncodingTable,
  37. bool? ignoreEndingFillingPatternsForCTable,
  38. String? storage,
  39. String? folder,
})

Recognize barcode from a file on server.

Implementation

Future<BarcodeResponseList> getBarcodeRecognize(String name,
    {String? type,
    List<DecodeBarcodeType>? types,
    String? checksumValidation,
    bool? detectEncoding,
    String? preset,
    int? rectX,
    int? rectY,
    int? rectWidth,
    int? rectHeight,
    bool? stripFNC,
    int? timeout,
    int? medianSmoothingWindowSize,
    bool? allowMedianSmoothing,
    bool? allowComplexBackground,
    bool? allowDatamatrixIndustrialBarcodes,
    bool? allowDecreasedImage,
    bool? allowDetectScanGap,
    bool? allowIncorrectBarcodes,
    bool? allowInvertImage,
    bool? allowMicroWhiteSpotsRemoving,
    bool? allowOneDFastBarcodesDetector,
    bool? allowOneDWipedBarsRestoration,
    bool? allowQRMicroQrRestoration,
    bool? allowRegularImage,
    bool? allowSaltAndPepperFiltering,
    bool? allowWhiteSpotsRemoving,
    bool? checkMore1DVariants,
    bool? fastScanOnly,
    bool? allowAdditionalRestorations,
    double? regionLikelihoodThresholdPercent,
    List<int>? scanWindowSizes,
    double? similarity,
    bool? skipDiagonalSearch,
    bool? readTinyBarcodes,
    String? australianPostEncodingTable,
    bool? ignoreEndingFillingPatternsForCTable,
    String? storage,
    String? folder}) async {
  // ignore: prefer_final_locals
  Object? postBody;

  // create path and map variables
  final String requestPath = "/barcode/{name}/recognize"
      .replaceAll("{format}", "json")
      .replaceAll("{name}", name);

  // query params
  final List<QueryParam> queryParams = [];
  final Map<String, String> headerParams = {};
  final Map<String, String> formParams = {};
  if (type != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "Type", type));
  }
  if (types != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("multi", "Types", types));
  }
  if (checksumValidation != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "ChecksumValidation", checksumValidation));
  }
  if (detectEncoding != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "DetectEncoding", detectEncoding));
  }
  if (preset != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "Preset", preset));
  }
  if (rectX != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "RectX", rectX));
  }
  if (rectY != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "RectY", rectY));
  }
  if (rectWidth != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "RectWidth", rectWidth));
  }
  if (rectHeight != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "RectHeight", rectHeight));
  }
  if (stripFNC != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "StripFNC", stripFNC));
  }
  if (timeout != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "Timeout", timeout));
  }
  if (medianSmoothingWindowSize != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "MedianSmoothingWindowSize", medianSmoothingWindowSize));
  }
  if (allowMedianSmoothing != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowMedianSmoothing", allowMedianSmoothing));
  }
  if (allowComplexBackground != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowComplexBackground", allowComplexBackground));
  }
  if (allowDatamatrixIndustrialBarcodes != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "",
        "AllowDatamatrixIndustrialBarcodes",
        allowDatamatrixIndustrialBarcodes));
  }
  if (allowDecreasedImage != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowDecreasedImage", allowDecreasedImage));
  }
  if (allowDetectScanGap != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowDetectScanGap", allowDetectScanGap));
  }
  if (allowIncorrectBarcodes != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowIncorrectBarcodes", allowIncorrectBarcodes));
  }
  if (allowInvertImage != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowInvertImage", allowInvertImage));
  }
  if (allowMicroWhiteSpotsRemoving != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowMicroWhiteSpotsRemoving", allowMicroWhiteSpotsRemoving));
  }
  if (allowOneDFastBarcodesDetector != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowOneDFastBarcodesDetector", allowOneDFastBarcodesDetector));
  }
  if (allowOneDWipedBarsRestoration != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowOneDWipedBarsRestoration", allowOneDWipedBarsRestoration));
  }
  if (allowQRMicroQrRestoration != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowQRMicroQrRestoration", allowQRMicroQrRestoration));
  }
  if (allowRegularImage != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowRegularImage", allowRegularImage));
  }
  if (allowSaltAndPepperFiltering != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowSaltAndPepperFiltering", allowSaltAndPepperFiltering));
  }
  if (allowWhiteSpotsRemoving != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowWhiteSpotsRemoving", allowWhiteSpotsRemoving));
  }
  if (checkMore1DVariants != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "CheckMore1DVariants", checkMore1DVariants));
  }
  if (fastScanOnly != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "FastScanOnly", fastScanOnly));
  }
  if (allowAdditionalRestorations != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AllowAdditionalRestorations", allowAdditionalRestorations));
  }
  if (regionLikelihoodThresholdPercent != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "",
        "RegionLikelihoodThresholdPercent",
        regionLikelihoodThresholdPercent));
  }
  if (scanWindowSizes != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "multi", "ScanWindowSizes", scanWindowSizes));
  }
  if (similarity != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "Similarity", similarity));
  }
  if (skipDiagonalSearch != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "SkipDiagonalSearch", skipDiagonalSearch));
  }
  if (readTinyBarcodes != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "ReadTinyBarcodes", readTinyBarcodes));
  }
  if (australianPostEncodingTable != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AustralianPostEncodingTable", australianPostEncodingTable));
  }
  if (ignoreEndingFillingPatternsForCTable != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "",
        "IgnoreEndingFillingPatternsForCTable",
        ignoreEndingFillingPatternsForCTable));
  }
  if (storage != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "storage", storage));
  }
  if (folder != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "folder", folder));
  }

  final List<String> contentTypes = ["application/json"];

  final String contentType =
      contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
  final List<String> authNames = ["JWT"];

  final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams,
      postBody, headerParams, formParams, contentType, authNames);

  if (response.statusCode >= 400) {
    throw ApiException(response.statusCode, response.body);
  } else {
    return _apiClient.deserialize(response.body, 'BarcodeResponseList')
        as BarcodeResponseList;
  }
}