langgraph_api/generated/apis/
system_api.rs1use super::{ContentType, Error, UploadFile, configuration};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{Deserialize, Serialize, de::Error as _};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum HealthCheckOkGetError {
20 Status500(String),
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum ServerInfoInfoGetError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum SystemMetricsMetricsGetError {
35 UnknownValue(serde_json::Value),
36}
37
38pub fn health_check_ok_get_request_builder(
40 configuration: &configuration::Configuration,
41 check_db: Option<i32>,
42) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
43 let p_query_check_db = check_db;
45
46 let uri_str = format!("{}/ok", configuration.base_path);
47 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
48
49 if let Some(ref param_value) = p_query_check_db {
50 req_builder = req_builder.query(&[("check_db", ¶m_value.to_string())]);
51 }
52 if let Some(ref user_agent) = configuration.user_agent {
53 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
54 }
55
56 Ok(req_builder)
57}
58
59pub async fn health_check_ok_get(
60 configuration: &configuration::Configuration,
61 check_db: Option<i32>,
62) -> Result<models::HealthResponse, Error<HealthCheckOkGetError>> {
63 let req_builder = health_check_ok_get_request_builder(configuration, check_db)
64 .map_err(super::map_request_builder_error)?;
65 let req = req_builder.build()?;
66 let resp = configuration.client.execute(req).await?;
67
68 let status = resp.status();
69 let content_type = resp
70 .headers()
71 .get("content-type")
72 .and_then(|v| v.to_str().ok())
73 .unwrap_or("application/octet-stream");
74 let content_type = super::ContentType::from(content_type);
75
76 if !status.is_client_error() && !status.is_server_error() {
77 let content = resp.text().await?;
78 match content_type {
79 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
80 ContentType::Text => Err(Error::from(serde_json::Error::custom(
81 "Received `text/plain` content type response that cannot be converted to `models::HealthResponse`",
82 ))),
83 ContentType::Unsupported(unknown_type) => {
84 Err(Error::from(serde_json::Error::custom(format!(
85 "Received `{unknown_type}` content type response that cannot be converted to `models::HealthResponse`"
86 ))))
87 }
88 }
89 } else {
90 let content = resp.text().await?;
91 let entity: Option<HealthCheckOkGetError> = serde_json::from_str(&content).ok();
92 Err(Error::ResponseError(ResponseContent {
93 status,
94 content,
95 entity,
96 }))
97 }
98}
99
100pub fn server_info_info_get_request_builder(
102 configuration: &configuration::Configuration,
103) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
104 let uri_str = format!("{}/info", configuration.base_path);
105 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
106
107 if let Some(ref user_agent) = configuration.user_agent {
108 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
109 }
110
111 Ok(req_builder)
112}
113
114pub async fn server_info_info_get(
115 configuration: &configuration::Configuration,
116) -> Result<models::ServerInfo, Error<ServerInfoInfoGetError>> {
117 let req_builder = server_info_info_get_request_builder(configuration)
118 .map_err(super::map_request_builder_error)?;
119 let req = req_builder.build()?;
120 let resp = configuration.client.execute(req).await?;
121
122 let status = resp.status();
123 let content_type = resp
124 .headers()
125 .get("content-type")
126 .and_then(|v| v.to_str().ok())
127 .unwrap_or("application/octet-stream");
128 let content_type = super::ContentType::from(content_type);
129
130 if !status.is_client_error() && !status.is_server_error() {
131 let content = resp.text().await?;
132 match content_type {
133 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
134 ContentType::Text => Err(Error::from(serde_json::Error::custom(
135 "Received `text/plain` content type response that cannot be converted to `models::ServerInfo`",
136 ))),
137 ContentType::Unsupported(unknown_type) => {
138 Err(Error::from(serde_json::Error::custom(format!(
139 "Received `{unknown_type}` content type response that cannot be converted to `models::ServerInfo`"
140 ))))
141 }
142 }
143 } else {
144 let content = resp.text().await?;
145 let entity: Option<ServerInfoInfoGetError> = serde_json::from_str(&content).ok();
146 Err(Error::ResponseError(ResponseContent {
147 status,
148 content,
149 entity,
150 }))
151 }
152}
153
154pub fn system_metrics_metrics_get_request_builder(
156 configuration: &configuration::Configuration,
157 format: Option<&str>,
158) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
159 let p_query_format = format;
161
162 let uri_str = format!("{}/metrics", configuration.base_path);
163 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
164
165 if let Some(ref param_value) = p_query_format {
166 req_builder = req_builder.query(&[("format", ¶m_value.to_string())]);
167 }
168 if let Some(ref user_agent) = configuration.user_agent {
169 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
170 }
171
172 Ok(req_builder)
173}
174
175pub async fn system_metrics_metrics_get(
176 configuration: &configuration::Configuration,
177 format: Option<&str>,
178) -> Result<String, Error<SystemMetricsMetricsGetError>> {
179 let req_builder = system_metrics_metrics_get_request_builder(configuration, format)
180 .map_err(super::map_request_builder_error)?;
181 let req = req_builder.build()?;
182 let resp = configuration.client.execute(req).await?;
183
184 let status = resp.status();
185 let content_type = resp
186 .headers()
187 .get("content-type")
188 .and_then(|v| v.to_str().ok())
189 .unwrap_or("application/octet-stream");
190 let content_type = super::ContentType::from(content_type);
191
192 if !status.is_client_error() && !status.is_server_error() {
193 let content = resp.text().await?;
194 match content_type {
195 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
196 ContentType::Text => Ok(content),
197 ContentType::Unsupported(unknown_type) => {
198 Err(Error::from(serde_json::Error::custom(format!(
199 "Received `{unknown_type}` content type response that cannot be converted to `String`"
200 ))))
201 }
202 }
203 } else {
204 let content = resp.text().await?;
205 let entity: Option<SystemMetricsMetricsGetError> = serde_json::from_str(&content).ok();
206 Err(Error::ResponseError(ResponseContent {
207 status,
208 content,
209 entity,
210 }))
211 }
212}