From daffe24734e6b7b8a24ab6a2074d627012e1f84e Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 14 Aug 2021 15:35:38 +0200 Subject: [PATCH] Increment version and update documentation Signed-off-by: trivernis --- Cargo.toml | 2 +- README.md | 12 +++++++----- src/lib.rs | 13 ++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a4f09d6..6f3c35f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydrus-api" -version = "0.4.0" +version = "0.5.0" authors = ["trivernis "] edition = "2018" license = "Apache-2.0" diff --git a/README.md b/README.md index 9041978..04d2258 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ 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::search_builder::SortType; use hydrus_api::wrapper::builders::tag_builder::{ SystemTagBuilder, Comparator }; @@ -33,11 +34,12 @@ 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(vec![ - Tag::from("character:megumin"), - SystemTagBuilder::new().archive().build(), - SystemTagBuilder::new().number_of_tags(Comparator::Greater, 12).build(), - ]).await.unwrap(); + let files = hydrus.search() + .add_tag(Tag::from("character:megumin")) + .add_tag(SystemTagBuilder::new().archive().build()) + .add_tag(SystemTagBuilder::new().number_of_tags(Comparator::Greater, 12).build()) + .sort(SortType::ModifiedTime) + .run().await.unwrap(); for mut file in files { file.add_tags(ServiceName::my_tags(), vec![Tag::from("ark mage")]).await.unwrap(); diff --git a/src/lib.rs b/src/lib.rs index e42b011..c9f8f5f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,17 +13,20 @@ //! use hydrus_api::wrapper::hydrus_file::FileStatus; //! use hydrus_api::wrapper::page::PageIdentifier; //! use hydrus_api::wrapper::builders::tag_builder::{SystemTagBuilder, Comparator}; +//! use hydrus_api::wrapper::builders::search_builder::SortType; //! //! # #[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"), -//! SystemTagBuilder::new().archive().build(), -//! SystemTagBuilder::new().tag_namespace_as_number("page", Comparator::Equal, 5).negate().build(), -//! ]).await.unwrap(); +//! let files = hydrus.search() +//! .add_tag(Tag::from("character:megumin")) +//! .add_tag(SystemTagBuilder::new().archive().build()) +//! .add_tag(SystemTagBuilder::new().tag_namespace_as_number("page", Comparator::Equal, 5).negate().build()) +//! .sort_by(SortType::NumberOfPixels) +//! .sort_descending() +//! .run().await.unwrap(); //! //! for mut file in files { //! file.add_tags(ServiceName::my_tags(), vec![Tag::from("ark mage")]).await.unwrap();