putBarcodeRecognizeFromBody method

Future<BarcodeResponseList> putBarcodeRecognizeFromBody(
  1. String name,
  2. ReaderParams readerParams, {
  3. String? type,
  4. String? storage,
  5. String? folder,
})

Recognition of a barcode from file on server with parameters in body.

Implementation

Future<BarcodeResponseList> putBarcodeRecognizeFromBody(
    String name, ReaderParams readerParams,
    {String? type, String? storage, String? folder}) async {
  // ignore: prefer_final_locals
  Object? postBody = readerParams;

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