deleteFolder method

Future deleteFolder(
  1. String path, {
  2. String? storageName,
  3. bool? recursive,
})

Delete folder

Implementation

Future deleteFolder(String path,
    {String? storageName, bool? recursive}) async {
  // ignore: prefer_final_locals
  Object? postBody = null;

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

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

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

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