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;
account: Option<String>,
id: String,
recipient: Option<String>,
- group_id: 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)]
&self,
account: Option<String>,
recipients: Vec<String>,
+ usernames: Vec<String>,
) -> Result<Value, ErrorObjectOwned>;
#[method(name = "joinGroup", param_kind = map)]
endSession: bool,
message: String,
attachments: Vec<String>,
+ viewOnce: bool,
mentions: Vec<String>,
textStyle: Vec<String>,
quoteTimestamp: Option<u64>,
quoteMention: Vec<String>,
quoteTextStyle: Vec<String>,
quoteAttachment: Vec<String>,
- preview_url: Option<String>,
- preview_title: Option<String>,
- preview_description: Option<String>,
- preview_image: Option<String>,
+ previewUrl: Option<String>,
+ previewTitle: Option<String>,
+ previewDescription: Option<String>,
+ previewImage: Option<String>,
sticker: Option<String>,
storyTimestamp: Option<u64>,
storyAuthor: Option<String>,
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>;
account: Option<String>,
deviceName: Option<String>,
unrestrictedUnidentifiedSender: Option<bool>,
+ discoverableByNumber: Option<bool>,
+ numberSharing: Option<bool>,
) -> Result<Value, ErrorObjectOwned>;
#[method(name = "updateConfiguration", param_kind = map)]
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))
}
+#[cfg(unix)]
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))
}
-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)
}