pub struct ChatSession {
pub id: String,
pub workspace_id: String,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub messages: Vec<ChatMessage>,
pub model: Option<String>,
pub mode: Option<String>,
}Expand description
Represents a Copilot chat session
Fields§
§id: StringSession ID
workspace_id: StringWorkspace ID this session belongs to
created_at: DateTime<Utc>Session creation timestamp
updated_at: DateTime<Utc>Session last updated timestamp
messages: Vec<ChatMessage>Messages in this session
model: Option<String>Model used for this session (e.g., “copilot/claude-opus-4.5”)
mode: Option<String>Session mode (e.g., “agent”, “ask”)
Implementations§
Source§impl ChatSession
impl ChatSession
Sourcepub fn new(id: String, workspace_id: String, timestamp: DateTime<Utc>) -> Self
pub fn new(id: String, workspace_id: String, timestamp: DateTime<Utc>) -> Self
Create a new empty session
Sourcepub fn with_metadata(
id: String,
workspace_id: String,
created_at: DateTime<Utc>,
updated_at: DateTime<Utc>,
model: Option<String>,
mode: Option<String>,
) -> Self
pub fn with_metadata( id: String, workspace_id: String, created_at: DateTime<Utc>, updated_at: DateTime<Utc>, model: Option<String>, mode: Option<String>, ) -> Self
Create a session with model and mode information
Sourcepub fn add_message(&mut self, message: ChatMessage)
pub fn add_message(&mut self, message: ChatMessage)
Add a message to the session
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of messages in the session
Sourcepub fn user_messages(&self) -> Vec<&ChatMessage>
pub fn user_messages(&self) -> Vec<&ChatMessage>
Get all user messages
Sourcepub fn assistant_messages(&self) -> Vec<&ChatMessage>
pub fn assistant_messages(&self) -> Vec<&ChatMessage>
Get all assistant messages
Trait Implementations§
Source§impl Clone for ChatSession
impl Clone for ChatSession
Source§fn clone(&self) -> ChatSession
fn clone(&self) -> ChatSession
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 ChatSession
impl Debug for ChatSession
Source§impl<'de> Deserialize<'de> for ChatSession
impl<'de> Deserialize<'de> for ChatSession
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
Source§impl PartialEq for ChatSession
impl PartialEq for ChatSession
Source§impl Serialize for ChatSession
impl Serialize for ChatSession
impl Eq for ChatSession
impl StructuralPartialEq for ChatSession
Auto Trait Implementations§
impl Freeze for ChatSession
impl RefUnwindSafe for ChatSession
impl Send for ChatSession
impl Sync for ChatSession
impl Unpin for ChatSession
impl UnwindSafe for ChatSession
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