1use super::{ContentType, Error, configuration};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{Deserialize, Serialize, de::Error as _};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum ChangeAppOwnerError {
20 Status403(models::RespBasic),
21 Status404(models::RespBasic),
22 Status500(models::RespBasic),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CreateAppVersionError {
30 Status400(models::RespBasic),
31 Status403(models::RespBasic),
32 Status409(models::RespResourceUrl),
33 Status500(models::RespBasic),
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum DeleteAppError {
41 Status403(models::RespBasic),
42 Status404(models::RespBasic),
43 Status500(models::RespBasic),
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum DisableAppError {
51 Status403(models::RespBasic),
52 Status404(models::RespBasic),
53 Status500(models::RespBasic),
54 UnknownValue(serde_json::Value),
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum DisableAppVersionError {
61 Status403(models::RespBasic),
62 Status404(models::RespBasic),
63 Status500(models::RespBasic),
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum EnableAppError {
71 Status403(models::RespBasic),
72 Status404(models::RespBasic),
73 Status500(models::RespBasic),
74 UnknownValue(serde_json::Value),
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum EnableAppVersionError {
81 Status403(models::RespBasic),
82 Status404(models::RespBasic),
83 Status500(models::RespBasic),
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetAppError {
91 Status400(models::RespBasic),
92 Status403(models::RespBasic),
93 Status404(models::RespBasic),
94 Status500(models::RespBasic),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum GetAppLatestVersionError {
102 Status400(models::RespBasic),
103 Status403(models::RespBasic),
104 Status404(models::RespBasic),
105 Status500(models::RespBasic),
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetAppsError {
113 Status400(models::RespBasic),
114 Status500(models::RespBasic),
115 UnknownValue(serde_json::Value),
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum GetHistoryError {
122 Status403(models::RespBasic),
123 Status404(models::RespBasic),
124 Status500(models::RespBasic),
125 UnknownValue(serde_json::Value),
126}
127
128#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum IsEnabledError {
132 Status403(models::RespBasic),
133 Status404(models::RespBasic),
134 Status500(models::RespBasic),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum LockAppError {
142 Status403(models::RespBasic),
143 Status404(models::RespBasic),
144 Status500(models::RespBasic),
145 UnknownValue(serde_json::Value),
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize)]
150#[serde(untagged)]
151pub enum PatchAppError {
152 Status400(models::RespBasic),
153 Status403(models::RespBasic),
154 Status404(models::RespBasic),
155 Status500(models::RespBasic),
156 UnknownValue(serde_json::Value),
157}
158
159#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum PutAppError {
163 Status400(models::RespBasic),
164 Status403(models::RespBasic),
165 Status404(models::RespBasic),
166 Status409(models::RespResourceUrl),
167 Status500(models::RespBasic),
168 UnknownValue(serde_json::Value),
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum SearchAppsQueryParametersError {
175 Status400(models::RespBasic),
176 Status500(models::RespBasic),
177 UnknownValue(serde_json::Value),
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum SearchAppsRequestBodyError {
184 Status400(models::RespBasic),
185 Status500(models::RespBasic),
186 UnknownValue(serde_json::Value),
187}
188
189#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum UndeleteAppError {
193 Status403(models::RespBasic),
194 Status404(models::RespBasic),
195 Status500(models::RespBasic),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum UnlockAppError {
203 Status403(models::RespBasic),
204 Status404(models::RespBasic),
205 Status500(models::RespBasic),
206 UnknownValue(serde_json::Value),
207}
208
209pub async fn change_app_owner(
211 configuration: &configuration::Configuration,
212 app_id: &str,
213 user_name: &str,
214) -> Result<models::RespChangeCount, Error<ChangeAppOwnerError>> {
215 let p_path_app_id = app_id;
217 let p_path_user_name = user_name;
218
219 let uri_str = format!(
220 "{}/v3/apps/{appId}/changeOwner/{userName}",
221 configuration.base_path,
222 appId = crate::apis::urlencode(p_path_app_id),
223 userName = crate::apis::urlencode(p_path_user_name)
224 );
225 let mut req_builder = configuration
226 .client
227 .request(reqwest::Method::POST, &uri_str);
228
229 if let Some(ref user_agent) = configuration.user_agent {
230 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
231 }
232 if let Some(ref apikey) = configuration.api_key {
233 let key = apikey.key.clone();
234 let value = match apikey.prefix {
235 Some(ref prefix) => format!("{} {}", prefix, key),
236 None => key,
237 };
238 req_builder = req_builder.header("X-Tapis-Token", value);
239 };
240
241 let req = req_builder.build()?;
242 let resp = configuration.client.execute(req).await?;
243
244 let status = resp.status();
245 let content_type = resp
246 .headers()
247 .get("content-type")
248 .and_then(|v| v.to_str().ok())
249 .unwrap_or("application/octet-stream");
250 let content_type = super::ContentType::from(content_type);
251
252 if !status.is_client_error() && !status.is_server_error() {
253 let content = resp.text().await?;
254 match content_type {
255 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
256 ContentType::Text => Err(Error::from(serde_json::Error::custom(
257 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
258 ))),
259 ContentType::Unsupported(unknown_type) => {
260 Err(Error::from(serde_json::Error::custom(format!(
261 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
262 ))))
263 }
264 }
265 } else {
266 let content = resp.text().await?;
267 let entity: Option<ChangeAppOwnerError> = serde_json::from_str(&content).ok();
268 Err(Error::ResponseError(ResponseContent {
269 status,
270 content,
271 entity,
272 }))
273 }
274}
275
276pub async fn create_app_version(
278 configuration: &configuration::Configuration,
279 req_post_app: models::ReqPostApp,
280) -> Result<models::RespResourceUrl, Error<CreateAppVersionError>> {
281 let p_body_req_post_app = req_post_app;
283
284 let uri_str = format!("{}/v3/apps", configuration.base_path);
285 let mut req_builder = configuration
286 .client
287 .request(reqwest::Method::POST, &uri_str);
288
289 if let Some(ref user_agent) = configuration.user_agent {
290 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
291 }
292 if let Some(ref apikey) = configuration.api_key {
293 let key = apikey.key.clone();
294 let value = match apikey.prefix {
295 Some(ref prefix) => format!("{} {}", prefix, key),
296 None => key,
297 };
298 req_builder = req_builder.header("X-Tapis-Token", value);
299 };
300 req_builder = req_builder.json(&p_body_req_post_app);
301
302 let req = req_builder.build()?;
303 let resp = configuration.client.execute(req).await?;
304
305 let status = resp.status();
306 let content_type = resp
307 .headers()
308 .get("content-type")
309 .and_then(|v| v.to_str().ok())
310 .unwrap_or("application/octet-stream");
311 let content_type = super::ContentType::from(content_type);
312
313 if !status.is_client_error() && !status.is_server_error() {
314 let content = resp.text().await?;
315 match content_type {
316 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
317 ContentType::Text => Err(Error::from(serde_json::Error::custom(
318 "Received `text/plain` content type response that cannot be converted to `models::RespResourceUrl`",
319 ))),
320 ContentType::Unsupported(unknown_type) => {
321 Err(Error::from(serde_json::Error::custom(format!(
322 "Received `{unknown_type}` content type response that cannot be converted to `models::RespResourceUrl`"
323 ))))
324 }
325 }
326 } else {
327 let content = resp.text().await?;
328 let entity: Option<CreateAppVersionError> = serde_json::from_str(&content).ok();
329 Err(Error::ResponseError(ResponseContent {
330 status,
331 content,
332 entity,
333 }))
334 }
335}
336
337pub async fn delete_app(
339 configuration: &configuration::Configuration,
340 app_id: &str,
341) -> Result<models::RespChangeCount, Error<DeleteAppError>> {
342 let p_path_app_id = app_id;
344
345 let uri_str = format!(
346 "{}/v3/apps/{appId}/delete",
347 configuration.base_path,
348 appId = crate::apis::urlencode(p_path_app_id)
349 );
350 let mut req_builder = configuration
351 .client
352 .request(reqwest::Method::POST, &uri_str);
353
354 if let Some(ref user_agent) = configuration.user_agent {
355 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
356 }
357 if let Some(ref apikey) = configuration.api_key {
358 let key = apikey.key.clone();
359 let value = match apikey.prefix {
360 Some(ref prefix) => format!("{} {}", prefix, key),
361 None => key,
362 };
363 req_builder = req_builder.header("X-Tapis-Token", value);
364 };
365
366 let req = req_builder.build()?;
367 let resp = configuration.client.execute(req).await?;
368
369 let status = resp.status();
370 let content_type = resp
371 .headers()
372 .get("content-type")
373 .and_then(|v| v.to_str().ok())
374 .unwrap_or("application/octet-stream");
375 let content_type = super::ContentType::from(content_type);
376
377 if !status.is_client_error() && !status.is_server_error() {
378 let content = resp.text().await?;
379 match content_type {
380 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
381 ContentType::Text => Err(Error::from(serde_json::Error::custom(
382 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
383 ))),
384 ContentType::Unsupported(unknown_type) => {
385 Err(Error::from(serde_json::Error::custom(format!(
386 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
387 ))))
388 }
389 }
390 } else {
391 let content = resp.text().await?;
392 let entity: Option<DeleteAppError> = serde_json::from_str(&content).ok();
393 Err(Error::ResponseError(ResponseContent {
394 status,
395 content,
396 entity,
397 }))
398 }
399}
400
401pub async fn disable_app(
403 configuration: &configuration::Configuration,
404 app_id: &str,
405) -> Result<models::RespChangeCount, Error<DisableAppError>> {
406 let p_path_app_id = app_id;
408
409 let uri_str = format!(
410 "{}/v3/apps/{appId}/disable",
411 configuration.base_path,
412 appId = crate::apis::urlencode(p_path_app_id)
413 );
414 let mut req_builder = configuration
415 .client
416 .request(reqwest::Method::POST, &uri_str);
417
418 if let Some(ref user_agent) = configuration.user_agent {
419 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
420 }
421 if let Some(ref apikey) = configuration.api_key {
422 let key = apikey.key.clone();
423 let value = match apikey.prefix {
424 Some(ref prefix) => format!("{} {}", prefix, key),
425 None => key,
426 };
427 req_builder = req_builder.header("X-Tapis-Token", value);
428 };
429
430 let req = req_builder.build()?;
431 let resp = configuration.client.execute(req).await?;
432
433 let status = resp.status();
434 let content_type = resp
435 .headers()
436 .get("content-type")
437 .and_then(|v| v.to_str().ok())
438 .unwrap_or("application/octet-stream");
439 let content_type = super::ContentType::from(content_type);
440
441 if !status.is_client_error() && !status.is_server_error() {
442 let content = resp.text().await?;
443 match content_type {
444 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
445 ContentType::Text => Err(Error::from(serde_json::Error::custom(
446 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
447 ))),
448 ContentType::Unsupported(unknown_type) => {
449 Err(Error::from(serde_json::Error::custom(format!(
450 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
451 ))))
452 }
453 }
454 } else {
455 let content = resp.text().await?;
456 let entity: Option<DisableAppError> = serde_json::from_str(&content).ok();
457 Err(Error::ResponseError(ResponseContent {
458 status,
459 content,
460 entity,
461 }))
462 }
463}
464
465pub async fn disable_app_version(
467 configuration: &configuration::Configuration,
468 app_id: &str,
469 app_version: &str,
470) -> Result<models::RespChangeCount, Error<DisableAppVersionError>> {
471 let p_path_app_id = app_id;
473 let p_path_app_version = app_version;
474
475 let uri_str = format!(
476 "{}/v3/apps/{appId}/{appVersion}/disable",
477 configuration.base_path,
478 appId = crate::apis::urlencode(p_path_app_id),
479 appVersion = crate::apis::urlencode(p_path_app_version)
480 );
481 let mut req_builder = configuration
482 .client
483 .request(reqwest::Method::POST, &uri_str);
484
485 if let Some(ref user_agent) = configuration.user_agent {
486 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
487 }
488 if let Some(ref apikey) = configuration.api_key {
489 let key = apikey.key.clone();
490 let value = match apikey.prefix {
491 Some(ref prefix) => format!("{} {}", prefix, key),
492 None => key,
493 };
494 req_builder = req_builder.header("X-Tapis-Token", value);
495 };
496
497 let req = req_builder.build()?;
498 let resp = configuration.client.execute(req).await?;
499
500 let status = resp.status();
501 let content_type = resp
502 .headers()
503 .get("content-type")
504 .and_then(|v| v.to_str().ok())
505 .unwrap_or("application/octet-stream");
506 let content_type = super::ContentType::from(content_type);
507
508 if !status.is_client_error() && !status.is_server_error() {
509 let content = resp.text().await?;
510 match content_type {
511 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
512 ContentType::Text => Err(Error::from(serde_json::Error::custom(
513 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
514 ))),
515 ContentType::Unsupported(unknown_type) => {
516 Err(Error::from(serde_json::Error::custom(format!(
517 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
518 ))))
519 }
520 }
521 } else {
522 let content = resp.text().await?;
523 let entity: Option<DisableAppVersionError> = serde_json::from_str(&content).ok();
524 Err(Error::ResponseError(ResponseContent {
525 status,
526 content,
527 entity,
528 }))
529 }
530}
531
532pub async fn enable_app(
534 configuration: &configuration::Configuration,
535 app_id: &str,
536) -> Result<models::RespChangeCount, Error<EnableAppError>> {
537 let p_path_app_id = app_id;
539
540 let uri_str = format!(
541 "{}/v3/apps/{appId}/enable",
542 configuration.base_path,
543 appId = crate::apis::urlencode(p_path_app_id)
544 );
545 let mut req_builder = configuration
546 .client
547 .request(reqwest::Method::POST, &uri_str);
548
549 if let Some(ref user_agent) = configuration.user_agent {
550 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
551 }
552 if let Some(ref apikey) = configuration.api_key {
553 let key = apikey.key.clone();
554 let value = match apikey.prefix {
555 Some(ref prefix) => format!("{} {}", prefix, key),
556 None => key,
557 };
558 req_builder = req_builder.header("X-Tapis-Token", value);
559 };
560
561 let req = req_builder.build()?;
562 let resp = configuration.client.execute(req).await?;
563
564 let status = resp.status();
565 let content_type = resp
566 .headers()
567 .get("content-type")
568 .and_then(|v| v.to_str().ok())
569 .unwrap_or("application/octet-stream");
570 let content_type = super::ContentType::from(content_type);
571
572 if !status.is_client_error() && !status.is_server_error() {
573 let content = resp.text().await?;
574 match content_type {
575 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
576 ContentType::Text => Err(Error::from(serde_json::Error::custom(
577 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
578 ))),
579 ContentType::Unsupported(unknown_type) => {
580 Err(Error::from(serde_json::Error::custom(format!(
581 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
582 ))))
583 }
584 }
585 } else {
586 let content = resp.text().await?;
587 let entity: Option<EnableAppError> = serde_json::from_str(&content).ok();
588 Err(Error::ResponseError(ResponseContent {
589 status,
590 content,
591 entity,
592 }))
593 }
594}
595
596pub async fn enable_app_version(
598 configuration: &configuration::Configuration,
599 app_id: &str,
600 app_version: &str,
601) -> Result<models::RespChangeCount, Error<EnableAppVersionError>> {
602 let p_path_app_id = app_id;
604 let p_path_app_version = app_version;
605
606 let uri_str = format!(
607 "{}/v3/apps/{appId}/{appVersion}/enable",
608 configuration.base_path,
609 appId = crate::apis::urlencode(p_path_app_id),
610 appVersion = crate::apis::urlencode(p_path_app_version)
611 );
612 let mut req_builder = configuration
613 .client
614 .request(reqwest::Method::POST, &uri_str);
615
616 if let Some(ref user_agent) = configuration.user_agent {
617 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
618 }
619 if let Some(ref apikey) = configuration.api_key {
620 let key = apikey.key.clone();
621 let value = match apikey.prefix {
622 Some(ref prefix) => format!("{} {}", prefix, key),
623 None => key,
624 };
625 req_builder = req_builder.header("X-Tapis-Token", value);
626 };
627
628 let req = req_builder.build()?;
629 let resp = configuration.client.execute(req).await?;
630
631 let status = resp.status();
632 let content_type = resp
633 .headers()
634 .get("content-type")
635 .and_then(|v| v.to_str().ok())
636 .unwrap_or("application/octet-stream");
637 let content_type = super::ContentType::from(content_type);
638
639 if !status.is_client_error() && !status.is_server_error() {
640 let content = resp.text().await?;
641 match content_type {
642 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
643 ContentType::Text => Err(Error::from(serde_json::Error::custom(
644 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
645 ))),
646 ContentType::Unsupported(unknown_type) => {
647 Err(Error::from(serde_json::Error::custom(format!(
648 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
649 ))))
650 }
651 }
652 } else {
653 let content = resp.text().await?;
654 let entity: Option<EnableAppVersionError> = serde_json::from_str(&content).ok();
655 Err(Error::ResponseError(ResponseContent {
656 status,
657 content,
658 entity,
659 }))
660 }
661}
662
663pub async fn get_app(
665 configuration: &configuration::Configuration,
666 app_id: &str,
667 app_version: &str,
668 require_exec_perm: Option<bool>,
669 impersonation_id: Option<&str>,
670 select: Option<&str>,
671 resource_tenant: Option<&str>,
672) -> Result<models::RespApp, Error<GetAppError>> {
673 let p_path_app_id = app_id;
675 let p_path_app_version = app_version;
676 let p_query_require_exec_perm = require_exec_perm;
677 let p_query_impersonation_id = impersonation_id;
678 let p_query_select = select;
679 let p_query_resource_tenant = resource_tenant;
680
681 let uri_str = format!(
682 "{}/v3/apps/{appId}/{appVersion}",
683 configuration.base_path,
684 appId = crate::apis::urlencode(p_path_app_id),
685 appVersion = crate::apis::urlencode(p_path_app_version)
686 );
687 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
688
689 if let Some(ref param_value) = p_query_require_exec_perm {
690 req_builder = req_builder.query(&[("requireExecPerm", ¶m_value.to_string())]);
691 }
692 if let Some(ref param_value) = p_query_impersonation_id {
693 req_builder = req_builder.query(&[("impersonationId", ¶m_value.to_string())]);
694 }
695 if let Some(ref param_value) = p_query_select {
696 req_builder = req_builder.query(&[("select", ¶m_value.to_string())]);
697 }
698 if let Some(ref param_value) = p_query_resource_tenant {
699 req_builder = req_builder.query(&[("resourceTenant", ¶m_value.to_string())]);
700 }
701 if let Some(ref user_agent) = configuration.user_agent {
702 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
703 }
704 if let Some(ref apikey) = configuration.api_key {
705 let key = apikey.key.clone();
706 let value = match apikey.prefix {
707 Some(ref prefix) => format!("{} {}", prefix, key),
708 None => key,
709 };
710 req_builder = req_builder.header("X-Tapis-Token", value);
711 };
712
713 let req = req_builder.build()?;
714 let resp = configuration.client.execute(req).await?;
715
716 let status = resp.status();
717 let content_type = resp
718 .headers()
719 .get("content-type")
720 .and_then(|v| v.to_str().ok())
721 .unwrap_or("application/octet-stream");
722 let content_type = super::ContentType::from(content_type);
723
724 if !status.is_client_error() && !status.is_server_error() {
725 let content = resp.text().await?;
726 match content_type {
727 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
728 ContentType::Text => Err(Error::from(serde_json::Error::custom(
729 "Received `text/plain` content type response that cannot be converted to `models::RespApp`",
730 ))),
731 ContentType::Unsupported(unknown_type) => {
732 Err(Error::from(serde_json::Error::custom(format!(
733 "Received `{unknown_type}` content type response that cannot be converted to `models::RespApp`"
734 ))))
735 }
736 }
737 } else {
738 let content = resp.text().await?;
739 let entity: Option<GetAppError> = serde_json::from_str(&content).ok();
740 Err(Error::ResponseError(ResponseContent {
741 status,
742 content,
743 entity,
744 }))
745 }
746}
747
748pub async fn get_app_latest_version(
750 configuration: &configuration::Configuration,
751 app_id: &str,
752 require_exec_perm: Option<bool>,
753 select: Option<&str>,
754 resource_tenant: Option<&str>,
755 impersonation_id: Option<&str>,
756) -> Result<models::RespApp, Error<GetAppLatestVersionError>> {
757 let p_path_app_id = app_id;
759 let p_query_require_exec_perm = require_exec_perm;
760 let p_query_select = select;
761 let p_query_resource_tenant = resource_tenant;
762 let p_query_impersonation_id = impersonation_id;
763
764 let uri_str = format!(
765 "{}/v3/apps/{appId}",
766 configuration.base_path,
767 appId = crate::apis::urlencode(p_path_app_id)
768 );
769 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
770
771 if let Some(ref param_value) = p_query_require_exec_perm {
772 req_builder = req_builder.query(&[("requireExecPerm", ¶m_value.to_string())]);
773 }
774 if let Some(ref param_value) = p_query_select {
775 req_builder = req_builder.query(&[("select", ¶m_value.to_string())]);
776 }
777 if let Some(ref param_value) = p_query_resource_tenant {
778 req_builder = req_builder.query(&[("resourceTenant", ¶m_value.to_string())]);
779 }
780 if let Some(ref param_value) = p_query_impersonation_id {
781 req_builder = req_builder.query(&[("impersonationId", ¶m_value.to_string())]);
782 }
783 if let Some(ref user_agent) = configuration.user_agent {
784 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
785 }
786 if let Some(ref apikey) = configuration.api_key {
787 let key = apikey.key.clone();
788 let value = match apikey.prefix {
789 Some(ref prefix) => format!("{} {}", prefix, key),
790 None => key,
791 };
792 req_builder = req_builder.header("X-Tapis-Token", value);
793 };
794
795 let req = req_builder.build()?;
796 let resp = configuration.client.execute(req).await?;
797
798 let status = resp.status();
799 let content_type = resp
800 .headers()
801 .get("content-type")
802 .and_then(|v| v.to_str().ok())
803 .unwrap_or("application/octet-stream");
804 let content_type = super::ContentType::from(content_type);
805
806 if !status.is_client_error() && !status.is_server_error() {
807 let content = resp.text().await?;
808 match content_type {
809 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
810 ContentType::Text => Err(Error::from(serde_json::Error::custom(
811 "Received `text/plain` content type response that cannot be converted to `models::RespApp`",
812 ))),
813 ContentType::Unsupported(unknown_type) => {
814 Err(Error::from(serde_json::Error::custom(format!(
815 "Received `{unknown_type}` content type response that cannot be converted to `models::RespApp`"
816 ))))
817 }
818 }
819 } else {
820 let content = resp.text().await?;
821 let entity: Option<GetAppLatestVersionError> = serde_json::from_str(&content).ok();
822 Err(Error::ResponseError(ResponseContent {
823 status,
824 content,
825 entity,
826 }))
827 }
828}
829
830pub async fn get_apps(
832 configuration: &configuration::Configuration,
833 search: Option<&str>,
834 list_type: Option<models::ListTypeEnum>,
835 limit: Option<i32>,
836 order_by: Option<&str>,
837 skip: Option<i32>,
838 start_after: Option<&str>,
839 compute_total: Option<bool>,
840 select: Option<&str>,
841 show_deleted: Option<bool>,
842 impersonation_id: Option<&str>,
843) -> Result<models::RespApps, Error<GetAppsError>> {
844 let p_query_search = search;
846 let p_query_list_type = list_type;
847 let p_query_limit = limit;
848 let p_query_order_by = order_by;
849 let p_query_skip = skip;
850 let p_query_start_after = start_after;
851 let p_query_compute_total = compute_total;
852 let p_query_select = select;
853 let p_query_show_deleted = show_deleted;
854 let p_query_impersonation_id = impersonation_id;
855
856 let uri_str = format!("{}/v3/apps", configuration.base_path);
857 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
858
859 if let Some(ref param_value) = p_query_search {
860 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
861 }
862 if let Some(ref param_value) = p_query_list_type {
863 req_builder = req_builder.query(&[("listType", &serde_json::to_string(param_value)?)]);
864 }
865 if let Some(ref param_value) = p_query_limit {
866 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
867 }
868 if let Some(ref param_value) = p_query_order_by {
869 req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
870 }
871 if let Some(ref param_value) = p_query_skip {
872 req_builder = req_builder.query(&[("skip", ¶m_value.to_string())]);
873 }
874 if let Some(ref param_value) = p_query_start_after {
875 req_builder = req_builder.query(&[("startAfter", ¶m_value.to_string())]);
876 }
877 if let Some(ref param_value) = p_query_compute_total {
878 req_builder = req_builder.query(&[("computeTotal", ¶m_value.to_string())]);
879 }
880 if let Some(ref param_value) = p_query_select {
881 req_builder = req_builder.query(&[("select", ¶m_value.to_string())]);
882 }
883 if let Some(ref param_value) = p_query_show_deleted {
884 req_builder = req_builder.query(&[("showDeleted", ¶m_value.to_string())]);
885 }
886 if let Some(ref param_value) = p_query_impersonation_id {
887 req_builder = req_builder.query(&[("impersonationId", ¶m_value.to_string())]);
888 }
889 if let Some(ref user_agent) = configuration.user_agent {
890 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
891 }
892 if let Some(ref apikey) = configuration.api_key {
893 let key = apikey.key.clone();
894 let value = match apikey.prefix {
895 Some(ref prefix) => format!("{} {}", prefix, key),
896 None => key,
897 };
898 req_builder = req_builder.header("X-Tapis-Token", value);
899 };
900
901 let req = req_builder.build()?;
902 let resp = configuration.client.execute(req).await?;
903
904 let status = resp.status();
905 let content_type = resp
906 .headers()
907 .get("content-type")
908 .and_then(|v| v.to_str().ok())
909 .unwrap_or("application/octet-stream");
910 let content_type = super::ContentType::from(content_type);
911
912 if !status.is_client_error() && !status.is_server_error() {
913 let content = resp.text().await?;
914 match content_type {
915 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
916 ContentType::Text => Err(Error::from(serde_json::Error::custom(
917 "Received `text/plain` content type response that cannot be converted to `models::RespApps`",
918 ))),
919 ContentType::Unsupported(unknown_type) => {
920 Err(Error::from(serde_json::Error::custom(format!(
921 "Received `{unknown_type}` content type response that cannot be converted to `models::RespApps`"
922 ))))
923 }
924 }
925 } else {
926 let content = resp.text().await?;
927 let entity: Option<GetAppsError> = serde_json::from_str(&content).ok();
928 Err(Error::ResponseError(ResponseContent {
929 status,
930 content,
931 entity,
932 }))
933 }
934}
935
936pub async fn get_history(
938 configuration: &configuration::Configuration,
939 app_id: &str,
940) -> Result<models::RespAppHistory, Error<GetHistoryError>> {
941 let p_path_app_id = app_id;
943
944 let uri_str = format!(
945 "{}/v3/apps/{appId}/history",
946 configuration.base_path,
947 appId = crate::apis::urlencode(p_path_app_id)
948 );
949 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
950
951 if let Some(ref user_agent) = configuration.user_agent {
952 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
953 }
954 if let Some(ref apikey) = configuration.api_key {
955 let key = apikey.key.clone();
956 let value = match apikey.prefix {
957 Some(ref prefix) => format!("{} {}", prefix, key),
958 None => key,
959 };
960 req_builder = req_builder.header("X-Tapis-Token", value);
961 };
962
963 let req = req_builder.build()?;
964 let resp = configuration.client.execute(req).await?;
965
966 let status = resp.status();
967 let content_type = resp
968 .headers()
969 .get("content-type")
970 .and_then(|v| v.to_str().ok())
971 .unwrap_or("application/octet-stream");
972 let content_type = super::ContentType::from(content_type);
973
974 if !status.is_client_error() && !status.is_server_error() {
975 let content = resp.text().await?;
976 match content_type {
977 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
978 ContentType::Text => Err(Error::from(serde_json::Error::custom(
979 "Received `text/plain` content type response that cannot be converted to `models::RespAppHistory`",
980 ))),
981 ContentType::Unsupported(unknown_type) => {
982 Err(Error::from(serde_json::Error::custom(format!(
983 "Received `{unknown_type}` content type response that cannot be converted to `models::RespAppHistory`"
984 ))))
985 }
986 }
987 } else {
988 let content = resp.text().await?;
989 let entity: Option<GetHistoryError> = serde_json::from_str(&content).ok();
990 Err(Error::ResponseError(ResponseContent {
991 status,
992 content,
993 entity,
994 }))
995 }
996}
997
998pub async fn is_enabled(
1000 configuration: &configuration::Configuration,
1001 app_id: &str,
1002 version: Option<&str>,
1003) -> Result<models::RespBoolean, Error<IsEnabledError>> {
1004 let p_path_app_id = app_id;
1006 let p_query_version = version;
1007
1008 let uri_str = format!(
1009 "{}/v3/apps/{appId}/isEnabled",
1010 configuration.base_path,
1011 appId = crate::apis::urlencode(p_path_app_id)
1012 );
1013 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1014
1015 if let Some(ref param_value) = p_query_version {
1016 req_builder = req_builder.query(&[("version", ¶m_value.to_string())]);
1017 }
1018 if let Some(ref user_agent) = configuration.user_agent {
1019 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1020 }
1021 if let Some(ref apikey) = configuration.api_key {
1022 let key = apikey.key.clone();
1023 let value = match apikey.prefix {
1024 Some(ref prefix) => format!("{} {}", prefix, key),
1025 None => key,
1026 };
1027 req_builder = req_builder.header("X-Tapis-Token", value);
1028 };
1029
1030 let req = req_builder.build()?;
1031 let resp = configuration.client.execute(req).await?;
1032
1033 let status = resp.status();
1034 let content_type = resp
1035 .headers()
1036 .get("content-type")
1037 .and_then(|v| v.to_str().ok())
1038 .unwrap_or("application/octet-stream");
1039 let content_type = super::ContentType::from(content_type);
1040
1041 if !status.is_client_error() && !status.is_server_error() {
1042 let content = resp.text().await?;
1043 match content_type {
1044 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1045 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1046 "Received `text/plain` content type response that cannot be converted to `models::RespBoolean`",
1047 ))),
1048 ContentType::Unsupported(unknown_type) => {
1049 Err(Error::from(serde_json::Error::custom(format!(
1050 "Received `{unknown_type}` content type response that cannot be converted to `models::RespBoolean`"
1051 ))))
1052 }
1053 }
1054 } else {
1055 let content = resp.text().await?;
1056 let entity: Option<IsEnabledError> = serde_json::from_str(&content).ok();
1057 Err(Error::ResponseError(ResponseContent {
1058 status,
1059 content,
1060 entity,
1061 }))
1062 }
1063}
1064
1065pub async fn lock_app(
1067 configuration: &configuration::Configuration,
1068 app_id: &str,
1069 app_version: &str,
1070) -> Result<models::RespChangeCount, Error<LockAppError>> {
1071 let p_path_app_id = app_id;
1073 let p_path_app_version = app_version;
1074
1075 let uri_str = format!(
1076 "{}/v3/apps/{appId}/{appVersion}/lock",
1077 configuration.base_path,
1078 appId = crate::apis::urlencode(p_path_app_id),
1079 appVersion = crate::apis::urlencode(p_path_app_version)
1080 );
1081 let mut req_builder = configuration
1082 .client
1083 .request(reqwest::Method::POST, &uri_str);
1084
1085 if let Some(ref user_agent) = configuration.user_agent {
1086 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1087 }
1088 if let Some(ref apikey) = configuration.api_key {
1089 let key = apikey.key.clone();
1090 let value = match apikey.prefix {
1091 Some(ref prefix) => format!("{} {}", prefix, key),
1092 None => key,
1093 };
1094 req_builder = req_builder.header("X-Tapis-Token", value);
1095 };
1096
1097 let req = req_builder.build()?;
1098 let resp = configuration.client.execute(req).await?;
1099
1100 let status = resp.status();
1101 let content_type = resp
1102 .headers()
1103 .get("content-type")
1104 .and_then(|v| v.to_str().ok())
1105 .unwrap_or("application/octet-stream");
1106 let content_type = super::ContentType::from(content_type);
1107
1108 if !status.is_client_error() && !status.is_server_error() {
1109 let content = resp.text().await?;
1110 match content_type {
1111 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1112 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1113 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
1114 ))),
1115 ContentType::Unsupported(unknown_type) => {
1116 Err(Error::from(serde_json::Error::custom(format!(
1117 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
1118 ))))
1119 }
1120 }
1121 } else {
1122 let content = resp.text().await?;
1123 let entity: Option<LockAppError> = serde_json::from_str(&content).ok();
1124 Err(Error::ResponseError(ResponseContent {
1125 status,
1126 content,
1127 entity,
1128 }))
1129 }
1130}
1131
1132pub async fn patch_app(
1134 configuration: &configuration::Configuration,
1135 app_id: &str,
1136 app_version: &str,
1137 req_patch_app: models::ReqPatchApp,
1138) -> Result<models::RespResourceUrl, Error<PatchAppError>> {
1139 let p_path_app_id = app_id;
1141 let p_path_app_version = app_version;
1142 let p_body_req_patch_app = req_patch_app;
1143
1144 let uri_str = format!(
1145 "{}/v3/apps/{appId}/{appVersion}",
1146 configuration.base_path,
1147 appId = crate::apis::urlencode(p_path_app_id),
1148 appVersion = crate::apis::urlencode(p_path_app_version)
1149 );
1150 let mut req_builder = configuration
1151 .client
1152 .request(reqwest::Method::PATCH, &uri_str);
1153
1154 if let Some(ref user_agent) = configuration.user_agent {
1155 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1156 }
1157 if let Some(ref apikey) = configuration.api_key {
1158 let key = apikey.key.clone();
1159 let value = match apikey.prefix {
1160 Some(ref prefix) => format!("{} {}", prefix, key),
1161 None => key,
1162 };
1163 req_builder = req_builder.header("X-Tapis-Token", value);
1164 };
1165 req_builder = req_builder.json(&p_body_req_patch_app);
1166
1167 let req = req_builder.build()?;
1168 let resp = configuration.client.execute(req).await?;
1169
1170 let status = resp.status();
1171 let content_type = resp
1172 .headers()
1173 .get("content-type")
1174 .and_then(|v| v.to_str().ok())
1175 .unwrap_or("application/octet-stream");
1176 let content_type = super::ContentType::from(content_type);
1177
1178 if !status.is_client_error() && !status.is_server_error() {
1179 let content = resp.text().await?;
1180 match content_type {
1181 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1182 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1183 "Received `text/plain` content type response that cannot be converted to `models::RespResourceUrl`",
1184 ))),
1185 ContentType::Unsupported(unknown_type) => {
1186 Err(Error::from(serde_json::Error::custom(format!(
1187 "Received `{unknown_type}` content type response that cannot be converted to `models::RespResourceUrl`"
1188 ))))
1189 }
1190 }
1191 } else {
1192 let content = resp.text().await?;
1193 let entity: Option<PatchAppError> = serde_json::from_str(&content).ok();
1194 Err(Error::ResponseError(ResponseContent {
1195 status,
1196 content,
1197 entity,
1198 }))
1199 }
1200}
1201
1202pub async fn put_app(
1204 configuration: &configuration::Configuration,
1205 app_id: &str,
1206 app_version: &str,
1207 req_put_app: models::ReqPutApp,
1208) -> Result<models::RespResourceUrl, Error<PutAppError>> {
1209 let p_path_app_id = app_id;
1211 let p_path_app_version = app_version;
1212 let p_body_req_put_app = req_put_app;
1213
1214 let uri_str = format!(
1215 "{}/v3/apps/{appId}/{appVersion}",
1216 configuration.base_path,
1217 appId = crate::apis::urlencode(p_path_app_id),
1218 appVersion = crate::apis::urlencode(p_path_app_version)
1219 );
1220 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1221
1222 if let Some(ref user_agent) = configuration.user_agent {
1223 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1224 }
1225 if let Some(ref apikey) = configuration.api_key {
1226 let key = apikey.key.clone();
1227 let value = match apikey.prefix {
1228 Some(ref prefix) => format!("{} {}", prefix, key),
1229 None => key,
1230 };
1231 req_builder = req_builder.header("X-Tapis-Token", value);
1232 };
1233 req_builder = req_builder.json(&p_body_req_put_app);
1234
1235 let req = req_builder.build()?;
1236 let resp = configuration.client.execute(req).await?;
1237
1238 let status = resp.status();
1239 let content_type = resp
1240 .headers()
1241 .get("content-type")
1242 .and_then(|v| v.to_str().ok())
1243 .unwrap_or("application/octet-stream");
1244 let content_type = super::ContentType::from(content_type);
1245
1246 if !status.is_client_error() && !status.is_server_error() {
1247 let content = resp.text().await?;
1248 match content_type {
1249 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1250 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1251 "Received `text/plain` content type response that cannot be converted to `models::RespResourceUrl`",
1252 ))),
1253 ContentType::Unsupported(unknown_type) => {
1254 Err(Error::from(serde_json::Error::custom(format!(
1255 "Received `{unknown_type}` content type response that cannot be converted to `models::RespResourceUrl`"
1256 ))))
1257 }
1258 }
1259 } else {
1260 let content = resp.text().await?;
1261 let entity: Option<PutAppError> = serde_json::from_str(&content).ok();
1262 Err(Error::ResponseError(ResponseContent {
1263 status,
1264 content,
1265 entity,
1266 }))
1267 }
1268}
1269
1270pub async fn search_apps_query_parameters(
1272 configuration: &configuration::Configuration,
1273 list_type: Option<models::ListTypeEnum>,
1274 limit: Option<i32>,
1275 order_by: Option<&str>,
1276 skip: Option<i32>,
1277 start_after: Option<&str>,
1278 compute_total: Option<bool>,
1279 select: Option<&str>,
1280) -> Result<models::RespApps, Error<SearchAppsQueryParametersError>> {
1281 let p_query_list_type = list_type;
1283 let p_query_limit = limit;
1284 let p_query_order_by = order_by;
1285 let p_query_skip = skip;
1286 let p_query_start_after = start_after;
1287 let p_query_compute_total = compute_total;
1288 let p_query_select = select;
1289
1290 let uri_str = format!("{}/v3/apps/search", configuration.base_path);
1291 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1292
1293 if let Some(ref param_value) = p_query_list_type {
1294 req_builder = req_builder.query(&[("listType", &serde_json::to_string(param_value)?)]);
1295 }
1296 if let Some(ref param_value) = p_query_limit {
1297 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1298 }
1299 if let Some(ref param_value) = p_query_order_by {
1300 req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
1301 }
1302 if let Some(ref param_value) = p_query_skip {
1303 req_builder = req_builder.query(&[("skip", ¶m_value.to_string())]);
1304 }
1305 if let Some(ref param_value) = p_query_start_after {
1306 req_builder = req_builder.query(&[("startAfter", ¶m_value.to_string())]);
1307 }
1308 if let Some(ref param_value) = p_query_compute_total {
1309 req_builder = req_builder.query(&[("computeTotal", ¶m_value.to_string())]);
1310 }
1311 if let Some(ref param_value) = p_query_select {
1312 req_builder = req_builder.query(&[("select", ¶m_value.to_string())]);
1313 }
1314 if let Some(ref user_agent) = configuration.user_agent {
1315 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1316 }
1317 if let Some(ref apikey) = configuration.api_key {
1318 let key = apikey.key.clone();
1319 let value = match apikey.prefix {
1320 Some(ref prefix) => format!("{} {}", prefix, key),
1321 None => key,
1322 };
1323 req_builder = req_builder.header("X-Tapis-Token", value);
1324 };
1325
1326 let req = req_builder.build()?;
1327 let resp = configuration.client.execute(req).await?;
1328
1329 let status = resp.status();
1330 let content_type = resp
1331 .headers()
1332 .get("content-type")
1333 .and_then(|v| v.to_str().ok())
1334 .unwrap_or("application/octet-stream");
1335 let content_type = super::ContentType::from(content_type);
1336
1337 if !status.is_client_error() && !status.is_server_error() {
1338 let content = resp.text().await?;
1339 match content_type {
1340 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1341 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1342 "Received `text/plain` content type response that cannot be converted to `models::RespApps`",
1343 ))),
1344 ContentType::Unsupported(unknown_type) => {
1345 Err(Error::from(serde_json::Error::custom(format!(
1346 "Received `{unknown_type}` content type response that cannot be converted to `models::RespApps`"
1347 ))))
1348 }
1349 }
1350 } else {
1351 let content = resp.text().await?;
1352 let entity: Option<SearchAppsQueryParametersError> = serde_json::from_str(&content).ok();
1353 Err(Error::ResponseError(ResponseContent {
1354 status,
1355 content,
1356 entity,
1357 }))
1358 }
1359}
1360
1361pub async fn search_apps_request_body(
1363 configuration: &configuration::Configuration,
1364 req_search_apps: models::ReqSearchApps,
1365 list_type: Option<models::ListTypeEnum>,
1366 limit: Option<i32>,
1367 order_by: Option<&str>,
1368 skip: Option<i32>,
1369 start_after: Option<&str>,
1370 compute_total: Option<bool>,
1371 select: Option<&str>,
1372) -> Result<models::RespApps, Error<SearchAppsRequestBodyError>> {
1373 let p_body_req_search_apps = req_search_apps;
1375 let p_query_list_type = list_type;
1376 let p_query_limit = limit;
1377 let p_query_order_by = order_by;
1378 let p_query_skip = skip;
1379 let p_query_start_after = start_after;
1380 let p_query_compute_total = compute_total;
1381 let p_query_select = select;
1382
1383 let uri_str = format!("{}/v3/apps/search", configuration.base_path);
1384 let mut req_builder = configuration
1385 .client
1386 .request(reqwest::Method::POST, &uri_str);
1387
1388 if let Some(ref param_value) = p_query_list_type {
1389 req_builder = req_builder.query(&[("listType", &serde_json::to_string(param_value)?)]);
1390 }
1391 if let Some(ref param_value) = p_query_limit {
1392 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1393 }
1394 if let Some(ref param_value) = p_query_order_by {
1395 req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
1396 }
1397 if let Some(ref param_value) = p_query_skip {
1398 req_builder = req_builder.query(&[("skip", ¶m_value.to_string())]);
1399 }
1400 if let Some(ref param_value) = p_query_start_after {
1401 req_builder = req_builder.query(&[("startAfter", ¶m_value.to_string())]);
1402 }
1403 if let Some(ref param_value) = p_query_compute_total {
1404 req_builder = req_builder.query(&[("computeTotal", ¶m_value.to_string())]);
1405 }
1406 if let Some(ref param_value) = p_query_select {
1407 req_builder = req_builder.query(&[("select", ¶m_value.to_string())]);
1408 }
1409 if let Some(ref user_agent) = configuration.user_agent {
1410 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1411 }
1412 if let Some(ref apikey) = configuration.api_key {
1413 let key = apikey.key.clone();
1414 let value = match apikey.prefix {
1415 Some(ref prefix) => format!("{} {}", prefix, key),
1416 None => key,
1417 };
1418 req_builder = req_builder.header("X-Tapis-Token", value);
1419 };
1420 req_builder = req_builder.json(&p_body_req_search_apps);
1421
1422 let req = req_builder.build()?;
1423 let resp = configuration.client.execute(req).await?;
1424
1425 let status = resp.status();
1426 let content_type = resp
1427 .headers()
1428 .get("content-type")
1429 .and_then(|v| v.to_str().ok())
1430 .unwrap_or("application/octet-stream");
1431 let content_type = super::ContentType::from(content_type);
1432
1433 if !status.is_client_error() && !status.is_server_error() {
1434 let content = resp.text().await?;
1435 match content_type {
1436 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1437 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1438 "Received `text/plain` content type response that cannot be converted to `models::RespApps`",
1439 ))),
1440 ContentType::Unsupported(unknown_type) => {
1441 Err(Error::from(serde_json::Error::custom(format!(
1442 "Received `{unknown_type}` content type response that cannot be converted to `models::RespApps`"
1443 ))))
1444 }
1445 }
1446 } else {
1447 let content = resp.text().await?;
1448 let entity: Option<SearchAppsRequestBodyError> = serde_json::from_str(&content).ok();
1449 Err(Error::ResponseError(ResponseContent {
1450 status,
1451 content,
1452 entity,
1453 }))
1454 }
1455}
1456
1457pub async fn undelete_app(
1459 configuration: &configuration::Configuration,
1460 app_id: &str,
1461) -> Result<models::RespChangeCount, Error<UndeleteAppError>> {
1462 let p_path_app_id = app_id;
1464
1465 let uri_str = format!(
1466 "{}/v3/apps/{appId}/undelete",
1467 configuration.base_path,
1468 appId = crate::apis::urlencode(p_path_app_id)
1469 );
1470 let mut req_builder = configuration
1471 .client
1472 .request(reqwest::Method::POST, &uri_str);
1473
1474 if let Some(ref user_agent) = configuration.user_agent {
1475 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1476 }
1477 if let Some(ref apikey) = configuration.api_key {
1478 let key = apikey.key.clone();
1479 let value = match apikey.prefix {
1480 Some(ref prefix) => format!("{} {}", prefix, key),
1481 None => key,
1482 };
1483 req_builder = req_builder.header("X-Tapis-Token", value);
1484 };
1485
1486 let req = req_builder.build()?;
1487 let resp = configuration.client.execute(req).await?;
1488
1489 let status = resp.status();
1490 let content_type = resp
1491 .headers()
1492 .get("content-type")
1493 .and_then(|v| v.to_str().ok())
1494 .unwrap_or("application/octet-stream");
1495 let content_type = super::ContentType::from(content_type);
1496
1497 if !status.is_client_error() && !status.is_server_error() {
1498 let content = resp.text().await?;
1499 match content_type {
1500 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1501 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1502 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
1503 ))),
1504 ContentType::Unsupported(unknown_type) => {
1505 Err(Error::from(serde_json::Error::custom(format!(
1506 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
1507 ))))
1508 }
1509 }
1510 } else {
1511 let content = resp.text().await?;
1512 let entity: Option<UndeleteAppError> = serde_json::from_str(&content).ok();
1513 Err(Error::ResponseError(ResponseContent {
1514 status,
1515 content,
1516 entity,
1517 }))
1518 }
1519}
1520
1521pub async fn unlock_app(
1523 configuration: &configuration::Configuration,
1524 app_id: &str,
1525 app_version: &str,
1526) -> Result<models::RespChangeCount, Error<UnlockAppError>> {
1527 let p_path_app_id = app_id;
1529 let p_path_app_version = app_version;
1530
1531 let uri_str = format!(
1532 "{}/v3/apps/{appId}/{appVersion}/unlock",
1533 configuration.base_path,
1534 appId = crate::apis::urlencode(p_path_app_id),
1535 appVersion = crate::apis::urlencode(p_path_app_version)
1536 );
1537 let mut req_builder = configuration
1538 .client
1539 .request(reqwest::Method::POST, &uri_str);
1540
1541 if let Some(ref user_agent) = configuration.user_agent {
1542 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1543 }
1544 if let Some(ref apikey) = configuration.api_key {
1545 let key = apikey.key.clone();
1546 let value = match apikey.prefix {
1547 Some(ref prefix) => format!("{} {}", prefix, key),
1548 None => key,
1549 };
1550 req_builder = req_builder.header("X-Tapis-Token", value);
1551 };
1552
1553 let req = req_builder.build()?;
1554 let resp = configuration.client.execute(req).await?;
1555
1556 let status = resp.status();
1557 let content_type = resp
1558 .headers()
1559 .get("content-type")
1560 .and_then(|v| v.to_str().ok())
1561 .unwrap_or("application/octet-stream");
1562 let content_type = super::ContentType::from(content_type);
1563
1564 if !status.is_client_error() && !status.is_server_error() {
1565 let content = resp.text().await?;
1566 match content_type {
1567 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1568 ContentType::Text => Err(Error::from(serde_json::Error::custom(
1569 "Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`",
1570 ))),
1571 ContentType::Unsupported(unknown_type) => {
1572 Err(Error::from(serde_json::Error::custom(format!(
1573 "Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`"
1574 ))))
1575 }
1576 }
1577 } else {
1578 let content = resp.text().await?;
1579 let entity: Option<UnlockAppError> = serde_json::from_str(&content).ok();
1580 Err(Error::ResponseError(ResponseContent {
1581 status,
1582 content,
1583 entity,
1584 }))
1585 }
1586}