Implements mark as read
This commit is contained in:
@@ -52,6 +52,9 @@ pub enum Commands {
|
||||
conversation_id: String,
|
||||
message: String,
|
||||
},
|
||||
|
||||
/// Marks a conversation as read.
|
||||
Mark { conversation_id: String },
|
||||
}
|
||||
|
||||
impl Commands {
|
||||
@@ -67,6 +70,9 @@ impl Commands {
|
||||
conversation_id,
|
||||
message,
|
||||
} => client.send_message(conversation_id, message).await,
|
||||
Commands::Mark { conversation_id } => {
|
||||
client.mark_conversation_as_read(conversation_id).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,4 +169,10 @@ impl ClientCli {
|
||||
println!("Message sent: {}", message.guid);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn mark_conversation_as_read(&mut self, conversation_id: String) -> Result<()> {
|
||||
self.api.mark_conversation_as_read(&conversation_id).await?;
|
||||
println!("Conversation marked as read: {}", conversation_id);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ pub enum Commands {
|
||||
|
||||
/// Uploads an attachment to the server, returns upload guid.
|
||||
UploadAttachment { path: String },
|
||||
|
||||
/// Marks a conversation as read.
|
||||
MarkConversationAsRead { conversation_id: String },
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -99,6 +102,9 @@ impl Commands {
|
||||
Commands::DownloadAttachment { attachment_id } => {
|
||||
client.download_attachment(attachment_id).await
|
||||
}
|
||||
Commands::MarkConversationAsRead { conversation_id } => {
|
||||
client.mark_conversation_as_read(conversation_id).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,4 +295,9 @@ impl DaemonCli {
|
||||
println!("Upload GUID: {}", upload_guid);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn mark_conversation_as_read(&mut self, conversation_id: String) -> Result<()> {
|
||||
KordophoneRepository::mark_conversation_as_read(&self.proxy(), &conversation_id)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to mark conversation as read: {}", e))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user