milkpotion v0.0.4 Milkpotion.Request

This module is the main entry point for issuing requests to the Remember the Milk service. It rate-limits any request (if necessary) and also ensures a proper error handling.

Summary

Functions

Issues a GET request to the given url with the provided http headers

Functions

get(url, headers \\ %{})

Specs

get(binary, map) ::
  {:ok, map} |
  {:error, atom, binary | map}

Issues a GET request to the given url with the provided http headers.

It returns either {:ok, body} where body contains the parsed JSON data, or {:error, cause, message}. The cause will be an atom describing the error in more detail. The possible values are:

  • :http: This caputures HTTP connection issues (e.g., timeouts):
  • :json: The received data was malformed, or at least not of the expected format.
  • :request: ?
parse_http_response(arg1)

Specs

parse_http_response(%HTTPoison.Response{body: term, headers: term, status_code: term}) :: {:ok, binary}
parse_http_response(%HTTPoison.Response{body: term, headers: term, status_code: term}) :: {:error, :http, binary}
parse_http_response(%HTTPoison.Error{__exception__: term, id: term, reason: term}) :: {:error, :http, binary}
parse_rtm_response(raw)

Specs

parse_rtm_response(binary) ::
  {:ok, map} |
  {:error, atom, binary} |
  {:error, atom, map}