View Source ExPipedrive.Response (ex_pipedrive v0.1.0)

Maps Tesla results into {:ok, value} / {:error, %ExPipedrive.Error{}}.

Resource modules should use this instead of matching raw Tesla envelopes so failure handling stays consistent.

Summary

Functions

On a successful HTTP status, invokes fun with the Tesla.Env.

Functions

Link to this function

map(arg, success_statuses, fun)

View Source
@spec map({:ok, Tesla.Env.t()} | {:error, term()}, [pos_integer()], (Tesla.Env.t() ->
                                                                 term())) ::
  {:ok, term()} | {:error, ExPipedrive.Error.t()}

On a successful HTTP status, invokes fun with the Tesla.Env.

Treats Pipedrive success: false bodies as errors even when the status is in success_statuses. Transport failures and other statuses become {:error, %ExPipedrive.Error{}}.