element_kit v0.3.0 ElementKit.API
Offers convenience functions that call ELEMENT IoT API endpoints
Example:
API.get("/api/v1/streams?mandate_id=MANDATE_ID")
will expand to
HTTPoison.get("https://element-iot.com/api/v1/streams?auth=API_KEY&mandate_id=MANDATE_ID")
Convenience functionality:
- HTTP methods with body automatically render JSON with Jason and add a
content-type: application/json
header. - The response will be parsed using Jason.
Link to this section Summary
Functions
Merges 2 URIs including their query parameters
Opens a WebSocket connection to the given url
.
An additional process is used to manage the connection.
New messages will be sent to the process that called this function in this format
Link to this section Functions
delete(path, headers \\ [], opts \\ [])
get(path, headers \\ [], opts \\ [])
merge(a_bin, b_bin)
Merges 2 URIs including their query parameters
patch(path, body, headers \\ [], opts \\ [])
post(path, body, headers \\ [], opts \\ [])
put(path, body, headers \\ [], opts \\ [])
request(method, path, body \\ "", headers \\ [], options \\ [])
ws_link(uri, opts \\ [])
Opens a WebSocket connection to the given url
.
An additional process is used to manage the connection.
New messages will be sent to the process that called this function in this format:
{:ws, :text, message}
- message will be the result of decoding then json.