diff --git a/src/http_client.rs b/src/http_client.rs index 33f5dbc..36b6053 100644 --- a/src/http_client.rs +++ b/src/http_client.rs @@ -44,8 +44,8 @@ impl BotServerClient { &self.base_url } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn get(&self, endpoint: &str) -> Result { let url = format!("{}{endpoint}", self.base_url); debug!("GET {url}"); @@ -54,8 +54,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn post( &self, endpoint: &str, @@ -68,8 +68,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn put( &self, endpoint: &str, @@ -82,8 +82,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn patch( &self, endpoint: &str, @@ -96,8 +96,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn delete(&self, endpoint: &str) -> Result { let url = format!("{}{endpoint}", self.base_url); debug!("DELETE {url}"); @@ -106,8 +106,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn get_authorized( &self, endpoint: &str, @@ -120,8 +120,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn post_authorized( &self, endpoint: &str, @@ -141,8 +141,8 @@ impl BotServerClient { self.handle_response(response).await } - /// # Errors - /// Returns `BotError` if the HTTP request fails or response parsing fails. + + pub async fn delete_authorized( &self, endpoint: &str, diff --git a/src/version.rs b/src/version.rs index 4578d94..f41943e 100644 --- a/src/version.rs +++ b/src/version.rs @@ -197,8 +197,8 @@ impl VersionRegistry { ) } - /// # Errors - /// Returns `serde_json::Error` if serialization fails. + + pub fn to_json(&self) -> Result { serde_json::to_string_pretty(self) }