From e2c97a8272bda7b5874f7b9039a8c0507b442ac3 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 4 Jul 2021 16:26:32 +0200 Subject: [PATCH] Add README and Crates.io metadata Signed-off-by: trivernis --- Cargo.toml | 4 ++++ README.md | 36 ++++++++++++++++++++++++++++++++++++ src/lib.rs | 2 ++ tests/test_adding_tags.rs | 1 - 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/Cargo.toml b/Cargo.toml index 7e101b9..466065e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,10 @@ name = "hydrus-api" version = "0.1.0" authors = ["trivernis "] edition = "2018" +license = "Apache-2.0" +readme = "README.md" +description = "A rust wrapper for the hydrus client api" +repository = "https://github.com/trivernis/hydrus-api-rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..24165a3 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Hydrus Rust API + +This is a WIP Rust Wrapper for the Hydrus Client API. +The official API documentation can be found [here](https://hydrusnetwork.github.io/hydrus/help/client_api.html). + +## Example + +```rust + +use hydrus_api_rs::Client; + +#[tokio::main] +async fn main() { + Client::new( + env::var("HYDRUS_URL").unwrap(), + env::var("HYDRUS_ACCESS_KEY").unwrap(), + ).unwrap(); + // let's first import a file + let hash = client.add_file("/path/to/my/file").await.unwrap().hash; + + // and now let's add tags to it + let request = AddTagsRequestBuilder::default() + .add_hash(hash) + // for each tag the service has to be specified + .add_tags("my tags", vec!["beach".into(), "summer".into()]) + // with tag actions tags can also be removed. It's especially useful for the PTR + .add_tag_with_action("my tags", "rain", TagAction::DeleteFromLocalService) + .build(); + + client.add_tags(request).await.unwrap(); +} +``` + +## License + +Apache-2.0 \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index fe75431..daf30ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,3 +5,5 @@ pub mod client; mod error; pub mod paths; pub(crate) mod utils; + +pub use client::Client; diff --git a/tests/test_adding_tags.rs b/tests/test_adding_tags.rs index 8828f49..15aa1d9 100644 --- a/tests/test_adding_tags.rs +++ b/tests/test_adding_tags.rs @@ -1,5 +1,4 @@ use hydrus_api::paths::adding_tags::{AddTagsRequestBuilder, TagAction}; - mod common; #[tokio::test]