putGenerateMultiple method

Future<ResultImageInfo> putGenerateMultiple(
  1. String name,
  2. GeneratorParamsList generatorParamsList, {
  3. String? format,
  4. String? folder,
  5. String? storage,
})

Generate image with multiple barcodes and put new file on server

Implementation

Future<ResultImageInfo> putGenerateMultiple(
    String name, GeneratorParamsList generatorParamsList,
    {String? format, String? folder, String? storage}) async {
  // ignore: prefer_final_locals
  Object? postBody = generatorParamsList;

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

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

  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, 'PUT', queryParams,
      postBody, headerParams, formParams, contentType, authNames);

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