Working on publish_description

This commit is contained in:
notplants 2021-12-22 16:19:52 -05:00
parent 4701c72f6a
commit c12ea2c8c1
2 changed files with 23 additions and 0 deletions

View File

@ -33,6 +33,9 @@ async fn run() -> Result<(), GolgiError> {
let post_msg_ref = sbot_client.publish(post).await?;
println!("{}", post_msg_ref);
let post_msg_ref = sbot_client.publish_description("this is a description").await?;
println!("description: {}", post_msg_ref);
Ok(())
}

View File

@ -122,6 +122,26 @@ impl Sbot {
self.publish(msg).await
}
/// Wrapper for publish which constructs and publishes an about description message appropriately from a string.
///
/// # Arguments
///
/// * `description` - A &str which represents the text to be published as an about description.
pub async fn publish_description(&mut self, description: &str) -> Result<String, GolgiError> {
let msg = TypedMessage::About {
about: self.id.to_string(),
name: None,
title: None,
branch: None,
image: None,
description: Some(description.to_string()),
location: None,
start_datetime: None,
};
self.publish(msg).await
}
/*
pub async fn publish_post(&mut self, post: Post) -> Result<String, GolgiError> {
let req_id = self.client.publish_req_send(post).await?;