80 lines
2.0 KiB
Rust
80 lines
2.0 KiB
Rust
use super::session_id::UnifiedSessionId;
|
|
|
|
/// Session management commands issued by Channel to SessionManager
|
|
#[derive(Debug, Clone)]
|
|
pub enum SessionCommand {
|
|
/// Create a new dialog in the given chat
|
|
CreateDialog {
|
|
channel: String,
|
|
chat_id: String,
|
|
title: Option<String>,
|
|
},
|
|
/// List all dialogs in a chat
|
|
ListDialogs {
|
|
channel: String,
|
|
chat_id: String,
|
|
include_archived: bool,
|
|
},
|
|
/// Switch to a specific dialog (set as current)
|
|
SwitchDialog {
|
|
channel: String,
|
|
chat_id: String,
|
|
dialog_id: String,
|
|
},
|
|
/// Get the current dialog for a chat
|
|
GetCurrentDialog {
|
|
channel: String,
|
|
chat_id: String,
|
|
},
|
|
/// Rename a dialog
|
|
RenameDialog {
|
|
session_id: UnifiedSessionId,
|
|
title: String,
|
|
},
|
|
/// Archive a dialog
|
|
ArchiveDialog {
|
|
session_id: UnifiedSessionId,
|
|
},
|
|
/// Delete a dialog
|
|
DeleteDialog {
|
|
session_id: UnifiedSessionId,
|
|
},
|
|
/// Clear dialog history
|
|
ClearHistory {
|
|
session_id: UnifiedSessionId,
|
|
},
|
|
/// Get list of available slash commands
|
|
GetSlashCommands {
|
|
channel: String,
|
|
chat_id: String,
|
|
},
|
|
/// Execute a slash command
|
|
ExecuteSlashCommand {
|
|
command: String,
|
|
args: Option<String>,
|
|
channel: String,
|
|
chat_id: String,
|
|
current_session_id: Option<UnifiedSessionId>,
|
|
},
|
|
}
|
|
|
|
impl SessionCommand {
|
|
/// Create a CreateDialog command
|
|
pub fn create_dialog(channel: impl Into<String>, chat_id: impl Into<String>, title: Option<String>) -> Self {
|
|
Self::CreateDialog {
|
|
channel: channel.into(),
|
|
chat_id: chat_id.into(),
|
|
title,
|
|
}
|
|
}
|
|
|
|
/// Create a ListDialogs command
|
|
pub fn list_dialogs(channel: impl Into<String>, chat_id: impl Into<String>, include_archived: bool) -> Self {
|
|
Self::ListDialogs {
|
|
channel: channel.into(),
|
|
chat_id: chat_id.into(),
|
|
include_archived,
|
|
}
|
|
}
|
|
}
|