pub struct StorageBucket {
pub name: String,
/* private fields */
}Expand description
Operations for a single storage bucket.
Fields§
§name: StringImplementations§
Source§impl StorageBucket
impl StorageBucket
Sourcepub fn get_url(&self, key: &str) -> String
pub fn get_url(&self, key: &str) -> String
Get public URL for a stored file (synchronous, no network).
Sourcepub async fn upload(
&self,
key: &str,
data: Vec<u8>,
content_type: &str,
) -> Result<Value, Error>
pub async fn upload( &self, key: &str, data: Vec<u8>, content_type: &str, ) -> Result<Value, Error>
Upload a file using multipart/form-data. Keep as direct HTTP — binary multipart upload.
Sourcepub async fn download(&self, key: &str) -> Result<Vec<u8>, Error>
pub async fn download(&self, key: &str) -> Result<Vec<u8>, Error>
Download raw file bytes. Keep as direct HTTP — binary download.
Sourcepub async fn list(
&self,
prefix: &str,
limit: u32,
offset: u32,
) -> Result<Value, Error>
pub async fn list( &self, prefix: &str, limit: u32, offset: u32, ) -> Result<Value, Error>
List files in the bucket.
Sourcepub async fn update_metadata(
&self,
key: &str,
metadata: &Value,
) -> Result<Value, Error>
pub async fn update_metadata( &self, key: &str, metadata: &Value, ) -> Result<Value, Error>
Update file metadata.
Sourcepub async fn create_signed_url(
&self,
key: &str,
expires_in: &str,
) -> Result<Value, Error>
pub async fn create_signed_url( &self, key: &str, expires_in: &str, ) -> Result<Value, Error>
Create a signed download URL.
Sourcepub async fn create_signed_upload_url(
&self,
key: &str,
expires_in: &str,
) -> Result<Value, Error>
pub async fn create_signed_upload_url( &self, key: &str, expires_in: &str, ) -> Result<Value, Error>
Create a signed upload URL for direct client-side uploads.
Sourcepub async fn create_signed_upload_url_with_options(
&self,
key: &str,
expires_in: &str,
max_file_size: Option<&str>,
) -> Result<Value, Error>
pub async fn create_signed_upload_url_with_options( &self, key: &str, expires_in: &str, max_file_size: Option<&str>, ) -> Result<Value, Error>
Create a signed upload URL with optional constraints such as maxFileSize.
Sourcepub async fn upload_string(
&self,
key: &str,
data: &str,
encoding: &str,
content_type: &str,
) -> Result<Value, Error>
pub async fn upload_string( &self, key: &str, data: &str, encoding: &str, content_type: &str, ) -> Result<Value, Error>
Upload a string with encoding support.
encoding: “raw”, “base64”, “base64url”, “data_url”.
Sourcepub async fn initiate_resumable_upload(
&self,
key: &str,
content_type: &str,
) -> Result<String, Error>
pub async fn initiate_resumable_upload( &self, key: &str, content_type: &str, ) -> Result<String, Error>
Initiate a multipart upload. Returns the upload ID.
Sourcepub async fn upload_part(
&self,
key: &str,
upload_id: &str,
part_number: u32,
data: Vec<u8>,
) -> Result<Value, Error>
pub async fn upload_part( &self, key: &str, upload_id: &str, part_number: u32, data: Vec<u8>, ) -> Result<Value, Error>
Upload a single part for a multipart upload. Returns { partNumber, etag }.
Keep as direct HTTP — binary part upload.
Sourcepub async fn complete_resumable_upload(
&self,
key: &str,
upload_id: &str,
parts: Vec<Value>,
) -> Result<Value, Error>
pub async fn complete_resumable_upload( &self, key: &str, upload_id: &str, parts: Vec<Value>, ) -> Result<Value, Error>
Complete a multipart upload. parts is a list of { partNumber, etag } from upload_part.