]> nmode's Git Repositories - signal-cli/blobdiff - client/src/jsonrpc.rs
Fix send parameters to be all camel case
[signal-cli] / client / src / jsonrpc.rs
index cd2573053218abbdd27a194baa8d42cf77cc8bd3..66ef9d9de831d51f2440acbce34b42b1d9764250 100644 (file)
@@ -1,8 +1,7 @@
 use std::path::Path;
 
 use jsonrpsee::async_client::ClientBuilder;
 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;
 use jsonrpsee::http_client::HttpClientBuilder;
 use jsonrpsee::proc_macros::rpc;
 use serde::Deserialize;
@@ -18,6 +17,13 @@ pub trait Rpc {
         uri: String,
     ) -> Result<Value, ErrorObjectOwned>;
 
         uri: String,
     ) -> Result<Value, ErrorObjectOwned>;
 
+    #[method(name = "addStickerPack", param_kind = map)]
+    async fn add_sticker_pack(
+        &self,
+        account: Option<String>,
+        uri: String,
+    ) -> Result<Value, ErrorObjectOwned>;
+
     #[method(name = "block", param_kind = map)]
     fn block(
         &self,
     #[method(name = "block", param_kind = map)]
     fn block(
         &self,
@@ -33,16 +39,53 @@ pub trait Rpc {
         #[allow(non_snake_case)] ignoreRegistered: Option<bool>,
     ) -> Result<Value, ErrorObjectOwned>;
 
         #[allow(non_snake_case)] ignoreRegistered: Option<bool>,
     ) -> Result<Value, ErrorObjectOwned>;
 
+    #[method(name = "getAttachment", param_kind = map)]
+    fn get_attachment(
+        &self,
+        account: Option<String>,
+        id: String,
+        recipient: Option<String>,
+        #[allow(non_snake_case)] groupId: Option<String>,
+    ) -> Result<Value, ErrorObjectOwned>;
+
+    #[method(name = "getAvatar", param_kind = map)]
+    fn get_avatar(
+        &self,
+        account: Option<String>,
+        contact: Option<String>,
+        profile: Option<String>,
+        #[allow(non_snake_case)] groupId: Option<String>,
+    ) -> Result<Value, ErrorObjectOwned>;
+
+    #[method(name = "getSticker", param_kind = map)]
+    fn get_sticker(
+        &self,
+        account: Option<String>,
+        #[allow(non_snake_case)] packId: String,
+        #[allow(non_snake_case)] stickerId: u32,
+    ) -> Result<Value, ErrorObjectOwned>;
+
     #[method(name = "getUserStatus", param_kind = map)]
     fn get_user_status(
         &self,
         account: Option<String>,
         recipients: Vec<String>,
     #[method(name = "getUserStatus", param_kind = map)]
     fn get_user_status(
         &self,
         account: Option<String>,
         recipients: Vec<String>,
+        usernames: Vec<String>,
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "joinGroup", param_kind = map)]
     fn join_group(&self, account: Option<String>, uri: String) -> Result<Value, ErrorObjectOwned>;
 
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "joinGroup", param_kind = map)]
     fn join_group(&self, account: Option<String>, uri: String) -> Result<Value, ErrorObjectOwned>;
 
+    #[allow(non_snake_case)]
+    #[method(name = "finishChangeNumber", param_kind = map)]
+    fn finish_change_number(
+        &self,
+        account: Option<String>,
+        number: String,
+        verificationCode: String,
+        pin: Option<String>,
+    ) -> Result<Value, ErrorObjectOwned>;
+
     #[method(name = "finishLink", param_kind = map)]
     fn finish_link(
         &self,
     #[method(name = "finishLink", param_kind = map)]
     fn finish_link(
         &self,
@@ -106,6 +149,7 @@ pub trait Rpc {
         account: Option<String>,
         recipient: String,
         forget: bool,
         account: Option<String>,
         recipient: String,
         forget: bool,
+        hide: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "removeDevice", param_kind = map)]
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "removeDevice", param_kind = map)]
@@ -128,24 +172,34 @@ pub trait Rpc {
         #[allow(non_snake_case)] noteToSelf: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
         #[allow(non_snake_case)] noteToSelf: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
+    #[allow(non_snake_case)]
     #[method(name = "send", param_kind = map)]
     fn send(
         &self,
         account: Option<String>,
         recipients: Vec<String>,
     #[method(name = "send", param_kind = map)]
     fn send(
         &self,
         account: Option<String>,
         recipients: Vec<String>,
-        #[allow(non_snake_case)] groupIds: Vec<String>,
-        #[allow(non_snake_case)] noteToSelf: bool,
-        #[allow(non_snake_case)] endSession: bool,
+        groupIds: Vec<String>,
+        noteToSelf: bool,
+        endSession: bool,
         message: String,
         attachments: Vec<String>,
         message: String,
         attachments: Vec<String>,
+        viewOnce: bool,
         mentions: Vec<String>,
         mentions: 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>,
+        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>,
         sticker: Option<String>,
         sticker: Option<String>,
-        #[allow(non_snake_case)] storyTimestamp: Option<u64>,
-        #[allow(non_snake_case)] storyAuthor: Option<String>,
+        storyTimestamp: Option<u64>,
+        storyAuthor: Option<String>,
+        editTimestamp: Option<u64>,
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "sendContacts", param_kind = map)]
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "sendContacts", param_kind = map)]
@@ -195,6 +249,15 @@ pub trait Rpc {
         stop: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
         stop: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
+    #[method(name = "sendMessageRequestResponse", param_kind = map)]
+    fn send_message_request_response(
+        &self,
+        account: Option<String>,
+        recipients: Vec<String>,
+        #[allow(non_snake_case)] groupIds: Vec<String>,
+        r#type: String,
+    ) -> Result<Value, ErrorObjectOwned>;
+
     #[method(name = "setPin", param_kind = map)]
     fn set_pin(&self, account: Option<String>, pin: String) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "setPin", param_kind = map)]
     fn set_pin(&self, account: Option<String>, pin: String) -> Result<Value, ErrorObjectOwned>;
 
