drive

package
v0.0.0-...-123d82a Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIgnoreFile = ".gdriveignore"
View Source
const DirectoryMimeType = "application/vnd.google-apps.folder"
View Source
const MaxDrawInterval = time.Second * 1
View Source
const MaxErrorRetries = 5
View Source
const MaxRateInterval = time.Second * 3
View Source
const TimeoutTimerInterval = time.Second * 10

Variables

View Source
var DefaultExportMime = map[string]string{
	"application/vnd.google-apps.form":         "application/zip",
	"application/vnd.google-apps.document":     "application/pdf",
	"application/vnd.google-apps.drawing":      "image/svg+xml",
	"application/vnd.google-apps.spreadsheet":  "text/csv",
	"application/vnd.google-apps.script":       "application/vnd.google-apps.script+json",
	"application/vnd.google-apps.presentation": "application/pdf",
}

Functions

func PrintChanges

func PrintChanges(args PrintChangesArgs)

func PrintFileInfo

func PrintFileInfo(args PrintFileInfoArgs)

func PrintFileList

func PrintFileList(args PrintFileListArgs)

func PrintRevisionList

func PrintRevisionList(args PrintRevisionListArgs)

Types

type AboutArgs

type AboutArgs struct {
	Out         io.Writer
	SizeInBytes bool
}

type AboutExportArgs

type AboutExportArgs struct {
	Out io.Writer
}

type AboutImportArgs

type AboutImportArgs struct {
	Out io.Writer
}

type ConflictResolution

type ConflictResolution int
const (
	NoResolution ConflictResolution = iota
	KeepLocal
	KeepRemote
	KeepLargest
)

type DeleteArgs

type DeleteArgs struct {
	Out       io.Writer
	Id        string
	Recursive bool
}

type DeleteRevisionArgs

type DeleteRevisionArgs struct {
	Out        io.Writer
	FileId     string
	RevisionId string
}

type DownloadArgs

type DownloadArgs struct {
	Out       io.Writer
	Progress  io.Writer
	Id        string
	Path      string
	Force     bool
	Skip      bool
	Recursive bool
	Delete    bool
	Stdout    bool
	Timeout   time.Duration
	Try       int
}

type DownloadQueryArgs

type DownloadQueryArgs struct {
	Out       io.Writer
	Progress  io.Writer
	Query     string
	Path      string
	Force     bool
	Skip      bool
	Recursive bool
	Try       int
}

type DownloadRevisionArgs

type DownloadRevisionArgs struct {
	Out        io.Writer
	Progress   io.Writer
	FileId     string
	RevisionId string
	Path       string
	Force      bool
	Stdout     bool
	Timeout    time.Duration
}

type DownloadSyncArgs

type DownloadSyncArgs struct {
	Out              io.Writer
	Progress         io.Writer
	RootId           string
	Path             string
	DryRun           bool
	DeleteExtraneous bool
	Timeout          time.Duration
	Resolution       ConflictResolution
	Comparer         FileComparer
}

type Drive

type Drive struct {
	// contains filtered or unexported fields
}

func New

func New(client *http.Client) (*Drive, error)

func (*Drive) About

func (self *Drive) About(args AboutArgs) (err error)

func (*Drive) AboutExport

func (self *Drive) AboutExport(args AboutExportArgs) (err error)

func (*Drive) AboutImport

func (self *Drive) AboutImport(args AboutImportArgs) (err error)

func (*Drive) Delete

func (self *Drive) Delete(args DeleteArgs) error

func (*Drive) DeleteRevision

func (self *Drive) DeleteRevision(args DeleteRevisionArgs) (err error)

func (*Drive) Download

func (self *Drive) Download(args DownloadArgs) error

func (*Drive) DownloadQuery

func (self *Drive) DownloadQuery(args DownloadQueryArgs) error

func (*Drive) DownloadRevision

func (self *Drive) DownloadRevision(args DownloadRevisionArgs) (err error)

func (*Drive) DownloadSync

func (self *Drive) DownloadSync(args DownloadSyncArgs) error

func (*Drive) Export

func (self *Drive) Export(args ExportArgs) error

func (*Drive) GetChangesStartPageToken

func (self *Drive) GetChangesStartPageToken() (string, error)

func (*Drive) Import

func (self *Drive) Import(args ImportArgs) error

func (*Drive) Info

func (self *Drive) Info(args FileInfoArgs) error

func (*Drive) List

func (self *Drive) List(args ListFilesArgs) (err error)

func (*Drive) ListChanges

func (self *Drive) ListChanges(args ListChangesArgs) error

func (*Drive) ListPermissions

func (self *Drive) ListPermissions(args ListPermissionsArgs) error

func (*Drive) ListRecursiveSync

func (self *Drive) ListRecursiveSync(args ListRecursiveSyncArgs) error

func (*Drive) ListRevisions

func (self *Drive) ListRevisions(args ListRevisionsArgs) (err error)

func (*Drive) ListSync

func (self *Drive) ListSync(args ListSyncArgs) error

func (*Drive) Mkdir

func (self *Drive) Mkdir(args MkdirArgs) error

func (*Drive) RevokePermission

func (self *Drive) RevokePermission(args RevokePermissionArgs) error

func (*Drive) Share

func (self *Drive) Share(args ShareArgs) error

func (*Drive) Update

func (self *Drive) Update(args UpdateArgs) error

func (*Drive) Upload

func (self *Drive) Upload(args UploadArgs) error

func (*Drive) UploadStream

func (self *Drive) UploadStream(args UploadStreamArgs) error

