2 unstable releases
0.2.0 | Feb 4, 2024 |
---|---|
0.1.0 | Nov 14, 2023 |
#41 in #post
Used in gemfreely
53KB
787 lines
writefreely-client.rs
An opinionated WriteFreely API client library in Rust. It implements most of the documented API, with workarounds where necessary. It is not a strict implementation, but rather one that tries to be practical.
Example
use writefreely_client::{error::Error, post::PostCreateRequest, Client};
const MARK: &str = "🐾";
#[tokio::main]
async fn main() -> Result<(), Error> {
let client = Client::new("http://localhost:8080")?
.login("username", "password")
.await?;
let posts = client.posts().list().await?;
let paw_prints = posts.iter().any(|post| post.body.contains(MARK));
if !paw_prints {
client
.posts()
.create(
PostCreateRequest::new()
.title("Footprints in the snow")
.body(MARK),
)
.await?;
println!("{} Woof.", MARK);
} else {
println!("{} Been there, done that. Woof, nevertheless.", MARK);
}
Ok(())
}
For more information, see the examples, or the documentation.
Dependencies
~6–19MB
~280K SLoC