# fw-client

This library provides an API client to [Flywheel](https://docs.flywheel.io/) for the
[Rust programming language](https://www.rust-lang.org/)

This library is a fairly thin wrapper around the rust
[reqwest](https://docs.rs/reqwest/latest/reqwest/) ecosystem.

The `FWClient` struct provides a simple API client, but also

* Handles Flywheel authentication
* Provides tracing via [reqwest-tracing](https://docs.rs/reqwest-tracing/0.5.8/reqwest_tracing/)
* Provides retries via [reqwest-retry](https://docs.rs/reqwest-retry/0.7.0/reqwest_retry/)

## Getting started

You can add this library as dependency with `cargo add fw-client`

## Usage

The `FWClientBuilder` can be used to create the `FWClient`

```rust
use fw_client::{FWClientBuilder,FWClient};

let client = FWClientBuilder::new("flywheel.site:my-api-key".parse().unwrap())
    .client_name("My cool app")
    .client_version("0.1.0")
    .build()
    .expect("Could not build FWClient");

let user_info = client
    .get("/api/users/self")
    .send()
    .await
    .expect("Request failed")
    .json::<serde_json::Value>()
    .await
    .expect("Failed to parse response as JSON");
```

## Minimum Supported Rust Version (MSRV)

Minimum tested rust version is `1.82.0`
