googledrive3k

package module
v0.0.0-...-3b49ca2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 15 Imported by: 0

README

googledrive3k

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DriveScope = []string{drive.DriveScope}
View Source
var DriveScopeReadOnly = []string{drive.DriveReadonlyScope}

Functions

func ByteCount

func ByteCount(b int64) string

func GetFileIdFromUrl

func GetFileIdFromUrl(url string) (string, bool)

func GetOSMimeType

func GetOSMimeType(googleWorkspaceMimeType string) (string, string)

func GetTransferCall

func GetTransferCall(newOwner, fileId string, service *drive.Service) *drive.PermissionsCreateCall

Types

type API

type API struct {
	Service *drive.Service
	Subject string
	Jobs    *sync.WaitGroup
}

func Build

func Build(client *http.Client, subject string, ctx context.Context) (*API, error)

func BuildImpersonator

func BuildImpersonator(subject string, scopes []string, serviceAccountKey []byte, ctx context.Context) (*API, error)

func BuildOAuth2

func BuildOAuth2(subject string, scopes []string, clientSecret, authorizationToken []byte, ctx context.Context) (*API, error)

func (*API) ChangeFileOwner

func (receiver *API) ChangeFileOwner(newOwner, fileId string, doIt bool) error

func (*API) ChangeFileOwnerWorker

func (receiver *API) ChangeFileOwnerWorker(newOwner, fileId string, doIt bool, wg *sync.WaitGroup)

func (*API) CopyFile

func (receiver *API) CopyFile(fileId, parentFolderId, fileName string) (*drive.File, error)

func (*API) CopyFileWorker

func (receiver *API) CopyFileWorker(fileInformation []string, wg *sync.WaitGroup)

func (*API) CopyFolder

func (receiver *API) CopyFolder(sourceFolderId, newSourceFolderName, parentFolderId string) error

func (*API) CreateFolder

func (receiver *API) CreateFolder(folderName, parentFolderId string, permissions []*drive.Permission) (*drive.File, error)

func (*API) DownloadFile

func (receiver *API) DownloadFile(file *drive.File) (*DownloadedFile, error)

func (*API) DownloadFileById

func (receiver *API) DownloadFileById(fileId string) (*DownloadedFile, error)

func (*API) GetAbout

func (receiver *API) GetAbout() *drive.About

func (*API) GetFileById

func (receiver *API) GetFileById(fileID string) (*drive.File, error)

func (*API) GetFilePermissions

func (receiver *API) GetFilePermissions(file *drive.File) string

func (*API) GetNestedFiles

func (receiver *API) GetNestedFiles(targetFolderId string) ([]*drive.File, error)

func (*API) MoveFile

func (receiver *API) MoveFile(fileId, parentFolderId string) (*drive.File, error)

func (*API) PermissionShareHandler

func (receiver *API) PermissionShareHandler(calls []*drive.PermissionsCreateCall, doIt bool)

func (*API) QueryFiles

func (receiver *API) QueryFiles(q string) ([]*drive.File, error)

func (*API) RemovePermissionByID

func (receiver *API) RemovePermissionByID(fileID, permissionID string, execute bool) error

func (*API) RemovePermissionByIDWorker

func (receiver *API) RemovePermissionByIDWorker(fileID, permissionId string, wg *sync.WaitGroup, execute bool) error

func (*API) RemoveUserPermission

func (receiver *API) RemoveUserPermission(fileId string, permission *drive.Permission, execute bool) error

func (*API) RemoveUserPermissionWorker

func (receiver *API) RemoveUserPermissionWorker(fileID string, permission *drive.Permission, wg *sync.WaitGroup, execute bool) error

func (*API) ShareFile

func (receiver *API) ShareFile(fileId, email, accountType, role string, notify, doIt bool) (*drive.Permission, error)

func (*API) UploadFile

func (receiver *API) UploadFile(filename, parentFolderId string, data []byte) (*drive.File, error)

type DownloadedFile

type DownloadedFile struct {
	FileInfo *drive.File `json:"file_info"`
	Blob     []byte      `json:"blob"`
}

type FileTransfer

type FileTransfer struct {
	NewOwner string
	DriveAPI *API
	Files    []string
}

Jump to

Keyboard shortcuts

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