pub struct SupabaseClientWrapper {
pub auth: Arc<Auth>,
pub realtime: Arc<RealtimeClient>,
/* private fields */
}Expand description
Wraps Supabase sub-clients and manages configuration/state.
Fields§
§auth: Arc<Auth>§realtime: Arc<RealtimeClient>Implementations§
Source§impl SupabaseClientWrapper
impl SupabaseClientWrapper
Sourcepub fn new(config: SupabaseConfig) -> Result<Self>
pub fn new(config: SupabaseConfig) -> Result<Self>
Creates a new Supabase client wrapper from configuration.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Convenience function to create a client directly from environment variables.
Sourcepub async fn authenticate(&self, credentials: AuthCredentials) -> Result<User>
pub async fn authenticate(&self, credentials: AuthCredentials) -> Result<User>
Authenticates a user using email and password.
Corresponds to authenticateUser in the SSOT.
Returns the Supabase User details on success.
Sourcepub async fn logout(&self) -> Result<()>
pub async fn logout(&self) -> Result<()>
Logs out the currently authenticated user by invalidating the session/token.
Corresponds to logoutUser in the SSOT.
Sourcepub async fn fetch_items(&self) -> Result<Vec<Item>>
pub async fn fetch_items(&self) -> Result<Vec<Item>>
Fetches ‘items’ from the database.
Requires authentication.
Corresponds to fetchItemsFromSupabase in the SSOT.
Sourcepub async fn subscribe_to_item_changes(
&self,
) -> Result<UnboundedReceiver<ItemChange>>
pub async fn subscribe_to_item_changes( &self, ) -> Result<UnboundedReceiver<ItemChange>>
Subscribes to item changes.
Corresponds to subscribeToItemChanges in the SSOT.
Sourcepub async fn create_item(&self, new_item: Item) -> Result<Item>
pub async fn create_item(&self, new_item: Item) -> Result<Item>
Creates a new item in the database. Requires authentication.
Sourcepub async fn fetch_item_by_id(&self, _item_id: Uuid) -> Result<Option<Item>>
pub async fn fetch_item_by_id(&self, _item_id: Uuid) -> Result<Option<Item>>
Fetches a single ‘item’ by its ID.
Sourcepub async fn update_item(
&self,
_item_id: Uuid,
_item_update: Item,
) -> Result<Item>
pub async fn update_item( &self, _item_id: Uuid, _item_update: Item, ) -> Result<Item>
Updates an existing ‘item’ by its ID.
Sourcepub async fn delete_item(&self, _item_id: Uuid) -> Result<()>
pub async fn delete_item(&self, _item_id: Uuid) -> Result<()>
Deletes an ‘item’ by its ID.
pub async fn set_session_for_test(&self, session: Option<AuthSession>)
Trait Implementations§
Source§impl Clone for SupabaseClientWrapper
impl Clone for SupabaseClientWrapper
Source§fn clone(&self) -> SupabaseClientWrapper
fn clone(&self) -> SupabaseClientWrapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more