Documentation
¶
Index ¶
- Constants
- func NewOAuth2Config(clientID, clientSecret string) *oauth2.Config
- type Access
- type Album
- type Category
- type Client
- func (c *Client) CreateAlbum(userID string, a *Album) (*Album, error)
- func (c *Client) CreateAlbumByName(userID string, albumName string) (*Album, error)
- func (c *Client) DeleteAlbum(userID string, albumID string) error
- func (c *Client) DeleteMedia(userID string, albumID string, mediaID string) error
- func (c *Client) GetMedia(userID, albumID, mediaID string) (*Media, error)
- func (c *Client) ListAlbums(userID string) ([]*Album, error)
- func (c *Client) ListMedia(userID, albumID string) ([]*Media, error)
- func (c *Client) UploadMedia(userID, albumID string, m *UploadMediaInfo, contentType string, ...) (*Media, error)
- type Content
- type Media
- type OriginalVideo
- type Thumbnail
- type UploadMediaInfo
Constants ¶
const ( AccessPublic Access = "public" AccessPrivate = "private" AccessProtected = "protected" )
Available Access values
const BaseURL = "https://picasaweb.google.com"
BaseURL is a base url for Google Photo API
const RedirectURL = "urn:ietf:wg:oauth:2.0:oob"
RedirectURL is a string passed for oauth
Variables ¶
This section is empty.
Functions ¶
func NewOAuth2Config ¶
NewOAuth2Config returns a new *oauth2.Config for Google Photo endpoint.
Types ¶
type Album ¶
type Album struct { XMLName xml.Name `xml:"http://www.w3.org/2005/Atom entry"` XMLNSMedia string `xml:"xmlns:media,attr"` XMLNSGPhoto string `xml:"xmlns:gphoto,attr"` ID string `xml:"http://schemas.google.com/photos/2007 id,omitempty"` PublishedAt *time.Time `xml:"published,omitempty"` // use pointer to make 'omitempty' work UpdatedAt *time.Time `xml:"updated,omitempty"` // use pointer to make 'omitempty' work Title string `xml:"title"` Summary string `xml:"summary"` Category *Category `xml:"category"` Timestamp int64 `xml:"http://schemas.google.com/photos/2007 timestamp,omitempty"` Access Access `xml:"http://schemas.google.com/photos/2007 access,omitempty"` Location string `xml:"http://schemas.google.com/photos/2007 location,omitempty"` AuthorID string `xml:"http://schemas.google.com/photos/2007 user,omitempty"` AuthorName string `xml:"http://schemas.google.com/photos/2007 nickname,omitempty"` NumPhotos int `xml:"http://schemas.google.com/photos/2007 numphotos,omitempty"` NumPhotosRemaining int `xml:"http://schemas.google.com/photos/2007 numphotosremaining,omitempty"` BytesUsed int64 `xml:"http://schemas.google.com/photos/2007 bytesUsed,omitempty"` }
Album represents an album data
type Client ¶
type Client struct { BaseURL string // contains filtered or unexported fields }
Client is a client for Gootle Photo API
func (*Client) CreateAlbum ¶
CreateAlbum creats a new album
func (*Client) CreateAlbumByName ¶
CreateAlbumByName creates a new album with the given album name
func (*Client) DeleteAlbum ¶
DeleteAlbum delets the album.
func (*Client) DeleteMedia ¶
DeleteMedia delets a media
func (*Client) ListAlbums ¶
ListAlbums returns a list of albums
type Content ¶
type Content struct { URL string `xml:"url,attr"` Width int `xml:"width,attr"` Height int `xml:"height,attr"` Type string `xml:"type,attr"` Medium string `xml:"medium,attr"` }
Content represents content field data
type Media ¶
type Media struct { ID string `xml:"http://schemas.google.com/photos/2007 id,omitempty"` AlbumID string `xml:"http://schemas.google.com/photos/2007 albumid,omitempty"` Title string `xml:"title"` PublishedAt *time.Time `xml:"published,omitempty"` UpdatedAt *time.Time `xml:"updated,omitempty"` Summary string `xml:"summary"` Category *Category `xml:"category"` Size int64 `xml:"http://schemas.google.com/photos/2007 size,omitempty"` Width int `xml:"http://schemas.google.com/photos/2007 width,omitempty"` Height int `xml:"http://schemas.google.com/photos/2007 height,omitempty"` VideoStatus string `xml:"http://schemas.google.com/photos/2007 videostatus,omitempty"` OriginalVideo *OriginalVideo `xml:"http://schemas.google.com/photos/2007 originalvideo,omitempty"` Contents []*Content `xml:"http://search.yahoo.com/mrss/ group>content,omitempty"` Thumbnails []*Thumbnail `xml:"http://search.yahoo.com/mrss/ group>thumbnail,omitempty"` }
Media represents media data
type OriginalVideo ¶
type OriginalVideo struct { Width int `xml:"width,attr"` Height int `xml:"height,attr"` Duration int `xml:"duration,attr"` Type string `xml:"type,attr"` Channels int `xml:"channels,attr"` SamplingRate float32 `xml:"samplingrate,attr"` VideoCodec string `xml:"videoCodec,attr"` AudioCodec string `xml:"audioCodec,attr"` Fps float32 `xml:"fps,attr"` }
OriginalVideo represents original_video field data.
type Thumbnail ¶
type Thumbnail struct { URL string `xml:"url,attr"` Width int `xml:"width,attr"` Height int `xml:"height,attr"` }
Thumbnail represents thumbnail field data
type UploadMediaInfo ¶
type UploadMediaInfo struct { XMLName xml.Name `xml:"http://www.w3.org/2005/Atom entry"` XMLNSMedia string `xml:"xmlns:media,attr"` XMLNSGPhoto string `xml:"xmlns:gphoto,attr"` Title string `xml:"title"` Summary string `xml:"summary"` Category *Category `xml:"category"` Client string `xml:"gphoto:client"` }
UploadMediaInfo is a struct used for uploading a media
func NewUploadMediaInfo ¶
func NewUploadMediaInfo(title string) *UploadMediaInfo
NewUploadMediaInfo returns a new *UploadMediaInfo