public class BoxTrash extends Object implements Iterable<BoxItem.Info>
Unless otherwise noted, the methods in this class can throw an unchecked BoxAPIException
(unchecked
meaning that the compiler won't force you to handle it) if an error occurs. If you wish to implement custom error
handling for errors related to the Box REST API, you should capture this exception explicitly.
Constructor and Description |
---|
BoxTrash(BoxAPIConnection api)
Constructs a BoxTrash using a given API connection.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteFile(String fileID)
Permanently deletes a trashed file.
|
void |
deleteFolder(String folderID)
Permanently deletes a trashed folder.
|
BoxFile.Info |
getFileInfo(String fileID)
Gets information about a trashed file.
|
BoxFile.Info |
getFileInfo(String fileID,
String... fields)
Gets information about a trashed file that's limited to a list of specified fields.
|
BoxFolder.Info |
getFolderInfo(String folderID)
Gets information about a trashed folder.
|
BoxFolder.Info |
getFolderInfo(String folderID,
String... fields)
Gets information about a trashed folder that's limited to a list of specified fields.
|
Iterator<BoxItem.Info> |
iterator()
Returns an iterator over the items in the trash.
|
BoxFile.Info |
restoreFile(String fileID)
Restores a trashed file back to its original location.
|
BoxFile.Info |
restoreFile(String fileID,
String newName,
String newParentID)
Restores a trashed file to a new location with a new name.
|
BoxFolder.Info |
restoreFolder(String folderID)
Restores a trashed folder back to its original location.
|
BoxFolder.Info |
restoreFolder(String folderID,
String newName,
String newParentID)
Restores a trashed folder to a new location with a new name.
|
public BoxTrash(BoxAPIConnection api)
api
- the API connection to be used by the trash.public void deleteFolder(String folderID)
folderID
- the ID of the trashed folder to permanently delete.public BoxFolder.Info getFolderInfo(String folderID)
folderID
- the ID of the trashed folder.public BoxFolder.Info getFolderInfo(String folderID, String... fields)
folderID
- the ID of the trashed folder.fields
- the fields to retrieve.public BoxFolder.Info restoreFolder(String folderID)
folderID
- the ID of the trashed folder.public BoxFolder.Info restoreFolder(String folderID, String newName, String newParentID)
folderID
- the ID of the trashed folder.newName
- an optional new name to give the folder. This can be null to use the folder's original name.newParentID
- an optional new parent ID for the folder. This can be null to use the folder's original
parent.public void deleteFile(String fileID)
fileID
- the ID of the trashed folder to permanently delete.public BoxFile.Info getFileInfo(String fileID)
fileID
- the ID of the trashed file.public BoxFile.Info getFileInfo(String fileID, String... fields)
fileID
- the ID of the trashed file.fields
- the fields to retrieve.public BoxFile.Info restoreFile(String fileID)
fileID
- the ID of the trashed file.public BoxFile.Info restoreFile(String fileID, String newName, String newParentID)
fileID
- the ID of the trashed file.newName
- an optional new name to give the file. This can be null to use the file's original name.newParentID
- an optional new parent ID for the file. This can be null to use the file's original
parent.public Iterator<BoxItem.Info> iterator()
iterator
in interface Iterable<BoxItem.Info>