public class DriveTemplate extends AbstractGoogleApiOperations implements DriveOperations
DriveOperations implementation.isAuthorized, restTemplate| Constructor and Description |
|---|
DriveTemplate(org.springframework.web.client.RestTemplate restTemplate,
boolean isAuthorized) |
| 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
|
deleteEntity, deleteEntity, getEntity, patch, requireAuthorization, saveEntity, saveEntitypublic DriveTemplate(org.springframework.web.client.RestTemplate restTemplate,
boolean isAuthorized)
public DriveAbout getAbout()
DriveOperationsgetAbout in interface DriveOperationsDriveAbout with details for the current userpublic java.util.List<DriveApp> getApps()
DriveOperationsgetApps in interface DriveOperationsDriveApp for the current userpublic DriveApp getApp(java.lang.String id)
DriveOperationsgetApp in interface DriveOperationsid - The ID of the applicationDriveApp matching the IDpublic DriveFile getFile(java.lang.String id)
DriveOperationsgetFile in interface DriveOperationsid - the ID to retrieve byDriveFile matching the IDpublic DriveFileQueryBuilder driveFileQuery()
DriveOperationsDriveFileQueryBuilderdriveFileQuery in interface DriveOperationsDriveFileQueryBuilderpublic DriveFilesPage getRootFiles(java.lang.String pageToken)
DriveOperationsgetRootFiles in interface DriveOperationspageToken - Page token or nullDriveFilesPagepublic DriveFilesPage getFiles(java.lang.String parent, java.lang.String pageToken)
DriveOperationsgetFiles in interface DriveOperationsparent - folder ID or "root"pageToken - Page token or nullDriveFilesPagepublic DriveFilesPage getTrashedFiles(java.lang.String pageToken)
DriveOperationsgetTrashedFiles in interface DriveOperationspageToken - Page token or nullDriveFilesPagepublic DriveFile trash(java.lang.String id)
DriveOperationstrash in interface DriveOperationsid - The ID of the file to trashDriveFilepublic DriveFile untrash(java.lang.String id)
DriveOperationsuntrash in interface DriveOperationsid - The ID of the file to untrash return The updated
DriveFileDriveFilepublic DriveFile star(java.lang.String id)
DriveOperationsstar in interface DriveOperationsid - The ID of the file to starDriveFilepublic DriveFile unstar(java.lang.String id)
DriveOperationsunstar in interface DriveOperationsid - The ID of the file to unstarDriveFilepublic DriveFile hide(java.lang.String id)
DriveOperationshide in interface DriveOperationsid - The ID of the file to hideDriveFilepublic DriveFile unhide(java.lang.String id)
DriveOperationsunhide in interface DriveOperationsid - The ID of the file to unhideDriveFilepublic void delete(java.lang.String id)
DriveOperationsdelete in interface DriveOperationsid - The ID of the file to deletepublic DriveFile upload(org.springframework.core.io.Resource resource, DriveFile metadata, UploadParameters parameters)
DriveOperationsupload in interface DriveOperationsresource - Reference to the file's contentmetadata - The file's metadataparameters - Parameters for uploading and processing the filepublic DriveFile createFileMetadata(DriveFile metadata)
DriveOperationscreateFileMetadata in interface DriveOperationsmetadata - The file's propertiesDriveFile representing the created filepublic DriveFile createFolder(java.lang.String parentId, java.lang.String name)
DriveOperationscreateFolder in interface DriveOperationsparentId - The parent folder ID or "root"name - The name of the folder to createDriveFile representing the created folderpublic java.util.List<UserPermission> getPermissions(java.lang.String fileId)
DriveOperationsgetPermissions in interface DriveOperationsfileId - The ID of the fileUserPermission for the filepublic UserPermission addPermission(java.lang.String fileId, UserPermission permission, boolean sendNotificationEmails)
DriveOperationsaddPermission in interface DriveOperationsfileId - The file IDpermission - UserPermission with the permission settingssendNotificationEmails - Whether to send notification e-mailsUserPermissionpublic UserPermission updatesPermission(java.lang.String fileId, java.lang.String permissionId, UserPermission permission)
DriveOperationsupdatesPermission in interface DriveOperationsfileId - The file IDpermissionId - the ID of the permissionpermission - UserPermission with new role and additionalRoles
propertiesUserPermissionpublic void removePermission(java.lang.String fileId,
java.lang.String permissionId)
DriveOperationsremovePermission in interface DriveOperationsfileId - The file IDpermissionId - The ID of the permissionpublic java.util.List<FileRevision> getRevisions(java.lang.String fileId)
DriveOperationsgetRevisions in interface DriveOperationsfileId - The ID of the fileFileRevisionpublic FileRevision updateRevision(java.lang.String fileId, java.lang.String revisionId, FileRevision revision)
DriveOperationsupdateRevision in interface DriveOperationsfileId - The ID of the filerevisionId - The ID of the revisionrevision - FileRevision with new pinned, publishAuto, published
and publishedOutsideDomain propertiesFileRevisionpublic FileCommentQueryBuilder fileCommentQueryBuilder(java.lang.String fileId)
DriveOperationsFileCommentQueryBuilder for listing the comments of a
filefileCommentQueryBuilder in interface DriveOperationsfileId - The ID of the fileFileCommentQueryBuilder for the filepublic FileCommentsPage getComments(java.lang.String fileId, java.lang.String pageToken)
DriveOperationsgetComments in interface DriveOperationsfileId - The ID of the filepageToken - Page token or nullpublic FileComment addComment(java.lang.String fileId, FileComment comment)
DriveOperationsaddComment in interface DriveOperationsfileId - The ID of the filecomment - The new commentFileCommentpublic FileComment updateComment(java.lang.String fileId, java.lang.String commentId, FileComment comment)
DriveOperationsupdateComment in interface DriveOperationsfileId - The ID of the filecommentId - The ID of the commentcomment - Comment with the new contentFileCommentpublic void removeComment(java.lang.String fileId,
java.lang.String commentId)
DriveOperationsremoveComment in interface DriveOperationsfileId - The ID of the filecommentId - The ID of the commentpublic CommentReply addReply(java.lang.String fileId, java.lang.String commentId, CommentReply reply)
DriveOperationsaddReply in interface DriveOperationsfileId - The ID of the filecommentId - The ID of the commentreply - The new replyCommentReplypublic CommentReply updateReply(java.lang.String fileId, java.lang.String commentId, java.lang.String replyId, CommentReply reply)
DriveOperationsupdateReply in interface DriveOperationsfileId - The ID of the filecommentId - The ID of the commentreplyId - The ID of the replyreply - Reply with new contentCommentReplypublic void removeReply(java.lang.String fileId,
java.lang.String commentId,
java.lang.String replyId)
DriveOperationsremoveReply in interface DriveOperationsfileId - The ID of the filecommentId - The ID of the commentreplyId - The ID of the replypublic org.springframework.core.io.Resource downloadFile(java.lang.String id)
DriveOperationsdownloadFile in interface DriveOperationsid - The file IDpublic org.springframework.core.io.Resource downloadFile(DriveFile file)
DriveOperationsDriveFile.getDownloadUrl(), which may have expired since the file
metadata was fetched.downloadFile in interface DriveOperationsfile - The file metadata