use crate::toolkit;
use crate::x_api::XApiClient;
use super::WorkflowError;
#[derive(Debug, Clone)]
pub struct PublishOutput {
pub tweet_id: String,
pub text: String,
}
pub async fn reply(
x_client: &dyn XApiClient,
text: &str,
in_reply_to_id: &str,
) -> Result<PublishOutput, WorkflowError> {
let posted = toolkit::write::reply_to_tweet(x_client, text, in_reply_to_id, None).await?;
Ok(PublishOutput {
tweet_id: posted.id,
text: posted.text,
})
}
pub async fn tweet(x_client: &dyn XApiClient, text: &str) -> Result<PublishOutput, WorkflowError> {
let posted = toolkit::write::post_tweet(x_client, text, None).await?;
Ok(PublishOutput {
tweet_id: posted.id,
text: posted.text,
})
}
pub async fn thread(
x_client: &dyn XApiClient,
tweets: &[String],
) -> Result<Vec<String>, WorkflowError> {
let ids = toolkit::write::post_thread(x_client, tweets, None).await?;
Ok(ids)
}