diff --git a/client/src/cli.rs b/client/src/cli.rs index fe10df74..0161b0e9 100644 --- a/client/src/cli.rs +++ b/client/src/cli.rs @@ -230,6 +230,22 @@ pub enum CliCommands { #[arg(long)] edit_timestamp: Option, }, + SendAdminDelete { + #[arg(short = 'g', long = "group-id")] + group_id: Vec, + + #[arg(short = 'a', long = "target-author")] + target_author: String, + + #[arg(short = 't', long = "target-timestamp")] + target_timestamp: u64, + + #[arg(long)] + story: bool, + + #[arg(long)] + notify_self: bool, + }, SendContacts, SendPaymentNotification { recipient: String, @@ -240,6 +256,102 @@ pub enum CliCommands { #[arg(long)] note: String, }, + SendPinMessage { + recipient: Vec, + + #[arg(short = 'g', long = "group-id")] + group_id: Vec, + + #[arg(short = 'u', long = "username")] + username: Vec, + + #[arg(short = 'a', long = "target-author")] + target_author: String, + + #[arg(short = 't', long = "target-timestamp")] + target_timestamp: u64, + + #[arg(short = 'd', long = "pin-duration")] + pin_duration: Option, + + #[arg(long = "note-to-self")] + note_to_self: bool, + + #[arg(long)] + notify_self: bool, + + #[arg(long)] + story: bool, + }, + SendPollCreate { + recipient: Vec, + + #[arg(short = 'g', long = "group-id")] + group_id: Vec, + + #[arg(short = 'u', long = "username")] + username: Vec, + + #[arg(short = 'q', long = "question")] + question: String, + + #[arg(short = 'o', long = "option")] + option: Vec, + + #[arg(long = "no-multi")] + no_multi: bool, + + #[arg(long = "note-to-self")] + note_to_self: bool, + + #[arg(long)] + notify_self: bool, + }, + SendPollTerminate { + recipient: Vec, + + #[arg(short = 'g', long = "group-id")] + group_id: Vec, + + #[arg(short = 'u', long = "username")] + username: Vec, + + #[arg(long = "poll-timestamp")] + poll_timestamp: u64, + + #[arg(long = "note-to-self")] + note_to_self: bool, + + #[arg(long)] + notify_self: bool, + }, + SendPollVote { + recipient: Vec, + + #[arg(short = 'g', long = "group-id")] + group_id: Vec, + + #[arg(short = 'u', long = "username")] + username: Vec, + + #[arg(long = "poll-author")] + poll_author: Option, + + #[arg(long = "poll-timestamp")] + poll_timestamp: u64, + + #[arg(short = 'o', long = "option")] + option: Vec, + + #[arg(long = "vote-count")] + vote_count: i32, + + #[arg(long = "note-to-self")] + note_to_self: bool, + + #[arg(long)] + notify_self: bool, + }, SendReaction { recipient: Vec, @@ -283,6 +395,30 @@ pub enum CliCommands { #[arg(short = 's', long)] stop: bool, }, + SendUnpinMessage { + recipient: Vec, + + #[arg(short = 'g', long = "group-id")] + group_id: Vec, + + #[arg(short = 'u', long = "username")] + username: Vec, + + #[arg(short = 'a', long = "target-author")] + target_author: String, + + #[arg(short = 't', long = "target-timestamp")] + target_timestamp: u64, + + #[arg(long = "note-to-self")] + note_to_self: bool, + + #[arg(long)] + notify_self: bool, + + #[arg(long)] + story: bool, + }, SendMessageRequestResponse { recipient: Vec, @@ -358,6 +494,13 @@ pub enum CliCommands { #[arg(short = 'n', long)] name: Option, }, + UpdateDevice { + #[arg(short = 'd', long = "device-id")] + device_id: u32, + + #[arg(short = 'n', long = "device-name")] + device_name: String, + }, UpdateGroup { #[arg(short = 'g', long = "group-id")] group_id: Option, diff --git a/client/src/jsonrpc.rs b/client/src/jsonrpc.rs index 66ef9d9d..1e5cfcb8 100644 --- a/client/src/jsonrpc.rs +++ b/client/src/jsonrpc.rs @@ -205,6 +205,87 @@ pub trait Rpc { #[method(name = "sendContacts", param_kind = map)] fn send_contacts(&self, account: Option) -> Result; + #[method(name = "sendAdminDelete", param_kind = map)] + fn send_admin_delete( + &self, + account: Option, + #[allow(non_snake_case)] groupIds: Vec, + #[allow(non_snake_case)] targetAuthor: String, + #[allow(non_snake_case)] targetTimestamp: u64, + story: bool, + #[allow(non_snake_case)] notifySelf: bool, + ) -> Result; + + #[method(name = "sendPinMessage", param_kind = map)] + fn send_pin_message( + &self, + account: Option, + recipients: Vec, + #[allow(non_snake_case)] groupIds: Vec, + usernames: Vec, + #[allow(non_snake_case)] targetAuthor: String, + #[allow(non_snake_case)] targetTimestamp: u64, + #[allow(non_snake_case)] pinDuration: Option, + #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] notifySelf: bool, + story: bool, + ) -> Result; + + #[method(name = "sendPollCreate", param_kind = map)] + fn send_poll_create( + &self, + account: Option, + recipients: Vec, + #[allow(non_snake_case)] groupIds: Vec, + usernames: Vec, + question: String, + option: Vec, + #[allow(non_snake_case)] noMulti: bool, + #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] notifySelf: bool, + ) -> Result; + + #[method(name = "sendPollVote", param_kind = map)] + fn send_poll_vote( + &self, + account: Option, + recipients: Vec, + #[allow(non_snake_case)] groupIds: Vec, + usernames: Vec, + #[allow(non_snake_case)] pollAuthor: Option, + #[allow(non_snake_case)] pollTimestamp: u64, + option: Vec, + #[allow(non_snake_case)] voteCount: i32, + #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] notifySelf: bool, + ) -> Result; + + #[method(name = "sendPollTerminate", param_kind = map)] + fn send_poll_terminate( + &self, + account: Option, + recipients: Vec, + #[allow(non_snake_case)] groupIds: Vec, + usernames: Vec, + #[allow(non_snake_case)] pollTimestamp: u64, + #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] notifySelf: bool, + ) -> Result; + + #[method(name = "sendUnpinMessage", param_kind = map)] + fn send_unpin_message( + &self, + account: Option, + recipients: Vec, + #[allow(non_snake_case)] groupIds: Vec, + usernames: Vec, + #[allow(non_snake_case)] targetAuthor: String, + #[allow(non_snake_case)] targetTimestamp: u64, + #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] notifySelf: bool, + story: bool, + ) -> Result; + #[method(name = "sendPaymentNotification", param_kind = map)] fn send_payment_notification( &self, @@ -335,6 +416,14 @@ pub trait Rpc { expiration: Option, ) -> Result; + #[method(name = "updateDevice", param_kind = map)] + fn update_device( + &self, + account: Option, + #[allow(non_snake_case)] deviceId: u32, + #[allow(non_snake_case)] deviceName: String, + ) -> Result; + #[method(name = "updateGroup", param_kind = map)] fn update_group( &self, diff --git a/client/src/main.rs b/client/src/main.rs index ac12331d..e5c4fa50 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -192,6 +192,24 @@ async fn handle_command( .await } CliCommands::SendContacts => client.send_contacts(cli.account).await, + CliCommands::SendAdminDelete { + group_id, + target_author, + target_timestamp, + story, + notify_self, + } => { + client + .send_admin_delete( + cli.account, + group_id, + target_author, + target_timestamp, + story, + notify_self, + ) + .await + } CliCommands::SendPaymentNotification { recipient, receipt, @@ -201,6 +219,102 @@ async fn handle_command( .send_payment_notification(cli.account, recipient, receipt, note) .await } + CliCommands::SendPinMessage { + recipient, + group_id, + username, + target_author, + target_timestamp, + pin_duration, + note_to_self, + notify_self, + story, + } => { + client + .send_pin_message( + cli.account, + recipient, + group_id, + username, + target_author, + target_timestamp, + pin_duration, + note_to_self, + notify_self, + story, + ) + .await + } + CliCommands::SendPollCreate { + recipient, + group_id, + username, + question, + option, + no_multi, + note_to_self, + notify_self, + } => { + client + .send_poll_create( + cli.account, + recipient, + group_id, + username, + question, + option, + no_multi, + note_to_self, + notify_self, + ) + .await + } + CliCommands::SendPollTerminate { + recipient, + group_id, + username, + poll_timestamp, + note_to_self, + notify_self, + } => { + client + .send_poll_terminate( + cli.account, + recipient, + group_id, + username, + poll_timestamp, + note_to_self, + notify_self, + ) + .await + } + CliCommands::SendPollVote { + recipient, + group_id, + username, + poll_author, + poll_timestamp, + option, + vote_count, + note_to_self, + notify_self, + } => { + client + .send_poll_vote( + cli.account, + recipient, + group_id, + username, + poll_author, + poll_timestamp, + option, + vote_count, + note_to_self, + notify_self, + ) + .await + } CliCommands::SendReaction { recipient, group_id, @@ -252,6 +366,30 @@ async fn handle_command( .send_typing(cli.account, recipient, group_id, stop) .await } + CliCommands::SendUnpinMessage { + recipient, + group_id, + username, + target_author, + target_timestamp, + note_to_self, + notify_self, + story, + } => { + client + .send_unpin_message( + cli.account, + recipient, + group_id, + username, + target_author, + target_timestamp, + note_to_self, + notify_self, + story, + ) + .await + } CliCommands::SetPin { pin } => client.set_pin(cli.account, pin).await, CliCommands::SubmitRateLimitChallenge { challenge, captcha } => { client @@ -320,6 +458,14 @@ async fn handle_command( .update_contact(cli.account, recipient, name, expiration) .await } + CliCommands::UpdateDevice { + device_id, + device_name, + } => { + client + .update_device(cli.account, device_id, device_name) + .await + } CliCommands::UpdateGroup { group_id, name,