A rust wrapper for the hydrus client api
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
trivernis d3b4093f93
Add retrieval of its bytes to the file struct
Signed-off-by: trivernis <trivernis@protonmail.com>
3 years ago
.idea Add access management functions 3 years ago
src Add retrieval of its bytes to the file struct 3 years ago
tests Add retrieval of its bytes to the file struct 3 years ago
.gitignore Add access management functions 3 years ago
Cargo.toml Increment version 3 years ago
LICENSE Create LICENSE 3 years ago
README.md Update README and doccomments 3 years ago

README.md

Hydrus Rust API

This is a WIP Rust Wrapper for the Hydrus Client API. The official API documentation can be found here.

Example

use hydrus_api::Client;
use hydrus_api::paths::adding_tags::{AddTagsRequestBuilder, TagAction};
use std::env;

#[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