Private
Public Access
1
0
Files
Kordophone/kordophoned/src/daemon/events.rs

41 lines
1.3 KiB
Rust
Raw Normal View History

use tokio::sync::oneshot;
use kordophone_db::models::{Conversation, Message};
use crate::daemon::settings::Settings;
pub type Reply<T> = oneshot::Sender<T>;
#[derive(Debug)]
pub enum Event {
/// Get the version of the daemon.
GetVersion(Reply<String>),
/// Asynchronous event for syncing the conversation list with the server.
SyncConversationList(Reply<()>),
/// Asynchronous event for syncing all conversations with the server.
SyncAllConversations(Reply<()>),
/// Asynchronous event for syncing a single conversation with the server.
SyncConversation(String, Reply<()>),
/// Returns all known conversations from the database.
GetAllConversations(Reply<Vec<Conversation>>),
/// Returns all known settings from the database.
GetAllSettings(Reply<Settings>),
/// Update settings in the database.
UpdateSettings(Settings, Reply<()>),
/// Returns all messages for a conversation from the database.
/// Parameters:
/// - conversation_id: The ID of the conversation to get messages for.
/// - last_message_id: (optional) The ID of the last message to get. If None, all messages are returned.
GetMessages(String, Option<String>, Reply<Vec<Message>>),
2025-05-01 01:08:13 -07:00
/// Delete all conversations from the database.
DeleteAllConversations(Reply<()>),
}