postGenerateMultiple method

Future<Uint8List> postGenerateMultiple(
  1. GeneratorParamsList generatorParamsList, {
  2. String? format,
})

Generate multiple barcodes and return in response stream

Implementation

Future<Uint8List> postGenerateMultiple(
    GeneratorParamsList generatorParamsList,
    {String? format}) async {
  // ignore: prefer_final_locals
  Object? postBody = generatorParamsList;

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

  // query params
  final List<QueryParam> queryParams = [];
  final Map<String, String> headerParams = {};
  final Map<String, String> formParams = {};
  if (format != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "format", format));
  }

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

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

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

  if (response.statusCode >= 400) {
    throw ApiException(response.statusCode, response.body);
  } else {
    return response.bodyBytes;
  }
}