moveFolder method

Future moveFolder(
  1. String srcPath,
  2. String destPath, {
  3. String? srcStorageName,
  4. String? destStorageName,
})

Move folder

Implementation

Future moveFolder(String srcPath, String destPath,
    {String? srcStorageName, String? destStorageName}) async {
  // ignore: prefer_final_locals
  Object? postBody;

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

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

  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;
  }
}