aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-client/src/apis
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rocie-client/src/apis')
-rw-r--r--crates/rocie-client/src/apis/api_get_api.rs2
-rw-r--r--crates/rocie-client/src/apis/api_get_product_api.rs105
-rw-r--r--crates/rocie-client/src/apis/api_get_unit_api.rs105
-rw-r--r--crates/rocie-client/src/apis/api_set_api.rs4
-rw-r--r--crates/rocie-client/src/apis/api_set_product_api.rs100
-rw-r--r--crates/rocie-client/src/apis/api_set_unit_api.rs63
-rw-r--r--crates/rocie-client/src/apis/mod.rs6
7 files changed, 383 insertions, 2 deletions
diff --git a/crates/rocie-client/src/apis/api_get_api.rs b/crates/rocie-client/src/apis/api_get_api.rs
index 3217717..a8f4c17 100644
--- a/crates/rocie-client/src/apis/api_get_api.rs
+++ b/crates/rocie-client/src/apis/api_get_api.rs
@@ -20,6 +20,7 @@ use super::{Error, configuration, ContentType};
#[serde(untagged)]
pub enum ProductByIdError {
Status404(),
+ Status500(String),
UnknownValue(serde_json::Value),
}
@@ -27,6 +28,7 @@ pub enum ProductByIdError {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ProductsError {
+ Status500(String),
UnknownValue(serde_json::Value),
}
diff --git a/crates/rocie-client/src/apis/api_get_product_api.rs b/crates/rocie-client/src/apis/api_get_product_api.rs
new file mode 100644
index 0000000..a8f4c17
--- /dev/null
+++ b/crates/rocie-client/src/apis/api_get_product_api.rs
@@ -0,0 +1,105 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system
+ *
+ * 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 [`product_by_id`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ProductByIdError {
+ Status404(),
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+/// struct for typed errors of method [`products`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ProductsError {
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+
+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 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::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 }))
+ }
+}
+
+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);
+
+ 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&lt;models::Product&gt;`"))),
+ ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Product&gt;`")))),
+ }
+ } else {
+ let content = resp.text().await?;
+ let entity: Option<ProductsError> = serde_json::from_str(&content).ok();
+ Err(Error::ResponseError(ResponseContent { status, content, entity }))
+ }
+}
+
diff --git a/crates/rocie-client/src/apis/api_get_unit_api.rs b/crates/rocie-client/src/apis/api_get_unit_api.rs
new file mode 100644
index 0000000..5895652
--- /dev/null
+++ b/crates/rocie-client/src/apis/api_get_unit_api.rs
@@ -0,0 +1,105 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system
+ *
+ * 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_by_id`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum UnitByIdError {
+ Status404(),
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+/// struct for typed errors of method [`units`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum UnitsError {
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+
+pub async fn unit_by_id(configuration: &configuration::Configuration, id: &str) -> 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=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 {
+ 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::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 }))
+ }
+}
+
+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);
+
+ 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&lt;models::Unit&gt;`"))),
+ ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Unit&gt;`")))),
+ }
+ } else {
+ let content = resp.text().await?;
+ let entity: Option<UnitsError> = serde_json::from_str(&content).ok();
+ Err(Error::ResponseError(ResponseContent { status, content, entity }))
+ }
+}
+
diff --git a/crates/rocie-client/src/apis/api_set_api.rs b/crates/rocie-client/src/apis/api_set_api.rs
index 7c0c414..81f029e 100644
--- a/crates/rocie-client/src/apis/api_set_api.rs
+++ b/crates/rocie-client/src/apis/api_set_api.rs
@@ -19,6 +19,9 @@ use super::{Error, configuration, ContentType};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AssociateBarcodeError {
+ Status403(),
+ Status404(),
+ Status500(String),
UnknownValue(serde_json::Value),
}
@@ -26,6 +29,7 @@ pub enum AssociateBarcodeError {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RegisterProductError {
+ Status500(String),
UnknownValue(serde_json::Value),
}
diff --git a/crates/rocie-client/src/apis/api_set_product_api.rs b/crates/rocie-client/src/apis/api_set_product_api.rs
new file mode 100644
index 0000000..0d2679b
--- /dev/null
+++ b/crates/rocie-client/src/apis/api_set_product_api.rs
@@ -0,0 +1,100 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system
+ *
+ * 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 [`associate_barcode`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum AssociateBarcodeError {
+ Status403(String),
+ Status404(),
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+/// struct for typed errors of method [`register_product`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum RegisterProductError {
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+
+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);
+
+ 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_barcode);
+
+ let req = req_builder.build()?;
+ let resp = configuration.client.execute(req).await?;
+
+ let status = resp.status();
+
+ if !status.is_client_error() && !status.is_server_error() {
+ Ok(())
+ } else {
+ let content = resp.text().await?;
+ let entity: Option<AssociateBarcodeError> = serde_json::from_str(&content).ok();
+ Err(Error::ResponseError(ResponseContent { status, content, entity }))
+ }
+}
+
+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);
+
+ 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_product_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 `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 }))
+ }
+}
+
diff --git a/crates/rocie-client/src/apis/api_set_unit_api.rs b/crates/rocie-client/src/apis/api_set_unit_api.rs
new file mode 100644
index 0000000..e894fc3
--- /dev/null
+++ b/crates/rocie-client/src/apis/api_set_unit_api.rs
@@ -0,0 +1,63 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system
+ *
+ * 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`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum RegisterUnitError {
+ Status500(String),
+ UnknownValue(serde_json::Value),
+}
+
+
+pub async fn register_unit(configuration: &configuration::Configuration, unit_stub: models::UnitStub) -> Result<uuid::Uuid, 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);
+
+ 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_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 `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<RegisterUnitError> = serde_json::from_str(&content).ok();
+ Err(Error::ResponseError(ResponseContent { status, content, entity }))
+ }
+}
+
diff --git a/crates/rocie-client/src/apis/mod.rs b/crates/rocie-client/src/apis/mod.rs
index c3f990f..7daca17 100644
--- a/crates/rocie-client/src/apis/mod.rs
+++ b/crates/rocie-client/src/apis/mod.rs
@@ -111,7 +111,9 @@ impl From<&str> for ContentType {
}
}
-pub mod api_get_api;
-pub mod api_set_api;
+pub mod api_get_product_api;
+pub mod api_get_unit_api;
+pub mod api_set_product_api;
+pub mod api_set_unit_api;
pub mod configuration;