import com.aspose.storage.model.RemoveFolderResponse; //导入依赖的package包/类
/**
* DeleteFolder
* Remove a specific folder. Parameters: path - folder path e.g. /Folder1, storage - user's storage name, recursive - is subfolders and files must be deleted for specified path.
* @param Path String
* @param storage String
* @param recursive Boolean
* @return RemoveFolderResponse
*/
public RemoveFolderResponse DeleteFolder (String Path, String storage, Boolean recursive) {
Object postBody = null;
// verify required params are set
if(Path == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/storage/folder/{Path}/?appSid={appSid}&storage={storage}&recursive={recursive}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(Path!=null)
resourcePath = resourcePath.replace("{" + "Path" + "}" , apiInvoker.toPathValue(Path));
else
resourcePath = resourcePath.replaceAll("[&?]Path.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(recursive!=null)
resourcePath = resourcePath.replace("{" + "recursive" + "}" , apiInvoker.toPathValue(recursive));
else
resourcePath = resourcePath.replaceAll("[&?]recursive.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
return (RemoveFolderResponse) ApiInvoker.deserialize(response, "", RemoveFolderResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
请发表评论