Crates.io | ddclient-rs |
lib.rs | ddclient-rs |
version | 0.1.3 |
source | src |
created_at | 2023-12-19 21:55:22.988301 |
updated_at | 2024-01-22 17:36:44.837719 |
description | A Rust client library for the Direct Decisions API. |
homepage | https://directdecisions.com/ |
repository | https://github.com/directdecisions/ddclient-rs |
max_upload_size | |
id | 1074656 |
size | 109,900 |
A client library for accessing the Direct Decisions v1 API.
You can view Direct Decisions API v1 docs here: https://api.directdecisions.com/v1
This is an asynchronous Rust client using reqwest
. The plan in the future is to also provide a blocking(sync) version and a support for other HTTP clients as well.
The async client uses tokio
and reqwest
as dependencies. To use it you would need to setup your Cargo.toml
to something like this:
[dependencies]
ddclient = "0.1.1"
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }
And then use it in your code:
#[tokio::main]
async fn main() -> Result<(), ApiError> {
let client = Client::new("my-api-key".to_string());
let v = client
.create_voting(vec![
"Einstein".to_string(),
"Maxwell".to_string(),
"Newton".to_string(),
])
.await?;
Ok(())
}
This client implements all Direct API features.
Feel free to check out the examples in the examples
directory. These examples cover both regular flow and error handling. Also, for specific errors you can check out the tests
directory and APIError
enum.
Each version of the client is tagged and the version is updated accordingly.
To see the list of past versions, run git tag
.
We love pull requests! Please see the contribution guidelines.
This library is distributed under the BSD-style license found in the LICENSE file.