use std::collections::HashMap;
use std::sync::Arc;
pub struct UploadProgress {
pub bytes_sent: u64,
pub total_bytes: Option<u64>,
pub percent: Option<f32>,
}
pub type ProgressCallback = Arc<dyn Fn(UploadProgress) + Send + Sync>;
#[derive(Clone, Default)]
pub struct UploadOptions {
pub content_type: Option<String>,
pub metadata: HashMap<String, String>,
pub progress: Option<ProgressCallback>,
}
impl UploadOptions {
#[must_use]
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn with_content_type(mut self, content_type: impl Into<String>) -> Self {
self.content_type = Some(content_type.into());
self
}
#[must_use]
pub fn with_metadata(mut self, metadata: HashMap<String, String>) -> Self {
self.metadata = metadata;
self
}
#[must_use]
pub fn with_progress(mut self, progress: ProgressCallback) -> Self {
self.progress = Some(progress);
self
}
#[must_use]
pub fn content_type(&self) -> Option<&str> {
self.content_type.as_deref()
}
}