diff --git a/src/sbot.rs b/src/sbot.rs index 5d05c25..c7f72be 100644 --- a/src/sbot.rs +++ b/src/sbot.rs @@ -180,6 +180,32 @@ impl Sbot { .await } + /// Call the `friends follow` RPC method and return a message reference. + pub async fn friends_follow(&mut self, ssb_id: &str) -> Result { + let mut sbot_connection = self.get_sbot_connection().await?; + let req_id = sbot_connection.client.friends_follow_req_send(ssb_id).await?; + + utils::get_async( + &mut sbot_connection.rpc_reader, + req_id, + utils::string_res_parse, + ) + .await + } + + /// Call the `friends isfollowing` RPC method and return a message reference. + /// returns true if src_id is following dest_id and false otherwise + pub async fn friends_is_following(&mut self, src_id: &str, dest_id: &str) -> Result { + let mut sbot_connection = self.get_sbot_connection().await?; + let req_id = sbot_connection.client.friends_isfollowing_req_send(src_id, dest_id).await?; + + utils::get_async( + &mut sbot_connection.rpc_reader, + req_id, + utils::string_res_parse, + ).await + } + /// Wrapper for publish which constructs and publishes a post message appropriately from a string. /// /// # Arguments