Macfly.Discharge (macfly v0.2.21)

Copy Markdown View Source

Summary

Functions

Attempts to perform the next step in the discharge protocol. The caller should check the state between calls to next(). Terminal states are :success and :error. For :user_interactive, the caller is responsible for redirecting the user to the user_url before calling next() again.

Types

error()

@type error() ::
  {:error, :failed, Exception.t()}
  | {:error, integer(),
     String.t() | {:bad_response, term()} | {:bad_json, String.t(), term()}}

state()

@type state() ::
  :init
  | {:poll, String.t()}
  | {:user_interactive, String.t(), String.t()}
  | {:success, String.t()}
  | error()

t()

@type t() :: %Macfly.Discharge{
  auth: map(),
  id: binary(),
  location: URI.t(),
  state: state(),
  ticket: binary() | nil
}

Functions

new(list)

next(d)

@spec next(%Macfly.Discharge{
  auth: term(),
  id: term(),
  location: term(),
  state: state(),
  ticket: term()
}) :: %Macfly.Discharge{
  auth: term(),
  id: term(),
  location: term(),
  state: state(),
  ticket: term()
}

Attempts to perform the next step in the discharge protocol. The caller should check the state between calls to next(). Terminal states are :success and :error. For :user_interactive, the caller is responsible for redirecting the user to the user_url before calling next() again.

with_bearer_auth(d, hostname, token)