107 lines
2.6 KiB
Rust
107 lines
2.6 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
use crate::event::{RoomInfo, UserInfo};
|
|
|
|
use crate::event::reaction::ReactionGroup;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageNewService {
|
|
pub id: Uuid,
|
|
pub seq: i64,
|
|
pub room: RoomInfo,
|
|
pub sender_type: String,
|
|
pub sender: UserInfo,
|
|
pub thread: Option<Uuid>,
|
|
pub in_reply_to: Option<Uuid>,
|
|
pub content: String,
|
|
pub content_type: String,
|
|
#[serde(default)]
|
|
pub pinned: bool,
|
|
pub system_type: Option<String>,
|
|
#[serde(default)]
|
|
pub metadata: serde_json::Value,
|
|
pub thinking_content: Option<String>,
|
|
pub thinking_is_chunked: Option<bool>,
|
|
pub send_at: DateTime<Utc>,
|
|
#[serde(default)]
|
|
pub reactions: Vec<ReactionGroup>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageEditedService {
|
|
pub id: Uuid,
|
|
pub seq: i64,
|
|
pub room: RoomInfo,
|
|
pub sender: UserInfo,
|
|
pub content: String,
|
|
pub edited_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageRevokedService {
|
|
pub id: Uuid,
|
|
pub seq: i64,
|
|
pub room: RoomInfo,
|
|
pub revoked_by: UserInfo,
|
|
pub revoked_at: DateTime<Utc>,
|
|
}
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageStreamStartService {
|
|
pub message_id: Uuid,
|
|
pub room: RoomInfo,
|
|
pub sse_url: Option<String>,
|
|
pub display_name: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageStreamChunkService {
|
|
pub message_id: Uuid,
|
|
pub room: RoomInfo,
|
|
pub seq: i64,
|
|
pub content: String,
|
|
pub chunk_type: String,
|
|
pub display_name: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageStreamDoneService {
|
|
pub message_id: Uuid,
|
|
pub room: RoomInfo,
|
|
pub content: String,
|
|
pub thinking_content: Option<String>,
|
|
pub display_name: Option<String>,
|
|
pub error: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageListService {
|
|
pub room: RoomInfo,
|
|
pub messages: Vec<MessageNewService>,
|
|
pub total: i64,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageSendClient {
|
|
pub room: Uuid,
|
|
pub content: String,
|
|
pub content_type: String,
|
|
pub thread: Option<Uuid>,
|
|
pub in_reply_to: Option<Uuid>,
|
|
pub attachment_ids: Option<Vec<Uuid>>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageEditClient {
|
|
pub room: Uuid,
|
|
pub message_id: Uuid,
|
|
pub content: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageRevokeClient {
|
|
pub room: Uuid,
|
|
pub message_id: Uuid,
|
|
}
|