Index | Files

package service

import ""

Package service translates blobserver.Storage methods into Google Drive API methods.


Package Files



const (
    MimeTypeDriveFolder = "application/"
    MimeTypeCamliBlob   = "application/vnd.camlistore.blob"

type DriveService Uses

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 Uses

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 Uses

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

Fetch retrieves the metadata and contents of a file.

func (*DriveService) Get Uses

func (s *DriveService) Get(ctx context.Context, 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 Uses

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

List returns a list of files. When limit is greater than zero a paginated list is returned using the next response as a pageToken in subsequent calls.

func (*DriveService) Stat Uses

func (s *DriveService) Stat(ctx context.Context, title string) (int64, error)

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

func (*DriveService) Trash Uses

func (s *DriveService) Trash(ctx context.Context, title string) error

Trash trashes the file with the given title.

func (*DriveService) Upsert Uses

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

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

Package service imports 8 packages (graph) and is imported by 1 packages. Updated 2019-06-13. Refresh now. Tools for package owners.