pub struct Message {
pub role: MessageRole,
pub parts: Vec<Part>,
pub message_id: String,
pub task_id: Option<String>,
pub context_id: Option<String>,
pub metadata: Option<HashMap<String, Value>>,
pub extensions: Option<Vec<String>>,
pub reference_task_ids: Option<Vec<String>>,
}Expand description
Message: Core A2A communication object (v1.0)
Fields§
§role: MessageRole§parts: Vec<Part>§message_id: String§task_id: Option<String>§context_id: Option<String>§metadata: Option<HashMap<String, Value>>§extensions: Option<Vec<String>>§reference_task_ids: Option<Vec<String>>Implementations§
Source§impl Message
impl Message
pub fn new(role: MessageRole, parts: Vec<Part>, task_id: String) -> Self
pub fn with_id(message_id: String, role: MessageRole, parts: Vec<Part>) -> Self
pub fn text(role: MessageRole, text: impl Into<String>, task_id: String) -> Self
pub fn status(text: impl Into<String>, task_id: String) -> Self
pub fn error(text: impl Into<String>, task_id: String) -> Self
pub fn add_part(&mut self, part: Part)
pub fn set_metadata(&mut self, key: String, value: Value)
pub fn with_context(self, context_id: String) -> Self
pub fn add_extension(&mut self, extension: String)
pub fn get_text_content(&self) -> String
pub fn is_text_only(&self) -> bool
pub fn get_data_parts(&self) -> Vec<&Part>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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 Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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