use notmuch::SearchSummary; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct SearchResult { pub summary: SearchSummary, pub query: String, pub page: usize, pub results_per_page: usize, pub total: usize, } #[derive(Serialize, Deserialize, Debug)] pub struct Message {} pub mod urls { pub const MOUNT_POINT: &'static str = "/api"; pub fn cid_prefix(host: Option<&str>, cid: &str) -> String { if let Some(host) = host { format!("//{host}/api/cid/{cid}/") } else { format!("/api/cid/{cid}/") } } pub fn download_attachment(host: Option<&str>, id: &str, idx: &str, filename: &str) -> String { if let Some(host) = host { format!( "//{host}/api/download/attachment/{}/{}/{}", id, idx, filename ) } else { format!("/api/download/attachment/{}/{}/{}", id, idx, filename) } } }