Handkit.Connect (Handkit v0.2.0) View Source

A client module for connecting and interfacing with the Handcash Connect API endpoints.

Link to this section Summary

Types

Connect environment

t()

Handcash Connect client

Functions

Returns the Handcash API URL for the given environment.

Returns the Handcash Client URL for the given environment.

Handles the result from a Connect request.

Initiates a new Handcash Connect client.

Link to this section Types

Specs

env() :: :prod | :beta | :iae

Connect environment

Specs

t() :: %Handkit.Connect{client: Tesla.Client.t()}

Handcash Connect client

Link to this section Functions

Link to this function

api_endpoint(env \\ :prod)

View Source

Specs

api_endpoint(env()) :: String.t()

Returns the Handcash API URL for the given environment.

Link to this function

client_url(env \\ :prod)

View Source

Specs

client_url(env()) :: String.t()

Returns the Handcash Client URL for the given environment.

Link to this function

handle_result(result, key \\ nil)

View Source

Specs

handle_result(Tesla.Env.result(), String.t() | nil) ::
  {:ok, any()} | {:error, any()}

Handles the result from a Connect request.

If the result is a success, the request body is returned. Where the request returns an error, a %ConnectError{} exception is returned.

Link to this function

init_client(auth_token, env \\ :prod)

View Source

Specs

init_client(String.t(), env()) :: t()

Initiates a new Handcash Connect client.

Must be passed a valid auth token.