farmbot v6.0.1-alpha Farmbot.HTTP View Source

Wraps an HTTP Adapter.

Link to this section Summary

Functions

Make an http request. Will not raise.

  • method - can be any http verb
  • url - fully formatted url or an api slug.
  • body - body can be any of:

    • binary
    • {:multipart, [{binary_key, binary_value}]}
  • headers - [{binary_key, binary_value}]
  • opts - Keyword opts to be passed to adapter (hackney/httpoison)

    • file - option to be passed if the output should be saved to a file

Start HTTP Services

Upload a file to FB storage

Link to this section Functions

Link to this function download_file(url, path, progress_callback \\ nil, payload \\ "", headers \\ []) View Source

Download a file to the filesystem.

Link to this function get(url, headers \\ [], opts \\ []) View Source
get(url, headers, opts) ::
  {:ok, Farmbot.HTTP.Response.t} |
  {:error, term}

HTTP GET request.

Link to this function get!(url, headers \\ [], opts \\ []) View Source
get!(url, headers, opts) ::
  Farmbot.HTTP.Response.t |
  no_return

Same as get/3 but raises.

Link to this function post(url, body, headers \\ [], opts \\ []) View Source

HTTP POST request.

Link to this function post!(url, body, headers \\ [], opts \\ []) View Source

Same as post/4 but raises.

Link to this function put(url, body, headers \\ [], opts \\ []) View Source
Link to this function request(method, url, body \\ "", headers \\ [], opts \\ []) View Source
request(method, url, body, headers, opts) ::
  {:ok, Farmbot.HTTP.Response.t} |
  {:error, term}

Make an http request. Will not raise.

  • method - can be any http verb
  • url - fully formatted url or an api slug.
  • body - body can be any of:

    • binary
    • {:multipart, [{binary_key, binary_value}]}
  • headers - [{binary_key, binary_value}]
  • opts - Keyword opts to be passed to adapter (hackney/httpoison)

    • file - option to be passed if the output should be saved to a file.
Link to this function request!(method, url, body \\ "", headers \\ [], opts \\ []) View Source
request!(method, url, body, headers, opts) ::
  Farmbot.HTTP.Response.t |
  no_return

Same as request/5 but raises.

Start HTTP Services.

Link to this function upload_file(path, meta \\ nil) View Source

Upload a file to FB storage.