flickrex v0.6.0 Flickrex.Flickr View Source

Flickr API Modules.

These modules and functions map to the methods from the Flickr API Documentation.

Each function takes a keyword list of API arguments and returns an operation that can be executed with Flickrex.request/2.

Some Flickr methods require user access tokens that were granted read, write, or delete permissions.

Examples

Get the five most recent public photos:

get_recent = Flickrex.Flickr.Photos.get_recent(per_page: 5)
{:ok, resp} = Flickrex.request(get_recent)

%{"photos" => photos} = resp.body

Test logging in as a user, by configuring the tokens for the request:

config = [oauth_token: "...", oauth_token_secret: "..."]
{:ok, resp} = Flickrex.Flickr.Test.login() |> Flickrex.request(config)

%{"user" => user} = resp.body

The API methods will return an error tuple if there was a problem with the request:

{:error, resp} = Flickrex.Flickr.Photos.get_info() |> Flickrex.request()
resp.body == %{"code" => 1, "message" => "Photo not found", "stat" => "fail"}