pub struct Storage { /* private fields */ }
Expand description
Storage client for file operations
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn new(
config: Arc<SupabaseConfig>,
http_client: Arc<HttpClient>,
) -> Result<Self>
pub fn new( config: Arc<SupabaseConfig>, http_client: Arc<HttpClient>, ) -> Result<Self>
Create a new Storage instance
Sourcepub async fn list_buckets(&self) -> Result<Vec<Bucket>>
pub async fn list_buckets(&self) -> Result<Vec<Bucket>>
List all storage buckets
Sourcepub async fn get_bucket(&self, bucket_id: &str) -> Result<Bucket>
pub async fn get_bucket(&self, bucket_id: &str) -> Result<Bucket>
Get bucket information
Sourcepub async fn create_bucket(
&self,
id: &str,
name: &str,
public: bool,
) -> Result<Bucket>
pub async fn create_bucket( &self, id: &str, name: &str, public: bool, ) -> Result<Bucket>
Create a new storage bucket
Sourcepub async fn update_bucket(&self, id: &str, public: Option<bool>) -> Result<()>
pub async fn update_bucket(&self, id: &str, public: Option<bool>) -> Result<()>
Update bucket settings
Sourcepub async fn delete_bucket(&self, id: &str) -> Result<()>
pub async fn delete_bucket(&self, id: &str) -> Result<()>
Delete a storage bucket
Sourcepub async fn list(
&self,
bucket_id: &str,
path: Option<&str>,
) -> Result<Vec<FileObject>>
pub async fn list( &self, bucket_id: &str, path: Option<&str>, ) -> Result<Vec<FileObject>>
List files in a bucket
Sourcepub async fn upload(
&self,
bucket_id: &str,
path: &str,
file_body: Bytes,
options: Option<FileOptions>,
) -> Result<UploadResponse>
pub async fn upload( &self, bucket_id: &str, path: &str, file_body: Bytes, options: Option<FileOptions>, ) -> Result<UploadResponse>
Upload a file from bytes
Sourcepub async fn upload_file<P: AsRef<Path>>(
&self,
bucket_id: &str,
path: &str,
file_path: P,
options: Option<FileOptions>,
) -> Result<UploadResponse>
pub async fn upload_file<P: AsRef<Path>>( &self, bucket_id: &str, path: &str, file_path: P, options: Option<FileOptions>, ) -> Result<UploadResponse>
Upload a file from local filesystem (Native only, requires tokio)
Sourcepub async fn move(
&self,
bucket_id: &str,
from_path: &str,
to_path: &str,
) -> Result<()>
pub async fn move( &self, bucket_id: &str, from_path: &str, to_path: &str, ) -> Result<()>
Move a file
Sourcepub async fn copy(
&self,
bucket_id: &str,
from_path: &str,
to_path: &str,
) -> Result<()>
pub async fn copy( &self, bucket_id: &str, from_path: &str, to_path: &str, ) -> Result<()>
Copy a file
Sourcepub fn get_public_url(&self, bucket_id: &str, path: &str) -> String
pub fn get_public_url(&self, bucket_id: &str, path: &str) -> String
Get public URL for a file
Sourcepub async fn create_signed_url(
&self,
bucket_id: &str,
path: &str,
expires_in_seconds: u64,
) -> Result<String>
pub async fn create_signed_url( &self, bucket_id: &str, path: &str, expires_in_seconds: u64, ) -> Result<String>
Create a signed URL for private file access
Sourcepub fn get_public_url_transformed(
&self,
bucket_id: &str,
path: &str,
options: TransformOptions,
) -> Result<String>
pub fn get_public_url_transformed( &self, bucket_id: &str, path: &str, options: TransformOptions, ) -> Result<String>
Get transformed image URL
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl !UnwindSafe for Storage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more