shapelessai 0.1.11

Rust client for the ShapelessAI API: list connected social accounts, schedule posts to X, LinkedIn, Instagram, TikTok, YouTube, Threads, Bluesky and Facebook, read post status.
Documentation
//! Live check against prod: schedules a post for 2027 on the first account and cancels it at once.
#[tokio::main]
async fn main() -> Result<(), shapelessai::Error> {
    let c = shapelessai::Client::from_env()?;
    match shapelessai::Client::new("slk_wrong").accounts().await {
        Err(shapelessai::Error::Unauthorized) => println!("bad key refused: ok"),
        other => panic!("bad key not refused: {other:?}"),
    }
    let accounts = c.accounts().await?;
    println!("{} accounts", accounts.len());
    let bsky = accounts.iter().find(|a| a.platform == "bluesky").unwrap_or(&accounts[0]);
    let p = c.create_post(&shapelessai::NewPost::at(&bsky.id, "rust crate test, cancelled at once", "2027-03-01T12:00:00Z")).await?;
    println!("created {} {} {:?}", p.id, p.status, p.scheduled_at);
    let listed = c.posts(Some("scheduled"), 50).await?.iter().any(|x| x.id == p.id);
    println!("listed: {listed}");
    c.cancel_post(&p.id).await?;
    let after = c.posts(Some("canceled"), 50).await?.iter().any(|x| x.id == p.id);
    println!("canceled: {after}");
    assert!(listed && after);
    Ok(())
}