From 56f72f4d4c39588fe50414a4db1e8e345047c5d2 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 8 Oct 2025 12:05:36 +0200 Subject: chore(crates/rocie-client): Re-generate --- .../rocie-client/src/apis/api_get_inventory_api.rs | 2 +- .../rocie-client/src/apis/api_get_product_api.rs | 2 +- crates/rocie-client/src/apis/api_get_unit_api.rs | 2 +- .../src/apis/api_get_unit_property_api.rs | 105 +++++++++++++++++++++ .../rocie-client/src/apis/api_set_barcode_api.rs | 2 +- .../rocie-client/src/apis/api_set_product_api.rs | 2 +- crates/rocie-client/src/apis/api_set_unit_api.rs | 2 +- .../src/apis/api_set_unit_property_api.rs | 63 +++++++++++++ crates/rocie-client/src/apis/configuration.rs | 2 +- crates/rocie-client/src/apis/mod.rs | 2 + 10 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 crates/rocie-client/src/apis/api_get_unit_property_api.rs create mode 100644 crates/rocie-client/src/apis/api_set_unit_property_api.rs (limited to 'crates/rocie-client/src/apis') 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 965d3e3..e11fc7f 100644 --- a/crates/rocie-client/src/apis/api_get_inventory_api.rs +++ b/crates/rocie-client/src/apis/api_get_inventory_api.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de 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 88c680b..481084b 100644 --- a/crates/rocie-client/src/apis/api_get_product_api.rs +++ b/crates/rocie-client/src/apis/api_get_product_api.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de 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 81d772b..927b883 100644 --- a/crates/rocie-client/src/apis/api_get_unit_api.rs +++ b/crates/rocie-client/src/apis/api_get_unit_api.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de 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 new file mode 100644 index 0000000..1082dcb --- /dev/null +++ b/crates/rocie-client/src/apis/api_get_unit_property_api.rs @@ -0,0 +1,105 @@ +/* + * rocie-server + * + * An enterprise grocery management system - server + * + * The version of the OpenAPI document: 0.1.0 + * Contact: benedikt.peetz@b-peetz.de + * Generated by: https://openapi-generator.tech + */ + + +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)] +#[serde(untagged)] +pub enum UnitPropertiesError { + Status500(String), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`unit_property_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UnitPropertyByIdError { + Status404(), + Status500(String), + UnknownValue(serde_json::Value), +} + + +pub async fn unit_properties(configuration: &configuration::Configuration, ) -> Result, Error> { + + let uri_str = format!("{}/unit-properties/", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + 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>`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { status, content, entity })) + } +} + +pub async fn unit_property_by_id(configuration: &configuration::Configuration, id: models::UnitPropertyId) -> Result> { + // 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 mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + 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`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + 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 e3ac9fb..5111b6b 100644 --- a/crates/rocie-client/src/apis/api_set_barcode_api.rs +++ b/crates/rocie-client/src/apis/api_set_barcode_api.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de 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 d3cf378..b2d65a3 100644 --- a/crates/rocie-client/src/apis/api_set_product_api.rs +++ b/crates/rocie-client/src/apis/api_set_product_api.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de 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 dc88775..1c64bfb 100644 --- a/crates/rocie-client/src/apis/api_set_unit_api.rs +++ b/crates/rocie-client/src/apis/api_set_unit_api.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de 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 new file mode 100644 index 0000000..35398bc --- /dev/null +++ b/crates/rocie-client/src/apis/api_set_unit_property_api.rs @@ -0,0 +1,63 @@ +/* + * rocie-server + * + * An enterprise grocery management system - server + * + * The version of the OpenAPI document: 0.1.0 + * Contact: benedikt.peetz@b-peetz.de + * Generated by: https://openapi-generator.tech + */ + + +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)] +#[serde(untagged)] +pub enum RegisterUnitPropertyError { + Status500(String), + UnknownValue(serde_json::Value), +} + + +pub async fn register_unit_property(configuration: &configuration::Configuration, unit_property_stub: models::UnitPropertyStub) -> Result> { + // 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); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + req_builder = req_builder.json(&p_unit_property_stub); + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + let content_type = resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let content_type = super::ContentType::from(content_type); + + if !status.is_client_error() && !status.is_server_error() { + 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`")))), + } + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + 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 a4fbb93..590f233 100644 --- a/crates/rocie-client/src/apis/configuration.rs +++ b/crates/rocie-client/src/apis/configuration.rs @@ -1,7 +1,7 @@ /* * rocie-server * - * An enterprise grocery management system + * An enterprise grocery management system - server * * The version of the OpenAPI document: 0.1.0 * Contact: benedikt.peetz@b-peetz.de diff --git a/crates/rocie-client/src/apis/mod.rs b/crates/rocie-client/src/apis/mod.rs index be88193..0853432 100644 --- a/crates/rocie-client/src/apis/mod.rs +++ b/crates/rocie-client/src/apis/mod.rs @@ -114,8 +114,10 @@ impl From<&str> for ContentType { pub mod api_get_inventory_api; pub mod api_get_product_api; pub mod api_get_unit_api; +pub mod api_get_unit_property_api; pub mod api_set_barcode_api; pub mod api_set_product_api; pub mod api_set_unit_api; +pub mod api_set_unit_property_api; pub mod configuration; -- cgit 1.4.1