scan method
Scan barcode from file on server in the Internet using GET requests with parameter in query string. For scaning files from your hard drive use `scan-body` or `scan-multipart` endpoints instead.
Implementation
Future<BarcodeResponseList> scan(String fileUrl) async {
// ignore: prefer_final_locals
Object? postBody;
// create path and map variables
final String requestPath = "/barcode/scan";
// query params
final List<QueryParam> queryParams = [];
final Map<String, String> headerParams = {};
final Map<String, String> formParams = {};
queryParams
.addAll(convertParametersForCollectionFormat("", "fileUrl", fileUrl));
final List<String> contentTypes = [];
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) {
ApiErrorResponse error;
try {
error = _apiClient.deserialize(response.body, 'ApiErrorResponse');
} catch (e) {
throw ApiException(response.statusCode, response.body);
}
throw ApiException.withResponse(
response.statusCode,
response.reasonPhrase == null
? "Api response error"
: response.reasonPhrase!,
error);
} else {
return _apiClient.deserialize(response.body, 'BarcodeResponseList')
as BarcodeResponseList;
}
}