flickr

package module
v0.0.0-...-5bd8eb2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2017 License: MIT Imports: 16 Imported by: 0

README

flickr

A Go client for Flickr

Build Status Go Report Card Documentation

Documentation

Index

Constants

View Source
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 NewClient

func NewClient(key, secret, callback string) *Client

NewClient creates a new flickr client.

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

func (c *Client) GetAuthorizeURL(token, permissions string) string

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

func (c *Client) Sign(r *request, tokenSecret string)

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

type RequestToken struct {
	OAuthCallbackConfirmed bool
	OAuthToken             string
	OAuthTokenSecret       string
}

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

type UploadResult struct {
	Result
	ID string `xml:"photoid"`
}

UploadResult is the response types for photo uploads.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL