Working on friends methods

This commit is contained in:
notplants 2022-01-14 16:24:11 -05:00
parent 6fd27827a0
commit bacd954fa0
1 changed files with 26 additions and 0 deletions

View File

@ -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<String, GolgiError> {
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<String, GolgiError> {
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