Working on publish_description
This commit is contained in:
parent
4701c72f6a
commit
c12ea2c8c1
|
@ -33,6 +33,9 @@ async fn run() -> Result<(), GolgiError> {
|
||||||
let post_msg_ref = sbot_client.publish(post).await?;
|
let post_msg_ref = sbot_client.publish(post).await?;
|
||||||
println!("{}", post_msg_ref);
|
println!("{}", post_msg_ref);
|
||||||
|
|
||||||
|
let post_msg_ref = sbot_client.publish_description("this is a description").await?;
|
||||||
|
println!("description: {}", post_msg_ref);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
src/sbot.rs
20
src/sbot.rs
|
@ -122,6 +122,26 @@ impl Sbot {
|
||||||
self.publish(msg).await
|
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> {
|
pub async fn publish_post(&mut self, post: Post) -> Result<String, GolgiError> {
|
||||||
let req_id = self.client.publish_req_send(post).await?;
|
let req_id = self.client.publish_req_send(post).await?;
|
||||||
|
|
Loading…
Reference in New Issue