AlpacaElixir v2.2.0 Alpaca.Client View Source

Client responsible for making requests to Alpaca and handling the responses.

This client allows us to define all of our HTTP request logic and configuration in one place so that we can easily change or adapt this away from all of the other business logic of our library.

We have access to HTTP request types on this client and it will automatically use a base url as well as set all the necessary headers for us.

We have access to GET, POST, PATCH, and DELETE HTTP requests using this client.

Example usage

Alpaca.Client.get("/path", %{query_param: "value"})
Alpaca.Client.post("/path", %{param1: "value"})
Alpaca.Client.patch("/path", %{param1: "value"})
Alpaca.Client.delete("/path")

Link to this section Summary

Functions

Issue a delete request using the HTTP client

Issue a get request using the HTTP client

Issue a patch request using the HTTP client

Issue a post request using the HTTP client

Issue a put request using the HTTP client

Link to this section Functions

Specs

api_host() :: String.t()
Link to this function

client_id(env_key \\ :client_id)

View Source

Specs

client_id(atom()) :: String.t()
Link to this function

client_secret(env_key \\ :client_secret)

View Source

Specs

client_secret(atom()) :: String.t()

Specs

data_api_host() :: String.t()
Link to this function

delete(path, opts \\ [])

View Source

Issue a delete request using the HTTP client

Accepts path which is the url path of the request, will be added to the end of the base_url

Link to this function

get(path, params \\ %{}, opts \\ [])

View Source

Issue a get request using the HTTP client

Accepts path which is the url path of the request, will be added to the end of the base_url and a map of params which will become the query list for the get request

Link to this function

patch(path, params \\ %{}, opts \\ [])

View Source

Issue a patch request using the HTTP client

Accepts path which is the url path of the request, will be added to the end of the base_url and a map of params which will be the body of the post request

Link to this function

post(path, params \\ %{}, opts \\ [])

View Source

Issue a post request using the HTTP client

Accepts path which is the url path of the request, will be added to the end of the base_url and a map of params which will be the body of the post request

Link to this function

put(path, params \\ %{}, opts \\ [])

View Source

Issue a put request using the HTTP client

Accepts path which is the url path of the request, will be added to the end of the base_url and a map of params which will be the body of the post request