about summary refs log tree commit diff stats
path: root/crates/rocie-client/src/apis/api_get_unit_api.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-09 13:12:31 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-09 13:12:31 +0100
commit7565c34d69ee259fef3ac9813d689d97689a6d58 (patch)
treeee4f00e3d090ec288d481cc92781e55637619824 /crates/rocie-client/src/apis/api_get_unit_api.rs
parentfeat(rocie-server): Implement basic user handling and authentication (diff)
downloadserver-7565c34d69ee259fef3ac9813d689d97689a6d58.zip
style(rocie-client): Format
Diffstat (limited to 'crates/rocie-client/src/apis/api_get_unit_api.rs')
-rw-r--r--crates/rocie-client/src/apis/api_get_unit_api.rs89
1 files changed, 68 insertions, 21 deletions
diff --git a/crates/rocie-client/src/apis/api_get_unit_api.rs b/crates/rocie-client/src/apis/api_get_unit_api.rs
index df25b47..3e27264 100644
--- a/crates/rocie-client/src/apis/api_get_unit_api.rs
+++ b/crates/rocie-client/src/apis/api_get_unit_api.rs
@@ -8,12 +8,10 @@
  * Generated by: https://openapi-generator.tech
  */
 
-
+use super::{ContentType, Error, configuration};
+use crate::{apis::ResponseContent, models};
 use reqwest;
 use serde::{Deserialize, Serialize, de::Error as _};
-use crate::{apis::ResponseContent, models};
-use super::{Error, configuration, ContentType};
-
 
 /// struct for typed errors of method [`unit_by_id`]
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -40,12 +38,18 @@ pub enum UnitsByPropertyIdError {
     UnknownValue(serde_json::Value),
 }
 
-
-pub async fn unit_by_id(configuration: &configuration::Configuration, id: models::UnitId) -> Result<models::Unit, Error<UnitByIdError>> {
+pub async fn unit_by_id(
+    configuration: &configuration::Configuration,
+    id: models::UnitId,
+) -> Result<models::Unit, Error<UnitByIdError>> {
     // add a prefix to parameters to efficiently prevent name collisions
     let p_id = id;
 
-    let uri_str = format!("{}/unit/{id}", configuration.base_path, id=p_id.to_string());
+    let uri_str = format!(
+        "{}/unit/{id}",
+        configuration.base_path,
+        id = p_id.to_string()
+    );
     let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
 
     if let Some(ref user_agent) = configuration.user_agent {
@@ -67,18 +71,31 @@ pub async fn unit_by_id(configuration: &configuration::Configuration, id: models
         let content = resp.text().await?;
         match content_type {
             ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
-            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Unit`"))),
-            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Unit`")))),
+            ContentType::Text => {
+                return Err(Error::from(serde_json::Error::custom(
+                    "Received `text/plain` content type response that cannot be converted to `models::Unit`",
+                )));
+            }
+            ContentType::Unsupported(unknown_type) => {
+                return Err(Error::from(serde_json::Error::custom(format!(
+                    "Received `{unknown_type}` content type response that cannot be converted to `models::Unit`"
+                ))));
+            }
         }
     } else {
         let content = resp.text().await?;
         let entity: Option<UnitByIdError> = serde_json::from_str(&content).ok();
-        Err(Error::ResponseError(ResponseContent { status, content, entity }))
+        Err(Error::ResponseError(ResponseContent {
+            status,
+            content,
+            entity,
+        }))
     }
 }
 
-pub async fn units(configuration: &configuration::Configuration, ) -> Result<Vec<models::Unit>, Error<UnitsError>> {
-
+pub async fn units(
+    configuration: &configuration::Configuration,
+) -> Result<Vec<models::Unit>, Error<UnitsError>> {
     let uri_str = format!("{}/units/", configuration.base_path);
     let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
 
@@ -101,21 +118,40 @@ pub async fn units(configuration: &configuration::Configuration, ) -> Result<Vec
         let content = resp.text().await?;
         match content_type {
             ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
-            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`"))),
-            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`")))),
+            ContentType::Text => {
+                return Err(Error::from(serde_json::Error::custom(
+                    "Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`",
+                )));
+            }
+            ContentType::Unsupported(unknown_type) => {
+                return Err(Error::from(serde_json::Error::custom(format!(
+                    "Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`"
+                ))));
+            }
         }
     } else {
         let content = resp.text().await?;
         let entity: Option<UnitsError> = serde_json::from_str(&content).ok();
-        Err(Error::ResponseError(ResponseContent { status, content, entity }))
+        Err(Error::ResponseError(ResponseContent {
+            status,
+            content,
+            entity,
+        }))
     }
 }
 
-pub async fn units_by_property_id(configuration: &configuration::Configuration, id: models::UnitPropertyId) -> Result<Vec<models::Unit>, Error<UnitsByPropertyIdError>> {
+pub async fn units_by_property_id(
+    configuration: &configuration::Configuration,
+    id: models::UnitPropertyId,
+) -> Result<Vec<models::Unit>, Error<UnitsByPropertyIdError>> {
     // add a prefix to parameters to efficiently prevent name collisions
     let p_id = id;
 
-    let uri_str = format!("{}/units-by-property/{id}", configuration.base_path, id=p_id.to_string());
+    let uri_str = format!(
+        "{}/units-by-property/{id}",
+        configuration.base_path,
+        id = p_id.to_string()
+    );
     let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
 
     if let Some(ref user_agent) = configuration.user_agent {
@@ -137,13 +173,24 @@ pub async fn units_by_property_id(configuration: &configuration::Configuration,
         let content = resp.text().await?;
         match content_type {
             ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
-            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`"))),
-            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`")))),
+            ContentType::Text => {
+                return Err(Error::from(serde_json::Error::custom(
+                    "Received `text/plain` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`",
+                )));
+            }
+            ContentType::Unsupported(unknown_type) => {
+                return Err(Error::from(serde_json::Error::custom(format!(
+                    "Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`"
+                ))));
+            }
         }
     } else {
         let content = resp.text().await?;
         let entity: Option<UnitsByPropertyIdError> = serde_json::from_str(&content).ok();
-        Err(Error::ResponseError(ResponseContent { status, content, entity }))
+        Err(Error::ResponseError(ResponseContent {
+            status,
+            content,
+            entity,
+        }))
     }
 }
-