Documentation ¶
Overview ¶
Package gsmdrive implements the Drive API
Index ¶
- func CopyFile(fileID, includePermissionsForView, ocrLanguage, fields string, ...) (*drive.File, error)
- func CopyFoldersAndReturnFilesWithNewParents(folderID, destination string, results chan *drive.File, ...) (<-chan *drive.File, error)
- func CreateComment(fileID, fields string, comment *drive.Comment) (*drive.Comment, error)
- func CreateDrive(d *drive.Drive, fields string, returnWhenReady bool) (*drive.Drive, error)
- func CreateFile(file *drive.File, content *os.File, ...) (*drive.File, error)
- func CreatePermission(fileID, emailMessage, fields string, ...) (*drive.Permission, error)
- func CreateReply(fileID, commentID, fields string, reply *drive.Reply) (*drive.Reply, error)
- func DeleteComment(fileID, commentID string) (bool, error)
- func DeleteDrive(driveID string) (bool, error)
- func DeleteFile(fileID string) (bool, error)
- func DeletePermission(fileID, permissionID string, useDomainAdminAccess bool) (bool, error)
- func DeleteReply(fileID, commentID, replyID string) (bool, error)
- func DeleteRevision(fileID, revisionID string) (bool, error)
- func DownloadFile(fileID, localFilePath string, acknowledgeAbuse bool) (string, error)
- func DownloadRevision(fileID, revisionID string, acknowledgeAbuse bool) (string, error)
- func EmptyTrash() (bool, error)
- func ExportFile(fileID, mimeType, localFilePath string) (string, error)
- func GenerateFileIDs(count int64, space string) ([]string, error)
- func GetAbout(fields string) (*drive.About, error)
- func GetComment(fileID, commentID, fields string, includeDeleted bool) (*drive.Comment, error)
- func GetDrive(driveID, fields string, useDomainAdminAccess bool) (*drive.Drive, error)
- func GetFile(fileID, fields, includePermissionsForView string) (*drive.File, error)
- func GetFolder(folderID string) (*drive.File, error)
- func GetPermission(fileID, permissionID, fields string, useDomainAdminAccess bool) (*drive.Permission, error)
- func GetPermissionID(flags map[string]*gsmhelpers.Value) (string, error)
- func GetReply(fileID, commentID, replyID, fields string, includeDeleted bool) (*drive.Reply, error)
- func GetRevision(fileID, revisionID, fields string) (*drive.Revision, error)
- func GetStartPageToken(driveID, fields string) (*drive.StartPageToken, error)
- func HideDrive(driveID, fields string) (*drive.Drive, error)
- func ListChanges(pageToken, driveID, spaces, fields, includePermissionsForView string, ...) ([]*drive.Change, string, error)
- func ListComments(fileID, startModifiedTime, fields string, includeDeleted bool, cap int) (<-chan *drive.Comment, <-chan error)
- func ListDrives(filter, fields string, useDomainAdminAccess bool, cap int) (<-chan *drive.Drive, <-chan error)
- func ListFiles(q, driveID, corpora, includePermissionsForView, orderBy, spaces, fields string, ...) (<-chan *drive.File, <-chan error)
- func ListFilesRecursive(id, fields string, excludeFolders []string, includeRoot bool, threads int) <-chan *drive.File
- func ListLabels(fileID, fields string, cap int) (<-chan *drive.Label, <-chan error)
- func ListPermissions(fileID, includePermissionsForView, fields string, useDomainAdminAccess bool, ...) (<-chan *drive.Permission, <-chan error)
- func ListReplies(fileID, commentID, fields string, includeDeleted bool, cap int) (<-chan *drive.Reply, <-chan error)
- func ListRevisions(fileID, fields string, cap int) (<-chan *drive.Revision, <-chan error)
- func ModifyLabels(fileID, fields string, modifyLabelsRequest *drive.ModifyLabelsRequest) ([]*drive.Label, error)
- func SetClient(c *http.Client)
- func UnhideDrive(driveID, fields string) (*drive.Drive, error)
- func UpdateComment(fileID, commentID, fields string, comment *drive.Comment) (*drive.Comment, error)
- func UpdateDrive(driveID, fields string, useDomainAdminAccess bool, d *drive.Drive) (*drive.Drive, error)
- func UpdateFile(...) (*drive.File, error)
- func UpdatePermission(fileID, permissionID, fields string, ...) (*drive.Permission, error)
- func UpdateReply(fileID, commentID, replyID, fields string, reply *drive.Reply) (*drive.Reply, error)
- func UpdateRevision(fileID, revisionID, fields string, revision *drive.Revision) (*drive.Revision, error)
- type FolderSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
func CopyFile(fileID, includePermissionsForView, ocrLanguage, fields string, file *drive.File, ignoreDefaultVisibility, keepRevisionForever bool) (*drive.File, error)
CopyFile creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied.
func CopyFoldersAndReturnFilesWithNewParents ¶ added in v0.2.3
func CopyFoldersAndReturnFilesWithNewParents(folderID, destination string, results chan *drive.File, excludeFolders []string, threads int) (<-chan *drive.File, error)
CopyFoldersAndReturnFilesWithNewParents creates copy of each folder in the supplied channel, adds the new ID to the parents propertie of the files in the source folder and returns the files in a channel.
func CreateComment ¶
CreateComment creates a new comment on a file.
func CreateDrive ¶
CreateDrive creates a new shared drive.
func CreateFile ¶
func CreateFile(file *drive.File, content *os.File, ignoreDefaultVisibility, keepRevisionForever, useContentAsIndexableText bool, includePermissionsForView, ocrLanguage, sourceMimeType, fields string) (*drive.File, error)
CreateFile creates a new file.
func CreatePermission ¶
func CreatePermission(fileID, emailMessage, fields string, useDomainAdminAccess, sendNotificationEmail, transferOwnership, moveToNewOwnersRoot bool, permission *drive.Permission) (*drive.Permission, error)
CreatePermission creates a permission for a file or shared drive.
func CreateReply ¶
CreateReply creates a new reply to a comment.
func DeleteComment ¶
DeleteComment deletes a comment.
func DeleteDrive ¶
DeleteDrive permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.
func DeleteFile ¶
DeleteFile permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.
func DeletePermission ¶
DeletePermission deletes a permission.
func DeleteReply ¶
DeleteReply deletes a reply.
func DeleteRevision ¶
DeleteRevision permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.
func DownloadFile ¶
DownloadFile downloads a file from drive
func DownloadRevision ¶
DownloadRevision downloads a file revision from drive
func EmptyTrash ¶
EmptyTrash permanently deletes all of the user's trashed files.
func ExportFile ¶
ExportFile exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.
func GenerateFileIDs ¶
GenerateFileIDs generates a set of file IDs which can be provided in create or copy requests.
func GetAbout ¶
GetAbout gets information about the user, the user's Drive, and system capabilities.
func GetComment ¶
GetComment gets a comment by ID.
func GetFolder ¶ added in v0.2.3
GetFolder returns the file if it can be found AND is a folder, otherwise, it returns an error
func GetPermission ¶
func GetPermission(fileID, permissionID, fields string, useDomainAdminAccess bool) (*drive.Permission, error)
GetPermission gets a permission by ID.
func GetPermissionID ¶ added in v0.2.3
func GetPermissionID(flags map[string]*gsmhelpers.Value) (string, error)
GetPermissionID returns the permissionId from a flag set if either the permissionId itself, or the emailAddress is set. Otherwise, it will return an error.
func GetRevision ¶
GetRevision gets a revision's metadata or content by ID.
func GetStartPageToken ¶
func GetStartPageToken(driveID, fields string) (*drive.StartPageToken, error)
GetStartPageToken gets the starting pageToken for listing future changes.
func ListChanges ¶
func ListChanges(pageToken, driveID, spaces, fields, includePermissionsForView string, includeCorpusRemovals, includeItemsFromAllDrives, includeRemoved, restrictToMyDrive bool) ([]*drive.Change, string, error)
ListChanges lists the changes for a user or shared drive.
func ListComments ¶
func ListComments(fileID, startModifiedTime, fields string, includeDeleted bool, cap int) (<-chan *drive.Comment, <-chan error)
ListComments lists a file's comments.
func ListDrives ¶
func ListDrives(filter, fields string, useDomainAdminAccess bool, cap int) (<-chan *drive.Drive, <-chan error)
ListDrives lists the user's shared drives. This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see https://developers.google.com/drive/api/v3/search-shareddrives.
func ListFiles ¶
func ListFiles(q, driveID, corpora, includePermissionsForView, orderBy, spaces, fields string, includeItemsFromAllDrives bool, cap int) (<-chan *drive.File, <-chan error)
ListFiles lists or searches files. This method accepts the q parameter, which is a search query combining one or more search terms. For more information, see https://developers.google.com/drive/api/v3/search-files.
func ListFilesRecursive ¶
func ListFilesRecursive(id, fields string, excludeFolders []string, includeRoot bool, threads int) <-chan *drive.File
ListFilesRecursive lists all files and foldes in a parent folder recursively
func ListLabels ¶ added in v0.8.0
ListLabels lists the labels on a file.
func ListPermissions ¶
func ListPermissions(fileID, includePermissionsForView, fields string, useDomainAdminAccess bool, cap int) (<-chan *drive.Permission, <-chan error)
ListPermissions lists a file's or shared drive's permissions.
func ListReplies ¶
func ListReplies(fileID, commentID, fields string, includeDeleted bool, cap int) (<-chan *drive.Reply, <-chan error)
ListReplies Lists a comment's replies.
func ListRevisions ¶
ListRevisions lists a file's revisions.
func ModifyLabels ¶ added in v0.8.0
func ModifyLabels(fileID, fields string, modifyLabelsRequest *drive.ModifyLabelsRequest) ([]*drive.Label, error)
ModifyLabels modifies the set of labels on a file.
func UnhideDrive ¶
UnhideDrive restores a shared drive to the default view.
func UpdateComment ¶
func UpdateComment(fileID, commentID, fields string, comment *drive.Comment) (*drive.Comment, error)
UpdateComment updates a comment with patch semantics.
func UpdateDrive ¶
func UpdateDrive(driveID, fields string, useDomainAdminAccess bool, d *drive.Drive) (*drive.Drive, error)
UpdateDrive updates the metadate for a shared drive.
func UpdateFile ¶
func UpdateFile(fileID, addParents, removeParents, includePermissionsForView, ocrLanguage, fields string, file *drive.File, content *os.File, keepRevisionForever, useContentAsIndexableText bool) (*drive.File, error)
UpdateFile updates a file's metadata and/or content. This method supports patch semantics.
func UpdatePermission ¶
func UpdatePermission(fileID, permissionID, fields string, useDomainAdminAccess, removeExpiration bool, permission *drive.Permission) (*drive.Permission, error)
UpdatePermission updates a permission with patch semantics.
Types ¶
type FolderSize ¶ added in v0.2.4
type FolderSize struct { Files int64 `json:"files,omitempty"` Folders int64 `json:"folders,omitempty"` Size int64 `json:"size,omitempty"` }
FolderSize represents the size of a Drive folder or Shared Drive
func CountFilesAndFolders ¶ added in v0.2.4
func CountFilesAndFolders(filesCh <-chan *drive.File) (folderSize *FolderSize)
CountFilesAndFolders returns the number of files in a channel and their size