getBarcodeRecognize method

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

Recognize barcode from a file on server.

Implementation

Future<BarcodeResponseList> getBarcodeRecognize(String name,
    {String? type,
    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 = null;

  // 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 (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;
  }
}