From bdc2e645c2d174881f7278139de95b141328431e Mon Sep 17 00:00:00 2001 From: jakka Date: Thu, 18 Sep 2025 10:55:49 +0300 Subject: added documentation --- src/client.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/client.rs') diff --git a/src/client.rs b/src/client.rs index 0b3f1c7..d8c7c40 100644 --- a/src/client.rs +++ b/src/client.rs @@ -9,6 +9,7 @@ use crate::{traits::*, types::*}; type Result = std::result::Result; +/// hydrus client pub struct HydrusClient { client: reqwest::Client, apikey: Option, @@ -17,6 +18,7 @@ pub struct HydrusClient { } impl HydrusClient { + /// create a new hydurs client object. requires a url to hydrus API endpoint pub fn new(url: &str) -> HydrusClient { HydrusClient { client: reqwest::Client::new(), @@ -25,11 +27,11 @@ impl HydrusClient { url: url.to_string(), } } - + /// set an api key pub fn set_api_key(&mut self, key: &str) { self.apikey = Some(key.to_owned()) } - + /// set a session key pub fn set_session_key(&mut self, key: &str) { self.sessionkey = Some(key.to_owned()) } @@ -182,10 +184,10 @@ impl AccessManagement for HydrusClient { impl ImportingAndDeletingFiles for HydrusClient { async fn add_file_via_path( &self, - path: &str, + path: PathBuf, delete: Option, domains: Option, - ) -> Result { + ) -> Result { let mut form = AddFileRequest { path: path.to_owned(), delete_after_successful_import: delete, @@ -212,11 +214,11 @@ impl ImportingAndDeletingFiles for HydrusClient { .json(&form) .send() .await? - .json::() + .json::() .await?) } - async fn add_file_via_file(&self, file: PathBuf) -> Result { + async fn add_file_via_file(&self, file: PathBuf) -> Result { let mut req_url = self.url.to_owned(); req_url.push_str("add_files/add_file"); @@ -231,7 +233,7 @@ impl ImportingAndDeletingFiles for HydrusClient { .body(body) .send() .await? - .json::() + .json::() .await?) } } -- cgit v1.3.1