mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Update json-rpc client
This commit is contained in:
parent
5f941004f5
commit
2ecddba375
4 changed files with 189 additions and 96 deletions
|
@ -49,6 +49,10 @@ pub enum CliCommands {
|
|||
#[clap(short = 'g', long)]
|
||||
group_id: Vec<String>,
|
||||
},
|
||||
DeleteLocalAccountData {
|
||||
#[clap(long = "ignore-registered")]
|
||||
ignore_registered: Option<bool>,
|
||||
},
|
||||
GetUserStatus {
|
||||
recipient: Vec<String>,
|
||||
},
|
||||
|
@ -61,11 +65,21 @@ pub enum CliCommands {
|
|||
name: String,
|
||||
},
|
||||
ListAccounts,
|
||||
ListContacts,
|
||||
ListContacts {
|
||||
recipient: Vec<String>,
|
||||
#[clap(short = 'a', long = "all-recipients")]
|
||||
all_recipients: bool,
|
||||
#[clap(long, parse(try_from_str))]
|
||||
blocked: Option<bool>,
|
||||
#[clap(long)]
|
||||
name: Option<String>,
|
||||
},
|
||||
ListDevices,
|
||||
ListGroups {
|
||||
#[clap(short = 'd', long)]
|
||||
detailed: bool,
|
||||
#[clap(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
},
|
||||
ListIdentities {
|
||||
#[clap(short = 'n', long)]
|
||||
|
@ -225,13 +239,13 @@ pub enum CliCommands {
|
|||
#[clap(long = "read-receipts", parse(try_from_str))]
|
||||
read_receipts: Option<bool>,
|
||||
|
||||
#[clap(long = "unidentified-delivery-indicators")]
|
||||
#[clap(long = "unidentified-delivery-indicators", parse(try_from_str))]
|
||||
unidentified_delivery_indicators: Option<bool>,
|
||||
|
||||
#[clap(long = "typing-indicators")]
|
||||
#[clap(long = "typing-indicators", parse(try_from_str))]
|
||||
typing_indicators: Option<bool>,
|
||||
|
||||
#[clap(long = "link-previews")]
|
||||
#[clap(long = "link-previews", parse(try_from_str))]
|
||||
link_previews: Option<bool>,
|
||||
},
|
||||
UpdateContact {
|
||||
|
|
|
@ -20,6 +20,13 @@ pub trait Rpc {
|
|||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
) -> Result<Value>;
|
||||
|
||||
#[rpc(name = "deleteLocalAccountData", params = "named")]
|
||||
fn delete_local_account_data(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] ignoreRegistered: Option<bool>,
|
||||
) -> Result<Value>;
|
||||
|
||||
#[rpc(name = "getUserStatus", params = "named")]
|
||||
fn get_user_status(&self, account: Option<String>, recipients: Vec<String>) -> Result<Value>;
|
||||
|
||||
|
@ -37,13 +44,24 @@ pub trait Rpc {
|
|||
fn list_accounts(&self) -> Result<Value>;
|
||||
|
||||
#[rpc(name = "listContacts", params = "named")]
|
||||
fn list_contacts(&self, account: Option<String>) -> Result<Value>;
|
||||
fn list_contacts(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] allRecipients: bool,
|
||||
blocked: Option<bool>,
|
||||
name: Option<String>,
|
||||
) -> Result<Value>;
|
||||
|
||||
#[rpc(name = "listDevices", params = "named")]
|
||||
fn list_devices(&self, account: Option<String>) -> Result<Value>;
|
||||
|
||||
#[rpc(name = "listGroups", params = "named")]
|
||||
fn list_groups(&self, account: Option<String>) -> Result<Value>;
|
||||
fn list_groups(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
) -> Result<Value>;
|
||||
|
||||
#[rpc(name = "listIdentities", params = "named")]
|
||||
fn list_identities(&self, account: Option<String>, number: Option<String>) -> Result<Value>;
|
||||
|
|
|
@ -41,6 +41,11 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
recipient,
|
||||
group_id,
|
||||
} => client.block(cli.account, recipient, group_id).await,
|
||||
cli::CliCommands::DeleteLocalAccountData { ignore_registered } => {
|
||||
client
|
||||
.delete_local_account_data(cli.account, ignore_registered)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::GetUserStatus { recipient } => {
|
||||
client.get_user_status(cli.account, recipient).await
|
||||
}
|
||||
|
@ -55,9 +60,21 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
client.finish_link(url, name).await
|
||||
}
|
||||
cli::CliCommands::ListAccounts => client.list_accounts().await,
|
||||
cli::CliCommands::ListContacts => client.list_contacts(cli.account).await,
|
||||
cli::CliCommands::ListContacts {
|
||||
recipient,
|
||||
all_recipients,
|
||||
blocked,
|
||||
name,
|
||||
} => {
|
||||
client
|
||||
.list_contacts(cli.account, recipient, all_recipients, blocked, name)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::ListDevices => client.list_devices(cli.account).await,
|
||||
cli::CliCommands::ListGroups { detailed: _ } => client.list_groups(cli.account).await,
|
||||
cli::CliCommands::ListGroups {
|
||||
detailed: _,
|
||||
group_id,
|
||||
} => client.list_groups(cli.account, group_id).await,
|
||||
cli::CliCommands::ListIdentities { number } => {
|
||||
client.list_identities(cli.account, number).await
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue