|
|
@ -22,8 +22,8 @@ use crate::api_core::managing_pages::{
|
|
|
|
GetPages, GetPagesResponse,
|
|
|
|
GetPages, GetPagesResponse,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use crate::api_core::searching_and_fetching_files::{
|
|
|
|
use crate::api_core::searching_and_fetching_files::{
|
|
|
|
FileMetadata, FileMetadataResponse, FileSearchOptions, GetFile, SearchFiles,
|
|
|
|
FileMetadata, FileMetadataResponse, FileSearchOptions, GetFile, SearchFileHashes,
|
|
|
|
SearchFilesResponse, SearchQueryEntry,
|
|
|
|
SearchFileHashesResponse, SearchFiles, SearchFilesResponse, SearchQueryEntry,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use crate::api_core::Endpoint;
|
|
|
|
use crate::api_core::Endpoint;
|
|
|
|
use crate::error::{Error, Result};
|
|
|
|
use crate::error::{Error, Result};
|
|
|
@ -241,7 +241,7 @@ impl Client {
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Searches for files in the inbox, the archive or both
|
|
|
|
/// Searches for files
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
pub async fn search_files(
|
|
|
|
pub async fn search_files(
|
|
|
|
&self,
|
|
|
|
&self,
|
|
|
@ -254,6 +254,20 @@ impl Client {
|
|
|
|
.await
|
|
|
|
.await
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Searches for file hashes
|
|
|
|
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
|
|
|
|
pub async fn search_file_hashes(
|
|
|
|
|
|
|
|
&self,
|
|
|
|
|
|
|
|
query: Vec<SearchQueryEntry>,
|
|
|
|
|
|
|
|
options: FileSearchOptions,
|
|
|
|
|
|
|
|
) -> Result<SearchFileHashesResponse> {
|
|
|
|
|
|
|
|
let mut args = options.into_query_args();
|
|
|
|
|
|
|
|
args.push(("tags", search_query_list_to_json_array(query)));
|
|
|
|
|
|
|
|
args.push(("return_hashes", String::from("true")));
|
|
|
|
|
|
|
|
self.get_and_parse::<SearchFileHashes, [(&str, String)]>(&args)
|
|
|
|
|
|
|
|
.await
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns the metadata for a given list of file_ids or hashes
|
|
|
|
/// Returns the metadata for a given list of file_ids or hashes
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
pub async fn get_file_metadata(
|
|
|
|
pub async fn get_file_metadata(
|
|
|
|