Documentation ¶
Overview ¶
package response provides methods for unmarshaling Flickr API responses in to structs and instances corresponding to specific API methods. Not all Flickr API responses are supported yet and may not be until time and circumstance warrant their inclusion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckTicket ¶
type CheckTicket struct { // An Uploader instance that maps to the "uploader" element in the API response. Uploader *Uploader `json:"uploader"` }
CheckTicket is a struct that maps to the Flickr API flickr.photos.upload.checkTickets method response.
func UnmarshalCheckTicketResponse ¶
func UnmarshalCheckTicketResponse(fh io.Reader) (*CheckTicket, error)
Unmarshal Flickr API flickr.photos.upload.checkTickets method response into a CheckTicket instance.
type Error ¶
type Error struct { // The numeric code for the error. Code int `xml:"code,attr" json:"code"` // The message associated with the error. Message string `xml:"msg,attr" json:"msg"` }
Error is a struct containing information about a failed API request.
type Login ¶
type Pagination ¶
type Pagination struct { // The current page of results for an API request. Page int `json:"page"` // The total number of pages of results for an API request. Pages int `json:"pages"` // The number of results, per page, for an API request. PerPage int `json:"perpage"` // The total number of results, across all pages, for an API request. Total int `json:"total"` }
Pagination is a struct containing pagination metrics for a given API response.
func DerivePagination ¶
func DerivePagination(ctx context.Context, fh io.ReadSeekCloser) (*Pagination, error)
Given an API response try to derive pagination metrics.
type Response ¶
type Response struct { XMLName xml.Name `xml:"rsp" json:"-"` // A string label indicating whether or not an API request succeeded or failed, "ok" and "error" respectively. Status string `xml:"stat,attr" json:"stat"` // An optional Error instance containing specific details about a failed API request. Error *Error `xml:"err,omitempty" json:"err,omitempty"` }
Response is a struct containing only minimal information about an API request, notably it's Status and optionally an Error associated with the request.
type Upload ¶
type Upload struct { XMLName xml.Name `xml:"rsp" json:"-"` // The Flickr API response status. Status string `xml:"stat,attr" json:"stat"` Error *Error `xml:"err,omitempty" json:"error,omitempty"` Photo *UploadPhoto `xml:"photoid" json:"photo,omitempty"` }
type UploadPhoto ¶
type UploadTicket ¶
type UploadTicket struct { XMLName xml.Name `xml:"rsp"` // The Flickr API response status. Status string `xml:"stat,attr"` Error *Error `xml:"err,omitempty"` TicketId string `xml:"ticketid"` }
func UmarshalUploadTicketResponse ¶
func UmarshalUploadTicketResponse(fh io.Reader) (*UploadTicket, error)
Unmarshal Flickr API flickr.photos.upload method response, for asynchronous uploads, in to a UploadTicket instance.
func UnmarshalUploadTicketResponse ¶
func UnmarshalUploadTicketResponse(fh io.Reader) (*UploadTicket, error)
type Uploader ¶
type Uploader struct { // An array of UploaderTicket instances that map to the "ticket" array in the API response. Tickets []*UploaderTicket `json:"ticket"` }
Uploader is a struct that maps to the "uploader" element in a Flickr API flickr.photos.upload.checkTickets method response.
type UploaderTicket ¶
type UploaderTicket struct { // A Flickr API upload ticket ID. TicketId string `json:"id"` // A numeric flag (1 or 0) indicating whether an upload ticket has been completed. Complete int `json:"complete"` // The Flickr photo ID for a successful upload. Note that this is encoded (by the Flickr API) a string. PhotoId string `json:"photoid"` // The creation time (Unix timestamp) for a successful upload. Note that this is encoded (by the Flickr API) a string. Imported string `json:"imported"` }
UploaderTicket is a struct that maps to the "ticket" array in a Flickr API flickr.photos.upload.checkTickets method response.