mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-09-19 05:58:57 +00:00
Add missing flags to jsonrpc client
This commit is contained in:
parent
a9d235b7f1
commit
c70515035f
@ -10,6 +10,9 @@ pub struct Cli {
|
||||
#[arg(short = 'a', long)]
|
||||
pub account: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
pub output: Option<String>,
|
||||
|
||||
/// TCP host and port of signal-cli daemon
|
||||
#[arg(long, conflicts_with = "json_rpc_http")]
|
||||
pub json_rpc_tcp: Option<Option<SocketAddr>>,
|
||||
@ -105,6 +108,10 @@ pub enum CliCommands {
|
||||
blocked: Option<bool>,
|
||||
#[arg(long)]
|
||||
name: Option<String>,
|
||||
#[arg(long)]
|
||||
detailed: bool,
|
||||
#[arg(long)]
|
||||
internal: bool,
|
||||
},
|
||||
ListDevices,
|
||||
ListGroups {
|
||||
@ -135,6 +142,8 @@ pub enum CliCommands {
|
||||
voice: bool,
|
||||
#[arg(long)]
|
||||
captcha: Option<String>,
|
||||
#[arg(long)]
|
||||
reregister: bool,
|
||||
},
|
||||
RemoveContact {
|
||||
recipient: String,
|
||||
@ -167,15 +176,24 @@ pub enum CliCommands {
|
||||
#[arg(short = 'g', long)]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
|
||||
#[arg(short = 'e', long)]
|
||||
end_session: bool,
|
||||
|
||||
#[arg(short = 'm', long)]
|
||||
message: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
message_from_stdin: bool,
|
||||
|
||||
#[arg(short = 'a', long)]
|
||||
attachment: Vec<String>,
|
||||
|
||||
@ -229,6 +247,9 @@ pub enum CliCommands {
|
||||
|
||||
#[arg(long)]
|
||||
edit_timestamp: Option<u64>,
|
||||
|
||||
#[arg(long = "no-urgent")]
|
||||
no_urgent: bool,
|
||||
},
|
||||
SendAdminDelete {
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
@ -358,9 +379,15 @@ pub enum CliCommands {
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
|
||||
#[arg(short = 'e', long)]
|
||||
emoji: String,
|
||||
|
||||
@ -379,6 +406,9 @@ pub enum CliCommands {
|
||||
SendReceipt {
|
||||
recipient: String,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: Vec<u64>,
|
||||
|
||||
@ -471,6 +501,10 @@ pub enum CliCommands {
|
||||
discoverable_by_number: Option<bool>,
|
||||
#[arg(long = "number-sharing")]
|
||||
number_sharing: Option<bool>,
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Option<String>,
|
||||
#[arg(long = "delete-username")]
|
||||
delete_username: bool,
|
||||
},
|
||||
UpdateConfiguration {
|
||||
#[arg(long = "read-receipts")]
|
||||
@ -493,6 +527,21 @@ pub enum CliCommands {
|
||||
|
||||
#[arg(short = 'n', long)]
|
||||
name: Option<String>,
|
||||
|
||||
#[arg(long = "given-name")]
|
||||
given_name: Option<String>,
|
||||
|
||||
#[arg(long = "family-name")]
|
||||
family_name: Option<String>,
|
||||
|
||||
#[arg(long = "nick-given-name")]
|
||||
nick_given_name: Option<String>,
|
||||
|
||||
#[arg(long = "nick-family-name")]
|
||||
nick_family_name: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
note: Option<String>,
|
||||
},
|
||||
UpdateDevice {
|
||||
#[arg(short = 'd', long = "device-id")]
|
||||
|
||||
@ -104,6 +104,8 @@ pub trait Rpc {
|
||||
#[allow(non_snake_case)] allRecipients: bool,
|
||||
blocked: Option<bool>,
|
||||
name: Option<String>,
|
||||
detailed: bool,
|
||||
internal: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "listDevices", param_kind = map)]
|
||||
@ -141,6 +143,7 @@ pub trait Rpc {
|
||||
account: Option<String>,
|
||||
voice: bool,
|
||||
captcha: Option<String>,
|
||||
reregister: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "removeContact", param_kind = map)]
|
||||
@ -179,27 +182,30 @@ pub trait Rpc {
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
groupIds: Vec<String>,
|
||||
noteToSelf: bool,
|
||||
endSession: bool,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] endSession: bool,
|
||||
message: String,
|
||||
attachments: Vec<String>,
|
||||
viewOnce: bool,
|
||||
#[allow(non_snake_case)] viewOnce: bool,
|
||||
mentions: Vec<String>,
|
||||
textStyle: Vec<String>,
|
||||
quoteTimestamp: Option<u64>,
|
||||
quoteAuthor: Option<String>,
|
||||
quoteMessage: Option<String>,
|
||||
quoteMention: Vec<String>,
|
||||
quoteTextStyle: Vec<String>,
|
||||
quoteAttachment: Vec<String>,
|
||||
previewUrl: Option<String>,
|
||||
previewTitle: Option<String>,
|
||||
previewDescription: Option<String>,
|
||||
previewImage: Option<String>,
|
||||
#[allow(non_snake_case)] textStyle: Vec<String>,
|
||||
#[allow(non_snake_case)] quoteTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] quoteAuthor: Option<String>,
|
||||
#[allow(non_snake_case)] quoteMessage: Option<String>,
|
||||
#[allow(non_snake_case)] quoteMention: Vec<String>,
|
||||
#[allow(non_snake_case)] quoteTextStyle: Vec<String>,
|
||||
#[allow(non_snake_case)] quoteAttachment: Vec<String>,
|
||||
#[allow(non_snake_case)] previewUrl: Option<String>,
|
||||
#[allow(non_snake_case)] previewTitle: Option<String>,
|
||||
#[allow(non_snake_case)] previewDescription: Option<String>,
|
||||
#[allow(non_snake_case)] previewImage: Option<String>,
|
||||
sticker: Option<String>,
|
||||
storyTimestamp: Option<u64>,
|
||||
storyAuthor: Option<String>,
|
||||
editTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] storyTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] storyAuthor: Option<String>,
|
||||
#[allow(non_snake_case)] editTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] noUrgent: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendContacts", param_kind = map)]
|
||||
@ -301,7 +307,9 @@ pub trait Rpc {
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
emoji: String,
|
||||
#[allow(non_snake_case)] targetAuthor: String,
|
||||
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||
@ -314,6 +322,7 @@ pub trait Rpc {
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipient: String,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] targetTimestamps: Vec<u64>,
|
||||
r#type: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
@ -395,6 +404,8 @@ pub trait Rpc {
|
||||
unrestrictedUnidentifiedSender: Option<bool>,
|
||||
discoverableByNumber: Option<bool>,
|
||||
numberSharing: Option<bool>,
|
||||
username: Option<String>,
|
||||
deleteUsername: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "updateConfiguration", param_kind = map)]
|
||||
@ -414,6 +425,11 @@ pub trait Rpc {
|
||||
recipient: String,
|
||||
name: Option<String>,
|
||||
expiration: Option<u32>,
|
||||
#[allow(non_snake_case)] givenName: Option<String>,
|
||||
#[allow(non_snake_case)] familyName: Option<String>,
|
||||
#[allow(non_snake_case)] nickGivenName: Option<String>,
|
||||
#[allow(non_snake_case)] nickFamilyName: Option<String>,
|
||||
note: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "updateDevice", param_kind = map)]
|
||||
|
||||
@ -84,9 +84,19 @@ async fn handle_command(
|
||||
all_recipients,
|
||||
blocked,
|
||||
name,
|
||||
detailed,
|
||||
internal,
|
||||
} => {
|
||||
client
|
||||
.list_contacts(cli.account, recipient, all_recipients, blocked, name)
|
||||
.list_contacts(
|
||||
cli.account,
|
||||
recipient,
|
||||
all_recipients,
|
||||
blocked,
|
||||
name,
|
||||
detailed,
|
||||
internal,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::ListDevices => client.list_devices(cli.account).await,
|
||||
@ -105,8 +115,14 @@ async fn handle_command(
|
||||
.quit_group(cli.account, group_id, delete, admin)
|
||||
.await
|
||||
}
|
||||
CliCommands::Register { voice, captcha } => {
|
||||
client.register(cli.account, voice, captcha).await
|
||||
CliCommands::Register {
|
||||
voice,
|
||||
captcha,
|
||||
reregister,
|
||||
} => {
|
||||
client
|
||||
.register(cli.account, voice, captcha, reregister)
|
||||
.await
|
||||
}
|
||||
CliCommands::RemoveContact {
|
||||
recipient,
|
||||
@ -140,9 +156,12 @@ async fn handle_command(
|
||||
CliCommands::Send {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
notify_self,
|
||||
note_to_self,
|
||||
end_session,
|
||||
message,
|
||||
message_from_stdin,
|
||||
attachment,
|
||||
view_once,
|
||||
mention,
|
||||
@ -161,15 +180,22 @@ async fn handle_command(
|
||||
story_timestamp,
|
||||
story_author,
|
||||
edit_timestamp,
|
||||
no_urgent,
|
||||
} => {
|
||||
client
|
||||
.send(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
notify_self,
|
||||
note_to_self,
|
||||
end_session,
|
||||
message.unwrap_or_default(),
|
||||
if message_from_stdin {
|
||||
std::io::read_to_string(std::io::stdin()).unwrap()
|
||||
} else {
|
||||
message.unwrap_or_default()
|
||||
},
|
||||
attachment,
|
||||
view_once,
|
||||
mention,
|
||||
@ -188,6 +214,7 @@ async fn handle_command(
|
||||
story_timestamp,
|
||||
story_author,
|
||||
edit_timestamp,
|
||||
no_urgent,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@ -318,7 +345,9 @@ async fn handle_command(
|
||||
CliCommands::SendReaction {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
emoji,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
@ -330,7 +359,9 @@ async fn handle_command(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
emoji,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
@ -341,6 +372,7 @@ async fn handle_command(
|
||||
}
|
||||
CliCommands::SendReceipt {
|
||||
recipient,
|
||||
username,
|
||||
target_timestamp,
|
||||
r#type,
|
||||
} => {
|
||||
@ -348,6 +380,7 @@ async fn handle_command(
|
||||
.send_receipt(
|
||||
cli.account,
|
||||
recipient,
|
||||
username,
|
||||
target_timestamp,
|
||||
match r#type {
|
||||
cli::ReceiptType::Read => "read".to_owned(),
|
||||
@ -422,6 +455,8 @@ async fn handle_command(
|
||||
unrestricted_unidentified_sender,
|
||||
discoverable_by_number,
|
||||
number_sharing,
|
||||
username,
|
||||
delete_username,
|
||||
} => {
|
||||
client
|
||||
.update_account(
|
||||
@ -430,6 +465,8 @@ async fn handle_command(
|
||||
unrestricted_unidentified_sender,
|
||||
discoverable_by_number,
|
||||
number_sharing,
|
||||
username,
|
||||
delete_username,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@ -453,9 +490,24 @@ async fn handle_command(
|
||||
recipient,
|
||||
expiration,
|
||||
name,
|
||||
given_name,
|
||||
family_name,
|
||||
nick_given_name,
|
||||
nick_family_name,
|
||||
note,
|
||||
} => {
|
||||
client
|
||||
.update_contact(cli.account, recipient, name, expiration)
|
||||
.update_contact(
|
||||
cli.account,
|
||||
recipient,
|
||||
name,
|
||||
expiration,
|
||||
given_name,
|
||||
family_name,
|
||||
nick_given_name,
|
||||
nick_family_name,
|
||||
note,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::UpdateDevice {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user