btrz_ex_api_client v0.4.0 BtrzExApiClient View Source
Main module to handle requests to the Betterez's APIs.
Link to this section Summary
Functions
This function will prepare and do the request through the HTTP client and will handle success and errors responses
Link to this section Functions
Link to this function
request(action, endpoint, query, body, headers, opts \\ [])
View Source
request(action, endpoint, query, body, headers, opts \\ [])
View Source
request(
BtrzExApiClient.Types.methods(),
String.t(),
iolist(),
map(),
keyword(),
keyword()
) ::
{:error,
%BtrzExApiClient.APIConnectionError{
__exception__: term(),
code: term(),
message: term(),
type: term()
}
| %BtrzExApiClient.APIError{
__exception__: term(),
code: term(),
message: term(),
status: term(),
type: term()
}
| %BtrzExApiClient.AuthenticationError{
__exception__: term(),
code: term(),
message: term(),
status: term(),
type: term()
}
| %BtrzExApiClient.InvalidRequestError{
__exception__: term(),
code: term(),
message: term(),
param: term(),
status: term(),
type: term()
}}
| {:ok, term()}
request( BtrzExApiClient.Types.methods(), String.t(), iolist(), map(), keyword(), keyword() ) :: {:error, %BtrzExApiClient.APIConnectionError{ __exception__: term(), code: term(), message: term(), type: term() } | %BtrzExApiClient.APIError{ __exception__: term(), code: term(), message: term(), status: term(), type: term() } | %BtrzExApiClient.AuthenticationError{ __exception__: term(), code: term(), message: term(), status: term(), type: term() } | %BtrzExApiClient.InvalidRequestError{ __exception__: term(), code: term(), message: term(), param: term(), status: term(), type: term() }} | {:ok, term()}
This function will prepare and do the request through the HTTP client and will handle success and errors responses.
headers
:x_api_key
- Optional. This value will be placed in thex-api-key
header.:internal
- Optional. Boolean. Iftrue
it will use the main/secondary keys (passed via config) for getting an internal JWT to be set in theAuthorization
header. Defaults tofalse
.:token
- Optional. Set the JWT in theAuthorization
header. If:internal
option istrue
, this option will be discarded.
options
Using the HTTPoison options (https://hexdocs.pm/httpoison/HTTPoison.Request.html)