func (*Drive) UploadSync

func (self *Drive) UploadSync(args UploadSyncArgs) error

type ExportArgs

type ExportArgs struct {
	Out        io.Writer
	Id         string
	PrintMimes bool
	Mime       string
	Force      bool
}

type FileComparer

type FileComparer interface {
	Changed(*LocalFile, *RemoteFile) bool
}

type FileInfoArgs

type FileInfoArgs struct {
	Out         io.Writer
	Id          string
	SizeInBytes bool
}

type ImportArgs

type ImportArgs struct {
	Out      io.Writer
	Mime     string
	Progress io.Writer
	Path     string
	Parents  []string
}

type LargestSize

type LargestSize int
const (
	LocalLargestSize LargestSize = iota
	RemoteLargestSize
	EqualSize
)

type ListChangesArgs

type ListChangesArgs struct {
	Out        io.Writer
	PageToken  string
	MaxChanges int64
	Now        bool
	NameWidth  int64
	SkipHeader bool
}

type ListFilesArgs

type ListFilesArgs struct {
	Out         io.Writer
	MaxFiles    int64
	NameWidth   int64
	Query       string
	SortOrder   string
	SkipHeader  bool
	SizeInBytes bool
	AbsPath     bool
}

type ListPermissionsArgs

type ListPermissionsArgs struct {
	Out    io.Writer
	FileId string
}

type ListRecursiveSyncArgs

type ListRecursiveSyncArgs struct {
	Out         io.Writer
	RootId      string
	SkipHeader  bool
	PathWidth   int64
	SizeInBytes bool
	SortOrder   string
}

type ListRevisionsArgs

type ListRevisionsArgs struct {
	Out         io.Writer
	Id          string
	NameWidth   int64
	SkipHeader  bool
	SizeInBytes bool
}

type ListSyncArgs

type ListSyncArgs struct {
	Out        io.Writer
	SkipHeader bool
}

type LocalFile

type LocalFile struct {
	// contains filtered or unexported fields
}

func (LocalFile) AbsPath

func (self LocalFile) AbsPath() string

func (LocalFile) Modified

func (self LocalFile) Modified() time.Time

func (LocalFile) Size

func (self LocalFile) Size() int64

type MkdirArgs

type MkdirArgs struct {
	Out         io.Writer
	Name        string
	Description string
	Parents     []string
}

type ModTime

type ModTime int
const (
	LocalLastModified ModTime = iota
	RemoteLastModified
	EqualModifiedTime
)

type PrintChangesArgs

type PrintChangesArgs struct {
	Out        io.Writer
	ChangeList *drive.ChangeList
	NameWidth  int
	SkipHeader bool
}

type PrintFileInfoArgs

type PrintFileInfoArgs struct {
	Out         io.Writer
	File        *drive.File
	Path        string
	SizeInBytes bool
}

type PrintFileListArgs

type PrintFileListArgs struct {
	Out         io.Writer
	Files       []*drive.File
	NameWidth   int
	SkipHeader  bool
	SizeInBytes bool
}

type PrintRevisionListArgs

type PrintRevisionListArgs struct {
	Out         io.Writer
	Revisions   []*drive.Revision
	NameWidth   int
	SkipHeader  bool
	SizeInBytes bool
}

type Progress

type Progress struct {
	Writer io.Writer
	Reader io.Reader
	Size   int64
	// contains filtered or unexported fields
}

func (*Progress) Read

func (self *Progress) Read(p []byte) (int, error)

type RemoteFile

type RemoteFile struct {
	// contains filtered or unexported fields
}

func (RemoteFile) Md5

func (self RemoteFile) Md5() string

func (RemoteFile) Modified

func (self RemoteFile) Modified() time.Time

func (RemoteFile) Size

func (self RemoteFile) Size() int64

type RevokePermissionArgs

type RevokePermissionArgs struct {
	Out          io.Writer
	FileId       string
	PermissionId string
}

type ShareArgs

type ShareArgs struct {
	Out          io.Writer
	FileId       string
	Role         string
	Type         string
	Email        string
	Domain       string
	Discoverable bool
}

type TimeoutReader

type TimeoutReader struct {
	// contains filtered or unexported fields
}

func (*TimeoutReader) Read

func (self *TimeoutReader) Read(p []byte) (int, error)

type UpdateArgs

type UpdateArgs struct {
	Out         io.Writer
	Progress    io.Writer
	Id          string
	Path        string
	Name        string
	Description string
	Parents     []string
	Mime        string
	Recursive   bool
	ChunkSize   int64
	Timeout     time.Duration
}

type UploadArgs

type UploadArgs struct {
	Out         io.Writer
	Progress    io.Writer
	Path        string
	Name        string
	Description string
	Parents     []string
	Mime        string
	Recursive   bool
	Share       bool
	Delete      bool
	ChunkSize   int64
	Timeout     time.Duration
}

type UploadStreamArgs

type UploadStreamArgs struct {
	Out         io.Writer
	In          io.Reader
	Name        string
	Description string
	Parents     []string
	Mime        string
	Share       bool
	ChunkSize   int64
	Progress    io.Writer
	Timeout     time.Duration
}

type UploadSyncArgs

type UploadSyncArgs struct {
	Out              io.Writer
	Progress         io.Writer
	Path             string
	RootId           string
	DryRun           bool
	DeleteExtraneous bool
	ChunkSize        int64
	Timeout          time.Duration
	Resolution       ConflictResolution
	Comparer         FileComparer
}

Jump to

Keyboard shortcuts

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