public interface DriveOperations
Modifier and Type | Method and Description |
---|---|
FileComment |
addComment(java.lang.String fileId,
FileComment comment)
Adds a comment to a file
|
UserPermission |
addPermission(java.lang.String fileId,
UserPermission permission,
boolean sendNotificationEmails)
Adds a permission to a file
|
CommentReply |
addReply(java.lang.String fileId,
java.lang.String commentId,
CommentReply reply)
Adds a reply to a file comment
|
DriveFile |
createFileMetadata(DriveFile metadata)
Creates an empty file with metadata
|
DriveFile |
createFolder(java.lang.String parentId,
java.lang.String name)
Creates a folder
|
void |
delete(java.lang.String id)
Permanently deletes a file
|
org.springframework.core.io.Resource |
downloadFile(DriveFile file)
Downloads a file from Google Drive.
|
org.springframework.core.io.Resource |
downloadFile(java.lang.String id)
Downloads a file from Google Drive.
|
DriveFileQueryBuilder |
driveFileQuery()
Creates a
DriveFileQueryBuilder |
FileCommentQueryBuilder |
fileCommentQueryBuilder(java.lang.String fileId)
Returns a
FileCommentQueryBuilder for listing the comments of a
file |
DriveAbout |
getAbout()
Get general Google Drive details for the current user
|
DriveApp |
getApp(java.lang.String id)
Returns an application by its ID
|
java.util.List<DriveApp> |
getApps()
Returns the applications authorized by the user to access Google Drive
API
|
FileCommentsPage |
getComments(java.lang.String fileId,
java.lang.String pageToken)
Returns the first default page of comments on a file
|
DriveFile |
getFile(java.lang.String id)
Retrieves a file by its ID
|
DriveFilesPage |
getFiles(java.lang.String parent,
java.lang.String pageToken)
Returns the files and folders under a specified folder
|
java.util.List<UserPermission> |
getPermissions(java.lang.String fileId)
Returns the permissions of a file
|
java.util.List<FileRevision> |
getRevisions(java.lang.String fileId)
Returns the revisions of a file
|
DriveFilesPage |
getRootFiles(java.lang.String pageToken)
Returns files and folders under the root folder
|
DriveFilesPage |
getTrashedFiles(java.lang.String pageToken)
Returns trashed files and folders
|
DriveFile |
hide(java.lang.String id)
Hides a file
|
void |
removeComment(java.lang.String fileId,
java.lang.String commentId)
Removes a comment from a file
|
void |
removePermission(java.lang.String fileId,
java.lang.String permissionId)
Removes a permission from a file
|
void |
removeReply(java.lang.String fileId,
java.lang.String commentId,
java.lang.String replyId)
Removes a reply from a file comment
|
DriveFile |
star(java.lang.String id)
Stars a file
|
DriveFile |
trash(java.lang.String id)
Moves a file to trash
|
DriveFile |
unhide(java.lang.String id)
Unhides a file
|
DriveFile |
unstar(java.lang.String id)
Remove the star from a file
|
DriveFile |
untrash(java.lang.String id)
Restores a file from trash
|
FileComment |
updateComment(java.lang.String fileId,
java.lang.String commentId,
FileComment comment)
Updates a comment to a file
|
CommentReply |
updateReply(java.lang.String fileId,
java.lang.String commentId,
java.lang.String replyId,
CommentReply reply)
Updates a reply to a file comment
|
FileRevision |
updateRevision(java.lang.String fileId,
java.lang.String revisionId,
FileRevision revision)
Updates a file revision
|
UserPermission |
updatesPermission(java.lang.String fileId,
java.lang.String permissionId,
UserPermission permission)
Updates a permission to a file
|
DriveFile |
upload(org.springframework.core.io.Resource resource,
DriveFile metadata,
UploadParameters parameters)
Uploads a file using multipart
|
DriveAbout getAbout()
DriveAbout
with details for the current userjava.util.List<DriveApp> getApps()
DriveApp
for the current userDriveApp getApp(java.lang.String id)
id
- The ID of the applicationDriveApp
matching the IDDriveFile getFile(java.lang.String id)
id
- the ID to retrieve byDriveFile
matching the IDDriveFileQueryBuilder driveFileQuery()
DriveFileQueryBuilder
DriveFileQueryBuilder
DriveFilesPage getRootFiles(java.lang.String pageToken)
pageToken
- Page token or nullDriveFilesPage
DriveFilesPage getFiles(java.lang.String parent, java.lang.String pageToken)
parent
- folder ID or "root"pageToken
- Page token or nullDriveFilesPage
DriveFilesPage getTrashedFiles(java.lang.String pageToken)
pageToken
- Page token or nullDriveFilesPage
DriveFile trash(java.lang.String id)
id
- The ID of the file to trashDriveFile
DriveFile untrash(java.lang.String id)
DriveFile star(java.lang.String id)
id
- The ID of the file to starDriveFile
DriveFile unstar(java.lang.String id)
id
- The ID of the file to unstarDriveFile
DriveFile hide(java.lang.String id)
id
- The ID of the file to hideDriveFile
DriveFile unhide(java.lang.String id)
id
- The ID of the file to unhideDriveFile
void delete(java.lang.String id)
id
- The ID of the file to deleteDriveFile upload(org.springframework.core.io.Resource resource, DriveFile metadata, UploadParameters parameters)
resource
- Reference to the file's contentmetadata
- The file's metadataparameters
- Parameters for uploading and processing the fileDriveFile createFileMetadata(DriveFile metadata)
metadata
- The file's propertiesDriveFile
representing the created fileDriveFile createFolder(java.lang.String parentId, java.lang.String name)
parentId
- The parent folder ID or "root"name
- The name of the folder to createDriveFile
representing the created folderjava.util.List<UserPermission> getPermissions(java.lang.String fileId)
fileId
- The ID of the fileUserPermission
for the fileUserPermission addPermission(java.lang.String fileId, UserPermission permission, boolean sendNotificationEmails)
fileId
- The file IDpermission
- UserPermission
with the permission settingssendNotificationEmails
- Whether to send notification e-mailsUserPermission
UserPermission updatesPermission(java.lang.String fileId, java.lang.String permissionId, UserPermission permission)
fileId
- The file IDpermissionId
- the ID of the permissionpermission
- UserPermission
with new role and additionalRoles
propertiesUserPermission
void removePermission(java.lang.String fileId, java.lang.String permissionId)
fileId
- The file IDpermissionId
- The ID of the permissionjava.util.List<FileRevision> getRevisions(java.lang.String fileId)
fileId
- The ID of the fileFileRevision
FileRevision updateRevision(java.lang.String fileId, java.lang.String revisionId, FileRevision revision)
fileId
- The ID of the filerevisionId
- The ID of the revisionrevision
- FileRevision
with new pinned, publishAuto, published
and publishedOutsideDomain propertiesFileRevision
FileCommentQueryBuilder fileCommentQueryBuilder(java.lang.String fileId)
FileCommentQueryBuilder
for listing the comments of a
filefileId
- The ID of the fileFileCommentQueryBuilder
for the fileFileCommentsPage getComments(java.lang.String fileId, java.lang.String pageToken)
fileId
- The ID of the filepageToken
- Page token or nullFileComment addComment(java.lang.String fileId, FileComment comment)
fileId
- The ID of the filecomment
- The new commentFileComment
FileComment updateComment(java.lang.String fileId, java.lang.String commentId, FileComment comment)
fileId
- The ID of the filecommentId
- The ID of the commentcomment
- Comment with the new contentFileComment
void removeComment(java.lang.String fileId, java.lang.String commentId)
fileId
- The ID of the filecommentId
- The ID of the commentCommentReply addReply(java.lang.String fileId, java.lang.String commentId, CommentReply reply)
fileId
- The ID of the filecommentId
- The ID of the commentreply
- The new replyCommentReply
CommentReply updateReply(java.lang.String fileId, java.lang.String commentId, java.lang.String replyId, CommentReply reply)
fileId
- The ID of the filecommentId
- The ID of the commentreplyId
- The ID of the replyreply
- Reply with new contentCommentReply
void removeReply(java.lang.String fileId, java.lang.String commentId, java.lang.String replyId)
fileId
- The ID of the filecommentId
- The ID of the commentreplyId
- The ID of the replyorg.springframework.core.io.Resource downloadFile(java.lang.String id)
id
- The file IDorg.springframework.core.io.Resource downloadFile(DriveFile file)
DriveFile.getDownloadUrl()
, which may have expired since the file
metadata was fetched.file
- The file metadata