View Source Plaid behaviour (plaid v3.3.0)

An HTTP Client for Plaid.

Plaid API Docs

Link to this section Summary

Callbacks

Handle an HTTP response from Plaid.

Send an HTTP request to Plaid.

Link to this section Types

@type mapper() :: (any() -> any())

Link to this section Callbacks

Link to this callback

handle_response(arg1, mapper)

View Source
@callback handle_response({:ok, Tesla.Env.t()} | {:error, any()}, mapper()) ::
  {:ok, term()} | {:error, Plaid.Error.t()} | {:error, any()}

Handle an HTTP response from Plaid.

Takes response argument in the form of {:ok, Tesla.Env.t} or {:error, any()} and a 1-arity mapping function argument which is applied to the body of the Tesla.Env in the success case to unmarshal JSON into structured data.

Error cases are diverted into {:error, Plaid.Error.t} and {:error, any()} for handling Plaid and HTTP failure responses.

@callback send_request(Plaid.Client.Request.t(), Tesla.Client.t()) ::
  {:ok, Tesla.Env.t()} | {:error, any()}

Send an HTTP request to Plaid.

Takes a data structure Plaid.Request.t and Tesla client built at runtime and returns either {:ok, Tesla.Env.t} or {:error, any()}.