pub struct SessionEvent {
pub id: String,
pub timestamp: String,
pub parent_id: Option<String>,
pub ephemeral: bool,
pub event_type: String,
pub data: Value,
}Expand description
A session event received from the server.
Events are delivered via session.event JSON-RPC notifications.
The event_type field determines which variant’s data is populated.
Fields§
§id: String§timestamp: String§parent_id: Option<String>§ephemeral: bool§event_type: String§data: ValueThe event data, varying by event_type. Use helper methods or deserialize into specific types based on event_type.
Implementations§
Source§impl SessionEvent
impl SessionEvent
Sourcepub fn is_assistant_message(&self) -> bool
pub fn is_assistant_message(&self) -> bool
Returns true if this is an assistant.message event.
Sourcepub fn is_session_idle(&self) -> bool
pub fn is_session_idle(&self) -> bool
Returns true if this is a session.idle event.
Sourcepub fn is_session_error(&self) -> bool
pub fn is_session_error(&self) -> bool
Returns true if this is a session.error event.
Sourcepub fn assistant_message_content(&self) -> Option<&str>
pub fn assistant_message_content(&self) -> Option<&str>
Attempts to extract the assistant message content.
Returns None if this is not an assistant.message event.
Sourcepub fn error_message(&self) -> Option<&str>
pub fn error_message(&self) -> Option<&str>
Attempts to extract the error message from a session.error event.
Sourcepub fn error_stack(&self) -> Option<&str>
pub fn error_stack(&self) -> Option<&str>
Attempts to extract the error stack from a session.error event.
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionEvent
impl Debug for SessionEvent
Source§impl<'de> Deserialize<'de> for SessionEvent
impl<'de> Deserialize<'de> for SessionEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionEvent
impl RefUnwindSafe for SessionEvent
impl Send for SessionEvent
impl Sync for SessionEvent
impl Unpin for SessionEvent
impl UnsafeUnpin for SessionEvent
impl UnwindSafe for SessionEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more