btrz_ex_api_client v0.1.1 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, opts) View Source
request(
  BtrzExApiClient.Types.methods(),
  String.t(),
  iolist(),
  map(),
  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.

Options

  • :x_api_key - Optional. This value will be placed in the x-api-key header.
  • :internal - Optional. Boolean. If true it will use the main/secondary keys (passed via config) for getting an internal JWT to be set in the Authorization header. Defaults to false.
  • :token - Optional. Set the JWT in the Authorization header. If :internal option is true, this option will be discarded.