pub struct Supabase { /* private fields */ }Expand description
The Supabase client. Entry point for all operations.
Implementations§
Source§impl Supabase
impl Supabase
Sourcepub fn jwt_valid(&self, jwt: &str) -> Result<Claims, Error>
pub fn jwt_valid(&self, jwt: &str) -> Result<Claims, Error>
Validates a JWT token and returns its claims.
Returns an error if the token is invalid or expired.
Sourcepub async fn sign_in_password(
&self,
email: &str,
password: &str,
) -> Result<AuthResponse, Error>
pub async fn sign_in_password( &self, email: &str, password: &str, ) -> Result<AuthResponse, Error>
Signs in a user with email and password.
Returns an AuthResponse containing access and refresh tokens.
Sourcepub async fn refresh_token(
&self,
refresh_token: &str,
) -> Result<AuthResponse, Error>
pub async fn refresh_token( &self, refresh_token: &str, ) -> Result<AuthResponse, Error>
Refreshes an access token using a refresh token.
Note: This may fail if “Enable automatic reuse detection” is enabled in Supabase.
Sourcepub async fn logout(&self) -> Result<EmptyResponse, Error>
pub async fn logout(&self) -> Result<EmptyResponse, Error>
Logs out the current user.
Requires a bearer token to be set on the client.
Sourcepub async fn recover_password(
&self,
email: &str,
) -> Result<EmptyResponse, Error>
pub async fn recover_password( &self, email: &str, ) -> Result<EmptyResponse, Error>
Sends a password recovery email to the given address.
Sourcepub async fn signup_phone_password(
&self,
phone: &str,
password: &str,
) -> Result<AuthResponse, Error>
pub async fn signup_phone_password( &self, phone: &str, password: &str, ) -> Result<AuthResponse, Error>
Signs up a new user with phone and password.
Sourcepub async fn sign_in_otp(
&self,
phone: &str,
channel: Option<&str>,
) -> Result<EmptyResponse, Error>
pub async fn sign_in_otp( &self, phone: &str, channel: Option<&str>, ) -> Result<EmptyResponse, Error>
Sends a one-time password to the given phone number.
The channel parameter can be "sms" or "whatsapp". Defaults to SMS when None.
Sourcepub async fn verify_otp(
&self,
phone: &str,
token: &str,
verification_type: &str,
) -> Result<AuthResponse, Error>
pub async fn verify_otp( &self, phone: &str, token: &str, verification_type: &str, ) -> Result<AuthResponse, Error>
Verifies a one-time password token.
Returns an AuthResponse containing access and refresh tokens on success.
Sourcepub async fn resend_otp(
&self,
phone: &str,
verification_type: &str,
) -> Result<EmptyResponse, Error>
pub async fn resend_otp( &self, phone: &str, verification_type: &str, ) -> Result<EmptyResponse, Error>
Resends a one-time password to the given phone number.
Sourcepub async fn signup_email_password(
&self,
email: &str,
password: &str,
) -> Result<AuthResponse, Error>
pub async fn signup_email_password( &self, email: &str, password: &str, ) -> Result<AuthResponse, Error>
Signs up a new user with email and password.
Source§impl Supabase
impl Supabase
Sourcepub fn from(&self, table: impl Into<String>) -> QueryBuilder<'_>
pub fn from(&self, table: impl Into<String>) -> QueryBuilder<'_>
Creates a QueryBuilder for the specified table.
This is the entry point for all database operations.
§Examples
// Select all from users
client.from("users").select("*").execute().await?;
// Select with filter
client.from("users").select("id,name").eq("status", "active").execute().await?;
// Insert
client.from("users").insert(&user_data)?.execute().await?;
// Update
client.from("users").update(&updates)?.eq("id", "123").execute().await?;
// Delete
client.from("users").delete().eq("id", "123").execute().await?;Source§impl Supabase
impl Supabase
Sourcepub fn new(
url: Option<&str>,
api_key: Option<&str>,
jwt: Option<&str>,
) -> Result<Self, Error>
pub fn new( url: Option<&str>, api_key: Option<&str>, jwt: Option<&str>, ) -> Result<Self, Error>
Creates a new Supabase client.
url and api_key are required — they must be provided as arguments or
set via the SUPABASE_URL and SUPABASE_API_KEY environment variables.
Returns Error::Config if either value is missing or empty.
jwt is optional and defaults to an empty string when not provided.
Sourcepub fn set_bearer_token(&mut self, token: impl Into<String>)
pub fn set_bearer_token(&mut self, token: impl Into<String>)
Sets the bearer token for authenticated requests.