writefreely_client 0.1.0

WriteFreely API client library
Documentation
writefreely-client.rs
=====================

[![Build status][ci:badge]][ci:url]
[![Tested with: writefreely 0.14.0][tested:badge]][tested:url]
[![Documentation][docs:badge]][docs:url]
[![Crates.io release][crate:badge]][crate:url]

 [ci:badge]: https://ironforge.madhouse-project.org/actions/algernon/writefreely-client.rs/badge
 [ci:url]: https://ironforge.madhouse-project.org/actions/algernon/writefreely-client.rs/latest-log
 [tested:badge]: https://img.shields.io/badge/tested%20with-writefreely%200.14.0-blue?style=for-the-badge
 [tested:url]: https://github.com/writefreely/writefreely/releases/tag/v0.14.0
 [docs:badge]: https://img.shields.io/docsrs/writefreely_client?style=for-the-badge
 [docs:url]: https://docs.rs/writefreely_client/latest/writefreely_client/
 [crate:badge]: https://img.shields.io/crates/v/writefreely_client?style=for-the-badge
 [crate:url]: https://crates.io/crates/writefreely_client

An opinionated [WriteFreely][writefreely] API client library in Rust. It implements most of the [documented API][writefreely:api-docs], with workarounds where necessary. It is *not* a strict implementation, but rather one that tries to be practical.

 [writefreely]: https://writefreely.org/
 [writefreely:api-docs]: https://developers.write.as/docs/api/#introduction

### Example

```rust
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](examples/), or the documentation.