use anyhow::Result;
pub struct JmapClient;
impl JmapClient {
#[allow(dead_code)]
pub async fn query_messages(host: &str, port: u16) -> Result<usize> {
let _url = format!("http://{}:{}/jmap", host, port);
let _request = serde_json::json!({
"using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
"methodCalls": [
["Email/query", {
"accountId": "user@example.com",
"filter": {},
"sort": [{"property": "receivedAt", "isAscending": false}],
"limit": 10
}, "c1"]
]
});
Ok(1024)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_jmap_client_mock() {
let result = JmapClient::query_messages("localhost", 8080).await;
assert!(result.is_ok());
}
}