@@ -206,6 +269,15 @@ pub trait Rpc {
         captcha: String,
     ) -> Result<Value, ErrorObjectOwned>;
 
         captcha: String,
     ) -> Result<Value, ErrorObjectOwned>;
 
+    #[method(name = "startChangeNumber", param_kind = map)]
+    fn start_change_number(
+        &self,
+        account: Option<String>,
+        number: String,
+        voice: bool,
+        captcha: Option<String>,
+    ) -> Result<Value, ErrorObjectOwned>;
+
     #[method(name = "startLink", param_kind = map)]
     fn start_link(&self, account: Option<String>) -> Result<JsonLink, ErrorObjectOwned>;
 
     #[method(name = "startLink", param_kind = map)]
     fn start_link(&self, account: Option<String>) -> Result<JsonLink, ErrorObjectOwned>;
 
@@ -233,18 +305,22 @@ pub trait Rpc {
         #[allow(non_snake_case)] deleteAccount: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
         #[allow(non_snake_case)] deleteAccount: bool,
     ) -> Result<Value, ErrorObjectOwned>;
 
+    #[allow(non_snake_case)]
     #[method(name = "updateAccount", param_kind = map)]
     fn update_account(
         &self,
         account: Option<String>,
     #[method(name = "updateAccount", param_kind = map)]
     fn update_account(
         &self,
         account: Option<String>,
-        #[allow(non_snake_case)] deviceName: Option<String>,
+        deviceName: Option<String>,
+        unrestrictedUnidentifiedSender: Option<bool>,
+        discoverableByNumber: Option<bool>,
+        numberSharing: Option<bool>,
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "updateConfiguration", param_kind = map)]
     fn update_configuration(
         &self,
         account: Option<String>,
     ) -> Result<Value, ErrorObjectOwned>;
 
     #[method(name = "updateConfiguration", param_kind = map)]
     fn update_configuration(
         &self,
         account: Option<String>,
-        #[allow(non_snake_case)] readReceiptes: Option<bool>,
+        #[allow(non_snake_case)] readReceipts: Option<bool>,
         #[allow(non_snake_case)] unidentifiedDeliveryIndicators: Option<bool>,
         #[allow(non_snake_case)] typingIndicators: Option<bool>,
         #[allow(non_snake_case)] linkPreviews: Option<bool>,
         #[allow(non_snake_case)] unidentifiedDeliveryIndicators: Option<bool>,
         #[allow(non_snake_case)] typingIndicators: Option<bool>,
         #[allow(non_snake_case)] linkPreviews: Option<bool>,
@@ -327,20 +403,23 @@ pub struct JsonLink {
     pub device_link_uri: String,
 }
 
     pub device_link_uri: String,
 }
 
-pub async fn connect_tcp(tcp: impl ToSocketAddrs) -> Result<impl SubscriptionClientT, Error> {
+pub async fn connect_tcp(
+    tcp: impl ToSocketAddrs,
+) -> Result<impl SubscriptionClientT, std::io::Error> {
     let (sender, receiver) = super::transports::tcp::connect(tcp).await?;
 
     Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
 }
 
     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<Path>,
 pub async fn connect_unix(
     socket_path: impl AsRef<Path>,
-) -> Result<impl SubscriptionClientT, Error> {
+) -> Result<impl SubscriptionClientT, std::io::Error> {
     let (sender, receiver) = super::transports::ipc::connect(socket_path).await?;
 
     Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
 }
 
     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<impl SubscriptionClientT, Error> {
+pub async fn connect_http(uri: &str) -> Result<impl SubscriptionClientT + use<>, Error> {
     HttpClientBuilder::default().build(uri)
 }
     HttpClientBuilder::default().build(uri)
 }