use std::sync::Arc;
use std::time::Duration;
use crate::observer::DataTransferObserver;
#[derive(Default, Clone)]
pub struct SecretSendOptions {
pub observer: Option<Arc<dyn DataTransferObserver>>,
pub chunk_size: Option<usize>,
pub timeout: Option<Duration>,
pub user_agent: Option<String>,
}
impl SecretSendOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_observer(mut self, observer: Arc<dyn DataTransferObserver>) -> Self {
self.observer = Some(observer);
self
}
pub fn with_chunk_size(mut self, size: usize) -> Self {
self.chunk_size = Some(size);
self
}
pub fn with_timeout(mut self, timeout: Duration) -> Self {
self.timeout = Some(timeout);
self
}
pub fn with_user_agent(mut self, user_agent: String) -> Self {
self.user_agent = Some(user_agent);
self
}
}
#[derive(Default, Clone)]
pub struct SecretReceiveOptions {
pub observer: Option<Arc<dyn DataTransferObserver>>,
pub timeout: Option<Duration>,
pub user_agent: Option<String>,
}
impl SecretReceiveOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_timeout(mut self, timeout: Duration) -> Self {
self.timeout = Some(timeout);
self
}
pub fn with_user_agent(mut self, user_agent: String) -> Self {
self.user_agent = Some(user_agent);
self
}
pub fn with_observer(mut self, observer: Arc<dyn DataTransferObserver>) -> Self {
self.observer = Some(observer);
self
}
}