about summary refs log tree commit diff stats
path: root/crates/rocie-client/src/apis/api_get_api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rocie-client/src/apis/api_get_api.rs')
-rw-r--r--crates/rocie-client/src/apis/api_get_api.rs60
1 files changed, 44 insertions, 16 deletions
diff --git a/crates/rocie-client/src/apis/api_get_api.rs b/crates/rocie-client/src/apis/api_get_api.rs
index a8f4c17..a13b3b1 100644
--- a/crates/rocie-client/src/apis/api_get_api.rs
+++ b/crates/rocie-client/src/apis/api_get_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 [`product_by_id`]
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -32,12 +30,18 @@ pub enum ProductsError {
     UnknownValue(serde_json::Value),
 }
 
-
-pub async fn product_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::Product, Error<ProductByIdError>> {
+pub async fn product_by_id(
+    configuration: &configuration::Configuration,
+    id: &str,
+) -> Result<models::Product, Error<ProductByIdError>> {
     // add a prefix to parameters to efficiently prevent name collisions
     let p_id = id;
 
-    let uri_str = format!("{}/product/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
+    let uri_str = format!(
+        "{}/product/{id}",
+        configuration.base_path,
+        id = crate::apis::urlencode(p_id)
+    );
     let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
 
     if let Some(ref user_agent) = configuration.user_agent {
@@ -59,18 +63,31 @@ pub async fn product_by_id(configuration: &configuration::Configuration, id: &st
         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::Product`"))),
-            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::Product`")))),
+            ContentType::Text => {
+                return Err(Error::from(serde_json::Error::custom(
+                    "Received `text/plain` content type response that cannot be converted to `models::Product`",
+                )));
+            }
+            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::Product`"
+                ))));
+            }
         }
     } else {
         let content = resp.text().await?;
         let entity: Option<ProductByIdError> = serde_json::from_str(&content).ok();
-        Err(Error::ResponseError(ResponseContent { status, content, entity }))
+        Err(Error::ResponseError(ResponseContent {
+            status,
+            content,
+            entity,
+        }))
     }
 }
 
-pub async fn products(configuration: &configuration::Configuration, ) -> Result<Vec<models::Product>, Error<ProductsError>> {
-
+pub async fn products(
+    configuration: &configuration::Configuration,
+) -> Result<Vec<models::Product>, Error<ProductsError>> {
     let uri_str = format!("{}/products/", configuration.base_path);
     let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
 
@@ -93,13 +110,24 @@ pub async fn products(configuration: &configuration::Configuration, ) -> Result<
         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::Product&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::Product&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::Product&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::Product&gt;`"
+                ))));
+            }
         }
     } else {
         let content = resp.text().await?;
         let entity: Option<ProductsError> = serde_json::from_str(&content).ok();
-        Err(Error::ResponseError(ResponseContent { status, content, entity }))
+        Err(Error::ResponseError(ResponseContent {
+            status,
+            content,
+            entity,
+        }))
     }
 }
-