Merge pull request #17 from Trivernis/develop

Change wrapped search to operate on hashes instead
main
Julius Riegel 3 years ago committed by GitHub
commit 6f687d381a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
[package] [package]
name = "hydrus-api" name = "hydrus-api"
version = "0.9.1" version = "0.9.2"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"

@ -123,11 +123,11 @@ impl SearchBuilder {
.map(|c| SearchQueryEntry::OrChain(c.into_string_list())) .map(|c| SearchQueryEntry::OrChain(c.into_string_list()))
.collect(), .collect(),
); );
let response = client.search_files(entries, self.options).await?; let response = client.search_file_hashes(entries, self.options).await?;
let files = response let files = response
.file_ids .hashes
.into_iter() .into_iter()
.map(|id| HydrusFile::from_id(client.clone(), id)) .map(|hash| HydrusFile::from_hash(client.clone(), hash))
.collect(); .collect();
Ok(files) Ok(files)

@ -43,10 +43,10 @@ pub struct HydrusFile {
} }
impl HydrusFile { impl HydrusFile {
pub(crate) fn from_id(client: Client, id: u64) -> Self { pub(crate) fn from_hash<S: ToString>(client: Client, hash: S) -> Self {
Self { Self {
client, client,
id: FileIdentifier::ID(id), id: FileIdentifier::Hash(hash.to_string()),
status: FileStatus::Unknown, status: FileStatus::Unknown,
metadata: None, metadata: None,
} }

Loading…
Cancel
Save