Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/swarm-controller-api/src/messages.rs

20 lines
781 B
Rust

//! `GET /api/messages/stream`: the swarm-wide message feed.
use serde::{Deserialize, Serialize};
/// One message between two parties, as one event of `GET /api/messages/stream`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(utoipa::ToSchema))]
pub struct SwarmMessage {
/// When the sender's terminal row was stamped, ISO 8601 / RFC 3339 UTC.
pub ts: String,
/// An agent, or a non-agent sender such as `reminder`, `compact` or the
/// operator's name.
pub from: String,
/// The receiving agent.
pub to: String,
pub body: String,
/// `markdown` or `diff`; absent for plain text.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub body_format: Option<String>,
}