Monzo.Auth.Token (monzo_client v1.0.0)

Copy Markdown View Source

The response returned by Monzo's token endpoint.

Summary

Functions

Returns whether the token is expired as of now, with margin_seconds subtracted from the expiry to account for clock skew and in-flight requests.

Returns the wall-clock time this token expires at.

Types

t()

@type t() :: %Monzo.Auth.Token{
  access_token: String.t(),
  client_id: String.t() | nil,
  expires_in: integer() | nil,
  obtained_at: DateTime.t(),
  refresh_token: String.t() | nil,
  token_type: String.t() | nil,
  user_id: String.t() | nil
}

Functions

expired?(token, margin_seconds \\ 0)

@spec expired?(t(), non_neg_integer()) :: boolean()

Returns whether the token is expired as of now, with margin_seconds subtracted from the expiry to account for clock skew and in-flight requests.

expires_at(token)

@spec expires_at(t()) :: DateTime.t() | nil

Returns the wall-clock time this token expires at.