Update README and doccomments

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/2/head
trivernis 3 years ago
parent e06f87722e
commit 6a0df2c7fb
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -6,8 +6,9 @@ The official API documentation can be found [here](https://hydrusnetwork.github.
## Example
```rust
use hydrus_api_rs::Client;
use hydrus_api::Client;
use hydrus_api::paths::adding_tags::{AddTagsRequestBuilder, TagAction};
use std::env;
#[tokio::main]
async fn main() {

@ -1,3 +1,36 @@
//! ## About
//! This crate provides a rust wrapper for the hydrus client API. All request require an access
//! token that can be retrieved in the hydrus client from the *review services* dialog.
//! Different actions require different permissions, you can read about it in the [official docs](https://hydrusnetwork.github.io/hydrus/help/client_api.html).
//!
//! ## Usage Example
//! ```
//! use hydrus_api::Client;
//! use hydrus_api::paths::adding_tags::{AddTagsRequestBuilder, TagAction};
//! use std::env;
//! # #[tokio::test]
//! # async fn doctest() {
//!
//! 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();
//! # }
//! ```
#[macro_use]
extern crate serde_derive;

Loading…
Cancel
Save