pub struct Client { /* private fields */ }
Expand description
A low level Client for the hydrus API. It provides basic abstraction over the REST api.
Implementations
sourceimpl Client
impl Client
sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for the client
sourcepub fn new<S: AsRef<str>>(url: S, access_key: S) -> Self
pub fn new<S: AsRef<str>>(url: S, access_key: S) -> Self
Creates a new client to start requests against the hydrus api.
sourcepub async fn api_version(&self) -> Result<ApiVersionResponse>
pub async fn api_version(&self) -> Result<ApiVersionResponse>
Returns the current API version. It’s being incremented every time the API changes.
sourcepub async fn session_key(&self) -> Result<SessionKeyResponse>
pub async fn session_key(&self) -> Result<SessionKeyResponse>
Creates a new session key
sourcepub async fn verify_access_key(&self) -> Result<VerifyAccessKeyResponse>
pub async fn verify_access_key(&self) -> Result<VerifyAccessKeyResponse>
Verifies if the access key is valid and returns some information about its permissions
sourcepub async fn get_services(&self) -> Result<GetServicesResponse>
pub async fn get_services(&self) -> Result<GetServicesResponse>
Returns the list of tag and file services of the client
sourcepub async fn add_file<S: ToString + Debug>(
&self,
path: S
) -> Result<AddFileResponse>
pub async fn add_file<S: ToString + Debug>(
&self,
path: S
) -> Result<AddFileResponse>
Adds a file to hydrus
sourcepub async fn add_binary_file(&self, data: Vec<u8>) -> Result<AddFileResponse>
pub async fn add_binary_file(&self, data: Vec<u8>) -> Result<AddFileResponse>
Adds a file from binary data to hydrus
sourcepub async fn delete_files(&self, hashes: Vec<String>) -> Result<()>
pub async fn delete_files(&self, hashes: Vec<String>) -> Result<()>
Moves files with matching hashes to the trash
sourcepub async fn undelete_files(&self, hashes: Vec<String>) -> Result<()>
pub async fn undelete_files(&self, hashes: Vec<String>) -> Result<()>
Pulls files out of the trash by hash
sourcepub async fn archive_files(&self, hashes: Vec<String>) -> Result<()>
pub async fn archive_files(&self, hashes: Vec<String>) -> Result<()>
Moves files from the inbox into the archive
sourcepub async fn unarchive_files(&self, hashes: Vec<String>) -> Result<()>
pub async fn unarchive_files(&self, hashes: Vec<String>) -> Result<()>
Moves files from the archive into the inbox
Returns the list of tags as the client would see them in a human friendly order
Adds tags to files with the given hashes
sourcepub async fn search_files(
&self,
query: Vec<SearchQueryEntry>,
options: FileSearchOptions
) -> Result<SearchFilesResponse>
pub async fn search_files(
&self,
query: Vec<SearchQueryEntry>,
options: FileSearchOptions
) -> Result<SearchFilesResponse>
Searches for files
sourcepub async fn search_file_hashes(
&self,
query: Vec<SearchQueryEntry>,
options: FileSearchOptions
) -> Result<SearchFileHashesResponse>
pub async fn search_file_hashes(
&self,
query: Vec<SearchQueryEntry>,
options: FileSearchOptions
) -> Result<SearchFileHashesResponse>
Searches for file hashes
sourcepub async fn get_file_metadata(
&self,
file_ids: Vec<u64>,
hashes: Vec<String>
) -> Result<FileMetadataResponse>
pub async fn get_file_metadata(
&self,
file_ids: Vec<u64>,
hashes: Vec<String>
) -> Result<FileMetadataResponse>
Returns the metadata for a given list of file_ids or hashes
sourcepub async fn get_file_metadata_by_identifier(
&self,
id: FileIdentifier
) -> Result<FileMetadataInfo>
pub async fn get_file_metadata_by_identifier(
&self,
id: FileIdentifier
) -> Result<FileMetadataInfo>
Returns the metadata for a single file identifier
sourcepub async fn get_file(&self, id: FileIdentifier) -> Result<FileRecord>
pub async fn get_file(&self, id: FileIdentifier) -> Result<FileRecord>
Returns the bytes of a file from hydrus
sourcepub async fn get_url_files<S: AsRef<str> + Debug>(
&self,
url: S
) -> Result<GetUrlFilesResponse>
pub async fn get_url_files<S: AsRef<str> + Debug>(
&self,
url: S
) -> Result<GetUrlFilesResponse>
Returns all files associated with the given url
sourcepub async fn get_url_info<S: AsRef<str> + Debug>(
&self,
url: S
) -> Result<GetUrlInfoResponse>
pub async fn get_url_info<S: AsRef<str> + Debug>(
&self,
url: S
) -> Result<GetUrlInfoResponse>
Returns information about the given url
sourcepub async fn add_url(&self, request: AddUrlRequest) -> Result<AddUrlResponse>
pub async fn add_url(&self, request: AddUrlRequest) -> Result<AddUrlResponse>
Adds an url to hydrus, optionally with additional tags and a destination page
sourcepub async fn associate_urls(
&self,
urls: Vec<String>,
hashes: Vec<String>
) -> Result<()>
pub async fn associate_urls(
&self,
urls: Vec<String>,
hashes: Vec<String>
) -> Result<()>
Associates urls with the given file hashes
sourcepub async fn disassociate_urls(
&self,
urls: Vec<String>,
hashes: Vec<String>
) -> Result<()>
pub async fn disassociate_urls(
&self,
urls: Vec<String>,
hashes: Vec<String>
) -> Result<()>
Disassociates urls with the given file hashes
sourcepub async fn set_notes(
&self,
id: FileIdentifier,
notes: HashMap<String, String>
) -> Result<()>
pub async fn set_notes(
&self,
id: FileIdentifier,
notes: HashMap<String, String>
) -> Result<()>
Sets the notes for the file
sourcepub async fn delete_notes(
&self,
id: FileIdentifier,
note_names: Vec<String>
) -> Result<()>
pub async fn delete_notes(
&self,
id: FileIdentifier,
note_names: Vec<String>
) -> Result<()>
Deletes the notes of a file
sourcepub async fn get_pages(&self) -> Result<GetPagesResponse>
pub async fn get_pages(&self) -> Result<GetPagesResponse>
Returns all pages of the client
sourcepub async fn get_page_info<S: AsRef<str> + Debug>(
&self,
page_key: S
) -> Result<GetPageInfoResponse>
pub async fn get_page_info<S: AsRef<str> + Debug>(
&self,
page_key: S
) -> Result<GetPageInfoResponse>
Returns information about a single page
sourcepub async fn focus_page<S: ToString + Debug>(&self, page_key: S) -> Result<()>
pub async fn focus_page<S: ToString + Debug>(&self, page_key: S) -> Result<()>
Focuses a page in the client
sourcepub async fn add_files_to_page<S: ToString + Debug>(
&self,
page_key: S,
file_ids: Vec<u64>,
hashes: Vec<String>
) -> Result<()>
pub async fn add_files_to_page<S: ToString + Debug>(
&self,
page_key: S,
file_ids: Vec<u64>,
hashes: Vec<String>
) -> Result<()>
Adds files to a page
Returns all cookies for the given domain
Sets some cookies for some websites.
Each entry needs to be in the format [<name>, <value>, <domain>, <path>, <expires>]
with the types [String, String, String, String, u64]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more