driveapicollector

package
v0.0.0-...-d29814e Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalChange

func MarshalChange(change *drive.Change) (resource.Change, error)

MarshalChange marshals the given change as a resource.

func MarshalDrive

func MarshalDrive(d *drive.TeamDrive) (resource.Drive, error)

MarshalDrive marshals the given team drive as a resource.

func MarshalFile

func MarshalFile(file *drive.File) (resource.File, error)

MarshalFile marshals the given file as a resource.

func MarshalPermission

func MarshalPermission(perm *drive.Permission) (resource.Permission, error)

MarshalPermission marshals the given permission as a resource.

Types

type Collector

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

A Collector is responsible for collecting team drive file data from a drive service.

Collectors should be created by calling New.

func New

func New(s *drive.Service, teamDriveID string) *Collector

New returns a new collector for the requested team drive.

func (*Collector) ChangeToken

func (c *Collector) ChangeToken(ctx context.Context) (startToken string, err error)

ChangeToken returns the starting token for a new stream of changes.

func (*Collector) Changes

func (c *Collector) Changes(ctx context.Context, token string, p []resource.Change) (n int, nextToken string, nextStartToken string, err error)

Changes collects a set of changes into p, up to len(p), starting from the change identified by token.

If len(p) is zero it will panic.

The number of changes collected are returned in n.

If there more changes to be collected in the current set, nextToken will be non-empty. If there are no more changes in the current set then nextStartToken will hold the starting token for the next set.

func (*Collector) Drive

func (c *Collector) Drive(ctx context.Context) (resource.Change, error)

Drive collects the current drive data, formatted in the same manner as a change.

func (*Collector) Files

func (c *Collector) Files(ctx context.Context, token string, p []resource.Change) (n int, nextToken string, err error)

Files collects a set of files into p, starting from the file identified by token. It returns the number of files collected as n, and returns a non-empty nextToken if there are additional files in the list yet to be read.

If the provided token is empty it will start at the first file within the team drive.

If the length of p is zero Files will panic.

Jump to

Keyboard shortcuts

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