Add publish_post method
This commit is contained in:
parent
ee2949f1b8
commit
5b72de0b2b
|
@ -24,6 +24,8 @@
|
|||
//! }
|
||||
//! ```
|
||||
|
||||
extern crate kuska_ssb;
|
||||
|
||||
pub mod error;
|
||||
pub mod sbot;
|
||||
mod utils;
|
||||
|
|
10
src/sbot.rs
10
src/sbot.rs
|
@ -113,6 +113,16 @@ impl Sbot {
|
|||
utils::get_async(&mut self.rpc_reader, req_id, utils::publish_res_parse).await
|
||||
}
|
||||
|
||||
/// Wrapper for publish which constructs and publish a post message appropriately from a string.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `text` - A &str which represents the text to be published in the post
|
||||
pub async fn publish_post(&mut self, text: &str) -> Result<String, GolgiError> {
|
||||
let msg = TypedMessage::Post{ text: text.to_string(), mentions: 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?;
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::fmt::Debug;
|
|||
|
||||
use async_std::io::Read;
|
||||
|
||||
use kuska_ssb::api::dto::{PublishOut, WhoAmIOut};
|
||||
use kuska_ssb::api::dto::{WhoAmIOut};
|
||||
use kuska_ssb::feed::Feed;
|
||||
use kuska_ssb::rpc::{RecvMsg, RequestNo, RpcReader};
|
||||
|
||||
|
|
Loading…
Reference in New Issue