Flickrex.Flickr (flickrex v0.8.1) View Source
Flickr API Modules.
These modules and functions map to the methods from the Flickr API Documentation.
Arguments for the API functions should be strings, or integers (if the API
accepts a number). Any additional opts will be set as params for the Rest
operation.
Each function 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.bodyTest 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.bodyThe API methods will return an error tuple if there was a problem with the request:
{:error, resp} = Flickrex.Flickr.Photos.get_info(nil) |> Flickrex.request()
resp.body == %{"code" => 1, "message" => "Photo not found", "stat" => "fail"}