Documentation ¶
Index ¶
- Constants
- func GetUnmarshalJSON(c *http.Client, url string, target interface{}) error
- func Login(consumerKey string, consumerSecret string) (*oauth2.Token, error)
- func PostUnmarshalJSON(c *http.Client, url string, reqBody string, target interface{}) error
- type Album
- type CachedMediaItem
- type Client
- type CodeCatcher
- type GooglephotosAuth
- type MaybeQuotedInt64
- type MediaItem
- type MediaMetadata
- type PhotoMediaMetadata
- type SearchMediaItemsResponse
- type UpdateCacheCallback
- type UpdateCacheResult
- type VideoMediaMetadata
Constants ¶
View Source
const (
CodeAcceptedPage = `` /* 438-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
func GetUnmarshalJSON ¶
GetUnmarshalJSON gets a JSON response from url and unmarshals into target
Types ¶
type Album ¶
type Album struct { Id string `json:"id"` Title string `json:"title"` ProductUrl string `json:"productUrl"` IsWriteable bool `json:"isWriteable"` MediaItemsCount MaybeQuotedInt64 `json:"mediaItemsCount"` CoverPhotoBaseUrl string `json:"coverPhotoBaseUrl"` CoverPhotoMediaItemId string `json:"coverPhotoMediaItemId"` }
type CachedMediaItem ¶
type Client ¶
type Client interface { ListAlbums() ([]*Album, error) ListMediaItemsForAlbumId(albumId string, nextPageToken string) (*SearchMediaItemsResponse, error) UpdateCacheForAlbumId(albumId string, nextPageToken string, cb UpdateCacheCallback) (*UpdateCacheResult, error) }
type CodeCatcher ¶
type GooglephotosAuth ¶
type MaybeQuotedInt64 ¶
type MaybeQuotedInt64 int64
The Google Photos API sometimes returns ints wrapped in quotes.
{ mediaItemsCount: "6" }
Go's default JSON parser will only allow this as the string "6". Define a new optionally-quoted int type, where the custom unmarshaller will pull off one pair of quotes, if present.
func (MaybeQuotedInt64) MarshalJSON ¶
func (i MaybeQuotedInt64) MarshalJSON() ([]byte, error)
func (*MaybeQuotedInt64) UnmarshalJSON ¶
func (i *MaybeQuotedInt64) UnmarshalJSON(data []byte) error
type MediaMetadata ¶
type MediaMetadata struct { CreationTime string `json:"creationTime"` Width MaybeQuotedInt64 `json:"width"` Height MaybeQuotedInt64 `json:"height"` // Either Photo or Video will be present Photo *PhotoMediaMetadata `json:"photo"` Video *VideoMediaMetadata `json:"video"` }
type PhotoMediaMetadata ¶
type UpdateCacheCallback ¶
type UpdateCacheCallback func(*CachedMediaItem)
type UpdateCacheResult ¶
type UpdateCacheResult struct { CachedMediaItems []*CachedMediaItem NextPageToken string }
Click to show internal directories.
Click to hide internal directories.