kuska-ssb/src/api/dto/blobs.rs

36 lines
884 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#[derive(Debug, Serialize, Deserialize)]
pub struct BlobsGetIn {
// key : ID of the blob. Required.
pub key: String,
// size : Expected size of the blob in bytes.
// If the blob is not exactly this size then reject the request. Optional.
pub size: Option<u64>,
// max Maximum size of the blob in bytes. If the blob is larger then reject
// the request. Only makes sense to specify max if you dont already know size. Optional.
pub max: Option<u64>,
}
impl BlobsGetIn {
pub fn new(key: String) -> Self {
Self {
key,
size: None,
max: None,
}
}
pub fn size(self, size: u64) -> Self {
Self {
size: Some(size),
..self
}
}
pub fn max(self, max: u64) -> Self {
Self {
max: Some(max),
..self
}
}
}