Supabase.GoTrue.AdminBehaviour behaviour (supabase_gotrue v0.5.2)

View Source

Behaviour specification for the Supabase.GoTrue.Admin module.

This module defines the contract that any GoTrue Admin implementation must fulfill, providing function specifications and return types for all admin operations.

Summary

Types

invite_options()

@type invite_options() :: %{
  optional(:data) => map(),
  optional(:redirect_to) => String.t()
}

pagination()

@type pagination() :: %{
  next_page: integer() | nil,
  last_page: integer(),
  total: integer()
}

scope()

@type scope() :: :global | :local | :others

Callbacks

create_user(t, map)

@callback create_user(Supabase.Client.t(), map()) ::
  {:ok, Supabase.GoTrue.User.t()} | {:error, term()}

delete_factor(t, t, t)

@callback delete_factor(Supabase.Client.t(), String.t(), String.t()) ::
  :ok | {:error, term()}

delete_identity(t, t, t)

@callback delete_identity(Supabase.Client.t(), String.t(), String.t()) ::
  :ok | {:error, term()}

delete_user(t, t, keyword)

@callback delete_user(Supabase.Client.t(), String.t(), keyword()) ::
  :ok | {:error, term()}

generate_link(t, map)

@callback generate_link(Supabase.Client.t(), map()) ::
  {:ok,
   %{
     action_link: String.t(),
     email_otp: String.t(),
     hashed_token: String.t(),
     redirect_to: String.t(),
     verification_type: atom()
   }}
  | {:error, term()}

get_user_by_id(t, t)

@callback get_user_by_id(Supabase.Client.t(), String.t()) ::
  {:ok, Supabase.GoTrue.User.t()} | {:error, term()}

invite_user_by_email(t, t, invite_options)

@callback invite_user_by_email(Supabase.Client.t(), String.t(), invite_options()) ::
  {:ok, Supabase.GoTrue.User.t()} | {:error, term()}

list_identities(t, t)

@callback list_identities(Supabase.Client.t(), String.t()) ::
  {:ok, [Supabase.GoTrue.User.Identity.t()]} | {:error, term()}

list_users(t, map)

@callback list_users(Supabase.Client.t(), map()) ::
  {:ok, [Supabase.GoTrue.User.t()], pagination()} | {:error, term()}

sign_out(t, t, scope)

@callback sign_out(Supabase.Client.t(), Supabase.GoTrue.Session.t(), scope()) ::
  :ok | {:error, term()}

update_user_by_id(t, t, map)

@callback update_user_by_id(Supabase.Client.t(), String.t(), map()) ::
  {:ok, Supabase.GoTrue.User.t()} | {:error, term()}