Documentation
¶
Overview ¶
Flickr library for Go. Created to be used primarily in Google App Engine.
Index ¶
- Constants
- type Client
- func (c *Client) AddPhotoToSet(photoID, setID string) error
- func (c *Client) AuthURL(perms string) string
- func (c *Client) CheckTickets(tickets []string) (statuses []TicketStatus, err error)
- func (c *Client) GetInfo(photoId string) (*InfoResponse, error)
- func (c *Client) GetSets(userID string) ([]PhotoSet, error)
- func (c *Client) GetSizes(photoId string) (*SizesResponse, error)
- func (c *Client) GetToken(frob string) (string, *User, error)
- func (c *Client) Search(args map[string]string) (*SearchResponse, error)
- func (c *Client) Upload(name string, photo []byte, args map[string]string) (ticketID string, err error)
- type Dates
- type Debugfer
- type InfoResponse
- type Photo
- type PhotoSet
- type SearchPhoto
- type SearchResponse
- type Size
- type SizesResponse
- type Tag
- type TicketStatus
- type Url
- type User
- type Visibility
Constants ¶
const ( ReadPerm = "read" WritePerm = "write" DeletePerm = "delete" )
Flickr API permission levels. See http://www.flickr.com/services/api/auth.spec.html.
const ( SizeSmallSquare = "s" SizeThumbnail = "t" SizeSmall = "m" SizeMedium500 = "-" SizeMedium640 = "z" SizeLarge = "b" SizeOriginal = "o" )
Image sizes supported by Flickr. See http://www.flickr.com/services/api/misc.urls.html for more information.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Auth token for acting on behalf of a user. AuthToken string // Logger to use. // Hint: App engine's Context implements this interface. Logger Debugfer // contains filtered or unexported fields }
Flickr client.
func New ¶
Creates a new Client object. See http://www.flickr.com/services/api/misc.api_keys.html for learning about API key and secret. For App Engine apps, you can create httpClient by calling urlfetch.Client function; other apps can pass http.DefaultClient.
func (*Client) AddPhotoToSet ¶
Adds a photo to a photoset.
func (*Client) AuthURL ¶
Returns the URL for requesting authorisation to access the user's Flickr account. List of possible permissions are defined at http://www.flickr.com/services/api/auth.spec.html. You can also use one of the following constants:
ReadPerm WritePerm DeletePerm
func (*Client) CheckTickets ¶
func (c *Client) CheckTickets(tickets []string) (statuses []TicketStatus, err error)
Checks the status of async upload tickets (returned by Upload method, for example). Interface for http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html API method.
func (*Client) GetToken ¶
Exchanges a temporary frob for a token that's valid forever. See http://www.flickr.com/services/api/auth.howto.web.html.
func (*Client) Search ¶
func (c *Client) Search(args map[string]string) (*SearchResponse, error)
Searches for photos. args contains search parameters as described in http://www.flickr.com/services/api/flickr.photos.search.html.
type Dates ¶
type Dates struct { Posted string `xml:"posted,attr"` // Unix timestamp Taken string `xml:"taken,attr"` Takengranularity int `xml:"takengranularity,attr"` Lastupdate string `xml:"lastupdate,attr"` }
func (*Dates) LastupdateTime ¶
func (*Dates) PostedTime ¶
type Debugfer ¶
type Debugfer interface { // Debugf formats its arguments according to the format, analogous to fmt.Printf, // and records the text as a log message at Debug level. Debug(format string, args ...interface{}) }
Debug logger.
type InfoResponse ¶
type Photo ¶
type SearchPhoto ¶
type SearchPhoto struct { Photo Owner string `xml:"owner,attr"` IsPublic string `xml:"ispublic,attr"` Width_T string `xml:"width_t,attr"` Height_T string `xml:"height_t,attr"` Title string `xml:"title,attr"` Width int `xml:"o_width,attr"` Height int `xml:"o_height,attr"` // Photo's aspect ratio: width divided by height. Ratio float64 }
Represents a Flickr photo.
type SearchResponse ¶
type SearchResponse struct { Page string `xml:"page,attr"` Pages string `xml:"pages,attr"` PerPage string `xml:"perpage,attr"` Total string `xml:"total,attr"` Photos []SearchPhoto `xml:"photo"` }
Response for photo search requests.
type SizesResponse ¶
type TicketStatus ¶
type TicketStatus struct { ID string `xml:"id,attr"` Complete string `xml:"complete,attr"` Invalid string `xml:"invalid,attr"` PhotoID string `xml:"photoid,attr"` }
Asynchronous photo upload status response.