Supabase.Client (supabase_potion v0.8.0)
A client for interacting with Supabase. This module is responsible for managing the connection options for your Supabase project.
Usage
Generally, you can start a client by calling Supabase.init_client/3:
iex> base_url = "https://<app-name>.supabase.io"
iex> api_key = "<supabase-api-key>"
iex> Supabase.init_client(base_url, api_key, %{})
{:ok, %Supabase.Client{}}For more information on how to configure your Supabase Client with additional options, please refer to the Supabase.Client.t() typespec.
Examples
%Supabase.Client{
base_url: "https://<app-name>.supabase.io",
api_key: "<supabase-api-key>",
access_token: "<supabase-access-token>",
db: %Supabase.Client.Db{
schema: "public"
},
global: %Supabase.Client.Global{
headers: %{}
},
auth: %Supabase.Client.Auth{
auto_refresh_token: true,
debug: false,
detect_session_in_url: true,
flow_type: :implicit,
persist_session: true,
storage_key: "sb-<host>-auth-token"
},
storage: %Supabase.Client.Storage{
use_new_hostname: false
}
}
Summary
Types
The type for the available additional options that can be passed
to Supabase.init_client/3 to configure the Supabase client.
The type of the Supabase.Client that will be returned from Supabase.init_client/3.
Functions
Helper function to swap the current acccess token being used in the Supabase client instance.
Types
@type options() :: %{ optional(:db) => Supabase.Client.Db.params(), optional(:global) => Supabase.Client.Global.params(), optional(:auth) => Supabase.Client.Auth.params(), optional(:storage) => Supabase.Client.Storage.params() }
The type for the available additional options that can be passed
to Supabase.init_client/3 to configure the Supabase client.
Note that these options can be passed to Supabase.init_client/3 as Enumerable, which means it can be either a Keyword.t() or a Map.t(), but internally it will be passed as a map.
@type t() :: %Supabase.Client{ access_token: String.t(), api_key: String.t(), auth: Supabase.Client.Auth.t(), auth_url: String.t(), base_url: String.t(), database_url: String.t(), db: Supabase.Client.Db.t(), functions_url: String.t(), global: Supabase.Client.Global.t(), realtime_url: String.t(), storage: Supabase.Client.Storage.t(), storage_url: String.t() }
The type of the Supabase.Client that will be returned from Supabase.init_client/3.
Source
Functions
@spec changeset(attrs :: map()) :: Ecto.Changeset.t()
Helper function to swap the current acccess token being used in the Supabase client instance.