authex v0.2.1 Authex.Banlist behaviour View Source

Link to this section Summary

Functions

Takes an Authex.Token struct or binary or integer sub and deletes it from the banlist using the provided module

Takes an Authex.Token struct or binary or integer sub and checks whether it has been banned using the provided module

Takes an Authex.Token struct or binary or integer sub and sets it as being banned using the provided module

Callbacks

Removes the provided binary or integer sub from the banlist

Checks whether the banlist contains the provided binary or integer sub

Puts the provided binary sub into the banlist

Link to this section Types

Link to this type sub() View Source
sub() :: binary() | integer()
Link to this type token_or_sub() View Source
token_or_sub() :: Authex.Token.t() | sub()

Link to this section Functions

Link to this function del(banlist, sub) View Source
del(banlist :: Authex.Banlist.t(), token_or_sub()) :: :ok | :error

Takes an Authex.Token struct or binary or integer sub and deletes it from the banlist using the provided module.

Returns :ok if the operation was successful.

Returns :error if an error occured.

Parameters

  • banlist: A banlist module.
  • token_or_sub: An Authex.Token struct or binary or integer sub.
Link to this function get(banlist, sub) View Source
get(banlist :: Authex.Banlist.t(), token_or_sub()) ::
  boolean() |
  :error

Takes an Authex.Token struct or binary or integer sub and checks whether it has been banned using the provided module.

Returns false if the sub is not banned.

Returns true if the sub is banned.

Otherwise, returns :error.

Parameters

  • banlist: A banlist module.
  • token_or_sub: An Authex.Token struct or binary or integer sub.
Link to this function set(banlist, sub) View Source
set(banlist :: Authex.Banlist.t(), token_or_sub()) :: :ok | :error

Takes an Authex.Token struct or binary or integer sub and sets it as being banned using the provided module.

Returns :ok if the operation was successful.

Returns :error if an error occured.

Parameters

  • banlist: A banlist module.
  • token_or_sub: An Authex.Token struct or binary or integer sub.

Link to this section Callbacks

Link to this callback handle_del(sub) View Source
handle_del(sub()) :: :ok | :error

Removes the provided binary or integer sub from the banlist.

Returning :ok signals the operation was successful.

Returning :error signals an error occured.

Parameters

  • sub: A binary or integer sub.
Link to this callback handle_get(sub) View Source
handle_get(sub()) :: boolean() | :error

Checks whether the banlist contains the provided binary or integer sub.

Returning true signals that the sub is banned.

Returning false signals that the sub is not banned.

Returning :error signals an error occured.

Parameters

  • sub: A binary or integer sub.
Link to this callback handle_set(sub) View Source
handle_set(sub()) :: :ok | :error

Puts the provided binary sub into the banlist.

Returning :ok signals the operation was successful.

Returning :error signals an error occured.

Parameters

  • sub: A binary or integer sub.