1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum AdminAppsListError {
20 Status400(models::ValidationError),
21 Status403(models::GenericError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum AdminFileCreateError {
29 Status400(models::ValidationError),
30 Status403(models::GenericError),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum AdminFileDestroyError {
38 Status400(models::ValidationError),
39 Status403(models::GenericError),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum AdminFileListError {
47 Status400(models::ValidationError),
48 Status403(models::GenericError),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum AdminFileUsedByListError {
56 Status400(models::ValidationError),
57 Status403(models::GenericError),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum AdminModelsListError {
65 Status400(models::ValidationError),
66 Status403(models::GenericError),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum AdminSettingsPartialUpdateError {
74 Status400(models::ValidationError),
75 Status403(models::GenericError),
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum AdminSettingsRetrieveError {
83 Status400(models::ValidationError),
84 Status403(models::GenericError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum AdminSettingsUpdateError {
92 Status400(models::ValidationError),
93 Status403(models::GenericError),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum AdminSystemCreateError {
101 Status400(models::ValidationError),
102 Status403(models::GenericError),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum AdminSystemRetrieveError {
110 Status400(models::ValidationError),
111 Status403(models::GenericError),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum AdminVersionHistoryListError {
119 Status400(models::ValidationError),
120 Status403(models::GenericError),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum AdminVersionHistoryRetrieveError {
128 Status400(models::ValidationError),
129 Status403(models::GenericError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum AdminVersionRetrieveError {
137 Status400(models::ValidationError),
138 Status403(models::GenericError),
139 UnknownValue(serde_json::Value),
140}
141
142pub async fn admin_apps_list(
144 configuration: &configuration::Configuration,
145) -> Result<Vec<models::App>, Error<AdminAppsListError>> {
146 let uri_str = format!("{}/admin/apps/", configuration.base_path);
147 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
148
149 if let Some(ref user_agent) = configuration.user_agent {
150 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
151 }
152 if let Some(ref token) = configuration.bearer_access_token {
153 req_builder = req_builder.bearer_auth(token.to_owned());
154 };
155
156 let req = req_builder.build()?;
157 let resp = configuration.client.execute(req).await?;
158
159 let status = resp.status();
160 let content_type = resp
161 .headers()
162 .get("content-type")
163 .and_then(|v| v.to_str().ok())
164 .unwrap_or("application/octet-stream");
165 let content_type = super::ContentType::from(content_type);
166
167 if !status.is_client_error() && !status.is_server_error() {
168 let content = resp.text().await?;
169 match content_type {
170 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
171 ContentType::Text => {
172 return Err(Error::from(serde_json::Error::custom(
173 "Received `text/plain` content type response that cannot be converted to `Vec<models::App>`",
174 )))
175 }
176 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
177 "Received `{unknown_type}` content type response that cannot be converted to `Vec<models::App>`"
178 )))),
179 }
180 } else {
181 let content = resp.text().await?;
182 let entity: Option<AdminAppsListError> = serde_json::from_str(&content).ok();
183 Err(Error::ResponseError(ResponseContent {
184 status,
185 content,
186 entity,
187 }))
188 }
189}
190
191pub async fn admin_file_create(
193 configuration: &configuration::Configuration,
194 file: std::path::PathBuf,
195 name: Option<&str>,
196 usage: Option<&str>,
197) -> Result<(), Error<AdminFileCreateError>> {
198 let p_form_file = file;
200 let p_form_name = name;
201 let p_form_usage = usage;
202
203 let uri_str = format!("{}/admin/file/", configuration.base_path);
204 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
205
206 if let Some(ref user_agent) = configuration.user_agent {
207 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
208 }
209 if let Some(ref token) = configuration.bearer_access_token {
210 req_builder = req_builder.bearer_auth(token.to_owned());
211 };
212 let mut multipart_form = reqwest::multipart::Form::new();
213 if let Some(param_value) = p_form_name {
215 multipart_form = multipart_form.text("name", param_value.to_string());
216 }
217 if let Some(param_value) = p_form_usage {
218 multipart_form = multipart_form.text("usage", param_value.to_string());
219 }
220 req_builder = req_builder.multipart(multipart_form);
221
222 let req = req_builder.build()?;
223 let resp = configuration.client.execute(req).await?;
224
225 let status = resp.status();
226
227 if !status.is_client_error() && !status.is_server_error() {
228 Ok(())
229 } else {
230 let content = resp.text().await?;
231 let entity: Option<AdminFileCreateError> = serde_json::from_str(&content).ok();
232 Err(Error::ResponseError(ResponseContent {
233 status,
234 content,
235 entity,
236 }))
237 }
238}
239
240pub async fn admin_file_destroy(
242 configuration: &configuration::Configuration,
243 name: Option<&str>,
244 usage: Option<&str>,
245) -> Result<(), Error<AdminFileDestroyError>> {
246 let p_query_name = name;
248 let p_query_usage = usage;
249
250 let uri_str = format!("{}/admin/file/", configuration.base_path);
251 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
252
253 if let Some(ref param_value) = p_query_name {
254 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
255 }
256 if let Some(ref param_value) = p_query_usage {
257 req_builder = req_builder.query(&[("usage", ¶m_value.to_string())]);
258 }
259 if let Some(ref user_agent) = configuration.user_agent {
260 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
261 }
262 if let Some(ref token) = configuration.bearer_access_token {
263 req_builder = req_builder.bearer_auth(token.to_owned());
264 };
265
266 let req = req_builder.build()?;
267 let resp = configuration.client.execute(req).await?;
268
269 let status = resp.status();
270
271 if !status.is_client_error() && !status.is_server_error() {
272 Ok(())
273 } else {
274 let content = resp.text().await?;
275 let entity: Option<AdminFileDestroyError> = serde_json::from_str(&content).ok();
276 Err(Error::ResponseError(ResponseContent {
277 status,
278 content,
279 entity,
280 }))
281 }
282}
283
284pub async fn admin_file_list(
286 configuration: &configuration::Configuration,
287 manageable_only: Option<bool>,
288 search: Option<&str>,
289 usage: Option<&str>,
290) -> Result<Vec<models::FileList>, Error<AdminFileListError>> {
291 let p_query_manageable_only = manageable_only;
293 let p_query_search = search;
294 let p_query_usage = usage;
295
296 let uri_str = format!("{}/admin/file/", configuration.base_path);
297 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
298
299 if let Some(ref param_value) = p_query_manageable_only {
300 req_builder = req_builder.query(&[("manageable_only", ¶m_value.to_string())]);
301 }
302 if let Some(ref param_value) = p_query_search {
303 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
304 }
305 if let Some(ref param_value) = p_query_usage {
306 req_builder = req_builder.query(&[("usage", ¶m_value.to_string())]);
307 }
308 if let Some(ref user_agent) = configuration.user_agent {
309 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
310 }
311 if let Some(ref token) = configuration.bearer_access_token {
312 req_builder = req_builder.bearer_auth(token.to_owned());
313 };
314
315 let req = req_builder.build()?;
316 let resp = configuration.client.execute(req).await?;
317
318 let status = resp.status();
319 let content_type = resp
320 .headers()
321 .get("content-type")
322 .and_then(|v| v.to_str().ok())
323 .unwrap_or("application/octet-stream");
324 let content_type = super::ContentType::from(content_type);
325
326 if !status.is_client_error() && !status.is_server_error() {
327 let content = resp.text().await?;
328 match content_type {
329 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
330 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FileList>`"))),
331 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::FileList>`")))),
332 }
333 } else {
334 let content = resp.text().await?;
335 let entity: Option<AdminFileListError> = serde_json::from_str(&content).ok();
336 Err(Error::ResponseError(ResponseContent {
337 status,
338 content,
339 entity,
340 }))
341 }
342}
343
344pub async fn admin_file_used_by_list(
345 configuration: &configuration::Configuration,
346 name: Option<&str>,
347) -> Result<Vec<models::UsedBy>, Error<AdminFileUsedByListError>> {
348 let p_query_name = name;
350
351 let uri_str = format!("{}/admin/file/used_by/", configuration.base_path);
352 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
353
354 if let Some(ref param_value) = p_query_name {
355 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
356 }
357 if let Some(ref user_agent) = configuration.user_agent {
358 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
359 }
360 if let Some(ref token) = configuration.bearer_access_token {
361 req_builder = req_builder.bearer_auth(token.to_owned());
362 };
363
364 let req = req_builder.build()?;
365 let resp = configuration.client.execute(req).await?;
366
367 let status = resp.status();
368 let content_type = resp
369 .headers()
370 .get("content-type")
371 .and_then(|v| v.to_str().ok())
372 .unwrap_or("application/octet-stream");
373 let content_type = super::ContentType::from(content_type);
374
375 if !status.is_client_error() && !status.is_server_error() {
376 let content = resp.text().await?;
377 match content_type {
378 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
379 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
380 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::UsedBy>`")))),
381 }
382 } else {
383 let content = resp.text().await?;
384 let entity: Option<AdminFileUsedByListError> = serde_json::from_str(&content).ok();
385 Err(Error::ResponseError(ResponseContent {
386 status,
387 content,
388 entity,
389 }))
390 }
391}
392
393pub async fn admin_models_list(
395 configuration: &configuration::Configuration,
396) -> Result<Vec<models::App>, Error<AdminModelsListError>> {
397 let uri_str = format!("{}/admin/models/", configuration.base_path);
398 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
399
400 if let Some(ref user_agent) = configuration.user_agent {
401 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
402 }
403 if let Some(ref token) = configuration.bearer_access_token {
404 req_builder = req_builder.bearer_auth(token.to_owned());
405 };
406
407 let req = req_builder.build()?;
408 let resp = configuration.client.execute(req).await?;
409
410 let status = resp.status();
411 let content_type = resp
412 .headers()
413 .get("content-type")
414 .and_then(|v| v.to_str().ok())
415 .unwrap_or("application/octet-stream");
416 let content_type = super::ContentType::from(content_type);
417
418 if !status.is_client_error() && !status.is_server_error() {
419 let content = resp.text().await?;
420 match content_type {
421 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
422 ContentType::Text => {
423 return Err(Error::from(serde_json::Error::custom(
424 "Received `text/plain` content type response that cannot be converted to `Vec<models::App>`",
425 )))
426 }
427 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
428 "Received `{unknown_type}` content type response that cannot be converted to `Vec<models::App>`"
429 )))),
430 }
431 } else {
432 let content = resp.text().await?;
433 let entity: Option<AdminModelsListError> = serde_json::from_str(&content).ok();
434 Err(Error::ResponseError(ResponseContent {
435 status,
436 content,
437 entity,
438 }))
439 }
440}
441
442pub async fn admin_settings_partial_update(
444 configuration: &configuration::Configuration,
445 patched_settings_request: Option<models::PatchedSettingsRequest>,
446) -> Result<models::Settings, Error<AdminSettingsPartialUpdateError>> {
447 let p_body_patched_settings_request = patched_settings_request;
449
450 let uri_str = format!("{}/admin/settings/", configuration.base_path);
451 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
452
453 if let Some(ref user_agent) = configuration.user_agent {
454 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
455 }
456 if let Some(ref token) = configuration.bearer_access_token {
457 req_builder = req_builder.bearer_auth(token.to_owned());
458 };
459 req_builder = req_builder.json(&p_body_patched_settings_request);
460
461 let req = req_builder.build()?;
462 let resp = configuration.client.execute(req).await?;
463
464 let status = resp.status();
465 let content_type = resp
466 .headers()
467 .get("content-type")
468 .and_then(|v| v.to_str().ok())
469 .unwrap_or("application/octet-stream");
470 let content_type = super::ContentType::from(content_type);
471
472 if !status.is_client_error() && !status.is_server_error() {
473 let content = resp.text().await?;
474 match content_type {
475 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
476 ContentType::Text => {
477 return Err(Error::from(serde_json::Error::custom(
478 "Received `text/plain` content type response that cannot be converted to `models::Settings`",
479 )))
480 }
481 ContentType::Unsupported(unknown_type) => {
482 return Err(Error::from(serde_json::Error::custom(format!(
483 "Received `{unknown_type}` content type response that cannot be converted to `models::Settings`"
484 ))))
485 }
486 }
487 } else {
488 let content = resp.text().await?;
489 let entity: Option<AdminSettingsPartialUpdateError> = serde_json::from_str(&content).ok();
490 Err(Error::ResponseError(ResponseContent {
491 status,
492 content,
493 entity,
494 }))
495 }
496}
497
498pub async fn admin_settings_retrieve(
500 configuration: &configuration::Configuration,
501) -> Result<models::Settings, Error<AdminSettingsRetrieveError>> {
502 let uri_str = format!("{}/admin/settings/", configuration.base_path);
503 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
504
505 if let Some(ref user_agent) = configuration.user_agent {
506 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
507 }
508 if let Some(ref token) = configuration.bearer_access_token {
509 req_builder = req_builder.bearer_auth(token.to_owned());
510 };
511
512 let req = req_builder.build()?;
513 let resp = configuration.client.execute(req).await?;
514
515 let status = resp.status();
516 let content_type = resp
517 .headers()
518 .get("content-type")
519 .and_then(|v| v.to_str().ok())
520 .unwrap_or("application/octet-stream");
521 let content_type = super::ContentType::from(content_type);
522
523 if !status.is_client_error() && !status.is_server_error() {
524 let content = resp.text().await?;
525 match content_type {
526 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
527 ContentType::Text => {
528 return Err(Error::from(serde_json::Error::custom(
529 "Received `text/plain` content type response that cannot be converted to `models::Settings`",
530 )))
531 }
532 ContentType::Unsupported(unknown_type) => {
533 return Err(Error::from(serde_json::Error::custom(format!(
534 "Received `{unknown_type}` content type response that cannot be converted to `models::Settings`"
535 ))))
536 }
537 }
538 } else {
539 let content = resp.text().await?;
540 let entity: Option<AdminSettingsRetrieveError> = serde_json::from_str(&content).ok();
541 Err(Error::ResponseError(ResponseContent {
542 status,
543 content,
544 entity,
545 }))
546 }
547}
548
549pub async fn admin_settings_update(
551 configuration: &configuration::Configuration,
552 settings_request: models::SettingsRequest,
553) -> Result<models::Settings, Error<AdminSettingsUpdateError>> {
554 let p_body_settings_request = settings_request;
556
557 let uri_str = format!("{}/admin/settings/", configuration.base_path);
558 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
559
560 if let Some(ref user_agent) = configuration.user_agent {
561 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
562 }
563 if let Some(ref token) = configuration.bearer_access_token {
564 req_builder = req_builder.bearer_auth(token.to_owned());
565 };
566 req_builder = req_builder.json(&p_body_settings_request);
567
568 let req = req_builder.build()?;
569 let resp = configuration.client.execute(req).await?;
570
571 let status = resp.status();
572 let content_type = resp
573 .headers()
574 .get("content-type")
575 .and_then(|v| v.to_str().ok())
576 .unwrap_or("application/octet-stream");
577 let content_type = super::ContentType::from(content_type);
578
579 if !status.is_client_error() && !status.is_server_error() {
580 let content = resp.text().await?;
581 match content_type {
582 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
583 ContentType::Text => {
584 return Err(Error::from(serde_json::Error::custom(
585 "Received `text/plain` content type response that cannot be converted to `models::Settings`",
586 )))
587 }
588 ContentType::Unsupported(unknown_type) => {
589 return Err(Error::from(serde_json::Error::custom(format!(
590 "Received `{unknown_type}` content type response that cannot be converted to `models::Settings`"
591 ))))
592 }
593 }
594 } else {
595 let content = resp.text().await?;
596 let entity: Option<AdminSettingsUpdateError> = serde_json::from_str(&content).ok();
597 Err(Error::ResponseError(ResponseContent {
598 status,
599 content,
600 entity,
601 }))
602 }
603}
604
605pub async fn admin_system_create(
607 configuration: &configuration::Configuration,
608) -> Result<models::SystemInfo, Error<AdminSystemCreateError>> {
609 let uri_str = format!("{}/admin/system/", configuration.base_path);
610 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
611
612 if let Some(ref user_agent) = configuration.user_agent {
613 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
614 }
615 if let Some(ref token) = configuration.bearer_access_token {
616 req_builder = req_builder.bearer_auth(token.to_owned());
617 };
618
619 let req = req_builder.build()?;
620 let resp = configuration.client.execute(req).await?;
621
622 let status = resp.status();
623 let content_type = resp
624 .headers()
625 .get("content-type")
626 .and_then(|v| v.to_str().ok())
627 .unwrap_or("application/octet-stream");
628 let content_type = super::ContentType::from(content_type);
629
630 if !status.is_client_error() && !status.is_server_error() {
631 let content = resp.text().await?;
632 match content_type {
633 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
634 ContentType::Text => {
635 return Err(Error::from(serde_json::Error::custom(
636 "Received `text/plain` content type response that cannot be converted to `models::SystemInfo`",
637 )))
638 }
639 ContentType::Unsupported(unknown_type) => {
640 return Err(Error::from(serde_json::Error::custom(format!(
641 "Received `{unknown_type}` content type response that cannot be converted to `models::SystemInfo`"
642 ))))
643 }
644 }
645 } else {
646 let content = resp.text().await?;
647 let entity: Option<AdminSystemCreateError> = serde_json::from_str(&content).ok();
648 Err(Error::ResponseError(ResponseContent {
649 status,
650 content,
651 entity,
652 }))
653 }
654}
655
656pub async fn admin_system_retrieve(
658 configuration: &configuration::Configuration,
659) -> Result<models::SystemInfo, Error<AdminSystemRetrieveError>> {
660 let uri_str = format!("{}/admin/system/", configuration.base_path);
661 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
662
663 if let Some(ref user_agent) = configuration.user_agent {
664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
665 }
666 if let Some(ref token) = configuration.bearer_access_token {
667 req_builder = req_builder.bearer_auth(token.to_owned());
668 };
669
670 let req = req_builder.build()?;
671 let resp = configuration.client.execute(req).await?;
672
673 let status = resp.status();
674 let content_type = resp
675 .headers()
676 .get("content-type")
677 .and_then(|v| v.to_str().ok())
678 .unwrap_or("application/octet-stream");
679 let content_type = super::ContentType::from(content_type);
680
681 if !status.is_client_error() && !status.is_server_error() {
682 let content = resp.text().await?;
683 match content_type {
684 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
685 ContentType::Text => {
686 return Err(Error::from(serde_json::Error::custom(
687 "Received `text/plain` content type response that cannot be converted to `models::SystemInfo`",
688 )))
689 }
690 ContentType::Unsupported(unknown_type) => {
691 return Err(Error::from(serde_json::Error::custom(format!(
692 "Received `{unknown_type}` content type response that cannot be converted to `models::SystemInfo`"
693 ))))
694 }
695 }
696 } else {
697 let content = resp.text().await?;
698 let entity: Option<AdminSystemRetrieveError> = serde_json::from_str(&content).ok();
699 Err(Error::ResponseError(ResponseContent {
700 status,
701 content,
702 entity,
703 }))
704 }
705}
706
707pub async fn admin_version_history_list(
709 configuration: &configuration::Configuration,
710 build: Option<&str>,
711 ordering: Option<&str>,
712 search: Option<&str>,
713 version: Option<&str>,
714) -> Result<Vec<models::VersionHistory>, Error<AdminVersionHistoryListError>> {
715 let p_query_build = build;
717 let p_query_ordering = ordering;
718 let p_query_search = search;
719 let p_query_version = version;
720
721 let uri_str = format!("{}/admin/version/history/", configuration.base_path);
722 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
723
724 if let Some(ref param_value) = p_query_build {
725 req_builder = req_builder.query(&[("build", ¶m_value.to_string())]);
726 }
727 if let Some(ref param_value) = p_query_ordering {
728 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
729 }
730 if let Some(ref param_value) = p_query_search {
731 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
732 }
733 if let Some(ref param_value) = p_query_version {
734 req_builder = req_builder.query(&[("version", ¶m_value.to_string())]);
735 }
736 if let Some(ref user_agent) = configuration.user_agent {
737 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
738 }
739 if let Some(ref token) = configuration.bearer_access_token {
740 req_builder = req_builder.bearer_auth(token.to_owned());
741 };
742
743 let req = req_builder.build()?;
744 let resp = configuration.client.execute(req).await?;
745
746 let status = resp.status();
747 let content_type = resp
748 .headers()
749 .get("content-type")
750 .and_then(|v| v.to_str().ok())
751 .unwrap_or("application/octet-stream");
752 let content_type = super::ContentType::from(content_type);
753
754 if !status.is_client_error() && !status.is_server_error() {
755 let content = resp.text().await?;
756 match content_type {
757 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
758 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::VersionHistory>`"))),
759 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::VersionHistory>`")))),
760 }
761 } else {
762 let content = resp.text().await?;
763 let entity: Option<AdminVersionHistoryListError> = serde_json::from_str(&content).ok();
764 Err(Error::ResponseError(ResponseContent {
765 status,
766 content,
767 entity,
768 }))
769 }
770}
771
772pub async fn admin_version_history_retrieve(
774 configuration: &configuration::Configuration,
775 id: i32,
776) -> Result<models::VersionHistory, Error<AdminVersionHistoryRetrieveError>> {
777 let p_path_id = id;
779
780 let uri_str = format!(
781 "{}/admin/version/history/{id}/",
782 configuration.base_path,
783 id = p_path_id
784 );
785 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
786
787 if let Some(ref user_agent) = configuration.user_agent {
788 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
789 }
790 if let Some(ref token) = configuration.bearer_access_token {
791 req_builder = req_builder.bearer_auth(token.to_owned());
792 };
793
794 let req = req_builder.build()?;
795 let resp = configuration.client.execute(req).await?;
796
797 let status = resp.status();
798 let content_type = resp
799 .headers()
800 .get("content-type")
801 .and_then(|v| v.to_str().ok())
802 .unwrap_or("application/octet-stream");
803 let content_type = super::ContentType::from(content_type);
804
805 if !status.is_client_error() && !status.is_server_error() {
806 let content = resp.text().await?;
807 match content_type {
808 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
809 ContentType::Text => {
810 return Err(Error::from(serde_json::Error::custom(
811 "Received `text/plain` content type response that cannot be converted to `models::VersionHistory`",
812 )))
813 }
814 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
815 "Received `{unknown_type}` content type response that cannot be converted to `models::VersionHistory`"
816 )))),
817 }
818 } else {
819 let content = resp.text().await?;
820 let entity: Option<AdminVersionHistoryRetrieveError> = serde_json::from_str(&content).ok();
821 Err(Error::ResponseError(ResponseContent {
822 status,
823 content,
824 entity,
825 }))
826 }
827}
828
829pub async fn admin_version_retrieve(
831 configuration: &configuration::Configuration,
832) -> Result<models::Version, Error<AdminVersionRetrieveError>> {
833 let uri_str = format!("{}/admin/version/", configuration.base_path);
834 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
835
836 if let Some(ref user_agent) = configuration.user_agent {
837 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
838 }
839 if let Some(ref token) = configuration.bearer_access_token {
840 req_builder = req_builder.bearer_auth(token.to_owned());
841 };
842
843 let req = req_builder.build()?;
844 let resp = configuration.client.execute(req).await?;
845
846 let status = resp.status();
847 let content_type = resp
848 .headers()
849 .get("content-type")
850 .and_then(|v| v.to_str().ok())
851 .unwrap_or("application/octet-stream");
852 let content_type = super::ContentType::from(content_type);
853
854 if !status.is_client_error() && !status.is_server_error() {
855 let content = resp.text().await?;
856 match content_type {
857 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
858 ContentType::Text => {
859 return Err(Error::from(serde_json::Error::custom(
860 "Received `text/plain` content type response that cannot be converted to `models::Version`",
861 )))
862 }
863 ContentType::Unsupported(unknown_type) => {
864 return Err(Error::from(serde_json::Error::custom(format!(
865 "Received `{unknown_type}` content type response that cannot be converted to `models::Version`"
866 ))))
867 }
868 }
869 } else {
870 let content = resp.text().await?;
871 let entity: Option<AdminVersionRetrieveError> = serde_json::from_str(&content).ok();
872 Err(Error::ResponseError(ResponseContent {
873 status,
874 content,
875 entity,
876 }))
877 }
878}