From b7295fb7bcc568a3269150bf427e4bda37272dbb Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 1 May 2022 09:57:31 +0200 Subject: [PATCH] Change wrapped search to operate on hashes instead Signed-off-by: trivernis --- Cargo.toml | 2 +- src/wrapper/builders/search_builder.rs | 6 +++--- src/wrapper/hydrus_file.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ba7a232..1500f3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydrus-api" -version = "0.9.1" +version = "0.9.2" authors = ["trivernis "] edition = "2018" license = "Apache-2.0" diff --git a/src/wrapper/builders/search_builder.rs b/src/wrapper/builders/search_builder.rs index 4443138..14cd3c8 100644 --- a/src/wrapper/builders/search_builder.rs +++ b/src/wrapper/builders/search_builder.rs @@ -123,11 +123,11 @@ impl SearchBuilder { .map(|c| SearchQueryEntry::OrChain(c.into_string_list())) .collect(), ); - let response = client.search_files(entries, self.options).await?; + let response = client.search_file_hashes(entries, self.options).await?; let files = response - .file_ids + .hashes .into_iter() - .map(|id| HydrusFile::from_id(client.clone(), id)) + .map(|hash| HydrusFile::from_hash(client.clone(), hash)) .collect(); Ok(files) diff --git a/src/wrapper/hydrus_file.rs b/src/wrapper/hydrus_file.rs index fd9ab1e..a0f09c1 100644 --- a/src/wrapper/hydrus_file.rs +++ b/src/wrapper/hydrus_file.rs @@ -43,10 +43,10 @@ pub struct HydrusFile { } impl HydrusFile { - pub(crate) fn from_id(client: Client, id: u64) -> Self { + pub(crate) fn from_hash(client: Client, hash: S) -> Self { Self { client, - id: FileIdentifier::ID(id), + id: FileIdentifier::Hash(hash.to_string()), status: FileStatus::Unknown, metadata: None, }