Class DriveItem
java.lang.Object
com.amilesend.onedrive.resource.item.BaseItem
com.amilesend.onedrive.resource.item.DriveItem
- Direct Known Subclasses:
SpecialDriveItem
Describes a resource stored in a drive.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
DriveItem.DriveItemBuilder<C extends DriveItem,
B extends DriveItem.DriveItemBuilder<C, B>> Nested classes/interfaces inherited from class com.amilesend.onedrive.resource.item.BaseItem
BaseItem.BaseItemBuilder<C extends BaseItem,
B extends BaseItem.BaseItemBuilder<C, B>> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddPermission
(@NonNull AddPermissionRequest requestBody) Adds a permission to thisDriveItem
for the given request.static DriveItem.DriveItemBuilder
<?, ?> builder()
Copies thisDriveItem
to a child of the givendestinationParentId
and updates the name of the copiedDriveItem
.Creates a newDriveItem
as a child ofthis
.createSharingLink
(@NonNull CreateSharingLinkRequest requestBody) Creates a sharing link for the given request.void
delete()
Deletes this drive item.void
download
(@NonNull Path folderPath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads the drive item and reports transfer progress to the givenTransferProgressCallback
.downloadAsync
(@NonNull Path folderPath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads the drive item asynchronously that reports transfer progress and completion to the specifiedTransferProgressCallback
.boolean
Indicates that a drive item is the top level item in a collection of items (read-only).Queries and fetches the activities associated with thisDriveItem
.getAudio()
The audio file attributes (read-only).Fetches the list of childDriveItem
s associated with thisDriveItem
.Describes how to handle conflicts upon copy/move operations.Gets the underlying connection instance.getCTag()
An eTag for the content of the item (read-only).Indicates if an item was deleted (read-only).The URL that can be used to download the file's content (read-only).getFile()
Indicates if an item is a file (read-only).Describes drive (client-side) properties of the local version of a drive item.Describes if a given drive item is a folder resource type (read-only).getImage()
The image attributes for a file (read-only).The geographic coordinates and elevation of a file (read-only).If defined, malware was detected in the file (read-only).Fetches the list of permissions associated with thisDriveItem
.getPhoto()
The photo attributes for a drive item file (read-only).The published status of a drive item or version (read-only).Indicates that a drive item references one that exists in another drive (read-only).getRoot()
If defined, indicates that the item is the top-most folder in the drive (read-only).Indicates that the item is in response to a search query (read-only).Indicates that a drive item has been shared with others (read-only).SharePoint resource identifiers for SharePoint and Business account items (read-only).long
getSize()
The size of the item in bytes (read-only).The source URL for remote uploading of file contents (write-only).Describes if the item is a special managed folder (read-only).Fetches the list of thumbnail sets associated with thisDriveItem
.Fetches the list of versions of thisDriveItem
.getVideo()
The video file attributes (read-only).int
hashCode()
Moves thisDriveItem
as a child to the givennewParentId
, updates the name, or both.previewItem
(@NonNull PreviewRequest requestBody) Gets the embeddable file preview URLs for inclusion in a web-based UI.Search for items associated with thisDriveItem
.void
setConflictBehavior
(String conflictBehavior) Describes how to handle conflicts upon copy/move operations.void
setFileSystemInfo
(FileSystemInfo fileSystemInfo) Describes drive (client-side) properties of the local version of a drive item.void
setSourceUrl
(String sourceUrl) The source URL for remote uploading of file contents (write-only).toString()
update()
Updates this drive item.upload
(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Uploads a file to replace the contents of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.uploadAsync
(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Uploads a file asynchronously to replace the contents of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.uploadNew
(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Uploads a new file as a child of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.uploadNewAsync
(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Uploads a new file asynchronously as a child of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.Methods inherited from class com.amilesend.onedrive.resource.item.BaseItem
getCreatedBy, getCreatedDateTime, getDescription, getETag, getId, getLastModifiedBy, getLastModifiedDateTime, getName, getParentReference, getWebUrl, setDescription, setName, setParentReference
-
Field Details
-
DRIVE_ITEM_BASE_URL_PATH
- See Also:
-
-
Method Details
-
download
public void download(@NonNull Path folderPath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads the drive item and reports transfer progress to the givenTransferProgressCallback
.- Parameters:
folderPath
- the path of the folder to download the drive item content tocallback
- the callback to inform of transfer progress
-
downloadAsync
public CompletableFuture<Long> downloadAsync(@NonNull Path folderPath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads the drive item asynchronously that reports transfer progress and completion to the specifiedTransferProgressCallback
.- Parameters:
folderPath
- the path of the folder to download the drive item content tocallback
- the callback to inform of transfer progress- Returns:
- the CompletableFuture used to fetch the number of bytes downloaded
-
upload
public DriveItem upload(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Uploads a file to replace the contents of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.- Parameters:
filePath
- the file to uploadcallback
- the callback to inform of transfer progress- Returns:
- the updated drive item information
- Throws:
IOException
- if unable to read or determine the file's content type
-
uploadAsync
public CompletableFuture<DriveItem> uploadAsync(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Uploads a file asynchronously to replace the contents of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.- Parameters:
filePath
- the file to uploadcallback
- the callback to inform of transfer progress- Returns:
- the CompletableFuture to fetch the updated drive item information
- Throws:
IOException
- if unable to read or determine the file's content type
-
uploadNew
public DriveItem uploadNew(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Uploads a new file as a child of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.- Parameters:
filePath
- the file to uploadcallback
- the callback to inform of transfer progress- Returns:
- the new child drive item associated with the uploaded file
- Throws:
IOException
- if unable to read or determine the file's content type
-
uploadNewAsync
public CompletableFuture<DriveItem> uploadNewAsync(@NonNull Path filePath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException Uploads a new file asynchronously as a child of thisDriveItem
and reports the transfer status to the givenTransferProgressCallback
.- Parameters:
filePath
- the file to uploadcallback
- the callback to inform of transfer progress- Returns:
- the completable future to fetch the updated drive item information
- Throws:
IOException
- if unable to read or determine the file's content type
-
create
- Parameters:
newChildDriveItem
- the new drive item to create- Returns:
- the new drive item
-
update
Updates this drive item.- Returns:
- the updated drive item
-
move
Moves thisDriveItem
as a child to the givennewParentId
, updates the name, or both.- Parameters:
destinationParentId
- the new parent identifiernewName
- the new name- Returns:
- the updated drive item
-
copy
Copies thisDriveItem
to a child of the givendestinationParentId
and updates the name of the copiedDriveItem
.- Parameters:
destinationParentId
- the new destination parent identifiernewName
- the new name- Returns:
- the
AsyncJob
that can be used to poll for the remote asynchronous operation progress. - See Also:
-
delete
public void delete()Deletes this drive item. -
getActivities
Queries and fetches the activities associated with thisDriveItem
.- Returns:
- the list of activities
-
getChildren
- Returns:
- list of child drive items
-
getVersions
Fetches the list of versions of thisDriveItem
.- Returns:
- the list of versions
- See Also:
-
getPermissions
Fetches the list of permissions associated with thisDriveItem
.- Returns:
- the list of permissions
- See Also:
-
addPermission
Adds a permission to thisDriveItem
for the given request.- Parameters:
requestBody
- the descriptor of the permission to add- Returns:
- the list of permissions for the associate item.
-
createSharingLink
Creates a sharing link for the given request.- Parameters:
requestBody
- the descriptor of the type of link to share- Returns:
- the sharing permissions that includes the link
-
previewItem
Gets the embeddable file preview URLs for inclusion in a web-based UI. Note: For long-lived embeddable links, usecreateSharingLink(CreateSharingLinkRequest)
instead.- Parameters:
requestBody
- the preview item request body- Returns:
- the preview URLs
-
getThumbnails
Fetches the list of thumbnail sets associated with thisDriveItem
.- Returns:
- the list of thumbnail sets
- See Also:
-
search
Search for items associated with thisDriveItem
.- Parameters:
query
- the search query- Returns:
- the list of drive items associated with the query
-
equals
-
hashCode
public int hashCode() -
builder
-
getAudio
The audio file attributes (read-only). -
getCTag
An eTag for the content of the item (read-only). -
getFile
Indicates if an item is a file (read-only). -
getFolder
Describes if a given drive item is a folder resource type (read-only). -
getImage
The image attributes for a file (read-only). -
getLocation
The geographic coordinates and elevation of a file (read-only). -
getMalware
If defined, malware was detected in the file (read-only). -
get_package
Indicates that a drive item is the top level item in a collection of items (read-only). -
getPhoto
The photo attributes for a drive item file (read-only). -
getPublication
The published status of a drive item or version (read-only). -
getRemoteItem
Indicates that a drive item references one that exists in another drive (read-only). -
getRoot
If defined, indicates that the item is the top-most folder in the drive (read-only). -
getSearchResult
Indicates that the item is in response to a search query (read-only). -
getSize
public long getSize()The size of the item in bytes (read-only). -
getSpecialFolder
Describes if the item is a special managed folder (read-only). -
getVideo
The video file attributes (read-only). -
getDownloadUrl
The URL that can be used to download the file's content (read-only). -
getConnection
Gets the underlying connection instance. -
getDeleted
Indicates if an item was deleted (read-only). -
getFileSystemInfo
Describes drive (client-side) properties of the local version of a drive item. -
getConflictBehavior
Describes how to handle conflicts upon copy/move operations. Valid values include:- fail
- replace
- rename
-
getSourceUrl
The source URL for remote uploading of file contents (write-only). Currently not tested nor supported. -
toString
-
setFileSystemInfo
Describes drive (client-side) properties of the local version of a drive item. -
setConflictBehavior
Describes how to handle conflicts upon copy/move operations. Valid values include:- fail
- replace
- rename
-
setSourceUrl
The source URL for remote uploading of file contents (write-only). Currently not tested nor supported.
-