pub struct InteractionContext {
pub platform: String,
pub channel: String,
pub interaction_type: InteractionType,
pub content_hash: Option<String>,
pub parent_id: Option<String>,
pub metadata: Option<Value>,
}Expand description
Context about where/how the interaction occurred.
Fields§
§platform: StringPlatform where interaction occurred (e.g., “moltbook”, “discord”).
channel: StringChannel within platform (e.g., “public_post”, “dm”).
interaction_type: InteractionTypeType of interaction.
content_hash: Option<String>Hash of content (if applicable).
parent_id: Option<String>Parent interaction ID (for replies).
metadata: Option<Value>Additional metadata.
Implementations§
Source§impl InteractionContext
impl InteractionContext
Sourcepub fn new(
platform: impl Into<String>,
channel: impl Into<String>,
interaction_type: InteractionType,
) -> Self
pub fn new( platform: impl Into<String>, channel: impl Into<String>, interaction_type: InteractionType, ) -> Self
Create a new interaction context.
Sourcepub fn with_content(self, content: &[u8]) -> Self
pub fn with_content(self, content: &[u8]) -> Self
Add content hash.
Sourcepub fn with_parent(self, parent_id: impl Into<String>) -> Self
pub fn with_parent(self, parent_id: impl Into<String>) -> Self
Add parent ID (for replies).
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Add metadata.
Trait Implementations§
Source§impl Clone for InteractionContext
impl Clone for InteractionContext
Source§fn clone(&self) -> InteractionContext
fn clone(&self) -> InteractionContext
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 InteractionContext
impl Debug for InteractionContext
Source§impl<'de> Deserialize<'de> for InteractionContext
impl<'de> Deserialize<'de> for InteractionContext
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 InteractionContext
impl RefUnwindSafe for InteractionContext
impl Send for InteractionContext
impl Sync for InteractionContext
impl Unpin for InteractionContext
impl UnwindSafe for InteractionContext
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