View Source NBP.Request (nbp v0.1.0)

Module responsible for wrapping logic of the HTTP requests issued to the NBP API.

Link to this section Summary

Functions

Issues a GET request to the NBP API.

Link to this section Functions

@spec get(Tesla.Env.url(), [Tesla.option()]) ::
  {:ok, NBP.Response.t()}
  | {:error, {:http, any()}}
  | {:error, {:code, pos_integer(), any()}}

Issues a GET request to the NBP API.

On success it returns {:ok, response} where response is a Response struct.

On error it returns either {:error, {:http, reason}} when underlying HTTP call has failed or {:error, {:code, code, body}} when the HTTP call suceeded but it returned unexpected status code.