pub mod bucket_api;
pub mod client;
pub mod error;
pub mod types;
pub use bucket_api::StorageBucketApi;
pub use client::StorageClient;
pub use error::{StorageApiErrorResponse, StorageError};
pub use types::*;
use supabase_client_core::SupabaseClient;
pub trait SupabaseClientStorageExt {
fn storage(&self) -> Result<StorageClient, StorageError>;
}
impl SupabaseClientStorageExt for SupabaseClient {
fn storage(&self) -> Result<StorageClient, StorageError> {
StorageClient::new(self.supabase_url(), self.api_key())
}
}
#[cfg(test)]
mod tests {
use super::*;
use supabase_client_core::config::SupabaseConfig;
#[test]
fn test_storage_extension_trait() {
let config = SupabaseConfig::new("http://localhost:54321", "test-key");
let client = SupabaseClient::new(config).unwrap();
let storage = client.storage();
assert!(storage.is_ok());
let storage = storage.unwrap();
assert_eq!(storage.base_url().path(), "/storage/v1");
}
}