Skip to main content

Module client

Module client 

Source
Available on crate feature client only.
Expand description

Standard, blocking JMAP client.

Wraps a single boxed stream plus the bearer token and discovered JmapSession, with one method per common coroutine. JmapClientStd::new takes a pre-connected stream; with one of the TLS features enabled, JmapClientStd::connect handles https:// URLs end-to-end.

Run JmapClientStd::session_get once after construction to populate the session; subsequent calls resolve accountId and apiUrl from it.

§Example

use io_jmap::client::JmapClientStd;
use pimalaya_stream::tls::Tls;
use secrecy::SecretString;
use url::Url;

let url: Url = "https://api.example.com/jmap/session/".parse().unwrap();
let auth = SecretString::from("Bearer xyz");

let mut client = JmapClientStd::connect(&url, &Tls::default(), auth).unwrap();
let session = client.session_get(&url).unwrap();

println!("logged in as {}", session.username);

Structs§

JmapClientStd
Std-blocking JMAP client wrapping a single boxed stream.

Enums§

JmapClientStdError
Errors returned by JmapClientStd.

Traits§

JmapStream
Erased stream the client resumes coroutines against: auto-implemented for any blocking Read + Write + Send + 'static. Send flows through the Box<dyn …> so JmapClientStd can move between worker threads; Self::as_any_mut lets specialized callers downcast back to the concrete stream.