gsmdrive

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2020 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Overview

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Package gsmdrive implements the Drive API Copyright © 2020 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

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 CopyFolders

func CopyFolders(folderMap map[string]*Folder, destination string) error

CopyFolders creates a copy of a Drive folder structure at a new destination

func CreateComment

func CreateComment(fileID, fields string, comment *drive.Comment) (*drive.Comment, error)

CreateComment creates a new comment on a file.

func CreateDrive

func CreateDrive(d *drive.Drive, fields string) (*drive.Drive, error)

CreateDrive creates a new shared drive.

func CreateFile

func CreateFile(file *drive.File, content *os.File, ignoreDefaultVisibility, keepRevisionForever, useContentAsIndexableText bool, includePermissionsForView, ocrLanguage, 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

func CreateReply(fileID, commentID, fields string, reply *drive.Reply) (*drive.Reply, error)

CreateReply creates a new reply to a comment.

func DeleteComment

func DeleteComment(fileID, commentID string) (bool, error)

DeleteComment deletes a comment.

func DeleteDrive

func DeleteDrive(driveID string) (bool, error)

DeleteDrive permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.

func DeleteFile

func DeleteFile(fileID string) (bool, error)

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

func DeletePermission(fileID, permissionID string, useDomainAdminAccess bool) (bool, error)

DeletePermission deletes a permission.

func DeleteReply

func DeleteReply(fileID, commentID, replyID string) (bool, error)

DeleteReply deletes a reply.

func DeleteRevision

func DeleteRevision(fileID, revisionID string) (bool, error)

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

func DownloadFile(fileID string, acknowledgeAbuse bool) (string, error)

DownloadFile downloads a file from drive

func DownloadRevision

func DownloadRevision(fileID, revisionID string, acknowledgeAbuse bool) (string, error)

DownloadRevision downloads a file revision from drive

func EmptyTrash

func EmptyTrash() (bool, error)

EmptyTrash permanently deletes all of the user's trashed files.

func ExportFile

func ExportFile(fileID, mimeType string) (string, error)

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

func GenerateFileIDs(count int64, space string) ([]string, error)

GenerateFileIDs generates a set of file IDs which can be provided in create or copy requests.

func GetAbout

func GetAbout(fields string) (*drive.About, error)

GetAbout gets information about the user, the user's Drive, and system capabilities.

func GetComment

func GetComment(fileID, commentID, fields string, includeDeleted bool) (*drive.Comment, error)

GetComment gets a comment by ID.

func GetDrive

func GetDrive(driveID, fields string, useDomainAdminAccess bool) (*drive.Drive, error)

GetDrive gets a shared drive's metadata by ID.

func GetFile

func GetFile(fileID, fields, includePermissionsForView string) (*drive.File, error)

GetFile gets a file's metadata or content by ID.

func GetFilesAndFolders

func GetFilesAndFolders(folderID string, threads int) (folderMap map[string]*Folder, files []*drive.File, err error)

GetFilesAndFolders recursively gets all files and folders below a parent folder and separates them, returning a map[string]*folder for folders and a simple list for files.

func GetPermission

func GetPermission(fileID, permissionID, fields string, useDomainAdminAccess bool) (*drive.Permission, error)

GetPermission gets a permission by ID.

func GetReply

func GetReply(fileID, commentID, replyID, fields string, includeDeleted bool) (*drive.Reply, error)

GetReply gets a reply by ID.

func GetRevision

func GetRevision(fileID, revisionID, fields string) (*drive.Revision, error)

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 HideDrive

func HideDrive(driveID, fields string) (*drive.Drive, error)

HideDrive hides a shared drive from the default view.

func IsFolder

func IsFolder(f *drive.File) bool

IsFolder returns true if the file object is a folder, otherwise false Make sure that the MimeType property is actually set.

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) ([]*drive.Comment, error)

ListComments lists a file's comments.

func ListDrives

func ListDrives(filter, fields string, useDomainAdminAccess bool) ([]*drive.Drive, 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) ([]*drive.File, 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, threads int) ([]*drive.File, error)

ListFilesRecursive lists all files and foldes in a parent folder recursively

func ListPermissions

func ListPermissions(fileID, includePermissionsForView, fields string, useDomainAdminAccess bool) ([]*drive.Permission, error)

ListPermissions lists a file's or shared drive's permissions.

func ListReplies

func ListReplies(fileID, commentID, fields string, includeDeleted bool) ([]*drive.Reply, error)

ListReplies Lists a comment's replies.

func ListRevisions

func ListRevisions(fileID, fields string) ([]*drive.Revision, error)

ListRevisions lists a file's revisions.

func SetClient

func SetClient(c *http.Client)

SetClient is used to inject a *http.Client into the package

func UnhideDrive

func UnhideDrive(driveID, fields string) (*drive.Drive, error)

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.

func UpdateReply

func UpdateReply(fileID, commentID, replyID, fields string, reply *drive.Reply) (*drive.Reply, error)

UpdateReply updates a reply with patch semantics.

func UpdateRevision

func UpdateRevision(fileID, revisionID, fields string, revision *drive.Revision) (*drive.Revision, error)

UpdateRevision updates a revision with patch semantics.

Types

type Folder

type Folder struct {
	NewID     string
	OldParent string
	NewParent string
	Name      string
	Root      bool
}

Folder represents a structure useful for copying Drive folder trees to a new destination

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL