Skip to main content

ChatSessionExt

Trait ChatSessionExt 

Source
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§

Source

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.

Source

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.
Source

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.
Source

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.

Source

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.

Source

fn supports_refplus(&self) -> bool

Returns true if the server supports JMAP RefPlus result references.

Checks for capabilities["urn:ietf:params:jmap:refplus"].

Source

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".

Implementations on Foreign Types§

Source§

impl ChatSessionExt for Session

Implementors§