service

package
v0.0.0-...-c8ec3b5 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

DriveService translates blobserver.Storage methods into Google Drive API methods.

Index

Constants

View Source
const (
	MimeTypeDriveFolder = "application/vnd.google-apps.folder"
	MimeTypeCamliBlob   = "application/vnd.camlistore.blob"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DriveService

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

DriveService wraps Google Drive API to implement utility methods to be performed on the root Drive destination folder.

func New

func New(oauthClient *http.Client, parentId string) (*DriveService, error)

New initiates a new DriveService. parentId is the ID of the directory that will be used as the current directory in methods on the returned DriveService (such as Get). If empty, it defaults to the root of the drive.

func (*DriveService) Fetch

func (s *DriveService) Fetch(title string) (body io.ReadCloser, size uint32, err error)

Fetch retrieves the metadata and contents of a file.

func (*DriveService) Get

func (s *DriveService) Get(title string) (*client.File, error)

Get retrieves a file with its title equal to the provided title and a child of the parentId as given to New. If not found, os.ErrNotExist is returned.

func (*DriveService) List

func (s *DriveService) List(pageToken string, limit int) (files []*client.File, next string, err error)

Lists the folder identified by parentId.

func (*DriveService) Stat

func (s *DriveService) Stat(title string) (int64, error)

Stat retrieves file metadata and returns file size. Returns error if file is not found.

func (*DriveService) Trash

func (s *DriveService) Trash(title string) (err error)

Trash trashes the file with the given title.

func (*DriveService) Upsert

func (s *DriveService) Upsert(title string, data io.Reader) (file *client.File, err error)

Upsert inserts a file, or updates if such a file exists.

Jump to

Keyboard shortcuts

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