flickrex v0.6.0 Flickrex.Request.HttpClient behaviour 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", "6WAWwg6NxMtMb8J/+vEaB6kH8Aw="},
   {"oauth_consumer_key", "CONSUMER_KEY"},
   {"oauth_nonce", "yOY1CvqgzOFaeeDr9lPCGgCfI14PFbTy"},
   {"oauth_signature_method", "HMAC-SHA1"},
   {"oauth_timestamp", "1518934770"},
   {"oauth_version", "1.0"},
   {"oauth_token", "TOKEN"},
   # 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

Link to this type body() View Source
body() :: iodata() | tuple() | nil
Link to this type error_t() View Source
error_t() :: {:error, %{reason: any()}}
Link to this type headers() View Source
headers() :: [{binary(), binary()}]
Link to this type http_opts() View Source
http_opts() :: list()
Link to this type method() View Source
method() :: :get | :post | :put | :delete
Link to this type success_t() View Source
success_t() :: {:ok, Flickrex.Response.t()}
Link to this type url() View Source
url() :: binary()

Link to this section Callbacks

Link to this callback request(method, url, body, headers, http_opts) View Source
request(method(), url(), body(), headers(), http_opts()) ::
  success_t() |
  error_t()