X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/8037fb2d66e52fa65333e4b176c430118f59e89c..3be1c24b1b18115becfaef1e2ea82c914a1fefea:/client/src/jsonrpc.rs diff --git a/client/src/jsonrpc.rs b/client/src/jsonrpc.rs index cd257305..cb1b4f8c 100644 --- a/client/src/jsonrpc.rs +++ b/client/src/jsonrpc.rs @@ -1,8 +1,7 @@ use std::path::Path; use jsonrpsee::async_client::ClientBuilder; -use jsonrpsee::core::client::SubscriptionClientT; -use jsonrpsee::core::Error; +use jsonrpsee::core::client::{Error, SubscriptionClientT}; use jsonrpsee::http_client::HttpClientBuilder; use jsonrpsee::proc_macros::rpc; use serde::Deserialize; @@ -18,6 +17,13 @@ pub trait Rpc { uri: String, ) -> Result; + #[method(name = "addStickerPack", param_kind = map)] + async fn add_sticker_pack( + &self, + account: Option, + uri: String, + ) -> Result; + #[method(name = "block", param_kind = map)] fn block( &self, @@ -33,6 +39,15 @@ pub trait Rpc { #[allow(non_snake_case)] ignoreRegistered: Option, ) -> Result; + #[method(name = "getAttachment", param_kind = map)] + fn get_attachment( + &self, + account: Option, + id: String, + recipient: Option, + group_id: Option, + ) -> Result; + #[method(name = "getUserStatus", param_kind = map)] fn get_user_status( &self, @@ -43,6 +58,16 @@ pub trait Rpc { #[method(name = "joinGroup", param_kind = map)] fn join_group(&self, account: Option, uri: String) -> Result; + #[allow(non_snake_case)] + #[method(name = "finishChangeNumber", param_kind = map)] + fn finish_change_number( + &self, + account: Option, + number: String, + verificationCode: String, + pin: Option, + ) -> Result; + #[method(name = "finishLink", param_kind = map)] fn finish_link( &self, @@ -106,6 +131,7 @@ pub trait Rpc { account: Option, recipient: String, forget: bool, + hide: bool, ) -> Result; #[method(name = "removeDevice", param_kind = map)] @@ -128,24 +154,33 @@ pub trait Rpc { #[allow(non_snake_case)] noteToSelf: bool, ) -> Result; + #[allow(non_snake_case)] #[method(name = "send", param_kind = map)] fn send( &self, account: Option, recipients: Vec, - #[allow(non_snake_case)] groupIds: Vec, - #[allow(non_snake_case)] noteToSelf: bool, - #[allow(non_snake_case)] endSession: bool, + groupIds: Vec, + noteToSelf: bool, + endSession: bool, message: String, attachments: Vec, mentions: Vec, - #[allow(non_snake_case)] quoteTimestamp: Option, - #[allow(non_snake_case)] quoteAuthor: Option, - #[allow(non_snake_case)] quoteMessage: Option, - #[allow(non_snake_case)] quoteMention: Vec, + textStyle: Vec, + quoteTimestamp: Option, + quoteAuthor: Option, + quoteMessage: Option, + quoteMention: Vec, + quoteTextStyle: Vec, + quoteAttachment: Vec, + preview_url: Option, + preview_title: Option, + preview_description: Option, + preview_image: Option, sticker: Option, - #[allow(non_snake_case)] storyTimestamp: Option, - #[allow(non_snake_case)] storyAuthor: Option, + storyTimestamp: Option, + storyAuthor: Option, + editTimestamp: Option, ) -> Result; #[method(name = "sendContacts", param_kind = map)] @@ -206,6 +241,15 @@ pub trait Rpc { captcha: String, ) -> Result; + #[method(name = "startChangeNumber", param_kind = map)] + fn start_change_number( + &self, + account: Option, + number: String, + voice: bool, + captcha: Option, + ) -> Result; + #[method(name = "startLink", param_kind = map)] fn start_link(&self, account: Option) -> Result; @@ -233,18 +277,20 @@ pub trait Rpc { #[allow(non_snake_case)] deleteAccount: bool, ) -> Result; + #[allow(non_snake_case)] #[method(name = "updateAccount", param_kind = map)] fn update_account( &self, account: Option, - #[allow(non_snake_case)] deviceName: Option, + deviceName: Option, + unrestrictedUnidentifiedSender: Option, ) -> Result; #[method(name = "updateConfiguration", param_kind = map)] fn update_configuration( &self, account: Option, - #[allow(non_snake_case)] readReceiptes: Option, + #[allow(non_snake_case)] readReceipts: Option, #[allow(non_snake_case)] unidentifiedDeliveryIndicators: Option, #[allow(non_snake_case)] typingIndicators: Option, #[allow(non_snake_case)] linkPreviews: Option, @@ -327,7 +373,9 @@ pub struct JsonLink { pub device_link_uri: String, } -pub async fn connect_tcp(tcp: impl ToSocketAddrs) -> Result { +pub async fn connect_tcp( + tcp: impl ToSocketAddrs, +) -> Result { let (sender, receiver) = super::transports::tcp::connect(tcp).await?; Ok(ClientBuilder::default().build_with_tokio(sender, receiver)) @@ -335,7 +383,7 @@ pub async fn connect_tcp(tcp: impl ToSocketAddrs) -> Result, -) -> Result { +) -> Result { let (sender, receiver) = super::transports::ipc::connect(socket_path).await?; Ok(ClientBuilder::default().build_with_tokio(sender, receiver))