Skip to main content

dtz_observability/apis/
default_api.rs

1/*
2 * DTZ Observability
3 *
4 * a generated client for the DTZ Observability API
5 *
6 * Contact: jens@apimeister.com
7 * Generated by: https://openapi-generator.tech
8 */
9
10
11use reqwest;
12#[allow(unused_imports)]
13use serde::{de::Error as _};
14use crate::{apis::ResponseContent, models};
15#[allow(unused_imports)]
16use super::{Error, ContentType};
17use dtz_config::Configuration;
18
19fn build_url(config: &Configuration) -> String {
20    if let Some(base_path) = &config.base_path {
21        let base = url::Url::parse(base_path).unwrap();
22        let mut target_url = url::Url::parse(crate::apis::SVC_URL).unwrap();
23        let _ = target_url.set_scheme(base.scheme());
24        let _ = target_url.set_port(base.port());
25        let _ = target_url.set_host(Some(base.host_str().unwrap()));
26        format!("{target_url}")
27    } else {
28        crate::apis::SVC_URL.to_string()
29    }
30}
31
32
33/// struct for typed errors of method [`disable`]
34#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(untagged)]
36pub enum DisableError {
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`enable`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum EnableError {
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`get_build_info`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum GetBuildInfoError {
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`get_log_activity`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum GetLogActivityError {
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`get_log_attributes`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum GetLogAttributesError {
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`get_logs`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum GetLogsError {
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`get_metric_metadata`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetMetricMetadataError {
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`get_stats`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetStatsError {
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`list_label_values`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum ListLabelValuesError {
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`list_labels`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum ListLabelsError {
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`post_log`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum PostLogError {
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`post_metric`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum PostMetricError {
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`post_prometheus`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum PostPrometheusError {
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`query_log_activity`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum QueryLogActivityError {
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`query_logs`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum QueryLogsError {
135    UnknownValue(serde_json::Value),
136}
137
138
139pub async fn disable(configuration: &Configuration) -> Result<(), Error<DisableError>> {
140
141    let uri_str = format!("{}/disable", build_url(configuration));
142    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
143
144
145    if let Some(ref token) = configuration.oauth_access_token {
146        req_builder = req_builder.bearer_auth(token.to_owned());
147    };
148    if let Some(ref value) = configuration.api_key {
149        req_builder = req_builder.header("X-API-KEY", value);
150    };
151
152    let req = req_builder.build()?;
153    let resp = configuration.client.execute(req).await?;
154
155    let status = resp.status();
156
157    if !status.is_client_error() && !status.is_server_error() {
158        Ok(())
159    } else {
160        let content = resp.text().await?;
161        let entity: Option<DisableError> = serde_json::from_str(&content).ok();
162        Err(Error::ResponseError(ResponseContent { status, content, entity }))
163    }
164}
165
166pub async fn enable(configuration: &Configuration) -> Result<(), Error<EnableError>> {
167
168    let uri_str = format!("{}/enable", build_url(configuration));
169    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
170
171
172    if let Some(ref token) = configuration.oauth_access_token {
173        req_builder = req_builder.bearer_auth(token.to_owned());
174    };
175    if let Some(ref value) = configuration.api_key {
176        req_builder = req_builder.header("X-API-KEY", value);
177    };
178
179    let req = req_builder.build()?;
180    let resp = configuration.client.execute(req).await?;
181
182    let status = resp.status();
183
184    if !status.is_client_error() && !status.is_server_error() {
185        Ok(())
186    } else {
187        let content = resp.text().await?;
188        let entity: Option<EnableError> = serde_json::from_str(&content).ok();
189        Err(Error::ResponseError(ResponseContent { status, content, entity }))
190    }
191}
192
193pub async fn get_build_info(configuration: &Configuration) -> Result<models::GetBuildInfo200Response, Error<GetBuildInfoError>> {
194
195    let uri_str = format!("{}/prometheus/api/v1/status/buildinfo", build_url(configuration));
196    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
197
198
199    if let Some(ref token) = configuration.oauth_access_token {
200        req_builder = req_builder.bearer_auth(token.to_owned());
201    };
202    if let Some(ref value) = configuration.api_key {
203        req_builder = req_builder.header("X-API-KEY", value);
204    };
205
206    let req = req_builder.build()?;
207    let resp = configuration.client.execute(req).await?;
208
209    let status = resp.status();
210    let content_type = resp
211        .headers()
212        .get("content-type")
213        .and_then(|v| v.to_str().ok())
214        .unwrap_or("application/octet-stream");
215    let content_type = super::ContentType::from(content_type);
216
217    if !status.is_client_error() && !status.is_server_error() {
218        let content = resp.text().await?;
219        match content_type {
220            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
221            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBuildInfo200Response`"))),
222            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::GetBuildInfo200Response`")))),
223        }
224    } else {
225        let content = resp.text().await?;
226        let entity: Option<GetBuildInfoError> = serde_json::from_str(&content).ok();
227        Err(Error::ResponseError(ResponseContent { status, content, entity }))
228    }
229}
230
231pub async fn get_log_activity(configuration: &Configuration) -> Result<Vec<models::GetLogActivity200ResponseInner>, Error<GetLogActivityError>> {
232
233    let uri_str = format!("{}/log/activity", build_url(configuration));
234    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
235
236
237    if let Some(ref token) = configuration.oauth_access_token {
238        req_builder = req_builder.bearer_auth(token.to_owned());
239    };
240    if let Some(ref value) = configuration.api_key {
241        req_builder = req_builder.header("X-API-KEY", value);
242    };
243
244    let req = req_builder.build()?;
245    let resp = configuration.client.execute(req).await?;
246
247    let status = resp.status();
248    let content_type = resp
249        .headers()
250        .get("content-type")
251        .and_then(|v| v.to_str().ok())
252        .unwrap_or("application/octet-stream");
253    let content_type = super::ContentType::from(content_type);
254
255    if !status.is_client_error() && !status.is_server_error() {
256        let content = resp.text().await?;
257        match content_type {
258            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
259            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::GetLogActivity200ResponseInner&gt;`"))),
260            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::GetLogActivity200ResponseInner&gt;`")))),
261        }
262    } else {
263        let content = resp.text().await?;
264        let entity: Option<GetLogActivityError> = serde_json::from_str(&content).ok();
265        Err(Error::ResponseError(ResponseContent { status, content, entity }))
266    }
267}
268
269pub async fn get_log_attributes(configuration: &Configuration) -> Result<Vec<models::GetLogAttributes200ResponseInner>, Error<GetLogAttributesError>> {
270
271    let uri_str = format!("{}/log/attribute", build_url(configuration));
272    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
273
274
275    if let Some(ref token) = configuration.oauth_access_token {
276        req_builder = req_builder.bearer_auth(token.to_owned());
277    };
278    if let Some(ref value) = configuration.api_key {
279        req_builder = req_builder.header("X-API-KEY", value);
280    };
281
282    let req = req_builder.build()?;
283    let resp = configuration.client.execute(req).await?;
284
285    let status = resp.status();
286    let content_type = resp
287        .headers()
288        .get("content-type")
289        .and_then(|v| v.to_str().ok())
290        .unwrap_or("application/octet-stream");
291    let content_type = super::ContentType::from(content_type);
292
293    if !status.is_client_error() && !status.is_server_error() {
294        let content = resp.text().await?;
295        match content_type {
296            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
297            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::GetLogAttributes200ResponseInner&gt;`"))),
298            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::GetLogAttributes200ResponseInner&gt;`")))),
299        }
300    } else {
301        let content = resp.text().await?;
302        let entity: Option<GetLogAttributesError> = serde_json::from_str(&content).ok();
303        Err(Error::ResponseError(ResponseContent { status, content, entity }))
304    }
305}
306
307pub async fn get_logs(configuration: &Configuration) -> Result<Vec<models::DtzLogsInner>, Error<GetLogsError>> {
308
309    let uri_str = format!("{}/log", build_url(configuration));
310    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
311
312
313    if let Some(ref token) = configuration.oauth_access_token {
314        req_builder = req_builder.bearer_auth(token.to_owned());
315    };
316    if let Some(ref value) = configuration.api_key {
317        req_builder = req_builder.header("X-API-KEY", value);
318    };
319
320    let req = req_builder.build()?;
321    let resp = configuration.client.execute(req).await?;
322
323    let status = resp.status();
324    let content_type = resp
325        .headers()
326        .get("content-type")
327        .and_then(|v| v.to_str().ok())
328        .unwrap_or("application/octet-stream");
329    let content_type = super::ContentType::from(content_type);
330
331    if !status.is_client_error() && !status.is_server_error() {
332        let content = resp.text().await?;
333        match content_type {
334            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
335            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::DtzLogsInner&gt;`"))),
336            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::DtzLogsInner&gt;`")))),
337        }
338    } else {
339        let content = resp.text().await?;
340        let entity: Option<GetLogsError> = serde_json::from_str(&content).ok();
341        Err(Error::ResponseError(ResponseContent { status, content, entity }))
342    }
343}
344
345pub async fn get_metric_metadata(configuration: &Configuration) -> Result<models::GetMetricMetadata200Response, Error<GetMetricMetadataError>> {
346
347    let uri_str = format!("{}/prometheus/api/v1/metadata", build_url(configuration));
348    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
349
350
351    if let Some(ref token) = configuration.oauth_access_token {
352        req_builder = req_builder.bearer_auth(token.to_owned());
353    };
354    if let Some(ref value) = configuration.api_key {
355        req_builder = req_builder.header("X-API-KEY", value);
356    };
357
358    let req = req_builder.build()?;
359    let resp = configuration.client.execute(req).await?;
360
361    let status = resp.status();
362    let content_type = resp
363        .headers()
364        .get("content-type")
365        .and_then(|v| v.to_str().ok())
366        .unwrap_or("application/octet-stream");
367    let content_type = super::ContentType::from(content_type);
368
369    if !status.is_client_error() && !status.is_server_error() {
370        let content = resp.text().await?;
371        match content_type {
372            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
373            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMetricMetadata200Response`"))),
374            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::GetMetricMetadata200Response`")))),
375        }
376    } else {
377        let content = resp.text().await?;
378        let entity: Option<GetMetricMetadataError> = serde_json::from_str(&content).ok();
379        Err(Error::ResponseError(ResponseContent { status, content, entity }))
380    }
381}
382
383pub async fn get_stats(configuration: &Configuration) -> Result<models::GetStats200Response, Error<GetStatsError>> {
384
385    let uri_str = format!("{}/stats", build_url(configuration));
386    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
387
388
389    if let Some(ref token) = configuration.oauth_access_token {
390        req_builder = req_builder.bearer_auth(token.to_owned());
391    };
392    if let Some(ref value) = configuration.api_key {
393        req_builder = req_builder.header("X-API-KEY", value);
394    };
395
396    let req = req_builder.build()?;
397    let resp = configuration.client.execute(req).await?;
398
399    let status = resp.status();
400    let content_type = resp
401        .headers()
402        .get("content-type")
403        .and_then(|v| v.to_str().ok())
404        .unwrap_or("application/octet-stream");
405    let content_type = super::ContentType::from(content_type);
406
407    if !status.is_client_error() && !status.is_server_error() {
408        let content = resp.text().await?;
409        match content_type {
410            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
411            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetStats200Response`"))),
412            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::GetStats200Response`")))),
413        }
414    } else {
415        let content = resp.text().await?;
416        let entity: Option<GetStatsError> = serde_json::from_str(&content).ok();
417        Err(Error::ResponseError(ResponseContent { status, content, entity }))
418    }
419}
420
421pub async fn list_label_values(configuration: &Configuration, label: &str) -> Result<models::ListLabelValues200Response, Error<ListLabelValuesError>> {
422    // add a prefix to parameters to efficiently prevent name collisions
423    let p_path_label = label;
424
425    let uri_str = format!("{}/prometheus/api/v1/label/{label}/values", build_url(configuration), label=crate::apis::urlencode(p_path_label));
426    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
427
428
429    if let Some(ref token) = configuration.oauth_access_token {
430        req_builder = req_builder.bearer_auth(token.to_owned());
431    };
432    if let Some(ref value) = configuration.api_key {
433        req_builder = req_builder.header("X-API-KEY", value);
434    };
435
436    let req = req_builder.build()?;
437    let resp = configuration.client.execute(req).await?;
438
439    let status = resp.status();
440    let content_type = resp
441        .headers()
442        .get("content-type")
443        .and_then(|v| v.to_str().ok())
444        .unwrap_or("application/octet-stream");
445    let content_type = super::ContentType::from(content_type);
446
447    if !status.is_client_error() && !status.is_server_error() {
448        let content = resp.text().await?;
449        match content_type {
450            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
451            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListLabelValues200Response`"))),
452            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::ListLabelValues200Response`")))),
453        }
454    } else {
455        let content = resp.text().await?;
456        let entity: Option<ListLabelValuesError> = serde_json::from_str(&content).ok();
457        Err(Error::ResponseError(ResponseContent { status, content, entity }))
458    }
459}
460
461pub async fn list_labels(configuration: &Configuration) -> Result<models::ListLabelValues200Response, Error<ListLabelsError>> {
462
463    let uri_str = format!("{}/prometheus/api/v1/labels", build_url(configuration));
464    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
465
466
467    if let Some(ref token) = configuration.oauth_access_token {
468        req_builder = req_builder.bearer_auth(token.to_owned());
469    };
470    if let Some(ref value) = configuration.api_key {
471        req_builder = req_builder.header("X-API-KEY", value);
472    };
473
474    let req = req_builder.build()?;
475    let resp = configuration.client.execute(req).await?;
476
477    let status = resp.status();
478    let content_type = resp
479        .headers()
480        .get("content-type")
481        .and_then(|v| v.to_str().ok())
482        .unwrap_or("application/octet-stream");
483    let content_type = super::ContentType::from(content_type);
484
485    if !status.is_client_error() && !status.is_server_error() {
486        let content = resp.text().await?;
487        match content_type {
488            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
489            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListLabelValues200Response`"))),
490            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::ListLabelValues200Response`")))),
491        }
492    } else {
493        let content = resp.text().await?;
494        let entity: Option<ListLabelsError> = serde_json::from_str(&content).ok();
495        Err(Error::ResponseError(ResponseContent { status, content, entity }))
496    }
497}
498
499pub async fn post_log(configuration: &Configuration, post_log_request_inner: Option<Vec<models::PostLogRequestInner>>) -> Result<(), Error<PostLogError>> {
500    // add a prefix to parameters to efficiently prevent name collisions
501    let p_body_post_log_request_inner = post_log_request_inner;
502
503    let uri_str = format!("{}/log/push", build_url(configuration));
504    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
505
506
507    if let Some(ref token) = configuration.oauth_access_token {
508        req_builder = req_builder.bearer_auth(token.to_owned());
509    };
510    if let Some(ref value) = configuration.api_key {
511        req_builder = req_builder.header("X-API-KEY", value);
512    };
513    req_builder = req_builder.json(&p_body_post_log_request_inner);
514
515    let req = req_builder.build()?;
516    let resp = configuration.client.execute(req).await?;
517
518    let status = resp.status();
519
520    if !status.is_client_error() && !status.is_server_error() {
521        Ok(())
522    } else {
523        let content = resp.text().await?;
524        let entity: Option<PostLogError> = serde_json::from_str(&content).ok();
525        Err(Error::ResponseError(ResponseContent { status, content, entity }))
526    }
527}
528
529pub async fn post_metric(configuration: &Configuration, dtz_metric: Option<Vec<models::DtzMetric>>) -> Result<(), Error<PostMetricError>> {
530    // add a prefix to parameters to efficiently prevent name collisions
531    let p_body_dtz_metric = dtz_metric;
532
533    let uri_str = format!("{}/metric", build_url(configuration));
534    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
535
536
537    if let Some(ref token) = configuration.oauth_access_token {
538        req_builder = req_builder.bearer_auth(token.to_owned());
539    };
540    if let Some(ref value) = configuration.api_key {
541        req_builder = req_builder.header("X-API-KEY", value);
542    };
543    req_builder = req_builder.json(&p_body_dtz_metric);
544
545    let req = req_builder.build()?;
546    let resp = configuration.client.execute(req).await?;
547
548    let status = resp.status();
549
550    if !status.is_client_error() && !status.is_server_error() {
551        Ok(())
552    } else {
553        let content = resp.text().await?;
554        let entity: Option<PostMetricError> = serde_json::from_str(&content).ok();
555        Err(Error::ResponseError(ResponseContent { status, content, entity }))
556    }
557}
558
559pub async fn post_prometheus(configuration: &Configuration, body: Option<&str>) -> Result<(), Error<PostPrometheusError>> {
560    // add a prefix to parameters to efficiently prevent name collisions
561    let p_body_body = body;
562
563    let uri_str = format!("{}/prometheus", build_url(configuration));
564    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
565
566
567    if let Some(ref token) = configuration.oauth_access_token {
568        req_builder = req_builder.bearer_auth(token.to_owned());
569    };
570    if let Some(ref value) = configuration.api_key {
571        req_builder = req_builder.header("X-API-KEY", value);
572    };
573    req_builder = req_builder.json(&p_body_body);
574
575    let req = req_builder.build()?;
576    let resp = configuration.client.execute(req).await?;
577
578    let status = resp.status();
579
580    if !status.is_client_error() && !status.is_server_error() {
581        Ok(())
582    } else {
583        let content = resp.text().await?;
584        let entity: Option<PostPrometheusError> = serde_json::from_str(&content).ok();
585        Err(Error::ResponseError(ResponseContent { status, content, entity }))
586    }
587}
588
589pub async fn query_log_activity(configuration: &Configuration, query_logs_request: Option<models::QueryLogsRequest>) -> Result<Vec<models::GetLogActivity200ResponseInner>, Error<QueryLogActivityError>> {
590    // add a prefix to parameters to efficiently prevent name collisions
591    let p_body_query_logs_request = query_logs_request;
592
593    let uri_str = format!("{}/log/activity", build_url(configuration));
594    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
595
596
597    if let Some(ref token) = configuration.oauth_access_token {
598        req_builder = req_builder.bearer_auth(token.to_owned());
599    };
600    if let Some(ref value) = configuration.api_key {
601        req_builder = req_builder.header("X-API-KEY", value);
602    };
603    req_builder = req_builder.json(&p_body_query_logs_request);
604
605    let req = req_builder.build()?;
606    let resp = configuration.client.execute(req).await?;
607
608    let status = resp.status();
609    let content_type = resp
610        .headers()
611        .get("content-type")
612        .and_then(|v| v.to_str().ok())
613        .unwrap_or("application/octet-stream");
614    let content_type = super::ContentType::from(content_type);
615
616    if !status.is_client_error() && !status.is_server_error() {
617        let content = resp.text().await?;
618        match content_type {
619            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
620            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::GetLogActivity200ResponseInner&gt;`"))),
621            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::GetLogActivity200ResponseInner&gt;`")))),
622        }
623    } else {
624        let content = resp.text().await?;
625        let entity: Option<QueryLogActivityError> = serde_json::from_str(&content).ok();
626        Err(Error::ResponseError(ResponseContent { status, content, entity }))
627    }
628}
629
630pub async fn query_logs(configuration: &Configuration, query_logs_request: Option<models::QueryLogsRequest>) -> Result<Vec<models::DtzLogsInner>, Error<QueryLogsError>> {
631    // add a prefix to parameters to efficiently prevent name collisions
632    let p_body_query_logs_request = query_logs_request;
633
634    let uri_str = format!("{}/log", build_url(configuration));
635    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
636
637
638    if let Some(ref token) = configuration.oauth_access_token {
639        req_builder = req_builder.bearer_auth(token.to_owned());
640    };
641    if let Some(ref value) = configuration.api_key {
642        req_builder = req_builder.header("X-API-KEY", value);
643    };
644    req_builder = req_builder.json(&p_body_query_logs_request);
645
646    let req = req_builder.build()?;
647    let resp = configuration.client.execute(req).await?;
648
649    let status = resp.status();
650    let content_type = resp
651        .headers()
652        .get("content-type")
653        .and_then(|v| v.to_str().ok())
654        .unwrap_or("application/octet-stream");
655    let content_type = super::ContentType::from(content_type);
656
657    if !status.is_client_error() && !status.is_server_error() {
658        let content = resp.text().await?;
659        match content_type {
660            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
661            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::DtzLogsInner&gt;`"))),
662            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::DtzLogsInner&gt;`")))),
663        }
664    } else {
665        let content = resp.text().await?;
666        let entity: Option<QueryLogsError> = serde_json::from_str(&content).ok();
667        Err(Error::ResponseError(ResponseContent { status, content, entity }))
668    }
669}
670