1use reqwest;
12use serde::{Deserialize, Serialize, de::Error as _};
13
14use super::{ContentType, Error, configuration};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum AddProviderError {
21 Status400(models::GetFinances400Response),
22 Status401(models::GetFinances401Response),
23 Status403(models::GetAccountStatus403Response),
24 Status409(models::CreateDatabaseBackup409Response),
25 Status429(models::GetFinances429Response),
26 Status500(models::GetFinances500Response),
27 UnknownValue(serde_json::Value)
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum CreateAppError {
34 Status400(models::GetFinances400Response),
35 Status401(models::GetFinances401Response),
36 Status403(models::GetAccountStatus403Response),
37 Status409(models::CreateDatabaseBackup409Response),
38 Status429(models::GetFinances429Response),
39 Status500(models::GetFinances500Response),
40 UnknownValue(serde_json::Value)
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum CreateDeployError {
47 Status400(models::GetFinances400Response),
48 Status401(models::GetFinances401Response),
49 Status403(models::GetAccountStatus403Response),
50 Status409(models::CreateDatabaseBackup409Response),
51 Status429(models::GetFinances429Response),
52 Status500(models::GetFinances500Response),
53 UnknownValue(serde_json::Value)
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum DeleteAppError {
60 Status400(models::GetFinances400Response),
61 Status401(models::GetFinances401Response),
62 Status403(models::GetAccountStatus403Response),
63 Status404(models::GetImage404Response),
64 Status429(models::GetFinances429Response),
65 Status500(models::GetFinances500Response),
66 UnknownValue(serde_json::Value)
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum DeleteProviderError {
73 Status400(models::GetFinances400Response),
74 Status401(models::GetFinances401Response),
75 Status403(models::GetAccountStatus403Response),
76 Status404(models::GetImage404Response),
77 Status429(models::GetFinances429Response),
78 Status500(models::GetFinances500Response),
79 UnknownValue(serde_json::Value)
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum DeployActionError {
86 Status400(models::GetFinances400Response),
87 Status401(models::GetFinances401Response),
88 Status403(models::GetAccountStatus403Response),
89 Status409(models::CreateDatabaseBackup409Response),
90 Status429(models::GetFinances429Response),
91 Status500(models::GetFinances500Response),
92 UnknownValue(serde_json::Value)
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetAppError {
99 Status400(models::GetFinances400Response),
100 Status401(models::GetFinances401Response),
101 Status403(models::GetAccountStatus403Response),
102 Status404(models::GetImage404Response),
103 Status429(models::GetFinances429Response),
104 Status500(models::GetFinances500Response),
105 UnknownValue(serde_json::Value)
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum GetAppDeploysError {
112 Status400(models::GetFinances400Response),
113 Status401(models::GetFinances401Response),
114 Status403(models::GetAccountStatus403Response),
115 Status404(models::GetImage404Response),
116 Status429(models::GetFinances429Response),
117 Status500(models::GetFinances500Response),
118 UnknownValue(serde_json::Value)
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum GetAppLogsError {
125 Status400(models::GetFinances400Response),
126 Status401(models::GetFinances401Response),
127 Status403(models::GetAccountStatus403Response),
128 Status404(models::GetImage404Response),
129 Status429(models::GetFinances429Response),
130 Status500(models::GetFinances500Response),
131 UnknownValue(serde_json::Value)
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum GetAppStatisticsError {
138 Status400(models::GetFinances400Response),
139 Status401(models::GetFinances401Response),
140 Status403(models::GetAccountStatus403Response),
141 Status404(models::GetImage404Response),
142 Status409(models::CreateDatabaseBackup409Response),
143 Status429(models::GetFinances429Response),
144 Status500(models::GetFinances500Response),
145 UnknownValue(serde_json::Value)
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize)]
150#[serde(untagged)]
151pub enum GetAppsError {
152 Status400(models::GetFinances400Response),
153 Status401(models::GetFinances401Response),
154 Status403(models::GetAccountStatus403Response),
155 Status404(models::GetImage404Response),
156 Status429(models::GetFinances429Response),
157 Status500(models::GetFinances500Response),
158 UnknownValue(serde_json::Value)
159}
160
161#[derive(Debug, Clone, Serialize, Deserialize)]
163#[serde(untagged)]
164pub enum GetAppsPresetsError {
165 Status400(models::GetFinances400Response),
166 Status401(models::GetFinances401Response),
167 Status403(models::GetAccountStatus403Response),
168 Status404(models::GetImage404Response),
169 Status429(models::GetFinances429Response),
170 Status500(models::GetFinances500Response),
171 UnknownValue(serde_json::Value)
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum GetBranchesError {
178 Status400(models::GetFinances400Response),
179 Status401(models::GetFinances401Response),
180 Status403(models::GetAccountStatus403Response),
181 Status404(models::GetImage404Response),
182 Status429(models::GetFinances429Response),
183 Status500(models::GetFinances500Response),
184 UnknownValue(serde_json::Value)
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetCommitsError {
191 Status400(models::GetFinances400Response),
192 Status401(models::GetFinances401Response),
193 Status403(models::GetAccountStatus403Response),
194 Status404(models::GetImage404Response),
195 Status429(models::GetFinances429Response),
196 Status500(models::GetFinances500Response),
197 UnknownValue(serde_json::Value)
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum GetDeployLogsError {
204 Status400(models::GetFinances400Response),
205 Status401(models::GetFinances401Response),
206 Status403(models::GetAccountStatus403Response),
207 Status404(models::GetImage404Response),
208 Status429(models::GetFinances429Response),
209 Status500(models::GetFinances500Response),
210 UnknownValue(serde_json::Value)
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum GetDeploySettingsError {
217 Status400(models::GetFinances400Response),
218 Status401(models::GetFinances401Response),
219 Status403(models::GetAccountStatus403Response),
220 Status404(models::GetImage404Response),
221 Status429(models::GetFinances429Response),
222 Status500(models::GetFinances500Response),
223 UnknownValue(serde_json::Value)
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum GetFrameworksError {
230 Status400(models::GetFinances400Response),
231 Status401(models::GetFinances401Response),
232 Status403(models::GetAccountStatus403Response),
233 Status404(models::GetImage404Response),
234 Status429(models::GetFinances429Response),
235 Status500(models::GetFinances500Response),
236 UnknownValue(serde_json::Value)
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize)]
241#[serde(untagged)]
242pub enum GetProvidersError {
243 Status400(models::GetFinances400Response),
244 Status401(models::GetFinances401Response),
245 Status403(models::GetAccountStatus403Response),
246 Status404(models::GetImage404Response),
247 Status429(models::GetFinances429Response),
248 Status500(models::GetFinances500Response),
249 UnknownValue(serde_json::Value)
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum GetRepositoriesError {
256 Status400(models::GetFinances400Response),
257 Status401(models::GetFinances401Response),
258 Status403(models::GetAccountStatus403Response),
259 Status404(models::GetImage404Response),
260 Status429(models::GetFinances429Response),
261 Status500(models::GetFinances500Response),
262 UnknownValue(serde_json::Value)
263}
264
265#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum UpdateAppSettingsError {
269 Status400(models::GetFinances400Response),
270 Status401(models::GetFinances401Response),
271 Status429(models::GetFinances429Response),
272 Status500(models::GetFinances500Response),
273 UnknownValue(serde_json::Value)
274}
275
276#[derive(Debug, Clone, Serialize, Deserialize)]
278#[serde(untagged)]
279pub enum UpdateAppStateError {
280 Status400(models::GetFinances400Response),
281 Status401(models::GetFinances401Response),
282 Status403(models::GetAccountStatus403Response),
283 Status404(models::GetImage404Response),
284 Status429(models::GetFinances429Response),
285 Status500(models::GetFinances500Response),
286 UnknownValue(serde_json::Value)
287}
288
289pub async fn add_provider(
292 configuration: &configuration::Configuration,
293 add_provider_request: models::AddProviderRequest
294) -> Result<models::AddProvider201Response, Error<AddProviderError>> {
295 let p_body_add_provider_request = add_provider_request;
297
298 let uri_str = format!("{}/api/v1/vcs-provider", configuration.base_path);
299 let mut req_builder = configuration
300 .client
301 .request(reqwest::Method::POST, &uri_str);
302
303 if let Some(ref user_agent) = configuration.user_agent {
304 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
305 }
306 if let Some(ref token) = configuration.bearer_access_token {
307 req_builder = req_builder.bearer_auth(token.to_owned());
308 };
309 req_builder = req_builder.json(&p_body_add_provider_request);
310
311 let req = req_builder.build()?;
312 let resp = configuration.client.execute(req).await?;
313
314 let status = resp.status();
315 let content_type = resp
316 .headers()
317 .get("content-type")
318 .and_then(|v| v.to_str().ok())
319 .unwrap_or("application/octet-stream");
320 let content_type = super::ContentType::from(content_type);
321
322 if !status.is_client_error() && !status.is_server_error() {
323 let content = resp.text().await?;
324 match content_type {
325 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
326 ContentType::Text => {
327 return Err(Error::from(serde_json::Error::custom(
328 "Received `text/plain` content type response that cannot be converted to `models::AddProvider201Response`"
329 )));
330 }
331 ContentType::Unsupported(unknown_type) => {
332 return Err(Error::from(serde_json::Error::custom(format!(
333 "Received `{unknown_type}` content type response that cannot be converted to `models::AddProvider201Response`"
334 ))));
335 }
336 }
337 } else {
338 let content = resp.text().await?;
339 let entity: Option<AddProviderError> = serde_json::from_str(&content).ok();
340 Err(Error::ResponseError(ResponseContent {
341 status,
342 content,
343 entity
344 }))
345 }
346}
347
348pub async fn create_app(
351 configuration: &configuration::Configuration,
352 create_app: models::CreateApp
353) -> Result<models::CreateApp201Response, Error<CreateAppError>> {
354 let p_body_create_app = create_app;
356
357 let uri_str = format!("{}/api/v1/apps", configuration.base_path);
358 let mut req_builder = configuration
359 .client
360 .request(reqwest::Method::POST, &uri_str);
361
362 if let Some(ref user_agent) = configuration.user_agent {
363 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
364 }
365 if let Some(ref token) = configuration.bearer_access_token {
366 req_builder = req_builder.bearer_auth(token.to_owned());
367 };
368 req_builder = req_builder.json(&p_body_create_app);
369
370 let req = req_builder.build()?;
371 let resp = configuration.client.execute(req).await?;
372
373 let status = resp.status();
374 let content_type = resp
375 .headers()
376 .get("content-type")
377 .and_then(|v| v.to_str().ok())
378 .unwrap_or("application/octet-stream");
379 let content_type = super::ContentType::from(content_type);
380
381 if !status.is_client_error() && !status.is_server_error() {
382 let content = resp.text().await?;
383 match content_type {
384 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
385 ContentType::Text => {
386 return Err(Error::from(serde_json::Error::custom(
387 "Received `text/plain` content type response that cannot be converted to `models::CreateApp201Response`"
388 )));
389 }
390 ContentType::Unsupported(unknown_type) => {
391 return Err(Error::from(serde_json::Error::custom(format!(
392 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateApp201Response`"
393 ))));
394 }
395 }
396 } else {
397 let content = resp.text().await?;
398 let entity: Option<CreateAppError> = serde_json::from_str(&content).ok();
399 Err(Error::ResponseError(ResponseContent {
400 status,
401 content,
402 entity
403 }))
404 }
405}
406
407pub async fn create_deploy(
410 configuration: &configuration::Configuration,
411 app_id: &str,
412 create_deploy_request: models::CreateDeployRequest
413) -> Result<models::CreateDeploy201Response, Error<CreateDeployError>> {
414 let p_path_app_id = app_id;
416 let p_body_create_deploy_request = create_deploy_request;
417
418 let uri_str = format!(
419 "{}/api/v1/apps/{app_id}/deploy",
420 configuration.base_path,
421 app_id = crate::apis::urlencode(p_path_app_id)
422 );
423 let mut req_builder = configuration
424 .client
425 .request(reqwest::Method::POST, &uri_str);
426
427 if let Some(ref user_agent) = configuration.user_agent {
428 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
429 }
430 if let Some(ref token) = configuration.bearer_access_token {
431 req_builder = req_builder.bearer_auth(token.to_owned());
432 };
433 req_builder = req_builder.json(&p_body_create_deploy_request);
434
435 let req = req_builder.build()?;
436 let resp = configuration.client.execute(req).await?;
437
438 let status = resp.status();
439 let content_type = resp
440 .headers()
441 .get("content-type")
442 .and_then(|v| v.to_str().ok())
443 .unwrap_or("application/octet-stream");
444 let content_type = super::ContentType::from(content_type);
445
446 if !status.is_client_error() && !status.is_server_error() {
447 let content = resp.text().await?;
448 match content_type {
449 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
450 ContentType::Text => {
451 return Err(Error::from(serde_json::Error::custom(
452 "Received `text/plain` content type response that cannot be converted to `models::CreateDeploy201Response`"
453 )));
454 }
455 ContentType::Unsupported(unknown_type) => {
456 return Err(Error::from(serde_json::Error::custom(format!(
457 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDeploy201Response`"
458 ))));
459 }
460 }
461 } else {
462 let content = resp.text().await?;
463 let entity: Option<CreateDeployError> = serde_json::from_str(&content).ok();
464 Err(Error::ResponseError(ResponseContent {
465 status,
466 content,
467 entity
468 }))
469 }
470}
471
472pub async fn delete_app(
474 configuration: &configuration::Configuration,
475 app_id: &str
476) -> Result<(), Error<DeleteAppError>> {
477 let p_path_app_id = app_id;
479
480 let uri_str = format!(
481 "{}/api/v1/apps/{app_id}",
482 configuration.base_path,
483 app_id = crate::apis::urlencode(p_path_app_id)
484 );
485 let mut req_builder = configuration
486 .client
487 .request(reqwest::Method::DELETE, &uri_str);
488
489 if let Some(ref user_agent) = configuration.user_agent {
490 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
491 }
492 if let Some(ref token) = configuration.bearer_access_token {
493 req_builder = req_builder.bearer_auth(token.to_owned());
494 };
495
496 let req = req_builder.build()?;
497 let resp = configuration.client.execute(req).await?;
498
499 let status = resp.status();
500
501 if !status.is_client_error() && !status.is_server_error() {
502 Ok(())
503 } else {
504 let content = resp.text().await?;
505 let entity: Option<DeleteAppError> = serde_json::from_str(&content).ok();
506 Err(Error::ResponseError(ResponseContent {
507 status,
508 content,
509 entity
510 }))
511 }
512}
513
514pub async fn delete_provider(
517 configuration: &configuration::Configuration,
518 provider_id: &str
519) -> Result<(), Error<DeleteProviderError>> {
520 let p_path_provider_id = provider_id;
522
523 let uri_str = format!(
524 "{}/api/v1/vcs-provider/{provider_id}",
525 configuration.base_path,
526 provider_id = crate::apis::urlencode(p_path_provider_id)
527 );
528 let mut req_builder = configuration
529 .client
530 .request(reqwest::Method::DELETE, &uri_str);
531
532 if let Some(ref user_agent) = configuration.user_agent {
533 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
534 }
535 if let Some(ref token) = configuration.bearer_access_token {
536 req_builder = req_builder.bearer_auth(token.to_owned());
537 };
538
539 let req = req_builder.build()?;
540 let resp = configuration.client.execute(req).await?;
541
542 let status = resp.status();
543
544 if !status.is_client_error() && !status.is_server_error() {
545 Ok(())
546 } else {
547 let content = resp.text().await?;
548 let entity: Option<DeleteProviderError> = serde_json::from_str(&content).ok();
549 Err(Error::ResponseError(ResponseContent {
550 status,
551 content,
552 entity
553 }))
554 }
555}
556
557pub async fn deploy_action(
560 configuration: &configuration::Configuration,
561 app_id: &str,
562 deploy_id: &str
563) -> Result<models::CreateDeploy201Response, Error<DeployActionError>> {
564 let p_path_app_id = app_id;
566 let p_path_deploy_id = deploy_id;
567
568 let uri_str = format!(
569 "{}/api/v1/apps/{app_id}/deploy/{deploy_id}/stop",
570 configuration.base_path,
571 app_id = crate::apis::urlencode(p_path_app_id),
572 deploy_id = crate::apis::urlencode(p_path_deploy_id)
573 );
574 let mut req_builder = configuration
575 .client
576 .request(reqwest::Method::POST, &uri_str);
577
578 if let Some(ref user_agent) = configuration.user_agent {
579 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
580 }
581 if let Some(ref token) = configuration.bearer_access_token {
582 req_builder = req_builder.bearer_auth(token.to_owned());
583 };
584
585 let req = req_builder.build()?;
586 let resp = configuration.client.execute(req).await?;
587
588 let status = resp.status();
589 let content_type = resp
590 .headers()
591 .get("content-type")
592 .and_then(|v| v.to_str().ok())
593 .unwrap_or("application/octet-stream");
594 let content_type = super::ContentType::from(content_type);
595
596 if !status.is_client_error() && !status.is_server_error() {
597 let content = resp.text().await?;
598 match content_type {
599 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
600 ContentType::Text => {
601 return Err(Error::from(serde_json::Error::custom(
602 "Received `text/plain` content type response that cannot be converted to `models::CreateDeploy201Response`"
603 )));
604 }
605 ContentType::Unsupported(unknown_type) => {
606 return Err(Error::from(serde_json::Error::custom(format!(
607 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateDeploy201Response`"
608 ))));
609 }
610 }
611 } else {
612 let content = resp.text().await?;
613 let entity: Option<DeployActionError> = serde_json::from_str(&content).ok();
614 Err(Error::ResponseError(ResponseContent {
615 status,
616 content,
617 entity
618 }))
619 }
620}
621
622pub async fn get_app(
625 configuration: &configuration::Configuration,
626 app_id: &str
627) -> Result<models::CreateApp201Response, Error<GetAppError>> {
628 let p_path_app_id = app_id;
630
631 let uri_str = format!(
632 "{}/api/v1/apps/{app_id}",
633 configuration.base_path,
634 app_id = crate::apis::urlencode(p_path_app_id)
635 );
636 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
637
638 if let Some(ref user_agent) = configuration.user_agent {
639 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
640 }
641 if let Some(ref token) = configuration.bearer_access_token {
642 req_builder = req_builder.bearer_auth(token.to_owned());
643 };
644
645 let req = req_builder.build()?;
646 let resp = configuration.client.execute(req).await?;
647
648 let status = resp.status();
649 let content_type = resp
650 .headers()
651 .get("content-type")
652 .and_then(|v| v.to_str().ok())
653 .unwrap_or("application/octet-stream");
654 let content_type = super::ContentType::from(content_type);
655
656 if !status.is_client_error() && !status.is_server_error() {
657 let content = resp.text().await?;
658 match content_type {
659 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
660 ContentType::Text => {
661 return Err(Error::from(serde_json::Error::custom(
662 "Received `text/plain` content type response that cannot be converted to `models::CreateApp201Response`"
663 )));
664 }
665 ContentType::Unsupported(unknown_type) => {
666 return Err(Error::from(serde_json::Error::custom(format!(
667 "Received `{unknown_type}` content type response that cannot be converted to `models::CreateApp201Response`"
668 ))));
669 }
670 }
671 } else {
672 let content = resp.text().await?;
673 let entity: Option<GetAppError> = serde_json::from_str(&content).ok();
674 Err(Error::ResponseError(ResponseContent {
675 status,
676 content,
677 entity
678 }))
679 }
680}
681
682pub async fn get_app_deploys(
685 configuration: &configuration::Configuration,
686 app_id: &str,
687 limit: Option<i32>,
688 offset: Option<i32>
689) -> Result<models::GetAppDeploys200Response, Error<GetAppDeploysError>> {
690 let p_path_app_id = app_id;
692 let p_query_limit = limit;
693 let p_query_offset = offset;
694
695 let uri_str = format!(
696 "{}/api/v1/apps/{app_id}/deploys",
697 configuration.base_path,
698 app_id = crate::apis::urlencode(p_path_app_id)
699 );
700 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
701
702 if let Some(ref param_value) = p_query_limit {
703 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
704 }
705 if let Some(ref param_value) = p_query_offset {
706 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
707 }
708 if let Some(ref user_agent) = configuration.user_agent {
709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
710 }
711 if let Some(ref token) = configuration.bearer_access_token {
712 req_builder = req_builder.bearer_auth(token.to_owned());
713 };
714
715 let req = req_builder.build()?;
716 let resp = configuration.client.execute(req).await?;
717
718 let status = resp.status();
719 let content_type = resp
720 .headers()
721 .get("content-type")
722 .and_then(|v| v.to_str().ok())
723 .unwrap_or("application/octet-stream");
724 let content_type = super::ContentType::from(content_type);
725
726 if !status.is_client_error() && !status.is_server_error() {
727 let content = resp.text().await?;
728 match content_type {
729 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
730 ContentType::Text => {
731 return Err(Error::from(serde_json::Error::custom(
732 "Received `text/plain` content type response that cannot be converted to `models::GetAppDeploys200Response`"
733 )));
734 }
735 ContentType::Unsupported(unknown_type) => {
736 return Err(Error::from(serde_json::Error::custom(format!(
737 "Received `{unknown_type}` content type response that cannot be converted to `models::GetAppDeploys200Response`"
738 ))));
739 }
740 }
741 } else {
742 let content = resp.text().await?;
743 let entity: Option<GetAppDeploysError> = serde_json::from_str(&content).ok();
744 Err(Error::ResponseError(ResponseContent {
745 status,
746 content,
747 entity
748 }))
749 }
750}
751
752pub async fn get_app_logs(
755 configuration: &configuration::Configuration,
756 app_id: &str
757) -> Result<models::GetAppLogs200Response, Error<GetAppLogsError>> {
758 let p_path_app_id = app_id;
760
761 let uri_str = format!(
762 "{}/api/v1/apps/{app_id}/logs",
763 configuration.base_path,
764 app_id = crate::apis::urlencode(p_path_app_id)
765 );
766 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
767
768 if let Some(ref user_agent) = configuration.user_agent {
769 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
770 }
771 if let Some(ref token) = configuration.bearer_access_token {
772 req_builder = req_builder.bearer_auth(token.to_owned());
773 };
774
775 let req = req_builder.build()?;
776 let resp = configuration.client.execute(req).await?;
777
778 let status = resp.status();
779 let content_type = resp
780 .headers()
781 .get("content-type")
782 .and_then(|v| v.to_str().ok())
783 .unwrap_or("application/octet-stream");
784 let content_type = super::ContentType::from(content_type);
785
786 if !status.is_client_error() && !status.is_server_error() {
787 let content = resp.text().await?;
788 match content_type {
789 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
790 ContentType::Text => {
791 return Err(Error::from(serde_json::Error::custom(
792 "Received `text/plain` content type response that cannot be converted to `models::GetAppLogs200Response`"
793 )));
794 }
795 ContentType::Unsupported(unknown_type) => {
796 return Err(Error::from(serde_json::Error::custom(format!(
797 "Received `{unknown_type}` content type response that cannot be converted to `models::GetAppLogs200Response`"
798 ))));
799 }
800 }
801 } else {
802 let content = resp.text().await?;
803 let entity: Option<GetAppLogsError> = serde_json::from_str(&content).ok();
804 Err(Error::ResponseError(ResponseContent {
805 status,
806 content,
807 entity
808 }))
809 }
810}
811
812pub async fn get_app_statistics(
816 configuration: &configuration::Configuration,
817 app_id: &str,
818 date_from: &str,
819 date_to: &str
820) -> Result<models::GetServerStatistics200Response, Error<GetAppStatisticsError>> {
821 let p_path_app_id = app_id;
823 let p_query_date_from = date_from;
824 let p_query_date_to = date_to;
825
826 let uri_str = format!(
827 "{}/api/v1/apps/{app_id}/statistics",
828 configuration.base_path,
829 app_id = crate::apis::urlencode(p_path_app_id)
830 );
831 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
832
833 req_builder = req_builder.query(&[("date_from", &p_query_date_from.to_string())]);
834 req_builder = req_builder.query(&[("date_to", &p_query_date_to.to_string())]);
835 if let Some(ref user_agent) = configuration.user_agent {
836 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
837 }
838 if let Some(ref token) = configuration.bearer_access_token {
839 req_builder = req_builder.bearer_auth(token.to_owned());
840 };
841
842 let req = req_builder.build()?;
843 let resp = configuration.client.execute(req).await?;
844
845 let status = resp.status();
846 let content_type = resp
847 .headers()
848 .get("content-type")
849 .and_then(|v| v.to_str().ok())
850 .unwrap_or("application/octet-stream");
851 let content_type = super::ContentType::from(content_type);
852
853 if !status.is_client_error() && !status.is_server_error() {
854 let content = resp.text().await?;
855 match content_type {
856 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
857 ContentType::Text => {
858 return Err(Error::from(serde_json::Error::custom(
859 "Received `text/plain` content type response that cannot be converted to `models::GetServerStatistics200Response`"
860 )));
861 }
862 ContentType::Unsupported(unknown_type) => {
863 return Err(Error::from(serde_json::Error::custom(format!(
864 "Received `{unknown_type}` content type response that cannot be converted to `models::GetServerStatistics200Response`"
865 ))));
866 }
867 }
868 } else {
869 let content = resp.text().await?;
870 let entity: Option<GetAppStatisticsError> = serde_json::from_str(&content).ok();
871 Err(Error::ResponseError(ResponseContent {
872 status,
873 content,
874 entity
875 }))
876 }
877}
878
879pub async fn get_apps(
881 configuration: &configuration::Configuration
882) -> Result<models::GetApps200Response, Error<GetAppsError>> {
883 let uri_str = format!("{}/api/v1/apps", configuration.base_path);
884 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
885
886 if let Some(ref user_agent) = configuration.user_agent {
887 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
888 }
889 if let Some(ref token) = configuration.bearer_access_token {
890 req_builder = req_builder.bearer_auth(token.to_owned());
891 };
892
893 let req = req_builder.build()?;
894 let resp = configuration.client.execute(req).await?;
895
896 let status = resp.status();
897 let content_type = resp
898 .headers()
899 .get("content-type")
900 .and_then(|v| v.to_str().ok())
901 .unwrap_or("application/octet-stream");
902 let content_type = super::ContentType::from(content_type);
903
904 if !status.is_client_error() && !status.is_server_error() {
905 let content = resp.text().await?;
906 match content_type {
907 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
908 ContentType::Text => {
909 return Err(Error::from(serde_json::Error::custom(
910 "Received `text/plain` content type response that cannot be converted to `models::GetApps200Response`"
911 )));
912 }
913 ContentType::Unsupported(unknown_type) => {
914 return Err(Error::from(serde_json::Error::custom(format!(
915 "Received `{unknown_type}` content type response that cannot be converted to `models::GetApps200Response`"
916 ))));
917 }
918 }
919 } else {
920 let content = resp.text().await?;
921 let entity: Option<GetAppsError> = serde_json::from_str(&content).ok();
922 Err(Error::ResponseError(ResponseContent {
923 status,
924 content,
925 entity
926 }))
927 }
928}
929
930pub async fn get_apps_presets(
933 configuration: &configuration::Configuration,
934 app_id: &str
935) -> Result<models::GetAppsPresets200Response, Error<GetAppsPresetsError>> {
936 let p_query_app_id = app_id;
938
939 let uri_str = format!("{}/api/v1/presets/apps", configuration.base_path);
940 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
941
942 req_builder = req_builder.query(&[("app_id", &p_query_app_id.to_string())]);
943 if let Some(ref user_agent) = configuration.user_agent {
944 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
945 }
946 if let Some(ref token) = configuration.bearer_access_token {
947 req_builder = req_builder.bearer_auth(token.to_owned());
948 };
949
950 let req = req_builder.build()?;
951 let resp = configuration.client.execute(req).await?;
952
953 let status = resp.status();
954 let content_type = resp
955 .headers()
956 .get("content-type")
957 .and_then(|v| v.to_str().ok())
958 .unwrap_or("application/octet-stream");
959 let content_type = super::ContentType::from(content_type);
960
961 if !status.is_client_error() && !status.is_server_error() {
962 let content = resp.text().await?;
963 match content_type {
964 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
965 ContentType::Text => {
966 return Err(Error::from(serde_json::Error::custom(
967 "Received `text/plain` content type response that cannot be converted to `models::GetAppsPresets200Response`"
968 )));
969 }
970 ContentType::Unsupported(unknown_type) => {
971 return Err(Error::from(serde_json::Error::custom(format!(
972 "Received `{unknown_type}` content type response that cannot be converted to `models::GetAppsPresets200Response`"
973 ))));
974 }
975 }
976 } else {
977 let content = resp.text().await?;
978 let entity: Option<GetAppsPresetsError> = serde_json::from_str(&content).ok();
979 Err(Error::ResponseError(ResponseContent {
980 status,
981 content,
982 entity
983 }))
984 }
985}
986
987pub async fn get_branches(
990 configuration: &configuration::Configuration,
991 provider_id: &str,
992 repository_id: &str
993) -> Result<models::GetBranches200Response, Error<GetBranchesError>> {
994 let p_path_provider_id = provider_id;
996 let p_path_repository_id = repository_id;
997
998 let uri_str = format!(
999 "{}/api/v1/vcs-provider/{provider_id}/repository/{repository_id}",
1000 configuration.base_path,
1001 provider_id = crate::apis::urlencode(p_path_provider_id),
1002 repository_id = crate::apis::urlencode(p_path_repository_id)
1003 );
1004 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1005
1006 if let Some(ref user_agent) = configuration.user_agent {
1007 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1008 }
1009 if let Some(ref token) = configuration.bearer_access_token {
1010 req_builder = req_builder.bearer_auth(token.to_owned());
1011 };
1012
1013 let req = req_builder.build()?;
1014 let resp = configuration.client.execute(req).await?;
1015
1016 let status = resp.status();
1017 let content_type = resp
1018 .headers()
1019 .get("content-type")
1020 .and_then(|v| v.to_str().ok())
1021 .unwrap_or("application/octet-stream");
1022 let content_type = super::ContentType::from(content_type);
1023
1024 if !status.is_client_error() && !status.is_server_error() {
1025 let content = resp.text().await?;
1026 match content_type {
1027 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1028 ContentType::Text => {
1029 return Err(Error::from(serde_json::Error::custom(
1030 "Received `text/plain` content type response that cannot be converted to `models::GetBranches200Response`"
1031 )));
1032 }
1033 ContentType::Unsupported(unknown_type) => {
1034 return Err(Error::from(serde_json::Error::custom(format!(
1035 "Received `{unknown_type}` content type response that cannot be converted to `models::GetBranches200Response`"
1036 ))));
1037 }
1038 }
1039 } else {
1040 let content = resp.text().await?;
1041 let entity: Option<GetBranchesError> = serde_json::from_str(&content).ok();
1042 Err(Error::ResponseError(ResponseContent {
1043 status,
1044 content,
1045 entity
1046 }))
1047 }
1048}
1049
1050pub async fn get_commits(
1053 configuration: &configuration::Configuration,
1054 account_id: &str,
1055 provider_id: &str,
1056 repository_id: &str,
1057 name: &str
1058) -> Result<models::GetCommits200Response, Error<GetCommitsError>> {
1059 let p_query_account_id = account_id;
1061 let p_path_provider_id = provider_id;
1062 let p_path_repository_id = repository_id;
1063 let p_query_name = name;
1064
1065 let uri_str = format!(
1066 "{}/api/v1/vcs-provider/{provider_id}/repository/{repository_id}/branch",
1067 configuration.base_path,
1068 provider_id = crate::apis::urlencode(p_path_provider_id),
1069 repository_id = crate::apis::urlencode(p_path_repository_id)
1070 );
1071 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1072
1073 req_builder = req_builder.query(&[("account_id", &p_query_account_id.to_string())]);
1074 req_builder = req_builder.query(&[("name", &p_query_name.to_string())]);
1075 if let Some(ref user_agent) = configuration.user_agent {
1076 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1077 }
1078 if let Some(ref token) = configuration.bearer_access_token {
1079 req_builder = req_builder.bearer_auth(token.to_owned());
1080 };
1081
1082 let req = req_builder.build()?;
1083 let resp = configuration.client.execute(req).await?;
1084
1085 let status = resp.status();
1086 let content_type = resp
1087 .headers()
1088 .get("content-type")
1089 .and_then(|v| v.to_str().ok())
1090 .unwrap_or("application/octet-stream");
1091 let content_type = super::ContentType::from(content_type);
1092
1093 if !status.is_client_error() && !status.is_server_error() {
1094 let content = resp.text().await?;
1095 match content_type {
1096 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1097 ContentType::Text => {
1098 return Err(Error::from(serde_json::Error::custom(
1099 "Received `text/plain` content type response that cannot be converted to `models::GetCommits200Response`"
1100 )));
1101 }
1102 ContentType::Unsupported(unknown_type) => {
1103 return Err(Error::from(serde_json::Error::custom(format!(
1104 "Received `{unknown_type}` content type response that cannot be converted to `models::GetCommits200Response`"
1105 ))));
1106 }
1107 }
1108 } else {
1109 let content = resp.text().await?;
1110 let entity: Option<GetCommitsError> = serde_json::from_str(&content).ok();
1111 Err(Error::ResponseError(ResponseContent {
1112 status,
1113 content,
1114 entity
1115 }))
1116 }
1117}
1118
1119pub async fn get_deploy_logs(
1122 configuration: &configuration::Configuration,
1123 app_id: &str,
1124 deploy_id: &str,
1125 debug: Option<bool>
1126) -> Result<models::GetDeployLogs200Response, Error<GetDeployLogsError>> {
1127 let p_path_app_id = app_id;
1129 let p_path_deploy_id = deploy_id;
1130 let p_query_debug = debug;
1131
1132 let uri_str = format!(
1133 "{}/api/v1/apps/{app_id}/deploy/{deploy_id}/logs",
1134 configuration.base_path,
1135 app_id = crate::apis::urlencode(p_path_app_id),
1136 deploy_id = crate::apis::urlencode(p_path_deploy_id)
1137 );
1138 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1139
1140 if let Some(ref param_value) = p_query_debug {
1141 req_builder = req_builder.query(&[("debug", ¶m_value.to_string())]);
1142 }
1143 if let Some(ref user_agent) = configuration.user_agent {
1144 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1145 }
1146 if let Some(ref token) = configuration.bearer_access_token {
1147 req_builder = req_builder.bearer_auth(token.to_owned());
1148 };
1149
1150 let req = req_builder.build()?;
1151 let resp = configuration.client.execute(req).await?;
1152
1153 let status = resp.status();
1154 let content_type = resp
1155 .headers()
1156 .get("content-type")
1157 .and_then(|v| v.to_str().ok())
1158 .unwrap_or("application/octet-stream");
1159 let content_type = super::ContentType::from(content_type);
1160
1161 if !status.is_client_error() && !status.is_server_error() {
1162 let content = resp.text().await?;
1163 match content_type {
1164 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1165 ContentType::Text => {
1166 return Err(Error::from(serde_json::Error::custom(
1167 "Received `text/plain` content type response that cannot be converted to `models::GetDeployLogs200Response`"
1168 )));
1169 }
1170 ContentType::Unsupported(unknown_type) => {
1171 return Err(Error::from(serde_json::Error::custom(format!(
1172 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDeployLogs200Response`"
1173 ))));
1174 }
1175 }
1176 } else {
1177 let content = resp.text().await?;
1178 let entity: Option<GetDeployLogsError> = serde_json::from_str(&content).ok();
1179 Err(Error::ResponseError(ResponseContent {
1180 status,
1181 content,
1182 entity
1183 }))
1184 }
1185}
1186
1187pub async fn get_deploy_settings(
1190 configuration: &configuration::Configuration,
1191 app_id: &str
1192) -> Result<models::GetDeploySettings200Response, Error<GetDeploySettingsError>> {
1193 let p_query_app_id = app_id;
1195
1196 let uri_str = format!("{}/api/v1/deploy-settings/apps", configuration.base_path);
1197 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1198
1199 req_builder = req_builder.query(&[("app_id", &p_query_app_id.to_string())]);
1200 if let Some(ref user_agent) = configuration.user_agent {
1201 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1202 }
1203 if let Some(ref token) = configuration.bearer_access_token {
1204 req_builder = req_builder.bearer_auth(token.to_owned());
1205 };
1206
1207 let req = req_builder.build()?;
1208 let resp = configuration.client.execute(req).await?;
1209
1210 let status = resp.status();
1211 let content_type = resp
1212 .headers()
1213 .get("content-type")
1214 .and_then(|v| v.to_str().ok())
1215 .unwrap_or("application/octet-stream");
1216 let content_type = super::ContentType::from(content_type);
1217
1218 if !status.is_client_error() && !status.is_server_error() {
1219 let content = resp.text().await?;
1220 match content_type {
1221 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1222 ContentType::Text => {
1223 return Err(Error::from(serde_json::Error::custom(
1224 "Received `text/plain` content type response that cannot be converted to `models::GetDeploySettings200Response`"
1225 )));
1226 }
1227 ContentType::Unsupported(unknown_type) => {
1228 return Err(Error::from(serde_json::Error::custom(format!(
1229 "Received `{unknown_type}` content type response that cannot be converted to `models::GetDeploySettings200Response`"
1230 ))));
1231 }
1232 }
1233 } else {
1234 let content = resp.text().await?;
1235 let entity: Option<GetDeploySettingsError> = serde_json::from_str(&content).ok();
1236 Err(Error::ResponseError(ResponseContent {
1237 status,
1238 content,
1239 entity
1240 }))
1241 }
1242}
1243
1244pub async fn get_frameworks(
1247 configuration: &configuration::Configuration,
1248 app_id: &str
1249) -> Result<models::GetFrameworks200Response, Error<GetFrameworksError>> {
1250 let p_query_app_id = app_id;
1252
1253 let uri_str = format!("{}/api/v1/frameworks/apps", configuration.base_path);
1254 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1255
1256 req_builder = req_builder.query(&[("app_id", &p_query_app_id.to_string())]);
1257 if let Some(ref user_agent) = configuration.user_agent {
1258 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1259 }
1260 if let Some(ref token) = configuration.bearer_access_token {
1261 req_builder = req_builder.bearer_auth(token.to_owned());
1262 };
1263
1264 let req = req_builder.build()?;
1265 let resp = configuration.client.execute(req).await?;
1266
1267 let status = resp.status();
1268 let content_type = resp
1269 .headers()
1270 .get("content-type")
1271 .and_then(|v| v.to_str().ok())
1272 .unwrap_or("application/octet-stream");
1273 let content_type = super::ContentType::from(content_type);
1274
1275 if !status.is_client_error() && !status.is_server_error() {
1276 let content = resp.text().await?;
1277 match content_type {
1278 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1279 ContentType::Text => {
1280 return Err(Error::from(serde_json::Error::custom(
1281 "Received `text/plain` content type response that cannot be converted to `models::GetFrameworks200Response`"
1282 )));
1283 }
1284 ContentType::Unsupported(unknown_type) => {
1285 return Err(Error::from(serde_json::Error::custom(format!(
1286 "Received `{unknown_type}` content type response that cannot be converted to `models::GetFrameworks200Response`"
1287 ))));
1288 }
1289 }
1290 } else {
1291 let content = resp.text().await?;
1292 let entity: Option<GetFrameworksError> = serde_json::from_str(&content).ok();
1293 Err(Error::ResponseError(ResponseContent {
1294 status,
1295 content,
1296 entity
1297 }))
1298 }
1299}
1300
1301pub async fn get_providers(
1304 configuration: &configuration::Configuration
1305) -> Result<models::GetProviders200Response, Error<GetProvidersError>> {
1306 let uri_str = format!("{}/api/v1/vcs-provider", configuration.base_path);
1307 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1308
1309 if let Some(ref user_agent) = configuration.user_agent {
1310 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1311 }
1312 if let Some(ref token) = configuration.bearer_access_token {
1313 req_builder = req_builder.bearer_auth(token.to_owned());
1314 };
1315
1316 let req = req_builder.build()?;
1317 let resp = configuration.client.execute(req).await?;
1318
1319 let status = resp.status();
1320 let content_type = resp
1321 .headers()
1322 .get("content-type")
1323 .and_then(|v| v.to_str().ok())
1324 .unwrap_or("application/octet-stream");
1325 let content_type = super::ContentType::from(content_type);
1326
1327 if !status.is_client_error() && !status.is_server_error() {
1328 let content = resp.text().await?;
1329 match content_type {
1330 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1331 ContentType::Text => {
1332 return Err(Error::from(serde_json::Error::custom(
1333 "Received `text/plain` content type response that cannot be converted to `models::GetProviders200Response`"
1334 )));
1335 }
1336 ContentType::Unsupported(unknown_type) => {
1337 return Err(Error::from(serde_json::Error::custom(format!(
1338 "Received `{unknown_type}` content type response that cannot be converted to `models::GetProviders200Response`"
1339 ))));
1340 }
1341 }
1342 } else {
1343 let content = resp.text().await?;
1344 let entity: Option<GetProvidersError> = serde_json::from_str(&content).ok();
1345 Err(Error::ResponseError(ResponseContent {
1346 status,
1347 content,
1348 entity
1349 }))
1350 }
1351}
1352
1353pub async fn get_repositories(
1356 configuration: &configuration::Configuration,
1357 provider_id: &str
1358) -> Result<models::GetRepositories200Response, Error<GetRepositoriesError>> {
1359 let p_path_provider_id = provider_id;
1361
1362 let uri_str = format!(
1363 "{}/api/v1/vcs-provider/{provider_id}",
1364 configuration.base_path,
1365 provider_id = crate::apis::urlencode(p_path_provider_id)
1366 );
1367 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1368
1369 if let Some(ref user_agent) = configuration.user_agent {
1370 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1371 }
1372 if let Some(ref token) = configuration.bearer_access_token {
1373 req_builder = req_builder.bearer_auth(token.to_owned());
1374 };
1375
1376 let req = req_builder.build()?;
1377 let resp = configuration.client.execute(req).await?;
1378
1379 let status = resp.status();
1380 let content_type = resp
1381 .headers()
1382 .get("content-type")
1383 .and_then(|v| v.to_str().ok())
1384 .unwrap_or("application/octet-stream");
1385 let content_type = super::ContentType::from(content_type);
1386
1387 if !status.is_client_error() && !status.is_server_error() {
1388 let content = resp.text().await?;
1389 match content_type {
1390 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1391 ContentType::Text => {
1392 return Err(Error::from(serde_json::Error::custom(
1393 "Received `text/plain` content type response that cannot be converted to `models::GetRepositories200Response`"
1394 )));
1395 }
1396 ContentType::Unsupported(unknown_type) => {
1397 return Err(Error::from(serde_json::Error::custom(format!(
1398 "Received `{unknown_type}` content type response that cannot be converted to `models::GetRepositories200Response`"
1399 ))));
1400 }
1401 }
1402 } else {
1403 let content = resp.text().await?;
1404 let entity: Option<GetRepositoriesError> = serde_json::from_str(&content).ok();
1405 Err(Error::ResponseError(ResponseContent {
1406 status,
1407 content,
1408 entity
1409 }))
1410 }
1411}
1412
1413pub async fn update_app_settings(
1416 configuration: &configuration::Configuration,
1417 app_id: &str,
1418 update_settings: models::UpdateSettings
1419) -> Result<models::UpdateAppSettings200Response, Error<UpdateAppSettingsError>> {
1420 let p_path_app_id = app_id;
1422 let p_body_update_settings = update_settings;
1423
1424 let uri_str = format!(
1425 "{}/api/v1/apps/{app_id}",
1426 configuration.base_path,
1427 app_id = crate::apis::urlencode(p_path_app_id)
1428 );
1429 let mut req_builder = configuration
1430 .client
1431 .request(reqwest::Method::PATCH, &uri_str);
1432
1433 if let Some(ref user_agent) = configuration.user_agent {
1434 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1435 }
1436 if let Some(ref token) = configuration.bearer_access_token {
1437 req_builder = req_builder.bearer_auth(token.to_owned());
1438 };
1439 req_builder = req_builder.json(&p_body_update_settings);
1440
1441 let req = req_builder.build()?;
1442 let resp = configuration.client.execute(req).await?;
1443
1444 let status = resp.status();
1445 let content_type = resp
1446 .headers()
1447 .get("content-type")
1448 .and_then(|v| v.to_str().ok())
1449 .unwrap_or("application/octet-stream");
1450 let content_type = super::ContentType::from(content_type);
1451
1452 if !status.is_client_error() && !status.is_server_error() {
1453 let content = resp.text().await?;
1454 match content_type {
1455 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1456 ContentType::Text => {
1457 return Err(Error::from(serde_json::Error::custom(
1458 "Received `text/plain` content type response that cannot be converted to `models::UpdateAppSettings200Response`"
1459 )));
1460 }
1461 ContentType::Unsupported(unknown_type) => {
1462 return Err(Error::from(serde_json::Error::custom(format!(
1463 "Received `{unknown_type}` content type response that cannot be converted to `models::UpdateAppSettings200Response`"
1464 ))));
1465 }
1466 }
1467 } else {
1468 let content = resp.text().await?;
1469 let entity: Option<UpdateAppSettingsError> = serde_json::from_str(&content).ok();
1470 Err(Error::ResponseError(ResponseContent {
1471 status,
1472 content,
1473 entity
1474 }))
1475 }
1476}
1477
1478pub async fn update_app_state(
1481 configuration: &configuration::Configuration,
1482 app_id: &str,
1483 action: &str
1484) -> Result<(), Error<UpdateAppStateError>> {
1485 let p_path_app_id = app_id;
1487 let p_path_action = action;
1488
1489 let uri_str = format!(
1490 "{}/api/v1/apps/{app_id}/action/{action}",
1491 configuration.base_path,
1492 app_id = crate::apis::urlencode(p_path_app_id),
1493 action = crate::apis::urlencode(p_path_action)
1494 );
1495 let mut req_builder = configuration
1496 .client
1497 .request(reqwest::Method::PATCH, &uri_str);
1498
1499 if let Some(ref user_agent) = configuration.user_agent {
1500 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1501 }
1502 if let Some(ref token) = configuration.bearer_access_token {
1503 req_builder = req_builder.bearer_auth(token.to_owned());
1504 };
1505
1506 let req = req_builder.build()?;
1507 let resp = configuration.client.execute(req).await?;
1508
1509 let status = resp.status();
1510
1511 if !status.is_client_error() && !status.is_server_error() {
1512 Ok(())
1513 } else {
1514 let content = resp.text().await?;
1515 let entity: Option<UpdateAppStateError> = serde_json::from_str(&content).ok();
1516 Err(Error::ResponseError(ResponseContent {
1517 status,
1518 content,
1519 entity
1520 }))
1521 }
1522}