pub struct DownloadBlobParams<'a> {
pub download_url_template: &'a JmapUrlTemplate,
pub account_id: &'a str,
pub blob_id: &'a str,
pub name: &'a str,
pub accept_type: Option<&'a str>,
pub expected_sha256: Option<&'a Sha256>,
}Expand description
Parameters for JmapClient::download_blob.
Use a struct literal to avoid confusion between the string-typed fields:
client.download_blob(DownloadBlobParams {
download_url_template: &session.download_url,
account_id: "A13824",
blob_id: "Gbc4c...",
name: "attachment.pdf",
accept_type: Some("application/pdf"),
expected_sha256: None,
}).await?;To request integrity verification, construct a typed
jmap_cid_types::Sha256 and pass a borrow:
let expected = jmap_cid_types::Sha256::from_hex(
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
)?;
client.download_blob(DownloadBlobParams {
// ... other fields ...
expected_sha256: Some(&expected),
}).await?;Fields§
§download_url_template: &'a JmapUrlTemplateURL template from Session.download_url.
Typed as &JmapUrlTemplate (bd:JMAP-6r7c.40) so the compiler
refuses an accidental &session.api_url (a plain JmapUrl).
account_id: &'a strAccount ID that owns the blob.
blob_id: &'a strServer-assigned blob identifier.
name: &'a strHuman-readable filename for the {name} template variable.
accept_type: Option<&'a str>Optional accept type for the {type} template variable (e.g. "image/png").
Pass None when no content-type preference is needed; {type} expands to an
empty string.
expected_sha256: Option<&'a Sha256>Optional expected SHA-256 digest for integrity verification.
Pass None to skip the check.
The typed jmap_cid_types::Sha256 wrapper guarantees the value is
exactly 64 characters of lowercase hex per draft-atwood-jmap-cid-00 §2 ABNF.
Construction is the only validation point: callers build the
Sha256 via from_hex
or deserialize and propagate the Sha256DigestError;
download_blob itself does not re-validate, so the &str-validation
branch and its ClientError::InvalidArgument mapping no longer exist
(bd:JMAP-6r7c.48, bd:JMAP-6r7c.53).
Trait Implementations§
Source§impl<'a> Clone for DownloadBlobParams<'a>
impl<'a> Clone for DownloadBlobParams<'a>
Source§fn clone(&self) -> DownloadBlobParams<'a>
fn clone(&self) -> DownloadBlobParams<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more