drive

package
v0.0.0-...-030d584 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2015 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package drive provides access to the Drive API.

See https://developers.google.com/drive/

Usage example:

import "google.golang.org/api/drive/v1"
...
driveService, err := drive.New(oauthHttpClient)

Index

Constants

View Source
const (
	// View and manage Google Drive files and folders that you have opened
	// or created with this app
	DriveFileScope = "https://www.googleapis.com/auth/drive.file"
)

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// CreatedDate: Create time for this file (formatted RFC 3339
	// timestamp).
	CreatedDate string `json:"createdDate,omitempty"`

	// Description: A short description of the file
	Description string `json:"description,omitempty"`

	DownloadUrl string `json:"downloadUrl,omitempty"`

	// Etag: ETag of the file.
	Etag string `json:"etag,omitempty"`

	// FileExtension: The file extension used when downloading this file.
	// This field is read only. To set the extension, include it on title
	// when creating the file. This will only be populated on files with
	// content stored in Drive.
	FileExtension string `json:"fileExtension,omitempty"`

	// FileSize: The size of the file in bytes. This will only be populated
	// on files with content stored in Drive.
	FileSize int64 `json:"fileSize,omitempty,string"`

	// Id: The id of the file.
	Id string `json:"id,omitempty"`

	// IndexableText: Indexable text attributes for the file (can only be
	// written)
	IndexableText *FileIndexableText `json:"indexableText,omitempty"`

	// Kind: The type of file. This is always drive#file
	Kind string `json:"kind,omitempty"`

	// Labels: Labels for the file.
	Labels *FileLabels `json:"labels,omitempty"`

	// LastViewedDate: Last time this file was viewed by the user (formatted
	// RFC 3339 timestamp).
	LastViewedDate string `json:"lastViewedDate,omitempty"`

	// Md5Checksum: An MD5 checksum for the content of this file. This will
	// only be populated on files with content stored in Drive.
	Md5Checksum string `json:"md5Checksum,omitempty"`

	// MimeType: The mimetype of the file
	MimeType string `json:"mimeType,omitempty"`

	// ModifiedByMeDate: Last time this file was modified by the user
	// (formatted RFC 3339 timestamp).
	ModifiedByMeDate string `json:"modifiedByMeDate,omitempty"`

	// ModifiedDate: Last time this file was modified by anyone (formatted
	// RFC 3339 timestamp).
	ModifiedDate string `json:"modifiedDate,omitempty"`

	// ParentsCollection: Collection of parent folders which contain this
	// file.
	// On insert, setting this field will put the file in all of the
	// provided folders. If no folders are provided, the file will be placed
	// in the default root folder. On update, this field is ignored.
	ParentsCollection []*FileParentsCollection `json:"parentsCollection,omitempty"`

	// SelfLink: A link back to this file.
	SelfLink string `json:"selfLink,omitempty"`

	// Title: The title of this file.
	Title string `json:"title,omitempty"`

	// UserPermission: The permissions for the authenticated user on this
	// file.
	UserPermission *Permission `json:"userPermission,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "CreatedDate") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

File: The metadata for a file.

func (*File) MarshalJSON

func (s *File) MarshalJSON() ([]byte, error)

type FileIndexableText

type FileIndexableText struct {
	// Text: The text to be indexed for this file
	Text string `json:"text,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Text") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

FileIndexableText: Indexable text attributes for the file (can only be written)

func (*FileIndexableText) MarshalJSON

func (s *FileIndexableText) MarshalJSON() ([]byte, error)

type FileLabels

type FileLabels struct {
	// Hidden: Whether this file is hidden from the user
	Hidden bool `json:"hidden,omitempty"`

	// Starred: Whether this file is starred by the user.
	Starred bool `json:"starred,omitempty"`

	// Trashed: Whether this file has been trashed.
	Trashed bool `json:"trashed,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Hidden") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

FileLabels: Labels for the file.

func (*FileLabels) MarshalJSON

func (s *FileLabels) MarshalJSON() ([]byte, error)

type FileParentsCollection

type FileParentsCollection struct {
	// Id: The id of this parent
	Id string `json:"id,omitempty"`

	// ParentLink: A link to get the metadata for this parent
	ParentLink string `json:"parentLink,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Id") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

func (*FileParentsCollection) MarshalJSON

func (s *FileParentsCollection) MarshalJSON() ([]byte, error)

type FilesGetCall

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

func (*FilesGetCall) Context

func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*FilesGetCall) Do

func (c *FilesGetCall) Do() (*File, error)

Do executes the "drive.files.get" call. Exactly one of *File or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *File.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*FilesGetCall) Fields

func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*FilesGetCall) IfNoneMatch

func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*FilesGetCall) Projection

func (c *FilesGetCall) Projection(projection string) *FilesGetCall

Projection sets the optional parameter "projection": This parameter is deprecated and has no function.

Possible values:

"BASIC" - Deprecated
"FULL" - Deprecated

func (*FilesGetCall) UpdateViewedDate

func (c *FilesGetCall) UpdateViewedDate(updateViewedDate bool) *FilesGetCall

UpdateViewedDate sets the optional parameter "updateViewedDate": Whether to update the view date after successfully retrieving the file.

type FilesInsertCall

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

func (*FilesInsertCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled. This context will supersede any context previously provided to the ResumableMedia method.

func (*FilesInsertCall) Do

func (c *FilesInsertCall) Do() (*File, error)

Do executes the "drive.files.insert" call. Exactly one of *File or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *File.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*FilesInsertCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*FilesInsertCall) Media

