googledrive

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package googledrive holds the implementation related to Drive interactions.

Index

Constants

View Source
const (
	// FileMimeType represents the GDrive file mime type.
	FileMimeType = "mimeType = 'application/vnd.googledrive-apps.file'"
	// DirMimeType represents the GDrive directory mime type.
	DirMimeType = "mimeType = 'application/vnd.googledrive-apps.folder'"
)

Variables

View Source
var (
	// ClientSecret is the client secret for the GDrive client and must be set from the LD flags.
	ClientSecret string
	// ClientID is the client ID for the GDrive client and must be set from the LD flags.
	ClientID string
)

Functions

This section is empty.

Types

type Client

type Client struct {
	TokenFile string
	// contains filtered or unexported fields
}

Client represents the GDrive client.

func (*Client) CopyFile added in v0.9.1

func (d *Client) CopyFile(fileID, name, mimeType string, parentID string) (*drive.File, error)

CopyFile method copies the given file.

func (*Client) CreateDir

func (d *Client) CreateDir(name string, parentID string) (*drive.File, error)

CreateDir method creates the given directory under the given parent ID.

func (*Client) CreateFile

func (d *Client) CreateFile(name string, mimeType string, content io.Reader, parentID string) (*drive.File, error)

CreateFile method creates the given file.

func (*Client) FileContent

func (d *Client) FileContent(fileID string) ([]byte, error)

FileContent method downloads the given file content.

func (*Client) Init

func (d *Client) Init() error

Init initialises the GDrive client.

func (*Client) IsDirExists

func (d *Client) IsDirExists(dirName string) (bool, string, error)

IsDirExists method checks whether the given directory exists or not.

func (*Client) IsFileExists

func (d *Client) IsFileExists(dirID string, fileName string) (bool, string, error)

IsFileExists method checks whether the given file exists under the given directory or not.

func (*Client) UpdateFileContent

func (d *Client) UpdateFileContent(fileID string, content []byte) error

UpdateFileContent method updates the given file with given content.

Jump to

Keyboard shortcuts

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