Lingo.Type.AccessToken (Lingo v0.4.2)

Copy Markdown View Source

An OAuth2 token, from Lingo.OAuth2. expires_at is when it stops working, counted from when Discord answered; refresh it with Lingo.OAuth2.refresh/2 before then. The client credentials grant gives no refresh_token.

Summary

Functions

Whether the token has expired, or will within margin_ms.

Types

t()

@type t() :: %Lingo.Type.AccessToken{
  access_token: String.t(),
  expires_at: DateTime.t() | nil,
  refresh_token: String.t() | nil,
  scopes: [String.t()],
  token_type: String.t()
}

Functions

expired?(token, margin_ms \\ 0)

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

Whether the token has expired, or will within margin_ms.