Documentation ¶
Index ¶
- Variables
- type AddResult
- type FileUploadItem
- type HTTPUploadItem
- type ListAlbumsFunc
- type Photos
- func (p *Photos) AddToAlbum(ctx context.Context, title string, uploadItems []UploadItem) ([]*AddResult, error)
- func (p *Photos) AddToLibrary(ctx context.Context, uploadItems []UploadItem) []*AddResult
- func (p *Photos) CreateAlbum(ctx context.Context, title string, uploadItems []UploadItem) ([]*AddResult, error)
- func (p *Photos) FindAlbumByTitle(ctx context.Context, title string) (*photoslibrary.Album, error)
- func (p *Photos) ListAlbums(ctx context.Context, callback ListAlbumsFunc) error
- type UploadItem
Constants ¶
This section is empty.
Variables ¶
var Endpoint = google.Endpoint
Endpoint is an URL of Google Photos Library API.
var Scopes = []string{photoslibrary.PhotoslibraryScope}
Scopes is a set of OAuth scopes.
Functions ¶
This section is empty.
Types ¶
type AddResult ¶
type AddResult struct { MediaItem *photoslibrary.MediaItem Error error }
AddResult represents result of the add operation.
type FileUploadItem ¶
type FileUploadItem string
FileUploadItem represents a local file.
func (FileUploadItem) Open ¶
func (m FileUploadItem) Open() (io.ReadCloser, int64, error)
Open returns a stream. Caller should close it finally.
func (FileUploadItem) String ¶
func (m FileUploadItem) String() string
type HTTPUploadItem ¶
HTTPUploadItem represents a remote file.
func (*HTTPUploadItem) Open ¶
func (m *HTTPUploadItem) Open() (io.ReadCloser, int64, error)
Open returns a stream. Caller should close it finally.
func (*HTTPUploadItem) String ¶
func (m *HTTPUploadItem) String() string
type ListAlbumsFunc ¶
type ListAlbumsFunc func(albums []*photoslibrary.Album, stop func())
ListAlbumsFunc is called for each response of 50 albums. If this calls stop, ListAlbums stops the loop.
type Photos ¶
type Photos struct {
// contains filtered or unexported fields
}
Photos provides service for manage albums and uploading media items.
func (*Photos) AddToAlbum ¶
func (p *Photos) AddToAlbum(ctx context.Context, title string, uploadItems []UploadItem) ([]*AddResult, error)
AddToAlbum adds the items to the album. This method tries uploading all items and ignores any error. If no item could be uploaded, this method returns an error.
func (*Photos) AddToLibrary ¶
func (p *Photos) AddToLibrary(ctx context.Context, uploadItems []UploadItem) []*AddResult
AddToLibrary adds the items to the library. This method tries uploading all items and ignores any error. If no item could be uploaded, this method returns an error.
func (*Photos) CreateAlbum ¶
func (p *Photos) CreateAlbum(ctx context.Context, title string, uploadItems []UploadItem) ([]*AddResult, error)
CreateAlbum creates an album with the media items. This method tries uploading all items and ignores any error. If no item could be uploaded, this method returns an error.
func (*Photos) FindAlbumByTitle ¶
FindAlbumByTitle returns the album which has the title. If the album was not found, it returns nil. If any error occurred, it returns the error.
func (*Photos) ListAlbums ¶
func (p *Photos) ListAlbums(ctx context.Context, callback ListAlbumsFunc) error
ListAlbums gets a list of albums. It calls the function for each 50 albums.
type UploadItem ¶
type UploadItem interface { internal.UploadItem }
UploadItem represents an uploadable item.