mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-25 14:24:36 +00:00
Add new commands to jsonrpc client
This commit is contained in:
parent
92ded3fdf2
commit
a9d235b7f1
@ -230,6 +230,22 @@ pub enum CliCommands {
|
|||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
edit_timestamp: Option<u64>,
|
edit_timestamp: Option<u64>,
|
||||||
},
|
},
|
||||||
|
SendAdminDelete {
|
||||||
|
#[arg(short = 'g', long = "group-id")]
|
||||||
|
group_id: Vec<String>,
|
||||||
|
|
||||||
|
#[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,
|
SendContacts,
|
||||||
SendPaymentNotification {
|
SendPaymentNotification {
|
||||||
recipient: String,
|
recipient: String,
|
||||||
@ -240,6 +256,102 @@ pub enum CliCommands {
|
|||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
note: String,
|
note: String,
|
||||||
},
|
},
|
||||||
|
SendPinMessage {
|
||||||
|
recipient: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'g', long = "group-id")]
|
||||||
|
group_id: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'u', long = "username")]
|
||||||
|
username: Vec<String>,
|
||||||
|
|
||||||
|
#[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<i32>,
|
||||||
|
|
||||||
|
#[arg(long = "note-to-self")]
|
||||||
|
note_to_self: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
notify_self: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
story: bool,
|
||||||
|
},
|
||||||
|
SendPollCreate {
|
||||||
|
recipient: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'g', long = "group-id")]
|
||||||
|
group_id: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'u', long = "username")]
|
||||||
|
username: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'q', long = "question")]
|
||||||
|
question: String,
|
||||||
|
|
||||||
|
#[arg(short = 'o', long = "option")]
|
||||||
|
option: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(long = "no-multi")]
|
||||||
|
no_multi: bool,
|
||||||
|
|
||||||
|
#[arg(long = "note-to-self")]
|
||||||
|
note_to_self: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
notify_self: bool,
|
||||||
|
},
|
||||||
|
SendPollTerminate {
|
||||||
|
recipient: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'g', long = "group-id")]
|
||||||
|
group_id: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'u', long = "username")]
|
||||||
|
username: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(long = "poll-timestamp")]
|
||||||
|
poll_timestamp: u64,
|
||||||
|
|
||||||
|
#[arg(long = "note-to-self")]
|
||||||
|
note_to_self: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
notify_self: bool,
|
||||||
|
},
|
||||||
|
SendPollVote {
|
||||||
|
recipient: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'g', long = "group-id")]
|
||||||
|
group_id: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'u', long = "username")]
|
||||||
|
username: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(long = "poll-author")]
|
||||||
|
poll_author: Option<String>,
|
||||||
|
|
||||||
|
#[arg(long = "poll-timestamp")]
|
||||||
|
poll_timestamp: u64,
|
||||||
|
|
||||||
|
#[arg(short = 'o', long = "option")]
|
||||||
|
option: Vec<i32>,
|
||||||
|
|
||||||
|
#[arg(long = "vote-count")]
|
||||||
|
vote_count: i32,
|
||||||
|
|
||||||
|
#[arg(long = "note-to-self")]
|
||||||
|
note_to_self: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
notify_self: bool,
|
||||||
|
},
|
||||||
SendReaction {
|
SendReaction {
|
||||||
recipient: Vec<String>,
|
recipient: Vec<String>,
|
||||||
|
|
||||||
@ -283,6 +395,30 @@ pub enum CliCommands {
|
|||||||
#[arg(short = 's', long)]
|
#[arg(short = 's', long)]
|
||||||
stop: bool,
|
stop: bool,
|
||||||
},
|
},
|
||||||
|
SendUnpinMessage {
|
||||||
|
recipient: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'g', long = "group-id")]
|
||||||
|
group_id: Vec<String>,
|
||||||
|
|
||||||
|
#[arg(short = 'u', long = "username")]
|
||||||
|
username: Vec<String>,
|
||||||
|
|
||||||
|
#[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 {
|
SendMessageRequestResponse {
|
||||||
recipient: Vec<String>,
|
recipient: Vec<String>,
|
||||||
|
|
||||||
@ -358,6 +494,13 @@ pub enum CliCommands {
|
|||||||
#[arg(short = 'n', long)]
|
#[arg(short = 'n', long)]
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
},
|
},
|
||||||
|
UpdateDevice {
|
||||||
|
#[arg(short = 'd', long = "device-id")]
|
||||||
|
device_id: u32,
|
||||||
|
|
||||||
|
#[arg(short = 'n', long = "device-name")]
|
||||||
|
device_name: String,
|
||||||
|
},
|
||||||
UpdateGroup {
|
UpdateGroup {
|
||||||
#[arg(short = 'g', long = "group-id")]
|
#[arg(short = 'g', long = "group-id")]
|
||||||
group_id: Option<String>,
|
group_id: Option<String>,
|
||||||
|
|||||||
@ -205,6 +205,87 @@ pub trait Rpc {
|
|||||||
#[method(name = "sendContacts", param_kind = map)]
|
#[method(name = "sendContacts", param_kind = map)]
|
||||||
fn send_contacts(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
fn send_contacts(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "sendAdminDelete", param_kind = map)]
|
||||||
|
fn send_admin_delete(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] targetAuthor: String,
|
||||||
|
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||||
|
story: bool,
|
||||||
|
#[allow(non_snake_case)] notifySelf: bool,
|
||||||
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "sendPinMessage", param_kind = map)]
|
||||||
|
fn send_pin_message(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
recipients: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||||
|
usernames: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] targetAuthor: String,
|
||||||
|
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||||
|
#[allow(non_snake_case)] pinDuration: Option<i32>,
|
||||||
|
#[allow(non_snake_case)] noteToSelf: bool,
|
||||||
|
#[allow(non_snake_case)] notifySelf: bool,
|
||||||
|
story: bool,
|
||||||
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "sendPollCreate", param_kind = map)]
|
||||||
|
fn send_poll_create(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
recipients: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||||
|
usernames: Vec<String>,
|
||||||
|
question: String,
|
||||||
|
option: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] noMulti: bool,
|
||||||
|
#[allow(non_snake_case)] noteToSelf: bool,
|
||||||
|
#[allow(non_snake_case)] notifySelf: bool,
|
||||||
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "sendPollVote", param_kind = map)]
|
||||||
|
fn send_poll_vote(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
recipients: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||||
|
usernames: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] pollAuthor: Option<String>,
|
||||||
|
#[allow(non_snake_case)] pollTimestamp: u64,
|
||||||
|
option: Vec<i32>,
|
||||||
|
#[allow(non_snake_case)] voteCount: i32,
|
||||||
|
#[allow(non_snake_case)] noteToSelf: bool,
|
||||||
|
#[allow(non_snake_case)] notifySelf: bool,
|
||||||
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "sendPollTerminate", param_kind = map)]
|
||||||
|
fn send_poll_terminate(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
recipients: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||||
|
usernames: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] pollTimestamp: u64,
|
||||||
|
#[allow(non_snake_case)] noteToSelf: bool,
|
||||||
|
#[allow(non_snake_case)] notifySelf: bool,
|
||||||
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "sendUnpinMessage", param_kind = map)]
|
||||||
|
fn send_unpin_message(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
recipients: Vec<String>,
|
||||||
|
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||||
|
usernames: Vec<String>,
|
||||||
|
#[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<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
#[method(name = "sendPaymentNotification", param_kind = map)]
|
#[method(name = "sendPaymentNotification", param_kind = map)]
|
||||||
fn send_payment_notification(
|
fn send_payment_notification(
|
||||||
&self,
|
&self,
|
||||||
@ -335,6 +416,14 @@ pub trait Rpc {
|
|||||||
expiration: Option<u32>,
|
expiration: Option<u32>,
|
||||||
) -> Result<Value, ErrorObjectOwned>;
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
|
#[method(name = "updateDevice", param_kind = map)]
|
||||||
|
fn update_device(
|
||||||
|
&self,
|
||||||
|
account: Option<String>,
|
||||||
|
#[allow(non_snake_case)] deviceId: u32,
|
||||||
|
#[allow(non_snake_case)] deviceName: String,
|
||||||
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
#[method(name = "updateGroup", param_kind = map)]
|
#[method(name = "updateGroup", param_kind = map)]
|
||||||
fn update_group(
|
fn update_group(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@ -192,6 +192,24 @@ async fn handle_command(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
CliCommands::SendContacts => client.send_contacts(cli.account).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 {
|
CliCommands::SendPaymentNotification {
|
||||||
recipient,
|
recipient,
|
||||||
receipt,
|
receipt,
|
||||||
@ -201,6 +219,102 @@ async fn handle_command(
|
|||||||
.send_payment_notification(cli.account, recipient, receipt, note)
|
.send_payment_notification(cli.account, recipient, receipt, note)
|
||||||
.await
|
.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 {
|
CliCommands::SendReaction {
|
||||||
recipient,
|
recipient,
|
||||||
group_id,
|
group_id,
|
||||||
@ -252,6 +366,30 @@ async fn handle_command(
|
|||||||
.send_typing(cli.account, recipient, group_id, stop)
|
.send_typing(cli.account, recipient, group_id, stop)
|
||||||
.await
|
.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::SetPin { pin } => client.set_pin(cli.account, pin).await,
|
||||||
CliCommands::SubmitRateLimitChallenge { challenge, captcha } => {
|
CliCommands::SubmitRateLimitChallenge { challenge, captcha } => {
|
||||||
client
|
client
|
||||||
@ -320,6 +458,14 @@ async fn handle_command(
|
|||||||
.update_contact(cli.account, recipient, name, expiration)
|
.update_contact(cli.account, recipient, name, expiration)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
CliCommands::UpdateDevice {
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
} => {
|
||||||
|
client
|
||||||
|
.update_device(cli.account, device_id, device_name)
|
||||||
|
.await
|
||||||
|
}
|
||||||
CliCommands::UpdateGroup {
|
CliCommands::UpdateGroup {
|
||||||
group_id,
|
group_id,
|
||||||
name,
|
name,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user