pub trait ChatSessionExt: Sealed {
// Required methods
fn chat_account_id(&self) -> Option<&str>;
fn chat_capability(
&self,
account_id: &str,
) -> Result<Option<ChatCapability>, ClientError>;
fn chat_push_capability(
&self,
account_id: &str,
) -> Result<Option<ChatPushCapability>, ClientError>;
fn supports_chat_websocket(&self) -> bool;
fn vapid_public_key(&self) -> Option<&str>;
fn supports_refplus(&self) -> bool;
fn supports_quotas(&self) -> bool;
}Expand description
Extension methods for jmap_base_client::Session that surface
JMAP Chat capability information.
Import this trait to use Chat-specific session helpers:
use jmap_chat_client::ChatSessionExt;This trait is sealed: implementations outside this crate are not
permitted. The crate adds an impl only for
jmap_base_client::Session. Sealing prevents downstream
divergence and keeps adding methods to the trait a non-breaking
change.
Required Methods§
Sourcefn chat_account_id(&self) -> Option<&str>
fn chat_account_id(&self) -> Option<&str>
Returns the primary account ID for the JMAP Chat capability, if present.
Reads primaryAccounts["urn:ietf:params:jmap:chat"].
Returns None when the server does not declare a primary chat account.
Sourcefn chat_capability(
&self,
account_id: &str,
) -> Result<Option<ChatCapability>, ClientError>
fn chat_capability( &self, account_id: &str, ) -> Result<Option<ChatCapability>, ClientError>
Returns the parsed ChatCapability for the given account, if present.
Reads accounts[account_id].accountCapabilities["urn:ietf:params:jmap:chat"].
Ok(None)— the account is absent or has no chat capability key.Ok(Some(...))— the capability is present and parsed successfully.Err(ClientError::Parse(...))— the key is present but malformed JSON.
Sourcefn chat_push_capability(
&self,
account_id: &str,
) -> Result<Option<ChatPushCapability>, ClientError>
fn chat_push_capability( &self, account_id: &str, ) -> Result<Option<ChatPushCapability>, ClientError>
Returns the parsed ChatPushCapability for the given account, if present.
Reads accounts[account_id].accountCapabilities["urn:ietf:params:jmap:chat:push"].
Ok(None)— the account is absent or has no chat push capability key.Ok(Some(...))— the capability is present and parsed successfully.Err(ClientError::Parse(...))— the key is present but malformed JSON.
Sourcefn supports_chat_websocket(&self) -> bool
fn supports_chat_websocket(&self) -> bool
Returns true if the server advertises JMAP Chat WebSocket ephemeral events.
Checks for presence of capabilities["urn:ietf:params:jmap:chat:websocket"].
Use jmap_base_client::Session::websocket_capability to obtain the actual
WebSocket URL for connecting.
Sourcefn vapid_public_key(&self) -> Option<&str>
fn vapid_public_key(&self) -> Option<&str>
Returns the VAPID public key advertised by the server, if present.
Reads capabilities["urn:ietf:params:jmap:webpush-vapid"]["vapidPublicKey"].
Returns None when the capability is absent or when vapidPublicKey is missing
or not a string value.
Sourcefn supports_refplus(&self) -> bool
fn supports_refplus(&self) -> bool
Returns true if the server supports JMAP RefPlus result references.
Checks for capabilities["urn:ietf:params:jmap:refplus"].
Sourcefn supports_quotas(&self) -> bool
fn supports_quotas(&self) -> bool
Returns true if the server supports JMAP Quotas.
Checks for capabilities["urn:ietf:params:jmap:quota"].
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".