This crate provides an oauth 1.0a client implementation fully-async with logging, metrics and tracing facilities. It was firstly designed to interact with the Clever-Cloud's api, but has been extended to be more generic.
This crate is under development, you can use it, but it may have bugs or unimplemented features.
To install this dependency, just add the following line to your Cargo.toml
manifest.
toml
oauth10a = { version = "^1.0.0", features = ["telemetry"] }
Below, you will find an example of executing a simple request to an api.
```rust use std::error::Error;
use oauth10a::client::{Client, Credentials, RestClient};
async fn main() -> Result<(), Box
let _obj: BtreeMap<String, String> = client.get("https://example.com/object.json").await?;
Ok(())
} ```
| name | description |
| --------- | ------------------------------------------------------------- |
| client | The oauth 1.0a client implementation |
| logging | Use the log
facility crate to print logs |
| metrics | Use lazy_static
and prometheus
crates to register metrics |
Below, the exposed metrics gathered by prometheus:
| name | labels | kind | description | | -------------------------------- | --------------------------------------------------------------- | ------- | -------------------------- | | oauth10aclientrequest | endpoint: String, method: String, status: Integer | Counter | number of request on api | | oauth10aclientrequest_duration | endpoint: String, method: String, status: Integer, unit: String | Counter | duration of request on api |
See the license.