Update docs for new tag builder

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent f1a423f721
commit 382019c4be
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -23,6 +23,9 @@ use hydrus_api::wrapper::tag::Tag;
use hydrus_api::wrapper::service::ServiceName;
use hydrus_api::wrapper::hydrus_file::FileStatus;
use hydrus_api::wrapper::page::PageIdentifier;
use hydrus_api::wrapper::builders::tag_builder::{
SystemTagBuilder, Comparator
};
#[tokio::main]
async fn main() {
@ -30,7 +33,11 @@ async fn main() {
let access_key = env::var("HYDRUS_ACCESS_KEY").unwrap();
let hydrus = Hydrus::new(Client::new(hydrus_url, access_key));
let files = hydrus.search(FileSearchLocation::Archive,vec![Tag::from("character:megumin")]).await.unwrap();
let files = hydrus.search(FileSearchLocation::Archive,vec![
Tag::from("character:megumin"),
SystemTagBuilder::new().archive().build(),
SystemTagBuilder::new().number_of_tags(Comparator::Greater, 12).build(),
]).await.unwrap();
for mut file in files {
file.add_tags(ServiceName::my_tags(), vec![Tag::from("ark mage")]).await.unwrap();

@ -12,13 +12,18 @@
//! use hydrus_api::wrapper::service::ServiceName;
//! use hydrus_api::wrapper::hydrus_file::FileStatus;
//! use hydrus_api::wrapper::page::PageIdentifier;
//! use hydrus_api::wrapper::builders::tag_builder::{SystemTagBuilder, Comparator};
//!
//! # #[tokio::test]
//! # async fn doctest() {
//! let hydrus_url = env::var("HYDRUS_URL").unwrap();
//! let access_key = env::var("HYDRUS_ACCESS_KEY").unwrap();
//! let hydrus = Hydrus::new(Client::new(hydrus_url, access_key));
//! let files = hydrus.search(vec![Tag::from("character:megumin")]).await.unwrap();
//! let files = hydrus.search(vec![
//! Tag::from("character:megumin"),
//! SystemTagBuilder::new().archive().build(),
//! SystemTagBuilder::new().tag_namespace_as_number("page", Comparator::Equal, 5).negate().build(),
//! ]).await.unwrap();
//!
//! for mut file in files {
//! file.add_tags(ServiceName::my_tags(), vec![Tag::from("ark mage")]).await.unwrap();

@ -21,6 +21,12 @@ async fn it_returns_everything() {
retrieve_single_tag(tag).await.unwrap();
}
#[tokio::test]
async fn it_returns_everything_negated() {
let tag = SystemTagBuilder::new().everything().negate().build();
retrieve_single_tag(tag).await.unwrap();
}
#[tokio::test]
async fn it_returns_the_inbox() {
let tag = SystemTagBuilder::new().inbox().build();

Loading…
Cancel
Save