ExQuickBooks.Token (ex_quickbooks v0.9.0)

Copy Markdown View Source

OAuth token data returned by QuickBooks.

Summary

Functions

Returns true when the access token has expired at or before the given time.

Builds a token struct from the QuickBooks OAuth response body.

Returns true when the refresh token has expired at or before the given time.

Types

t()

@type t() :: %ExQuickBooks.Token{
  access_token: String.t(),
  access_token_expires_at: DateTime.t(),
  expires_in: pos_integer(),
  realm_id: String.t() | nil,
  refresh_token: String.t(),
  refresh_token_expires_at: DateTime.t(),
  refresh_token_expires_in: pos_integer(),
  token_type: String.t()
}

Functions

access_token_expired?(token, current_time \\ DateTime.utc_now())

@spec access_token_expired?(t(), DateTime.t()) :: boolean()

Returns true when the access token has expired at or before the given time.

from_oauth_response(response_body, options \\ [])

@spec from_oauth_response(
  map(),
  keyword()
) :: {:ok, t()} | {:error, ExQuickBooks.Error.t()}

Builds a token struct from the QuickBooks OAuth response body.

refresh_token_expired?(token, current_time \\ DateTime.utc_now())

@spec refresh_token_expired?(t(), DateTime.t()) :: boolean()

Returns true when the refresh token has expired at or before the given time.