X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/7b5b5776f014db0ad18fb6af909c63bbf2293c88..3d4070a13907152b312c863a2ea885ac57935365:/client/src/jsonrpc.rs?ds=sidebyside diff --git a/client/src/jsonrpc.rs b/client/src/jsonrpc.rs index e3031bf3..6874652d 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,16 +39,53 @@ 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, + #[allow(non_snake_case)] groupId: Option, + ) -> Result; + + #[method(name = "getAvatar", param_kind = map)] + fn get_avatar( + &self, + account: Option, + contact: Option, + profile: Option, + #[allow(non_snake_case)] groupId: Option, + ) -> Result; + + #[method(name = "getSticker", param_kind = map)] + fn get_sticker( + &self, + account: Option, + #[allow(non_snake_case)] packId: String, + #[allow(non_snake_case)] stickerId: u32, + ) -> Result; + #[method(name = "getUserStatus", param_kind = map)] fn get_user_status( &self, account: Option, recipients: Vec, + usernames: Vec, ) -> Result; #[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 +149,7 @@ pub trait Rpc { account: Option, recipient: String, forget: bool, + hide: bool, ) -> Result; #[method(name = "removeDevice", param_kind = map)] @@ -128,25 +172,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, - #[allow(non_snake_case)] quoteAttachment: 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)] @@ -196,6 +248,15 @@ pub trait Rpc { stop: bool, ) -> Result; + #[method(name = "sendMessageRequestResponse", param_kind = map)] + fn send_message_request_response( + &self, + account: Option, + recipients: Vec, + #[allow(non_snake_case)] groupIds: Vec, + r#type: String, + ) -> Result; + #[method(name = "setPin", param_kind = map)] fn set_pin(&self, account: Option, pin: String) -> Result; @@ -207,6 +268,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; @@ -234,18 +304,22 @@ 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, + discoverableByNumber: Option, + numberSharing: 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, @@ -328,20 +402,23 @@ 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)) } +#[cfg(unix)] pub async fn connect_unix( socket_path: impl AsRef, -) -> Result { +) -> Result { let (sender, receiver) = super::transports::ipc::connect(socket_path).await?; Ok(ClientBuilder::default().build_with_tokio(sender, receiver)) } -pub async fn connect_http(uri: &str) -> Result { +pub async fn connect_http(uri: &str) -> Result, Error> { HttpClientBuilder::default().build(uri) }