Flickrex.Request.HttpClient behaviour (flickrex v0.8.1) View Source

Specifies HTTP client behaviour.

The client must be able to handle multipart form-data. For photo uploads, the body will be a tuple with the following format:

{:multipart,
 [
   {"oauth_signature", "U6wKLIKO68To+Ay2Z7Sht5EYMWk="},
   {"oauth_consumer_key", "653e7a6ecc1d528c516cc8f92cf98611"},
   {"oauth_nonce", "+I7IVgaOrR18bowgSxDc0EQ6UK6aNumz"},
   {"oauth_signature_method", "HMAC-SHA1"},
   {"oauth_timestamp", "1520426995"},
   {"oauth_version", "1.0"},
   {"oauth_token", "72157626318069415-087bfc7b5816092c"},
   # other upload params with the format {binary(), binary()}
   {:file, "path/to/photo.jpg",
    {"form-data", [{"name", "\"photo\""}, {"filename", "\"photo.jpg\""}]}, []}
 ]}

See Uploading Photos example from the Flickr API documentation.

Link to this section Summary

Link to this section Types

Specs

body() :: iodata() | tuple() | nil

Specs

error_t() :: {:error, %{reason: any()}}

Specs

headers() :: [{binary(), binary()}]

Specs

http_opts() :: list()

Specs

method() :: :get | :post | :put | :delete

Specs

success_t() :: {:ok, Flickrex.Response.t()}

Specs

url() :: binary()

Link to this section Callbacks

Link to this callback

request(method, url, body, headers, http_opts)

View Source

Specs

request(method(), url(), body(), headers(), http_opts()) ::
  success_t() | error_t()