diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-12-09 13:12:31 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-12-09 13:12:31 +0100 |
| commit | 7565c34d69ee259fef3ac9813d689d97689a6d58 (patch) | |
| tree | ee4f00e3d090ec288d481cc92781e55637619824 /crates/rocie-client/src/apis | |
| parent | feat(rocie-server): Implement basic user handling and authentication (diff) | |
| download | server-7565c34d69ee259fef3ac9813d689d97689a6d58.zip | |
style(rocie-client): Format
Diffstat (limited to 'crates/rocie-client/src/apis')
32 files changed, 1425 insertions, 503 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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } 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, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_inventory_api.rs b/crates/rocie-client/src/apis/api_get_auth_inventory_api.rs index 6249b62..a8b1684 100644 --- a/crates/rocie-client/src/apis/api_get_auth_inventory_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_inventory_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 [`amount_by_id`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -25,12 +23,18 @@ pub enum AmountByIdError { UnknownValue(serde_json::Value), } - -pub async fn amount_by_id(configuration: &configuration::Configuration, id: models::ProductId) -> Result<models::ProductAmount, Error<AmountByIdError>> { +pub async fn amount_by_id( + configuration: &configuration::Configuration, + id: models::ProductId, +) -> Result<models::ProductAmount, Error<AmountByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/inventory/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/inventory/{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 { @@ -52,13 +56,24 @@ pub async fn amount_by_id(configuration: &configuration::Configuration, id: mode 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::ProductAmount`"))), - 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::ProductAmount`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::ProductAmount`", + ))); + } + 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::ProductAmount`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<AmountByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_product_api.rs b/crates/rocie-client/src/apis/api_get_auth_product_api.rs index dcc35a7..e6a3db2 100644 --- a/crates/rocie-client/src/apis/api_get_auth_product_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_product_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)] @@ -82,12 +80,18 @@ pub enum ProductsRegisteredError { UnknownValue(serde_json::Value), } - -pub async fn product_by_id(configuration: &configuration::Configuration, id: models::ProductId) -> Result<models::Product, Error<ProductByIdError>> { +pub async fn product_by_id( + configuration: &configuration::Configuration, + id: models::ProductId, +) -> Result<models::Product, Error<ProductByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product/by-id/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product/by-id/{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 { @@ -109,21 +113,40 @@ pub async fn product_by_id(configuration: &configuration::Configuration, id: mod 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 product_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::Product, Error<ProductByNameError>> { +pub async fn product_by_name( + configuration: &configuration::Configuration, + name: &str, +) -> Result<models::Product, Error<ProductByNameError>> { // add a prefix to parameters to efficiently prevent name collisions let p_name = name; - let uri_str = format!("{}/product/by-name/{name}", configuration.base_path, name=crate::apis::urlencode(p_name)); + let uri_str = format!( + "{}/product/by-name/{name}", + configuration.base_path, + name = crate::apis::urlencode(p_name) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -145,21 +168,40 @@ pub async fn product_by_name(configuration: &configuration::Configuration, name: 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<ProductByNameError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn product_suggestion_by_name(configuration: &configuration::Configuration, name: &str) -> Result<Vec<models::Product>, Error<ProductSuggestionByNameError>> { +pub async fn product_suggestion_by_name( + configuration: &configuration::Configuration, + name: &str, +) -> Result<Vec<models::Product>, Error<ProductSuggestionByNameError>> { // add a prefix to parameters to efficiently prevent name collisions let p_name = name; - let uri_str = format!("{}/product/by-part-name/{name}", configuration.base_path, name=crate::apis::urlencode(p_name)); + let uri_str = format!( + "{}/product/by-part-name/{name}", + configuration.base_path, + name = crate::apis::urlencode(p_name) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -181,22 +223,41 @@ pub async fn product_suggestion_by_name(configuration: &configuration::Configura 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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductSuggestionByNameError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// This will only return products directly associated with this product parent id -pub async fn products_by_product_parent_id_direct(configuration: &configuration::Configuration, id: models::ProductParentId) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdDirectError>> { +pub async fn products_by_product_parent_id_direct( + configuration: &configuration::Configuration, + id: models::ProductParentId, +) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdDirectError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product/by-product-parent-id-direct/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product/by-product-parent-id-direct/{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 { @@ -218,22 +279,42 @@ pub async fn products_by_product_parent_id_direct(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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; - let entity: Option<ProductsByProductParentIdDirectError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + let entity: Option<ProductsByProductParentIdDirectError> = + serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// This will also return all products below this product parent id -pub async fn products_by_product_parent_id_indirect(configuration: &configuration::Configuration, id: models::ProductParentId) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdIndirectError>> { +pub async fn products_by_product_parent_id_indirect( + configuration: &configuration::Configuration, + id: models::ProductParentId, +) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdIndirectError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product/by-product-parent-id-indirect/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product/by-product-parent-id-indirect/{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 { @@ -255,18 +336,32 @@ pub async fn products_by_product_parent_id_indirect(configuration: &configuratio 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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; - let entity: Option<ProductsByProductParentIdIndirectError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + let entity: Option<ProductsByProductParentIdIndirectError> = + serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn products_in_storage(configuration: &configuration::Configuration, ) -> Result<Vec<models::Product>, Error<ProductsInStorageError>> { - +pub async fn products_in_storage( + configuration: &configuration::Configuration, +) -> Result<Vec<models::Product>, Error<ProductsInStorageError>> { let uri_str = format!("{}/products_in_storage/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -289,18 +384,31 @@ pub async fn products_in_storage(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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductsInStorageError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn products_registered(configuration: &configuration::Configuration, ) -> Result<Vec<models::Product>, Error<ProductsRegisteredError>> { - +pub async fn products_registered( + configuration: &configuration::Configuration, +) -> Result<Vec<models::Product>, Error<ProductsRegisteredError>> { let uri_str = format!("{}/products_registered/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -323,13 +431,24 @@ pub async fn products_registered(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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductsRegisteredError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_product_parent_api.rs b/crates/rocie-client/src/apis/api_get_auth_product_parent_api.rs index 68b17d7..b29a155 100644 --- a/crates/rocie-client/src/apis/api_get_auth_product_parent_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_product_parent_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_parents`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -42,9 +40,9 @@ pub enum ProductParentsUnderError { UnknownValue(serde_json::Value), } - -pub async fn product_parents(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProductParent>, Error<ProductParentsError>> { - +pub async fn product_parents( + configuration: &configuration::Configuration, +) -> Result<Vec<models::ProductParent>, Error<ProductParentsError>> { let uri_str = format!("{}/product_parents/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -67,18 +65,31 @@ pub async fn product_parents(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<models::ProductParent>`"))), - 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<models::ProductParent>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::ProductParent>`", + ))); + } + 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<models::ProductParent>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductParentsError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn product_parents_toplevel(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProductParent>, Error<ProductParentsToplevelError>> { - +pub async fn product_parents_toplevel( + configuration: &configuration::Configuration, +) -> Result<Vec<models::ProductParent>, Error<ProductParentsToplevelError>> { let uri_str = format!("{}/product_parents_toplevel/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -101,21 +112,40 @@ pub async fn product_parents_toplevel(configuration: &configuration::Configurati 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<models::ProductParent>`"))), - 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<models::ProductParent>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::ProductParent>`", + ))); + } + 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<models::ProductParent>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductParentsToplevelError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn product_parents_under(configuration: &configuration::Configuration, id: models::ProductParentId) -> Result<Vec<models::ProductParent>, Error<ProductParentsUnderError>> { +pub async fn product_parents_under( + configuration: &configuration::Configuration, + id: models::ProductParentId, +) -> Result<Vec<models::ProductParent>, Error<ProductParentsUnderError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product_parents_under/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product_parents_under/{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 +167,24 @@ pub async fn product_parents_under(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<models::ProductParent>`"))), - 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<models::ProductParent>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::ProductParent>`", + ))); + } + 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<models::ProductParent>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductParentsUnderError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_recipe_api.rs b/crates/rocie-client/src/apis/api_get_auth_recipe_api.rs index 4eddb2f..90420c9 100644 --- a/crates/rocie-client/src/apis/api_get_auth_recipe_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_recipe_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 [`recipe_by_id`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -34,12 +32,18 @@ pub enum RecipesError { UnknownValue(serde_json::Value), } - -pub async fn recipe_by_id(configuration: &configuration::Configuration, id: models::RecipeId) -> Result<models::Recipe, Error<RecipeByIdError>> { +pub async fn recipe_by_id( + configuration: &configuration::Configuration, + id: models::RecipeId, +) -> Result<models::Recipe, Error<RecipeByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/recipe/by-id/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/recipe/by-id/{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 { @@ -61,18 +65,31 @@ pub async fn recipe_by_id(configuration: &configuration::Configuration, id: mode 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::Recipe`"))), - 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::Recipe`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::Recipe`", + ))); + } + 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::Recipe`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RecipeByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn recipes(configuration: &configuration::Configuration, ) -> Result<models::Recipe, Error<RecipesError>> { - +pub async fn recipes( + configuration: &configuration::Configuration, +) -> Result<models::Recipe, Error<RecipesError>> { let uri_str = format!("{}/recipe/all", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -95,13 +112,24 @@ pub async fn recipes(configuration: &configuration::Configuration, ) -> Result<m 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::Recipe`"))), - 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::Recipe`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::Recipe`", + ))); + } + 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::Recipe`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RecipesError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_unit_api.rs b/crates/rocie-client/src/apis/api_get_auth_unit_api.rs index c1f7e97..5d17a74 100644 --- a/crates/rocie-client/src/apis/api_get_auth_unit_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_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)] @@ -43,12 +41,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 { @@ -70,18 +74,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); @@ -104,21 +121,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<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 `Vec<models::Unit>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Unit>`" + )))); + } } } 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 { @@ -140,13 +176,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<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 `Vec<models::Unit>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Unit>`" + )))); + } } } 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, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_unit_property_api.rs b/crates/rocie-client/src/apis/api_get_auth_unit_property_api.rs index 1359f40..a2ac138 100644 --- a/crates/rocie-client/src/apis/api_get_auth_unit_property_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_unit_property_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_properties`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -34,9 +32,9 @@ pub enum UnitPropertyByIdError { UnknownValue(serde_json::Value), } - -pub async fn unit_properties(configuration: &configuration::Configuration, ) -> Result<Vec<models::UnitProperty>, Error<UnitPropertiesError>> { - +pub async fn unit_properties( + configuration: &configuration::Configuration, +) -> Result<Vec<models::UnitProperty>, Error<UnitPropertiesError>> { let uri_str = format!("{}/unit-properties/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -59,21 +57,40 @@ pub async fn unit_properties(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<models::UnitProperty>`"))), - 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<models::UnitProperty>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::UnitProperty>`", + ))); + } + 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<models::UnitProperty>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UnitPropertiesError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn unit_property_by_id(configuration: &configuration::Configuration, id: models::UnitPropertyId) -> Result<models::UnitProperty, Error<UnitPropertyByIdError>> { +pub async fn unit_property_by_id( + configuration: &configuration::Configuration, + id: models::UnitPropertyId, +) -> Result<models::UnitProperty, Error<UnitPropertyByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/unit-property/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/unit-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 { @@ -95,13 +112,24 @@ pub async fn unit_property_by_id(configuration: &configuration::Configuration, i 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::UnitProperty`"))), - 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::UnitProperty`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UnitProperty`", + ))); + } + 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::UnitProperty`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UnitPropertyByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_auth_user_api.rs b/crates/rocie-client/src/apis/api_get_auth_user_api.rs index 61e3935..64d4671 100644 --- a/crates/rocie-client/src/apis/api_get_auth_user_api.rs +++ b/crates/rocie-client/src/apis/api_get_auth_user_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 [`user_by_id`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -35,12 +33,18 @@ pub enum UsersError { UnknownValue(serde_json::Value), } - -pub async fn user_by_id(configuration: &configuration::Configuration, id: models::UserId) -> Result<models::User, Error<UserByIdError>> { +pub async fn user_by_id( + configuration: &configuration::Configuration, + id: models::UserId, +) -> Result<models::User, Error<UserByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/user/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/user/{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 { @@ -62,18 +66,31 @@ pub async fn user_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::User`"))), - 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::User`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::User`", + ))); + } + 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::User`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UserByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn users(configuration: &configuration::Configuration, ) -> Result<Vec<models::User>, Error<UsersError>> { - +pub async fn users( + configuration: &configuration::Configuration, +) -> Result<Vec<models::User>, Error<UsersError>> { let uri_str = format!("{}/users", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -96,13 +113,24 @@ pub async fn users(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<models::User>`"))), - 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<models::User>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::User>`", + ))); + } + 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<models::User>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UsersError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_inventory_api.rs b/crates/rocie-client/src/apis/api_get_inventory_api.rs index e11fc7f..cdc8d95 100644 --- a/crates/rocie-client/src/apis/api_get_inventory_api.rs +++ b/crates/rocie-client/src/apis/api_get_inventory_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 [`amount_by_id`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,12 +22,18 @@ pub enum AmountByIdError { UnknownValue(serde_json::Value), } - -pub async fn amount_by_id(configuration: &configuration::Configuration, id: models::ProductId) -> Result<models::ProductAmount, Error<AmountByIdError>> { +pub async fn amount_by_id( + configuration: &configuration::Configuration, + id: models::ProductId, +) -> Result<models::ProductAmount, Error<AmountByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/inventory/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/inventory/{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 { @@ -51,13 +55,24 @@ pub async fn amount_by_id(configuration: &configuration::Configuration, id: mode 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::ProductAmount`"))), - 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::ProductAmount`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::ProductAmount`", + ))); + } + 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::ProductAmount`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<AmountByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_no_auth_user_api.rs b/crates/rocie-client/src/apis/api_get_no_auth_user_api.rs index 1a5e91d..68b92c8 100644 --- a/crates/rocie-client/src/apis/api_get_no_auth_user_api.rs +++ b/crates/rocie-client/src/apis/api_get_no_auth_user_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 [`user_by_id`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -33,12 +31,18 @@ pub enum UsersError { UnknownValue(serde_json::Value), } - -pub async fn user_by_id(configuration: &configuration::Configuration, id: models::UserId) -> Result<models::User, Error<UserByIdError>> { +pub async fn user_by_id( + configuration: &configuration::Configuration, + id: models::UserId, +) -> Result<models::User, Error<UserByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/user/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/user/{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 { @@ -60,18 +64,31 @@ pub async fn user_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::User`"))), - 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::User`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::User`", + ))); + } + 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::User`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UserByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn users(configuration: &configuration::Configuration, ) -> Result<Vec<models::User>, Error<UsersError>> { - +pub async fn users( + configuration: &configuration::Configuration, +) -> Result<Vec<models::User>, Error<UsersError>> { let uri_str = format!("{}/users", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -94,13 +111,24 @@ pub async fn users(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<models::User>`"))), - 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<models::User>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::User>`", + ))); + } + 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<models::User>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UsersError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_product_api.rs b/crates/rocie-client/src/apis/api_get_product_api.rs index a4bf9b8..6cc555f 100644 --- a/crates/rocie-client/src/apis/api_get_product_api.rs +++ b/crates/rocie-client/src/apis/api_get_product_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)] @@ -75,12 +73,18 @@ pub enum ProductsRegisteredError { UnknownValue(serde_json::Value), } - -pub async fn product_by_id(configuration: &configuration::Configuration, id: models::ProductId) -> Result<models::Product, Error<ProductByIdError>> { +pub async fn product_by_id( + configuration: &configuration::Configuration, + id: models::ProductId, +) -> Result<models::Product, Error<ProductByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product/by-id/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product/by-id/{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 { @@ -102,21 +106,40 @@ pub async fn product_by_id(configuration: &configuration::Configuration, id: mod 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 product_by_name(configuration: &configuration::Configuration, name: &str) -> Result<models::Product, Error<ProductByNameError>> { +pub async fn product_by_name( + configuration: &configuration::Configuration, + name: &str, +) -> Result<models::Product, Error<ProductByNameError>> { // add a prefix to parameters to efficiently prevent name collisions let p_name = name; - let uri_str = format!("{}/product/by-name/{name}", configuration.base_path, name=crate::apis::urlencode(p_name)); + let uri_str = format!( + "{}/product/by-name/{name}", + configuration.base_path, + name = crate::apis::urlencode(p_name) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -138,21 +161,40 @@ pub async fn product_by_name(configuration: &configuration::Configuration, name: 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<ProductByNameError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn product_suggestion_by_name(configuration: &configuration::Configuration, name: &str) -> Result<Vec<models::Product>, Error<ProductSuggestionByNameError>> { +pub async fn product_suggestion_by_name( + configuration: &configuration::Configuration, + name: &str, +) -> Result<Vec<models::Product>, Error<ProductSuggestionByNameError>> { // add a prefix to parameters to efficiently prevent name collisions let p_name = name; - let uri_str = format!("{}/product/by-part-name/{name}", configuration.base_path, name=crate::apis::urlencode(p_name)); + let uri_str = format!( + "{}/product/by-part-name/{name}", + configuration.base_path, + name = crate::apis::urlencode(p_name) + ); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); if let Some(ref user_agent) = configuration.user_agent { @@ -174,22 +216,41 @@ pub async fn product_suggestion_by_name(configuration: &configuration::Configura 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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductSuggestionByNameError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// This will only return products directly associated with this product parent id -pub async fn products_by_product_parent_id_direct(configuration: &configuration::Configuration, id: models::ProductParentId) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdDirectError>> { +pub async fn products_by_product_parent_id_direct( + configuration: &configuration::Configuration, + id: models::ProductParentId, +) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdDirectError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product/by-product-parent-id-direct/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product/by-product-parent-id-direct/{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 { @@ -211,22 +272,42 @@ pub async fn products_by_product_parent_id_direct(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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; - let entity: Option<ProductsByProductParentIdDirectError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + let entity: Option<ProductsByProductParentIdDirectError> = + serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// This will also return all products below this product parent id -pub async fn products_by_product_parent_id_indirect(configuration: &configuration::Configuration, id: models::ProductParentId) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdIndirectError>> { +pub async fn products_by_product_parent_id_indirect( + configuration: &configuration::Configuration, + id: models::ProductParentId, +) -> Result<Vec<models::Product>, Error<ProductsByProductParentIdIndirectError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product/by-product-parent-id-indirect/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product/by-product-parent-id-indirect/{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 { @@ -248,18 +329,32 @@ pub async fn products_by_product_parent_id_indirect(configuration: &configuratio 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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; - let entity: Option<ProductsByProductParentIdIndirectError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + let entity: Option<ProductsByProductParentIdIndirectError> = + serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn products_in_storage(configuration: &configuration::Configuration, ) -> Result<Vec<models::Product>, Error<ProductsInStorageError>> { - +pub async fn products_in_storage( + configuration: &configuration::Configuration, +) -> Result<Vec<models::Product>, Error<ProductsInStorageError>> { let uri_str = format!("{}/products_in_storage/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -282,18 +377,31 @@ pub async fn products_in_storage(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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductsInStorageError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn products_registered(configuration: &configuration::Configuration, ) -> Result<Vec<models::Product>, Error<ProductsRegisteredError>> { - +pub async fn products_registered( + configuration: &configuration::Configuration, +) -> Result<Vec<models::Product>, Error<ProductsRegisteredError>> { let uri_str = format!("{}/products_registered/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -316,13 +424,24 @@ pub async fn products_registered(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<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 `Vec<models::Product>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Product>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductsRegisteredError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_product_parent_api.rs b/crates/rocie-client/src/apis/api_get_product_parent_api.rs index 6adc6e1..09db44c 100644 --- a/crates/rocie-client/src/apis/api_get_product_parent_api.rs +++ b/crates/rocie-client/src/apis/api_get_product_parent_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_parents`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -39,9 +37,9 @@ pub enum ProductParentsUnderError { UnknownValue(serde_json::Value), } - -pub async fn product_parents(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProductParent>, Error<ProductParentsError>> { - +pub async fn product_parents( + configuration: &configuration::Configuration, +) -> Result<Vec<models::ProductParent>, Error<ProductParentsError>> { let uri_str = format!("{}/product_parents/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -64,18 +62,31 @@ pub async fn product_parents(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<models::ProductParent>`"))), - 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<models::ProductParent>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::ProductParent>`", + ))); + } + 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<models::ProductParent>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductParentsError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn product_parents_toplevel(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProductParent>, Error<ProductParentsToplevelError>> { - +pub async fn product_parents_toplevel( + configuration: &configuration::Configuration, +) -> Result<Vec<models::ProductParent>, Error<ProductParentsToplevelError>> { let uri_str = format!("{}/product_parents_toplevel/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -98,21 +109,40 @@ pub async fn product_parents_toplevel(configuration: &configuration::Configurati 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<models::ProductParent>`"))), - 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<models::ProductParent>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::ProductParent>`", + ))); + } + 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<models::ProductParent>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductParentsToplevelError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn product_parents_under(configuration: &configuration::Configuration, id: models::ProductParentId) -> Result<Vec<models::ProductParent>, Error<ProductParentsUnderError>> { +pub async fn product_parents_under( + configuration: &configuration::Configuration, + id: models::ProductParentId, +) -> Result<Vec<models::ProductParent>, Error<ProductParentsUnderError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/product_parents_under/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/product_parents_under/{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 { @@ -134,13 +164,24 @@ pub async fn product_parents_under(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<models::ProductParent>`"))), - 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<models::ProductParent>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::ProductParent>`", + ))); + } + 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<models::ProductParent>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProductParentsUnderError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_recipe_api.rs b/crates/rocie-client/src/apis/api_get_recipe_api.rs index f29a2ce..321e3a1 100644 --- a/crates/rocie-client/src/apis/api_get_recipe_api.rs +++ b/crates/rocie-client/src/apis/api_get_recipe_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 [`recipe_by_id`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -32,12 +30,18 @@ pub enum RecipesError { UnknownValue(serde_json::Value), } - -pub async fn recipe_by_id(configuration: &configuration::Configuration, id: models::RecipeId) -> Result<models::Recipe, Error<RecipeByIdError>> { +pub async fn recipe_by_id( + configuration: &configuration::Configuration, + id: models::RecipeId, +) -> Result<models::Recipe, Error<RecipeByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/recipe/by-id/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/recipe/by-id/{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 { @@ -59,18 +63,31 @@ pub async fn recipe_by_id(configuration: &configuration::Configuration, id: mode 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::Recipe`"))), - 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::Recipe`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::Recipe`", + ))); + } + 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::Recipe`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RecipeByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn recipes(configuration: &configuration::Configuration, ) -> Result<models::Recipe, Error<RecipesError>> { - +pub async fn recipes( + configuration: &configuration::Configuration, +) -> Result<models::Recipe, Error<RecipesError>> { let uri_str = format!("{}/recipe/all", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -93,13 +110,24 @@ pub async fn recipes(configuration: &configuration::Configuration, ) -> Result<m 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::Recipe`"))), - 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::Recipe`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::Recipe`", + ))); + } + 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::Recipe`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RecipesError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - 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<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 `Vec<models::Unit>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Unit>`" + )))); + } } } 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<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 `Vec<models::Unit>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<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 `Vec<models::Unit>`" + )))); + } } } 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, + })) } } - diff --git a/crates/rocie-client/src/apis/api_get_unit_property_api.rs b/crates/rocie-client/src/apis/api_get_unit_property_api.rs index 1082dcb..f61258b 100644 --- a/crates/rocie-client/src/apis/api_get_unit_property_api.rs +++ b/crates/rocie-client/src/apis/api_get_unit_property_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_properties`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -32,9 +30,9 @@ pub enum UnitPropertyByIdError { UnknownValue(serde_json::Value), } - -pub async fn unit_properties(configuration: &configuration::Configuration, ) -> Result<Vec<models::UnitProperty>, Error<UnitPropertiesError>> { - +pub async fn unit_properties( + configuration: &configuration::Configuration, +) -> Result<Vec<models::UnitProperty>, Error<UnitPropertiesError>> { let uri_str = format!("{}/unit-properties/", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -57,21 +55,40 @@ pub async fn unit_properties(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<models::UnitProperty>`"))), - 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<models::UnitProperty>`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `Vec<models::UnitProperty>`", + ))); + } + 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<models::UnitProperty>`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UnitPropertiesError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn unit_property_by_id(configuration: &configuration::Configuration, id: models::UnitPropertyId) -> Result<models::UnitProperty, Error<UnitPropertyByIdError>> { +pub async fn unit_property_by_id( + configuration: &configuration::Configuration, + id: models::UnitPropertyId, +) -> Result<models::UnitProperty, Error<UnitPropertyByIdError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; - let uri_str = format!("{}/unit-property/{id}", configuration.base_path, id=p_id.to_string()); + let uri_str = format!( + "{}/unit-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 { @@ -93,13 +110,24 @@ pub async fn unit_property_by_id(configuration: &configuration::Configuration, i 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::UnitProperty`"))), - 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::UnitProperty`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UnitProperty`", + ))); + } + 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::UnitProperty`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<UnitPropertyByIdError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_api.rs b/crates/rocie-client/src/apis/api_set_api.rs index 81f029e..5a029b8 100644 --- a/crates/rocie-client/src/apis/api_set_api.rs +++ b/crates/rocie-client/src/apis/api_set_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 [`associate_barcode`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -33,14 +31,23 @@ pub enum RegisterProductError { UnknownValue(serde_json::Value), } - -pub async fn associate_barcode(configuration: &configuration::Configuration, id: &str, barcode: models::Barcode) -> Result<(), Error<AssociateBarcodeError>> { +pub async fn associate_barcode( + configuration: &configuration::Configuration, + id: &str, + barcode: models::Barcode, +) -> Result<(), Error<AssociateBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; let p_barcode = barcode; - let uri_str = format!("{}/product/{id}/associate", configuration.base_path, id=crate::apis::urlencode(p_id)); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/product/{id}/associate", + configuration.base_path, + id = crate::apis::urlencode(p_id) + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -57,16 +64,25 @@ pub async fn associate_barcode(configuration: &configuration::Configuration, id: } else { let content = resp.text().await?; let entity: Option<AssociateBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn register_product(configuration: &configuration::Configuration, product_stub: models::ProductStub) -> Result<uuid::Uuid, Error<RegisterProductError>> { +pub async fn register_product( + configuration: &configuration::Configuration, + product_stub: models::ProductStub, +) -> Result<uuid::Uuid, Error<RegisterProductError>> { // add a prefix to parameters to efficiently prevent name collisions let p_product_stub = product_stub; let uri_str = format!("{}/product/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -88,13 +104,24 @@ pub async fn register_product(configuration: &configuration::Configuration, prod 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 `uuid::Uuid`"))), - ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `uuid::Uuid`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `uuid::Uuid`", + ))); + } + ContentType::Unsupported(unknown_type) => { + return Err(Error::from(serde_json::Error::custom(format!( + "Received `{unknown_type}` content type response that cannot be converted to `uuid::Uuid`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterProductError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_barcode_api.rs b/crates/rocie-client/src/apis/api_set_auth_barcode_api.rs index 494694d..55f813e 100644 --- a/crates/rocie-client/src/apis/api_set_auth_barcode_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_barcode_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 [`buy_barcode`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -35,14 +33,24 @@ pub enum ConsumeBarcodeError { UnknownValue(serde_json::Value), } - -pub async fn buy_barcode(configuration: &configuration::Configuration, barcode_id: models::BarcodeId, times: u32) -> Result<(), Error<BuyBarcodeError>> { +pub async fn buy_barcode( + configuration: &configuration::Configuration, + barcode_id: models::BarcodeId, + times: u32, +) -> Result<(), Error<BuyBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_barcode_id = barcode_id; let p_times = times; - let uri_str = format!("{}/barcode/{barcode_id}/buy/{times}", configuration.base_path, barcode_id=p_barcode_id.to_string(), times=p_times); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/barcode/{barcode_id}/buy/{times}", + configuration.base_path, + barcode_id = p_barcode_id.to_string(), + times = p_times + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -58,17 +66,31 @@ pub async fn buy_barcode(configuration: &configuration::Configuration, barcode_i } else { let content = resp.text().await?; let entity: Option<BuyBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn consume_barcode(configuration: &configuration::Configuration, id: models::BarcodeId, unit_amount: models::UnitAmount) -> Result<(), Error<ConsumeBarcodeError>> { +pub async fn consume_barcode( + configuration: &configuration::Configuration, + id: models::BarcodeId, + unit_amount: models::UnitAmount, +) -> Result<(), Error<ConsumeBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; let p_unit_amount = unit_amount; - let uri_str = format!("{}/barcode/{id}/consume", configuration.base_path, id=p_id.to_string()); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/barcode/{id}/consume", + configuration.base_path, + id = p_id.to_string() + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -85,7 +107,10 @@ pub async fn consume_barcode(configuration: &configuration::Configuration, id: m } else { let content = resp.text().await?; let entity: Option<ConsumeBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_product_api.rs b/crates/rocie-client/src/apis/api_set_auth_product_api.rs index fd1cd23..e29c7f1 100644 --- a/crates/rocie-client/src/apis/api_set_auth_product_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_product_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 [`associate_barcode`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -35,14 +33,23 @@ pub enum RegisterProductError { UnknownValue(serde_json::Value), } - -pub async fn associate_barcode(configuration: &configuration::Configuration, id: models::ProductId, barcode: models::Barcode) -> Result<(), Error<AssociateBarcodeError>> { +pub async fn associate_barcode( + configuration: &configuration::Configuration, + id: models::ProductId, + barcode: models::Barcode, +) -> Result<(), Error<AssociateBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; let p_barcode = barcode; - let uri_str = format!("{}/product/{id}/associate", configuration.base_path, id=p_id.to_string()); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/product/{id}/associate", + configuration.base_path, + id = p_id.to_string() + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -59,16 +66,25 @@ pub async fn associate_barcode(configuration: &configuration::Configuration, id: } else { let content = resp.text().await?; let entity: Option<AssociateBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn register_product(configuration: &configuration::Configuration, product_stub: models::ProductStub) -> Result<models::ProductId, Error<RegisterProductError>> { +pub async fn register_product( + configuration: &configuration::Configuration, + product_stub: models::ProductStub, +) -> Result<models::ProductId, Error<RegisterProductError>> { // add a prefix to parameters to efficiently prevent name collisions let p_product_stub = product_stub; let uri_str = format!("{}/product/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -90,13 +106,24 @@ pub async fn register_product(configuration: &configuration::Configuration, prod 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::ProductId`"))), - 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::ProductId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::ProductId`", + ))); + } + 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::ProductId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterProductError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_product_parent_api.rs b/crates/rocie-client/src/apis/api_set_auth_product_parent_api.rs index 6ec3a17..f42dd99 100644 --- a/crates/rocie-client/src/apis/api_set_auth_product_parent_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_product_parent_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 [`register_product_parent`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,13 +22,17 @@ pub enum RegisterProductParentError { UnknownValue(serde_json::Value), } - -pub async fn register_product_parent(configuration: &configuration::Configuration, product_parent_stub: models::ProductParentStub) -> Result<models::ProductParentId, Error<RegisterProductParentError>> { +pub async fn register_product_parent( + configuration: &configuration::Configuration, + product_parent_stub: models::ProductParentStub, +) -> Result<models::ProductParentId, Error<RegisterProductParentError>> { // add a prefix to parameters to efficiently prevent name collisions let p_product_parent_stub = product_parent_stub; let uri_str = format!("{}/product_parent/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -52,13 +54,24 @@ pub async fn register_product_parent(configuration: &configuration::Configuratio 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::ProductParentId`"))), - 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::ProductParentId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::ProductParentId`", + ))); + } + 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::ProductParentId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterProductParentError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_recipe_api.rs b/crates/rocie-client/src/apis/api_set_auth_recipe_api.rs index 52eb874..8df320d 100644 --- a/crates/rocie-client/src/apis/api_set_auth_recipe_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_recipe_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 [`add_recipe`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,13 +22,17 @@ pub enum AddRecipeError { UnknownValue(serde_json::Value), } - -pub async fn add_recipe(configuration: &configuration::Configuration, recipe_stub: models::RecipeStub) -> Result<models::RecipeId, Error<AddRecipeError>> { +pub async fn add_recipe( + configuration: &configuration::Configuration, + recipe_stub: models::RecipeStub, +) -> Result<models::RecipeId, Error<AddRecipeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_recipe_stub = recipe_stub; let uri_str = format!("{}/recipe/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -52,13 +54,24 @@ pub async fn add_recipe(configuration: &configuration::Configuration, recipe_stu 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::RecipeId`"))), - 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::RecipeId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::RecipeId`", + ))); + } + 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::RecipeId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<AddRecipeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_unit_api.rs b/crates/rocie-client/src/apis/api_set_auth_unit_api.rs index 0f96f98..d9bf507 100644 --- a/crates/rocie-client/src/apis/api_set_auth_unit_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_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 [`register_unit`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,13 +22,17 @@ pub enum RegisterUnitError { UnknownValue(serde_json::Value), } - -pub async fn register_unit(configuration: &configuration::Configuration, unit_stub: models::UnitStub) -> Result<models::UnitId, Error<RegisterUnitError>> { +pub async fn register_unit( + configuration: &configuration::Configuration, + unit_stub: models::UnitStub, +) -> Result<models::UnitId, Error<RegisterUnitError>> { // add a prefix to parameters to efficiently prevent name collisions let p_unit_stub = unit_stub; let uri_str = format!("{}/unit/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -52,13 +54,24 @@ pub async fn register_unit(configuration: &configuration::Configuration, unit_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::UnitId`"))), - 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::UnitId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UnitId`", + ))); + } + 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::UnitId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterUnitError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_unit_property_api.rs b/crates/rocie-client/src/apis/api_set_auth_unit_property_api.rs index bfb8a4d..cb59235 100644 --- a/crates/rocie-client/src/apis/api_set_auth_unit_property_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_unit_property_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 [`register_unit_property`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,13 +22,17 @@ pub enum RegisterUnitPropertyError { UnknownValue(serde_json::Value), } - -pub async fn register_unit_property(configuration: &configuration::Configuration, unit_property_stub: models::UnitPropertyStub) -> Result<models::UnitPropertyId, Error<RegisterUnitPropertyError>> { +pub async fn register_unit_property( + configuration: &configuration::Configuration, + unit_property_stub: models::UnitPropertyStub, +) -> Result<models::UnitPropertyId, Error<RegisterUnitPropertyError>> { // add a prefix to parameters to efficiently prevent name collisions let p_unit_property_stub = unit_property_stub; let uri_str = format!("{}/unit-property/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -52,13 +54,24 @@ pub async fn register_unit_property(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 `models::UnitPropertyId`"))), - 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::UnitPropertyId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UnitPropertyId`", + ))); + } + 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::UnitPropertyId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterUnitPropertyError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_auth_user_api.rs b/crates/rocie-client/src/apis/api_set_auth_user_api.rs index 4f43bbe..758b707 100644 --- a/crates/rocie-client/src/apis/api_set_auth_user_api.rs +++ b/crates/rocie-client/src/apis/api_set_auth_user_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 [`register_user`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,13 +22,17 @@ pub enum RegisterUserError { UnknownValue(serde_json::Value), } - -pub async fn register_user(configuration: &configuration::Configuration, user_stub: models::UserStub) -> Result<models::UserId, Error<RegisterUserError>> { +pub async fn register_user( + configuration: &configuration::Configuration, + user_stub: models::UserStub, +) -> Result<models::UserId, Error<RegisterUserError>> { // add a prefix to parameters to efficiently prevent name collisions let p_user_stub = user_stub; let uri_str = format!("{}/user/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -52,13 +54,24 @@ pub async fn register_user(configuration: &configuration::Configuration, user_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::UserId`"))), - 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::UserId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UserId`", + ))); + } + 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::UserId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterUserError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_barcode_api.rs b/crates/rocie-client/src/apis/api_set_barcode_api.rs index fd47d04..d6e0b0a 100644 --- a/crates/rocie-client/src/apis/api_set_barcode_api.rs +++ b/crates/rocie-client/src/apis/api_set_barcode_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 [`buy_barcode`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -33,14 +31,24 @@ pub enum ConsumeBarcodeError { UnknownValue(serde_json::Value), } - -pub async fn buy_barcode(configuration: &configuration::Configuration, barcode_id: models::BarcodeId, times: u32) -> Result<(), Error<BuyBarcodeError>> { +pub async fn buy_barcode( + configuration: &configuration::Configuration, + barcode_id: models::BarcodeId, + times: u32, +) -> Result<(), Error<BuyBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_barcode_id = barcode_id; let p_times = times; - let uri_str = format!("{}/barcode/{barcode_id}/buy/{times}", configuration.base_path, barcode_id=p_barcode_id.to_string(), times=p_times); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/barcode/{barcode_id}/buy/{times}", + configuration.base_path, + barcode_id = p_barcode_id.to_string(), + times = p_times + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -56,17 +64,31 @@ pub async fn buy_barcode(configuration: &configuration::Configuration, barcode_i } else { let content = resp.text().await?; let entity: Option<BuyBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn consume_barcode(configuration: &configuration::Configuration, id: models::BarcodeId, unit_amount: models::UnitAmount) -> Result<(), Error<ConsumeBarcodeError>> { +pub async fn consume_barcode( + configuration: &configuration::Configuration, + id: models::BarcodeId, + unit_amount: models::UnitAmount, +) -> Result<(), Error<ConsumeBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; let p_unit_amount = unit_amount; - let uri_str = format!("{}/barcode/{id}/consume", configuration.base_path, id=p_id.to_string()); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/barcode/{id}/consume", + configuration.base_path, + id = p_id.to_string() + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -83,7 +105,10 @@ pub async fn consume_barcode(configuration: &configuration::Configuration, id: m } else { let content = resp.text().await?; let entity: Option<ConsumeBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_no_auth_user_api.rs b/crates/rocie-client/src/apis/api_set_no_auth_user_api.rs index 6a59d1f..1d203c5 100644 --- a/crates/rocie-client/src/apis/api_set_no_auth_user_api.rs +++ b/crates/rocie-client/src/apis/api_set_no_auth_user_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 [`login`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -42,13 +40,17 @@ pub enum ProvisionError { UnknownValue(serde_json::Value), } - -pub async fn login(configuration: &configuration::Configuration, login_info: models::LoginInfo) -> Result<(), Error<LoginError>> { +pub async fn login( + configuration: &configuration::Configuration, + login_info: models::LoginInfo, +) -> Result<(), Error<LoginError>> { // add a prefix to parameters to efficiently prevent name collisions let p_login_info = login_info; let uri_str = format!("{}/login", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -65,14 +67,21 @@ pub async fn login(configuration: &configuration::Configuration, login_info: mod } else { let content = resp.text().await?; let entity: Option<LoginError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn logout(configuration: &configuration::Configuration, ) -> Result<(), Error<LogoutError>> { - +pub async fn logout( + configuration: &configuration::Configuration, +) -> Result<(), Error<LogoutError>> { let uri_str = format!("{}/logout", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -88,17 +97,26 @@ pub async fn logout(configuration: &configuration::Configuration, ) -> Result<() } else { let content = resp.text().await?; let entity: Option<LogoutError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } /// This only works, if no users exist yet. -pub async fn provision(configuration: &configuration::Configuration, user_stub: models::UserStub) -> Result<models::UserId, Error<ProvisionError>> { +pub async fn provision( + configuration: &configuration::Configuration, + user_stub: models::UserStub, +) -> Result<models::UserId, Error<ProvisionError>> { // add a prefix to parameters to efficiently prevent name collisions let p_user_stub = user_stub; let uri_str = format!("{}/provision", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -120,13 +138,24 @@ pub async fn provision(configuration: &configuration::Configuration, user_stub: 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::UserId`"))), - 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::UserId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UserId`", + ))); + } + 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::UserId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<ProvisionError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_product_api.rs b/crates/rocie-client/src/apis/api_set_product_api.rs index b2d65a3..0230a0f 100644 --- a/crates/rocie-client/src/apis/api_set_product_api.rs +++ b/crates/rocie-client/src/apis/api_set_product_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 [`associate_barcode`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -33,14 +31,23 @@ pub enum RegisterProductError { UnknownValue(serde_json::Value), } - -pub async fn associate_barcode(configuration: &configuration::Configuration, id: models::ProductId, barcode: models::Barcode) -> Result<(), Error<AssociateBarcodeError>> { +pub async fn associate_barcode( + configuration: &configuration::Configuration, + id: models::ProductId, + barcode: models::Barcode, +) -> Result<(), Error<AssociateBarcodeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_id = id; let p_barcode = barcode; - let uri_str = format!("{}/product/{id}/associate", configuration.base_path, id=p_id.to_string()); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let uri_str = format!( + "{}/product/{id}/associate", + configuration.base_path, + id = p_id.to_string() + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -57,16 +64,25 @@ pub async fn associate_barcode(configuration: &configuration::Configuration, id: } else { let content = resp.text().await?; let entity: Option<AssociateBarcodeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn register_product(configuration: &configuration::Configuration, product_stub: models::ProductStub) -> Result<models::ProductId, Error<RegisterProductError>> { +pub async fn register_product( + configuration: &configuration::Configuration, + product_stub: models::ProductStub, +) -> Result<models::ProductId, Error<RegisterProductError>> { // add a prefix to parameters to efficiently prevent name collisions let p_product_stub = product_stub; let uri_str = format!("{}/product/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -88,13 +104,24 @@ pub async fn register_product(configuration: &configuration::Configuration, prod 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::ProductId`"))), - 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::ProductId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::ProductId`", + ))); + } + 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::ProductId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterProductError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_product_parent_api.rs b/crates/rocie-client/src/apis/api_set_product_parent_api.rs index a537941..6b67802 100644 --- a/crates/rocie-client/src/apis/api_set_product_parent_api.rs +++ b/crates/rocie-client/src/apis/api_set_product_parent_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 [`register_product_parent`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -23,13 +21,17 @@ pub enum RegisterProductParentError { UnknownValue(serde_json::Value), } - -pub async fn register_product_parent(configuration: &configuration::Configuration, product_parent_stub: models::ProductParentStub) -> Result<models::ProductParentId, Error<RegisterProductParentError>> { +pub async fn register_product_parent( + configuration: &configuration::Configuration, + product_parent_stub: models::ProductParentStub, +) -> Result<models::ProductParentId, Error<RegisterProductParentError>> { // add a prefix to parameters to efficiently prevent name collisions let p_product_parent_stub = product_parent_stub; let uri_str = format!("{}/product_parent/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -51,13 +53,24 @@ pub async fn register_product_parent(configuration: &configuration::Configuratio 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::ProductParentId`"))), - 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::ProductParentId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::ProductParentId`", + ))); + } + 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::ProductParentId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterProductParentError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_recipe_api.rs b/crates/rocie-client/src/apis/api_set_recipe_api.rs index 519f90e..299cad0 100644 --- a/crates/rocie-client/src/apis/api_set_recipe_api.rs +++ b/crates/rocie-client/src/apis/api_set_recipe_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 [`add_recipe`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -23,13 +21,17 @@ pub enum AddRecipeError { UnknownValue(serde_json::Value), } - -pub async fn add_recipe(configuration: &configuration::Configuration, recipe_stub: models::RecipeStub) -> Result<models::RecipeId, Error<AddRecipeError>> { +pub async fn add_recipe( + configuration: &configuration::Configuration, + recipe_stub: models::RecipeStub, +) -> Result<models::RecipeId, Error<AddRecipeError>> { // add a prefix to parameters to efficiently prevent name collisions let p_recipe_stub = recipe_stub; let uri_str = format!("{}/recipe/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -51,13 +53,24 @@ pub async fn add_recipe(configuration: &configuration::Configuration, recipe_stu 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::RecipeId`"))), - 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::RecipeId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::RecipeId`", + ))); + } + 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::RecipeId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<AddRecipeError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_unit_api.rs b/crates/rocie-client/src/apis/api_set_unit_api.rs index 1c64bfb..93868f5 100644 --- a/crates/rocie-client/src/apis/api_set_unit_api.rs +++ b/crates/rocie-client/src/apis/api_set_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 [`register_unit`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -23,13 +21,17 @@ pub enum RegisterUnitError { UnknownValue(serde_json::Value), } - -pub async fn register_unit(configuration: &configuration::Configuration, unit_stub: models::UnitStub) -> Result<models::UnitId, Error<RegisterUnitError>> { +pub async fn register_unit( + configuration: &configuration::Configuration, + unit_stub: models::UnitStub, +) -> Result<models::UnitId, Error<RegisterUnitError>> { // add a prefix to parameters to efficiently prevent name collisions let p_unit_stub = unit_stub; let uri_str = format!("{}/unit/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -51,13 +53,24 @@ pub async fn register_unit(configuration: &configuration::Configuration, unit_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::UnitId`"))), - 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::UnitId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UnitId`", + ))); + } + 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::UnitId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterUnitError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/api_set_unit_property_api.rs b/crates/rocie-client/src/apis/api_set_unit_property_api.rs index 35398bc..883ab06 100644 --- a/crates/rocie-client/src/apis/api_set_unit_property_api.rs +++ b/crates/rocie-client/src/apis/api_set_unit_property_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 [`register_unit_property`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -23,13 +21,17 @@ pub enum RegisterUnitPropertyError { UnknownValue(serde_json::Value), } - -pub async fn register_unit_property(configuration: &configuration::Configuration, unit_property_stub: models::UnitPropertyStub) -> Result<models::UnitPropertyId, Error<RegisterUnitPropertyError>> { +pub async fn register_unit_property( + configuration: &configuration::Configuration, + unit_property_stub: models::UnitPropertyStub, +) -> Result<models::UnitPropertyId, Error<RegisterUnitPropertyError>> { // add a prefix to parameters to efficiently prevent name collisions let p_unit_property_stub = unit_property_stub; let uri_str = format!("{}/unit-property/new", configuration.base_path); - let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_str); if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); @@ -51,13 +53,24 @@ pub async fn register_unit_property(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 `models::UnitPropertyId`"))), - 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::UnitPropertyId`")))), + ContentType::Text => { + return Err(Error::from(serde_json::Error::custom( + "Received `text/plain` content type response that cannot be converted to `models::UnitPropertyId`", + ))); + } + 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::UnitPropertyId`" + )))); + } } } else { let content = resp.text().await?; let entity: Option<RegisterUnitPropertyError> = serde_json::from_str(&content).ok(); - Err(Error::ResponseError(ResponseContent { status, content, entity })) + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } - diff --git a/crates/rocie-client/src/apis/configuration.rs b/crates/rocie-client/src/apis/configuration.rs index c143926..d576aef 100644 --- a/crates/rocie-client/src/apis/configuration.rs +++ b/crates/rocie-client/src/apis/configuration.rs @@ -35,7 +35,10 @@ impl Configuration { impl Default for Configuration { fn default() -> Self { - let client = reqwest::Client::builder().cookie_store(true).build().expect("to be not missconfigured"); + let client = reqwest::Client::builder() + .cookie_store(true) + .build() + .expect("to be not missconfigured"); Configuration { base_path: "http://localhost".to_owned(), diff --git a/crates/rocie-client/src/apis/mod.rs b/crates/rocie-client/src/apis/mod.rs index e1b12e3..dd7464f 100644 --- a/crates/rocie-client/src/apis/mod.rs +++ b/crates/rocie-client/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error<T> { ResponseError(ResponseContent<T>), } -impl <T> fmt::Display for Error<T> { +impl<T> fmt::Display for Error<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl <T> fmt::Display for Error<T> { } } -impl <T: fmt::Debug> error::Error for Error<T> { +impl<T: fmt::Debug> error::Error for Error<T> { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl <T: fmt::Debug> error::Error for Error<T> { } } -impl <T> From<reqwest::Error> for Error<T> { +impl<T> From<reqwest::Error> for Error<T> { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl <T> From<serde_json::Error> for Error<T> { +impl<T> From<serde_json::Error> for Error<T> { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl <T> From<std::io::Error> for Error<T> { +impl<T> From<std::io::Error> for Error<T> { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - }, - serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } @@ -96,7 +98,7 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String enum ContentType { Json, Text, - Unsupported(String) + Unsupported(String), } impl From<&str> for ContentType { |
