flickrex v0.2.0 Flickrex

Flickr client library for Elixir.

Configuration

config :flickrex, :oauth, [
  consumer_key:    "...",
  consumer_secret: "...",
]

Examples

flickrex = Flickrex.new
token = Flickrex.get_request_token(flickrex)
auth_url = Flickrex.get_authorize_url(token)

# Open the URL in your browser, authorize the app, and get the verify token
verify = "..."
flickrex = Flickrex.fetch_access_token(flickrex, token, verify)
login = Flickr.Test.login(flickrex)

Summary

Functions

Updates the config of a Flickrex client

Fetches an access token from Flickr and updates the config

Makes a GET request to the Flickr REST endpoint

Generates a Flickr authorization page URL for a user

Gets a temporary token to authenticate the user to your application

Creates a Flickrex client using the application config

Creates a Flickrex client using the provided config

Makes a POST request to the Flickr REST endpoint

Types

response()
response() :: Flickrex.Parser.response

Functions

config(config, params)

Updates the config of a Flickrex client

Examples:

tokens = [access_token: "...", access_token_secret: "..."]
flickrex = Flickrex.new |> Flickrex.config(tokens)
fetch_access_token(config, request_token, verify)

Fetches an access token from Flickr and updates the config

The function takes an existing Flickrex config, a request token, and a verify token generated by the Flickr authorization page.

Examples:

flickrex = Flickrex.fetch_access_token(flickrex, token, verify)
get(config, method, args \\ [])

Makes a GET request to the Flickr REST endpoint

Examples:

response = Flickrex.get(flickrex, "flickr.photos.getRecent", per_page: 5)
get_authorize_url(request_token)

Generates a Flickr authorization page URL for a user

Examples:

token = Flickrex.get_request_token(flickrex)
auth_url = Flickrex.get_authorize_url(token)
get_authorize_url(request_token, params)
get_authorize_url(Flickrex.RequestToken.t, Keyword.t) :: binary

See Flickrex.API.Auth.get_authorize_url/2.

get_request_token(config)

Gets a temporary token to authenticate the user to your application

Options

  • oauth_callback - For web apps, the URL to redirect the user back to after authentication.
get_request_token(config, params)

See Flickrex.API.Auth.get_request_token/2.

new()

Creates a Flickrex client using the application config

new(params)

Creates a Flickrex client using the provided config

The accepted parameters are:

  • :consumer_token - Flickr API key
  • :consumer_secret - Flicrkr API shared secret
  • :access_token - Per-user access token
  • :access_token_secret - Per-user access token secret
post(config, method, args \\ [])

Makes a POST request to the Flickr REST endpoint

Examples:

response = Flickrex.post(flickrex, "flickr.photos.addTags", photo_id: photo_id, tags: "tag1,tag2")