Media specifies the media to upload in a single chunk. At most one of Media and ResumableMedia may be set.

func (*FilesInsertCall) ProgressUpdater

func (c *FilesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesInsertCall

ProgressUpdater provides a callback function that will be called after every chunk. It should be a low-latency function in order to not slow down the upload operation. This should only be called when using ResumableMedia (as opposed to Media).

func (*FilesInsertCall) ResumableMedia

func (c *FilesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesInsertCall

ResumableMedia specifies the media to upload in chunks and can be canceled with ctx. At most one of Media and ResumableMedia may be set. mediaType identifies the MIME media type of the upload, such as "image/png". If mediaType is "", it will be auto-detected. The provided ctx will supersede any context previously provided to the Context method.

type FilesPatchCall

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

func (*FilesPatchCall) Context

func (c *FilesPatchCall) Context(ctx context.Context) *FilesPatchCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*FilesPatchCall) Do

func (c *FilesPatchCall) Do() (*File, error)

Do executes the "drive.files.patch" call. Exactly one of *File or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *File.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*FilesPatchCall) Fields

func (c *FilesPatchCall) Fields(s ...googleapi.Field) *FilesPatchCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*FilesPatchCall) NewRevision

func (c *FilesPatchCall) NewRevision(newRevision bool) *FilesPatchCall

NewRevision sets the optional parameter "newRevision": Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions.

func (*FilesPatchCall) UpdateModifiedDate

func (c *FilesPatchCall) UpdateModifiedDate(updateModifiedDate bool) *FilesPatchCall

UpdateModifiedDate sets the optional parameter "updateModifiedDate": Controls updating the modified date of the file. If true, the modified date will be updated to the current time, regardless of whether other changes are being made. If false, the modified date will only be updated to the current time if other changes are also being made (changing the title, for example).

func (*FilesPatchCall) UpdateViewedDate

func (c *FilesPatchCall) UpdateViewedDate(updateViewedDate bool) *FilesPatchCall

UpdateViewedDate sets the optional parameter "updateViewedDate": Whether to update the view date after successfully updating the file.

type FilesService

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

func NewFilesService

func NewFilesService(s *Service) *FilesService

func (*FilesService) Get

func (r *FilesService) Get(id string) *FilesGetCall

Get: Gets a file's metadata by id.

func (*FilesService) Insert

func (r *FilesService) Insert(file *File) *FilesInsertCall

Insert: Inserts a file, and any settable metadata or blob content sent with the request.

func (*FilesService) Patch

func (r *FilesService) Patch(id string, file *File) *FilesPatchCall

Patch: Updates file metadata and/or content. This method supports patch semantics.

func (*FilesService) Update

func (r *FilesService) Update(id string, file *File) *FilesUpdateCall

Update: Updates file metadata and/or content

type FilesUpdateCall

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

func (*FilesUpdateCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled. This context will supersede any context previously provided to the ResumableMedia method.

func (*FilesUpdateCall) Do

func (c *FilesUpdateCall) Do() (*File, error)

Do executes the "drive.files.update" call. Exactly one of *File or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *File.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*FilesUpdateCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*FilesUpdateCall) Media

Media specifies the media to upload in a single chunk. At most one of Media and ResumableMedia may be set.

func (*FilesUpdateCall) NewRevision

func (c *FilesUpdateCall) NewRevision(newRevision bool) *FilesUpdateCall

NewRevision sets the optional parameter "newRevision": Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions.

func (*FilesUpdateCall) ProgressUpdater

func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall

ProgressUpdater provides a callback function that will be called after every chunk. It should be a low-latency function in order to not slow down the upload operation. This should only be called when using ResumableMedia (as opposed to Media).

func (*FilesUpdateCall) ResumableMedia

func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall

ResumableMedia specifies the media to upload in chunks and can be canceled with ctx. At most one of Media and ResumableMedia may be set. mediaType identifies the MIME media type of the upload, such as "image/png". If mediaType is "", it will be auto-detected. The provided ctx will supersede any context previously provided to the Context method.

func (*FilesUpdateCall) UpdateModifiedDate

func (c *FilesUpdateCall) UpdateModifiedDate(updateModifiedDate bool) *FilesUpdateCall

UpdateModifiedDate sets the optional parameter "updateModifiedDate": Controls updating the modified date of the file. If true, the modified date will be updated to the current time, regardless of whether other changes are being made. If false, the modified date will only be updated to the current time if other changes are also being made (changing the title, for example).

func (*FilesUpdateCall) UpdateViewedDate

func (c *FilesUpdateCall) UpdateViewedDate(updateViewedDate bool) *FilesUpdateCall

UpdateViewedDate sets the optional parameter "updateViewedDate": Whether to update the view date after successfully updating the file.

type Permission

type Permission struct {
	// AdditionalRoles: Any additional roles that this permission describes.
	AdditionalRoles []string `json:"additionalRoles,omitempty"`

	// Etag: An etag for this permission.
	Etag string `json:"etag,omitempty"`

	// Kind: The kind of this permission. This is always drive#permission
	Kind string `json:"kind,omitempty"`

	// Role: The role that this permission describes. (For example: reader,
	// writer, owner)
	Role string `json:"role,omitempty"`

	// Type: The type of permission (For example: user, group etc).
	Type string `json:"type,omitempty"`

	// ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

Permission: A single permission for a file.

func (*Permission) MarshalJSON

func (s *Permission) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Files *FilesService
	// contains filtered or unexported fields
}

func New

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

Jump to

Keyboard shortcuts

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