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.
Modifier and Type | Field and Description |
---|---|
static URLTemplate |
FILE_INFO_URL_TEMPLATE
File Info URL Template.
|
static URLTemplate |
FOLDER_INFO_URL_TEMPLATE
Folder Info URL Template.
|
static URLTemplate |
GET_ITEMS_URL
Get Item URL Template.
|
static URLTemplate |
RESTORE_FILE_URL_TEMPLATE
Restore File URL Template.
|
static URLTemplate |
RESTORE_FOLDER_URL_TEMPLATE
Restore Folder URL Template.
|
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.
|
Iterable<BoxItem.Info> |
items(SortParameters sortParameters,
PagingParameters pagingParameters,
String... fields)
Returns an iterable containing the items in trash.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static final URLTemplate GET_ITEMS_URL
public static final URLTemplate FOLDER_INFO_URL_TEMPLATE
public static final URLTemplate FILE_INFO_URL_TEMPLATE
public static final URLTemplate RESTORE_FILE_URL_TEMPLATE
public static final URLTemplate RESTORE_FOLDER_URL_TEMPLATE
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>
public Iterable<BoxItem.Info> items(SortParameters sortParameters, PagingParameters pagingParameters, String... fields)
sortParameters
- describes sorting parameters.
Sort parameters are supported only with offset based pagination.
Use SortParameters.none()
to ignore sorting.pagingParameters
- describes paging parametersfields
- the fields to retrieve.