Documentation
¶
Index ¶
- Constants
- type AccessToken
- type Client
- func (c *Client) GetAccessToken(rt *RequestToken, verifier string) (*AccessToken, error)
- func (c *Client) GetAuthorizeURL(token, permissions string) string
- func (c *Client) GetRequestToken() (*RequestToken, error)
- func (c *Client) Sign(r *request, tokenSecret string)
- func (c *Client) SignOAuth(r *request, at *AccessToken)
- func (c *Client) Upload(re io.Reader, name string, at *AccessToken) (*UploadResult, error)
- type RequestToken
- type Result
- type UploadResult
Constants ¶
const ( // AccessTokenURL is the Flickr API endpoint for requesting OAuth access tokens. AccessTokenURL = "https://www.flickr.com/services/oauth/access_token" // APIURL is the Flickr API endpoint for making general API requests. APIURL = "https://api.flickr.com/services/rest" // AuthorizeURL is the Flickr OAuth authorization endpoint. AuthorizeURL = "https://www.flickr.com/services/oauth/authorize" // RequestTokenURL is the Flickr API endpoint for requesting OAuth request tokens. RequestTokenURL = "https://www.flickr.com/services/oauth/request_token" // UploadURL is the Flickr API endpoint for uploading photos. UploadURL = "https://up.flickr.com/services/upload/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct {
OAuthToken string
OAuthTokenSecret string
Fullname string
UserNsid string
Username string
}
AccessToken represents a Flick OAuth access token.
type Client ¶
type Client struct {
APIKey string
APISecret string
Callback string
// contains filtered or unexported fields
}
Client is the primary type used to interact with the Flickr API.
func (*Client) GetAccessToken ¶
func (c *Client) GetAccessToken(rt *RequestToken, verifier string) (*AccessToken, error)
GetAccessToken finishes the OAuth flow by exchanging a verifier for an OAuth access token from Flickr.
func (*Client) GetAuthorizeURL ¶
GetAuthorizeURL produces a new authorization URL.
func (*Client) GetRequestToken ¶
func (c *Client) GetRequestToken() (*RequestToken, error)
GetRequestToken begins the OAuth flow by getting a request token from Flickr.
func (*Client) Sign ¶
Sign creates a HMAC-SHA1 signature for a request and adds it to the request parameters.
func (*Client) SignOAuth ¶
func (c *Client) SignOAuth(r *request, at *AccessToken)
SignOAuth creates a HMAC-SHA1 signature for an OAuth request and adds it to the request parameters.
func (*Client) Upload ¶
func (c *Client) Upload(re io.Reader, name string, at *AccessToken) (*UploadResult, error)
Upload POSTs the photo bytes from the provided reader to Flickr.
type RequestToken ¶
RequestToken represents a Flick OAuth request token.
type Result ¶
type Result struct {
XMLName xml.Name `xml:"rsp"`
Status string `xml:"stat,attr"`
Error *struct {
Code int `xml:"code,attr"`
Message string `xml:"msg,attr"`
} `xml:"err"`
}
Result is the base type for all API responses.
type UploadResult ¶
UploadResult is the response types for photo uploads.