Skip to main content

tapis_apps/apis/
applications_api.rs

1/*
2 * Tapis Applications API
3 *
4 * The Tapis Applications API provides for management of Tapis applications including permissions.
5 *
6 * The version of the OpenAPI document: 25Q4.0
7 * Contact: cicsupport@tacc.utexas.edu
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for typed errors of method [`change_app_owner`]
17#[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/// struct for typed errors of method [`create_app_version`]
27#[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/// struct for typed errors of method [`delete_app`]
38#[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/// struct for typed errors of method [`disable_app`]
48#[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/// struct for typed errors of method [`disable_app_version`]
58#[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/// struct for typed errors of method [`enable_app`]
68#[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/// struct for typed errors of method [`enable_app_version`]
78#[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/// struct for typed errors of method [`get_app`]
88#[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/// struct for typed errors of method [`get_app_latest_version`]
99#[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/// struct for typed errors of method [`get_apps`]
110#[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/// struct for typed errors of method [`get_history`]
119#[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/// struct for typed errors of method [`is_enabled`]
129#[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/// struct for typed errors of method [`lock_app`]
139#[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/// struct for typed errors of method [`patch_app`]
149#[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/// struct for typed errors of method [`put_app`]
160#[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/// struct for typed errors of method [`search_apps_query_parameters`]
172#[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/// struct for typed errors of method [`search_apps_request_body`]
181#[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/// struct for typed errors of method [`undelete_app`]
190#[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/// struct for typed errors of method [`unlock_app`]
200#[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
209/// Change owner of an application. Applies to all versions.
210pub async fn change_app_owner(
211    configuration: &configuration::Configuration,
212    app_id: &str,
213    user_name: &str,
214) -> Result<models::RespChangeCount, Error<ChangeAppOwnerError>> {
215    // add a prefix to parameters to efficiently prevent name collisions
216    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("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
257            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
258        }
259    } else {
260        let content = resp.text().await?;
261        let entity: Option<ChangeAppOwnerError> = serde_json::from_str(&content).ok();
262        Err(Error::ResponseError(ResponseContent {
263            status,
264            content,
265            entity,
266        }))
267    }
268}
269
270/// Create an application using a request body. App id+version must be unique within tenant and can be composed of alphanumeric characters and the following special characters [-._~]. Id must begin with an alphanumeric character and can be no more than 80 characters in length.  Note that certain attributes (such as tenant) are allowed but ignored so that the JSON result returned by a GET may be modified and used when making a POST request to create an application. The attributes that are allowed but ignored are    - tenant   - uuid   - isPublic   - sharedWithUsers   - sharedAppCtx   - deleted   - created   - updated
271pub async fn create_app_version(
272    configuration: &configuration::Configuration,
273    req_post_app: models::ReqPostApp,
274) -> Result<models::RespResourceUrl, Error<CreateAppVersionError>> {
275    // add a prefix to parameters to efficiently prevent name collisions
276    let p_body_req_post_app = req_post_app;
277
278    let uri_str = format!("{}/v3/apps", configuration.base_path);
279    let mut req_builder = configuration
280        .client
281        .request(reqwest::Method::POST, &uri_str);
282
283    if let Some(ref user_agent) = configuration.user_agent {
284        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
285    }
286    if let Some(ref apikey) = configuration.api_key {
287        let key = apikey.key.clone();
288        let value = match apikey.prefix {
289            Some(ref prefix) => format!("{} {}", prefix, key),
290            None => key,
291        };
292        req_builder = req_builder.header("X-Tapis-Token", value);
293    };
294    req_builder = req_builder.json(&p_body_req_post_app);
295
296    let req = req_builder.build()?;
297    let resp = configuration.client.execute(req).await?;
298
299    let status = resp.status();
300    let content_type = resp
301        .headers()
302        .get("content-type")
303        .and_then(|v| v.to_str().ok())
304        .unwrap_or("application/octet-stream");
305    let content_type = super::ContentType::from(content_type);
306
307    if !status.is_client_error() && !status.is_server_error() {
308        let content = resp.text().await?;
309        match content_type {
310            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
311            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespResourceUrl`"))),
312            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespResourceUrl`")))),
313        }
314    } else {
315        let content = resp.text().await?;
316        let entity: Option<CreateAppVersionError> = serde_json::from_str(&content).ok();
317        Err(Error::ResponseError(ResponseContent {
318            status,
319            content,
320            entity,
321        }))
322    }
323}
324
325/// Mark an application as deleted. Application will not appear in queries unless explicitly requested.
326pub async fn delete_app(
327    configuration: &configuration::Configuration,
328    app_id: &str,
329) -> Result<models::RespChangeCount, Error<DeleteAppError>> {
330    // add a prefix to parameters to efficiently prevent name collisions
331    let p_path_app_id = app_id;
332
333    let uri_str = format!(
334        "{}/v3/apps/{appId}/delete",
335        configuration.base_path,
336        appId = crate::apis::urlencode(p_path_app_id)
337    );
338    let mut req_builder = configuration
339        .client
340        .request(reqwest::Method::POST, &uri_str);
341
342    if let Some(ref user_agent) = configuration.user_agent {
343        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
344    }
345    if let Some(ref apikey) = configuration.api_key {
346        let key = apikey.key.clone();
347        let value = match apikey.prefix {
348            Some(ref prefix) => format!("{} {}", prefix, key),
349            None => key,
350        };
351        req_builder = req_builder.header("X-Tapis-Token", value);
352    };
353
354    let req = req_builder.build()?;
355    let resp = configuration.client.execute(req).await?;
356
357    let status = resp.status();
358    let content_type = resp
359        .headers()
360        .get("content-type")
361        .and_then(|v| v.to_str().ok())
362        .unwrap_or("application/octet-stream");
363    let content_type = super::ContentType::from(content_type);
364
365    if !status.is_client_error() && !status.is_server_error() {
366        let content = resp.text().await?;
367        match content_type {
368            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
369            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
370            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
371        }
372    } else {
373        let content = resp.text().await?;
374        let entity: Option<DeleteAppError> = serde_json::from_str(&content).ok();
375        Err(Error::ResponseError(ResponseContent {
376            status,
377            content,
378            entity,
379        }))
380    }
381}
382
383/// Mark an application unavailable for use. Applies to all versions. Requester must be owner of the app or a tenant administrator.
384pub async fn disable_app(
385    configuration: &configuration::Configuration,
386    app_id: &str,
387) -> Result<models::RespChangeCount, Error<DisableAppError>> {
388    // add a prefix to parameters to efficiently prevent name collisions
389    let p_path_app_id = app_id;
390
391    let uri_str = format!(
392        "{}/v3/apps/{appId}/disable",
393        configuration.base_path,
394        appId = crate::apis::urlencode(p_path_app_id)
395    );
396    let mut req_builder = configuration
397        .client
398        .request(reqwest::Method::POST, &uri_str);
399
400    if let Some(ref user_agent) = configuration.user_agent {
401        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
402    }
403    if let Some(ref apikey) = configuration.api_key {
404        let key = apikey.key.clone();
405        let value = match apikey.prefix {
406            Some(ref prefix) => format!("{} {}", prefix, key),
407            None => key,
408        };
409        req_builder = req_builder.header("X-Tapis-Token", value);
410    };
411
412    let req = req_builder.build()?;
413    let resp = configuration.client.execute(req).await?;
414
415    let status = resp.status();
416    let content_type = resp
417        .headers()
418        .get("content-type")
419        .and_then(|v| v.to_str().ok())
420        .unwrap_or("application/octet-stream");
421    let content_type = super::ContentType::from(content_type);
422
423    if !status.is_client_error() && !status.is_server_error() {
424        let content = resp.text().await?;
425        match content_type {
426            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
427            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
428            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
429        }
430    } else {
431        let content = resp.text().await?;
432        let entity: Option<DisableAppError> = serde_json::from_str(&content).ok();
433        Err(Error::ResponseError(ResponseContent {
434            status,
435            content,
436            entity,
437        }))
438    }
439}
440
441/// Mark a specific version of an application unavailable for use. Requester must be owner of the app or a tenant administrator.
442pub async fn disable_app_version(
443    configuration: &configuration::Configuration,
444    app_id: &str,
445    app_version: &str,
446) -> Result<models::RespChangeCount, Error<DisableAppVersionError>> {
447    // add a prefix to parameters to efficiently prevent name collisions
448    let p_path_app_id = app_id;
449    let p_path_app_version = app_version;
450
451    let uri_str = format!(
452        "{}/v3/apps/{appId}/{appVersion}/disable",
453        configuration.base_path,
454        appId = crate::apis::urlencode(p_path_app_id),
455        appVersion = crate::apis::urlencode(p_path_app_version)
456    );
457    let mut req_builder = configuration
458        .client
459        .request(reqwest::Method::POST, &uri_str);
460
461    if let Some(ref user_agent) = configuration.user_agent {
462        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
463    }
464    if let Some(ref apikey) = configuration.api_key {
465        let key = apikey.key.clone();
466        let value = match apikey.prefix {
467            Some(ref prefix) => format!("{} {}", prefix, key),
468            None => key,
469        };
470        req_builder = req_builder.header("X-Tapis-Token", value);
471    };
472
473    let req = req_builder.build()?;
474    let resp = configuration.client.execute(req).await?;
475
476    let status = resp.status();
477    let content_type = resp
478        .headers()
479        .get("content-type")
480        .and_then(|v| v.to_str().ok())
481        .unwrap_or("application/octet-stream");
482    let content_type = super::ContentType::from(content_type);
483
484    if !status.is_client_error() && !status.is_server_error() {
485        let content = resp.text().await?;
486        match content_type {
487            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
488            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
489            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
490        }
491    } else {
492        let content = resp.text().await?;
493        let entity: Option<DisableAppVersionError> = serde_json::from_str(&content).ok();
494        Err(Error::ResponseError(ResponseContent {
495            status,
496            content,
497            entity,
498        }))
499    }
500}
501
502/// Mark an application available for use. Applies to all versions. Requester must be owner of the app or a tenant administrator.
503pub async fn enable_app(
504    configuration: &configuration::Configuration,
505    app_id: &str,
506) -> Result<models::RespChangeCount, Error<EnableAppError>> {
507    // add a prefix to parameters to efficiently prevent name collisions
508    let p_path_app_id = app_id;
509
510    let uri_str = format!(
511        "{}/v3/apps/{appId}/enable",
512        configuration.base_path,
513        appId = crate::apis::urlencode(p_path_app_id)
514    );
515    let mut req_builder = configuration
516        .client
517        .request(reqwest::Method::POST, &uri_str);
518
519    if let Some(ref user_agent) = configuration.user_agent {
520        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
521    }
522    if let Some(ref apikey) = configuration.api_key {
523        let key = apikey.key.clone();
524        let value = match apikey.prefix {
525            Some(ref prefix) => format!("{} {}", prefix, key),
526            None => key,
527        };
528        req_builder = req_builder.header("X-Tapis-Token", value);
529    };
530
531    let req = req_builder.build()?;
532    let resp = configuration.client.execute(req).await?;
533
534    let status = resp.status();
535    let content_type = resp
536        .headers()
537        .get("content-type")
538        .and_then(|v| v.to_str().ok())
539        .unwrap_or("application/octet-stream");
540    let content_type = super::ContentType::from(content_type);
541
542    if !status.is_client_error() && !status.is_server_error() {
543        let content = resp.text().await?;
544        match content_type {
545            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
546            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
547            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
548        }
549    } else {
550        let content = resp.text().await?;
551        let entity: Option<EnableAppError> = serde_json::from_str(&content).ok();
552        Err(Error::ResponseError(ResponseContent {
553            status,
554            content,
555            entity,
556        }))
557    }
558}
559
560/// Mark a specific version of an application available for use. Requester must be owner of the app or a tenant administrator.
561pub async fn enable_app_version(
562    configuration: &configuration::Configuration,
563    app_id: &str,
564    app_version: &str,
565) -> Result<models::RespChangeCount, Error<EnableAppVersionError>> {
566    // add a prefix to parameters to efficiently prevent name collisions
567    let p_path_app_id = app_id;
568    let p_path_app_version = app_version;
569
570    let uri_str = format!(
571        "{}/v3/apps/{appId}/{appVersion}/enable",
572        configuration.base_path,
573        appId = crate::apis::urlencode(p_path_app_id),
574        appVersion = crate::apis::urlencode(p_path_app_version)
575    );
576    let mut req_builder = configuration
577        .client
578        .request(reqwest::Method::POST, &uri_str);
579
580    if let Some(ref user_agent) = configuration.user_agent {
581        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
582    }
583    if let Some(ref apikey) = configuration.api_key {
584        let key = apikey.key.clone();
585        let value = match apikey.prefix {
586            Some(ref prefix) => format!("{} {}", prefix, key),
587            None => key,
588        };
589        req_builder = req_builder.header("X-Tapis-Token", value);
590    };
591
592    let req = req_builder.build()?;
593    let resp = configuration.client.execute(req).await?;
594
595    let status = resp.status();
596    let content_type = resp
597        .headers()
598        .get("content-type")
599        .and_then(|v| v.to_str().ok())
600        .unwrap_or("application/octet-stream");
601    let content_type = super::ContentType::from(content_type);
602
603    if !status.is_client_error() && !status.is_server_error() {
604        let content = resp.text().await?;
605        match content_type {
606            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
607            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
608            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
609        }
610    } else {
611        let content = resp.text().await?;
612        let entity: Option<EnableAppVersionError> = serde_json::from_str(&content).ok();
613        Err(Error::ResponseError(ResponseContent {
614            status,
615            content,
616            entity,
617        }))
618    }
619}
620
621/// Retrieve information for an application given the application Id and version. In the result the attribute *sharedAppCtx* indicates if the application is available to the user because it has been shared with the user. The value of *sharedAppCtx* will be the grantor, the Tapis user who shared the application.  Certain Tapis services or a tenant administrator may use the query parameter *impersonationId* to be used in place of the requesting Tapis user. Tapis will use this user Id when performing authorization.
622pub async fn get_app(
623    configuration: &configuration::Configuration,
624    app_id: &str,
625    app_version: &str,
626    require_exec_perm: Option<bool>,
627    impersonation_id: Option<&str>,
628    select: Option<&str>,
629    resource_tenant: Option<&str>,
630) -> Result<models::RespApp, Error<GetAppError>> {
631    // add a prefix to parameters to efficiently prevent name collisions
632    let p_path_app_id = app_id;
633    let p_path_app_version = app_version;
634    let p_query_require_exec_perm = require_exec_perm;
635    let p_query_impersonation_id = impersonation_id;
636    let p_query_select = select;
637    let p_query_resource_tenant = resource_tenant;
638
639    let uri_str = format!(
640        "{}/v3/apps/{appId}/{appVersion}",
641        configuration.base_path,
642        appId = crate::apis::urlencode(p_path_app_id),
643        appVersion = crate::apis::urlencode(p_path_app_version)
644    );
645    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
646
647    if let Some(ref param_value) = p_query_require_exec_perm {
648        req_builder = req_builder.query(&[("requireExecPerm", &param_value.to_string())]);
649    }
650    if let Some(ref param_value) = p_query_impersonation_id {
651        req_builder = req_builder.query(&[("impersonationId", &param_value.to_string())]);
652    }
653    if let Some(ref param_value) = p_query_select {
654        req_builder = req_builder.query(&[("select", &param_value.to_string())]);
655    }
656    if let Some(ref param_value) = p_query_resource_tenant {
657        req_builder = req_builder.query(&[("resourceTenant", &param_value.to_string())]);
658    }
659    if let Some(ref user_agent) = configuration.user_agent {
660        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
661    }
662    if let Some(ref apikey) = configuration.api_key {
663        let key = apikey.key.clone();
664        let value = match apikey.prefix {
665            Some(ref prefix) => format!("{} {}", prefix, key),
666            None => key,
667        };
668        req_builder = req_builder.header("X-Tapis-Token", value);
669    };
670
671    let req = req_builder.build()?;
672    let resp = configuration.client.execute(req).await?;
673
674    let status = resp.status();
675    let content_type = resp
676        .headers()
677        .get("content-type")
678        .and_then(|v| v.to_str().ok())
679        .unwrap_or("application/octet-stream");
680    let content_type = super::ContentType::from(content_type);
681
682    if !status.is_client_error() && !status.is_server_error() {
683        let content = resp.text().await?;
684        match content_type {
685            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
686            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespApp`"))),
687            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespApp`")))),
688        }
689    } else {
690        let content = resp.text().await?;
691        let entity: Option<GetAppError> = serde_json::from_str(&content).ok();
692        Err(Error::ResponseError(ResponseContent {
693            status,
694            content,
695            entity,
696        }))
697    }
698}
699
700/// Retrieve latest version of an application. In the result the attribute *sharedAppCtx* indicates if the application is available to the user because it has been shared with the user. The value of *sharedAppCtx* will be the grantor, the Tapis user who shared the application.  Certain Tapis services or a tenant administrator may use the query parameter *impersonationId* to be used in place of the requesting Tapis user. Tapis will use this user Id when performing authorization.
701pub async fn get_app_latest_version(
702    configuration: &configuration::Configuration,
703    app_id: &str,
704    require_exec_perm: Option<bool>,
705    select: Option<&str>,
706    resource_tenant: Option<&str>,
707    impersonation_id: Option<&str>,
708) -> Result<models::RespApp, Error<GetAppLatestVersionError>> {
709    // add a prefix to parameters to efficiently prevent name collisions
710    let p_path_app_id = app_id;
711    let p_query_require_exec_perm = require_exec_perm;
712    let p_query_select = select;
713    let p_query_resource_tenant = resource_tenant;
714    let p_query_impersonation_id = impersonation_id;
715
716    let uri_str = format!(
717        "{}/v3/apps/{appId}",
718        configuration.base_path,
719        appId = crate::apis::urlencode(p_path_app_id)
720    );
721    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
722
723    if let Some(ref param_value) = p_query_require_exec_perm {
724        req_builder = req_builder.query(&[("requireExecPerm", &param_value.to_string())]);
725    }
726    if let Some(ref param_value) = p_query_select {
727        req_builder = req_builder.query(&[("select", &param_value.to_string())]);
728    }
729    if let Some(ref param_value) = p_query_resource_tenant {
730        req_builder = req_builder.query(&[("resourceTenant", &param_value.to_string())]);
731    }
732    if let Some(ref param_value) = p_query_impersonation_id {
733        req_builder = req_builder.query(&[("impersonationId", &param_value.to_string())]);
734    }
735    if let Some(ref user_agent) = configuration.user_agent {
736        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
737    }
738    if let Some(ref apikey) = configuration.api_key {
739        let key = apikey.key.clone();
740        let value = match apikey.prefix {
741            Some(ref prefix) => format!("{} {}", prefix, key),
742            None => key,
743        };
744        req_builder = req_builder.header("X-Tapis-Token", value);
745    };
746
747    let req = req_builder.build()?;
748    let resp = configuration.client.execute(req).await?;
749
750    let status = resp.status();
751    let content_type = resp
752        .headers()
753        .get("content-type")
754        .and_then(|v| v.to_str().ok())
755        .unwrap_or("application/octet-stream");
756    let content_type = super::ContentType::from(content_type);
757
758    if !status.is_client_error() && !status.is_server_error() {
759        let content = resp.text().await?;
760        match content_type {
761            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
762            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespApp`"))),
763            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespApp`")))),
764        }
765    } else {
766        let content = resp.text().await?;
767        let entity: Option<GetAppLatestVersionError> = serde_json::from_str(&content).ok();
768        Err(Error::ResponseError(ResponseContent {
769            status,
770            content,
771            entity,
772        }))
773    }
774}
775
776/// Retrieve list of applications.  Use *listType*, *search* and *select* query parameters to limit results. Query parameter *listType* allows for filtering results based on authorization. Options for *listType* are    - *OWNED* Include only items owned by requester (Default)   - *SHARED_PUBLIC* Include only items shared publicly   - *SHARED_DIRECT* Include only items shared directly with requester. Exclude publicly shared items.   - *READ_PERM* Include only items for which requester was granter READ or MODIFY permission.   - *MINE* Include items owned or shared directly with requester. Exclude publicly shared items.   - *ALL* Include all items requester is authorized to view. Includes check for READ or MODIFY permission.  Certain Tapis services or a tenant administrator may use the query parameter *impersonationId* to be used in place of the requesting Tapis user. Tapis will use this user Id when performing authorization.
777pub async fn get_apps(
778    configuration: &configuration::Configuration,
779    search: Option<&str>,
780    list_type: Option<models::ListTypeEnum>,
781    limit: Option<i32>,
782    order_by: Option<&str>,
783    skip: Option<i32>,
784    start_after: Option<&str>,
785    compute_total: Option<bool>,
786    select: Option<&str>,
787    show_deleted: Option<bool>,
788    impersonation_id: Option<&str>,
789) -> Result<models::RespApps, Error<GetAppsError>> {
790    // add a prefix to parameters to efficiently prevent name collisions
791    let p_query_search = search;
792    let p_query_list_type = list_type;
793    let p_query_limit = limit;
794    let p_query_order_by = order_by;
795    let p_query_skip = skip;
796    let p_query_start_after = start_after;
797    let p_query_compute_total = compute_total;
798    let p_query_select = select;
799    let p_query_show_deleted = show_deleted;
800    let p_query_impersonation_id = impersonation_id;
801
802    let uri_str = format!("{}/v3/apps", configuration.base_path);
803    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
804
805    if let Some(ref param_value) = p_query_search {
806        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
807    }
808    if let Some(ref param_value) = p_query_list_type {
809        req_builder = req_builder.query(&[("listType", &serde_json::to_string(param_value)?)]);
810    }
811    if let Some(ref param_value) = p_query_limit {
812        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
813    }
814    if let Some(ref param_value) = p_query_order_by {
815        req_builder = req_builder.query(&[("orderBy", &param_value.to_string())]);
816    }
817    if let Some(ref param_value) = p_query_skip {
818        req_builder = req_builder.query(&[("skip", &param_value.to_string())]);
819    }
820    if let Some(ref param_value) = p_query_start_after {
821        req_builder = req_builder.query(&[("startAfter", &param_value.to_string())]);
822    }
823    if let Some(ref param_value) = p_query_compute_total {
824        req_builder = req_builder.query(&[("computeTotal", &param_value.to_string())]);
825    }
826    if let Some(ref param_value) = p_query_select {
827        req_builder = req_builder.query(&[("select", &param_value.to_string())]);
828    }
829    if let Some(ref param_value) = p_query_show_deleted {
830        req_builder = req_builder.query(&[("showDeleted", &param_value.to_string())]);
831    }
832    if let Some(ref param_value) = p_query_impersonation_id {
833        req_builder = req_builder.query(&[("impersonationId", &param_value.to_string())]);
834    }
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 apikey) = configuration.api_key {
839        let key = apikey.key.clone();
840        let value = match apikey.prefix {
841            Some(ref prefix) => format!("{} {}", prefix, key),
842            None => key,
843        };
844        req_builder = req_builder.header("X-Tapis-Token", value);
845    };
846
847    let req = req_builder.build()?;
848    let resp = configuration.client.execute(req).await?;
849
850    let status = resp.status();
851    let content_type = resp
852        .headers()
853        .get("content-type")
854        .and_then(|v| v.to_str().ok())
855        .unwrap_or("application/octet-stream");
856    let content_type = super::ContentType::from(content_type);
857
858    if !status.is_client_error() && !status.is_server_error() {
859        let content = resp.text().await?;
860        match content_type {
861            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
862            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespApps`"))),
863            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespApps`")))),
864        }
865    } else {
866        let content = resp.text().await?;
867        let entity: Option<GetAppsError> = serde_json::from_str(&content).ok();
868        Err(Error::ResponseError(ResponseContent {
869            status,
870            content,
871            entity,
872        }))
873    }
874}
875
876/// Retrieve history of changes for a given appId.
877pub async fn get_history(
878    configuration: &configuration::Configuration,
879    app_id: &str,
880) -> Result<models::RespAppHistory, Error<GetHistoryError>> {
881    // add a prefix to parameters to efficiently prevent name collisions
882    let p_path_app_id = app_id;
883
884    let uri_str = format!(
885        "{}/v3/apps/{appId}/history",
886        configuration.base_path,
887        appId = crate::apis::urlencode(p_path_app_id)
888    );
889    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
890
891    if let Some(ref user_agent) = configuration.user_agent {
892        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
893    }
894    if let Some(ref apikey) = configuration.api_key {
895        let key = apikey.key.clone();
896        let value = match apikey.prefix {
897            Some(ref prefix) => format!("{} {}", prefix, key),
898            None => key,
899        };
900        req_builder = req_builder.header("X-Tapis-Token", value);
901    };
902
903    let req = req_builder.build()?;
904    let resp = configuration.client.execute(req).await?;
905
906    let status = resp.status();
907    let content_type = resp
908        .headers()
909        .get("content-type")
910        .and_then(|v| v.to_str().ok())
911        .unwrap_or("application/octet-stream");
912    let content_type = super::ContentType::from(content_type);
913
914    if !status.is_client_error() && !status.is_server_error() {
915        let content = resp.text().await?;
916        match content_type {
917            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
918            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespAppHistory`"))),
919            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespAppHistory`")))),
920        }
921    } else {
922        let content = resp.text().await?;
923        let entity: Option<GetHistoryError> = serde_json::from_str(&content).ok();
924        Err(Error::ResponseError(ResponseContent {
925            status,
926            content,
927            entity,
928        }))
929    }
930}
931
932/// Check if an application is currently enabled, i.e. available for use. If the query parameter *version* is specified then both the top level attribute *enabled* and the version specific attribute *versionEnabled* are checked. Both must be set to *true* for the application to be considered *enabled*.
933pub async fn is_enabled(
934    configuration: &configuration::Configuration,
935    app_id: &str,
936    version: Option<&str>,
937) -> Result<models::RespBoolean, Error<IsEnabledError>> {
938    // add a prefix to parameters to efficiently prevent name collisions
939    let p_path_app_id = app_id;
940    let p_query_version = version;
941
942    let uri_str = format!(
943        "{}/v3/apps/{appId}/isEnabled",
944        configuration.base_path,
945        appId = crate::apis::urlencode(p_path_app_id)
946    );
947    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
948
949    if let Some(ref param_value) = p_query_version {
950        req_builder = req_builder.query(&[("version", &param_value.to_string())]);
951    }
952    if let Some(ref user_agent) = configuration.user_agent {
953        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
954    }
955    if let Some(ref apikey) = configuration.api_key {
956        let key = apikey.key.clone();
957        let value = match apikey.prefix {
958            Some(ref prefix) => format!("{} {}", prefix, key),
959            None => key,
960        };
961        req_builder = req_builder.header("X-Tapis-Token", value);
962    };
963
964    let req = req_builder.build()?;
965    let resp = configuration.client.execute(req).await?;
966
967    let status = resp.status();
968    let content_type = resp
969        .headers()
970        .get("content-type")
971        .and_then(|v| v.to_str().ok())
972        .unwrap_or("application/octet-stream");
973    let content_type = super::ContentType::from(content_type);
974
975    if !status.is_client_error() && !status.is_server_error() {
976        let content = resp.text().await?;
977        match content_type {
978            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
979            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespBoolean`"))),
980            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespBoolean`")))),
981        }
982    } else {
983        let content = resp.text().await?;
984        let entity: Option<IsEnabledError> = serde_json::from_str(&content).ok();
985        Err(Error::ResponseError(ResponseContent {
986            status,
987            content,
988            entity,
989        }))
990    }
991}
992
993/// Lock a version of an application to prevent updates via PUT or PATCH. Requester must be owner of the app or a tenant administrator.
994pub async fn lock_app(
995    configuration: &configuration::Configuration,
996    app_id: &str,
997    app_version: &str,
998) -> Result<models::RespChangeCount, Error<LockAppError>> {
999    // add a prefix to parameters to efficiently prevent name collisions
1000    let p_path_app_id = app_id;
1001    let p_path_app_version = app_version;
1002
1003    let uri_str = format!(
1004        "{}/v3/apps/{appId}/{appVersion}/lock",
1005        configuration.base_path,
1006        appId = crate::apis::urlencode(p_path_app_id),
1007        appVersion = crate::apis::urlencode(p_path_app_version)
1008    );
1009    let mut req_builder = configuration
1010        .client
1011        .request(reqwest::Method::POST, &uri_str);
1012
1013    if let Some(ref user_agent) = configuration.user_agent {
1014        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1015    }
1016    if let Some(ref apikey) = configuration.api_key {
1017        let key = apikey.key.clone();
1018        let value = match apikey.prefix {
1019            Some(ref prefix) => format!("{} {}", prefix, key),
1020            None => key,
1021        };
1022        req_builder = req_builder.header("X-Tapis-Token", value);
1023    };
1024
1025    let req = req_builder.build()?;
1026    let resp = configuration.client.execute(req).await?;
1027
1028    let status = resp.status();
1029    let content_type = resp
1030        .headers()
1031        .get("content-type")
1032        .and_then(|v| v.to_str().ok())
1033        .unwrap_or("application/octet-stream");
1034    let content_type = super::ContentType::from(content_type);
1035
1036    if !status.is_client_error() && !status.is_server_error() {
1037        let content = resp.text().await?;
1038        match content_type {
1039            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1040            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
1041            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
1042        }
1043    } else {
1044        let content = resp.text().await?;
1045        let entity: Option<LockAppError> = serde_json::from_str(&content).ok();
1046        Err(Error::ResponseError(ResponseContent {
1047            status,
1048            content,
1049            entity,
1050        }))
1051    }
1052}
1053
1054/// Update selected attributes of an existing version of an application. Request body may only contain updatable attributes. Application must exist.  Attributes that may not be updated via PATCH are    - id   - owner   - enabled   - versionEnabled   - locked   - deleted  Note that the attributes owner, enabled, versionEnabled, locked and deleted may be modified using other endpoints.
1055pub async fn patch_app(
1056    configuration: &configuration::Configuration,
1057    app_id: &str,
1058    app_version: &str,
1059    req_patch_app: models::ReqPatchApp,
1060) -> Result<models::RespResourceUrl, Error<PatchAppError>> {
1061    // add a prefix to parameters to efficiently prevent name collisions
1062    let p_path_app_id = app_id;
1063    let p_path_app_version = app_version;
1064    let p_body_req_patch_app = req_patch_app;
1065
1066    let uri_str = format!(
1067        "{}/v3/apps/{appId}/{appVersion}",
1068        configuration.base_path,
1069        appId = crate::apis::urlencode(p_path_app_id),
1070        appVersion = crate::apis::urlencode(p_path_app_version)
1071    );
1072    let mut req_builder = configuration
1073        .client
1074        .request(reqwest::Method::PATCH, &uri_str);
1075
1076    if let Some(ref user_agent) = configuration.user_agent {
1077        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1078    }
1079    if let Some(ref apikey) = configuration.api_key {
1080        let key = apikey.key.clone();
1081        let value = match apikey.prefix {
1082            Some(ref prefix) => format!("{} {}", prefix, key),
1083            None => key,
1084        };
1085        req_builder = req_builder.header("X-Tapis-Token", value);
1086    };
1087    req_builder = req_builder.json(&p_body_req_patch_app);
1088
1089    let req = req_builder.build()?;
1090    let resp = configuration.client.execute(req).await?;
1091
1092    let status = resp.status();
1093    let content_type = resp
1094        .headers()
1095        .get("content-type")
1096        .and_then(|v| v.to_str().ok())
1097        .unwrap_or("application/octet-stream");
1098    let content_type = super::ContentType::from(content_type);
1099
1100    if !status.is_client_error() && !status.is_server_error() {
1101        let content = resp.text().await?;
1102        match content_type {
1103            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1104            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespResourceUrl`"))),
1105            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespResourceUrl`")))),
1106        }
1107    } else {
1108        let content = resp.text().await?;
1109        let entity: Option<PatchAppError> = serde_json::from_str(&content).ok();
1110        Err(Error::ResponseError(ResponseContent {
1111            status,
1112            content,
1113            entity,
1114        }))
1115    }
1116}
1117
1118/// Update all updatable attributes of an application using a request body identical to POST. Application must exist.  Note that certain attributes (such as tenant) are allowed but ignored so that the JSON result returned by a GET may be modified and used when making a PUT request to update.  The attributes that are allowed but ignored for both PUT and POST are    - tenant   - uuid   - isPublic   - sharedWithUsers   - sharedAppCtx   - deleted   - created   - updated  In addition, for a PUT operation, the following non-updatable attributes are allowed but ignored    - id   - version   - owner   - enabled   - versionEnabled   - locked  Note that the attributes owner, enabled, versionEnabled, locked and deleted may be modified using other endpoints.
1119pub async fn put_app(
1120    configuration: &configuration::Configuration,
1121    app_id: &str,
1122    app_version: &str,
1123    req_put_app: models::ReqPutApp,
1124) -> Result<models::RespResourceUrl, Error<PutAppError>> {
1125    // add a prefix to parameters to efficiently prevent name collisions
1126    let p_path_app_id = app_id;
1127    let p_path_app_version = app_version;
1128    let p_body_req_put_app = req_put_app;
1129
1130    let uri_str = format!(
1131        "{}/v3/apps/{appId}/{appVersion}",
1132        configuration.base_path,
1133        appId = crate::apis::urlencode(p_path_app_id),
1134        appVersion = crate::apis::urlencode(p_path_app_version)
1135    );
1136    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1137
1138    if let Some(ref user_agent) = configuration.user_agent {
1139        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1140    }
1141    if let Some(ref apikey) = configuration.api_key {
1142        let key = apikey.key.clone();
1143        let value = match apikey.prefix {
1144            Some(ref prefix) => format!("{} {}", prefix, key),
1145            None => key,
1146        };
1147        req_builder = req_builder.header("X-Tapis-Token", value);
1148    };
1149    req_builder = req_builder.json(&p_body_req_put_app);
1150
1151    let req = req_builder.build()?;
1152    let resp = configuration.client.execute(req).await?;
1153
1154    let status = resp.status();
1155    let content_type = resp
1156        .headers()
1157        .get("content-type")
1158        .and_then(|v| v.to_str().ok())
1159        .unwrap_or("application/octet-stream");
1160    let content_type = super::ContentType::from(content_type);
1161
1162    if !status.is_client_error() && !status.is_server_error() {
1163        let content = resp.text().await?;
1164        match content_type {
1165            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1166            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespResourceUrl`"))),
1167            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespResourceUrl`")))),
1168        }
1169    } else {
1170        let content = resp.text().await?;
1171        let entity: Option<PutAppError> = serde_json::from_str(&content).ok();
1172        Err(Error::ResponseError(ResponseContent {
1173            status,
1174            content,
1175            entity,
1176        }))
1177    }
1178}
1179
1180/// Retrieve details for applications. Use query parameters to specify search conditions. For example ?owner.eq=jdoe&enabled.eq=false Use *listType* and *select* query parameters to limit results. Query parameter *listType* allows for filtering results based on authorization. Options for *listType* are    - *OWNED* Include only items owned by requester (Default)   - *SHARED_PUBLIC* Include only items shared publicly   - *SHARED_DIRECT* Include only items shared directly with requester. Exclude publicly shared items.   - *READ_PERM* Include only items for which requester was granter READ or MODIFY permission.   - *MINE* Include items owned or shared directly with requester. Exclude publicly shared items.   - *ALL* Include all items requester is authorized to view. Includes check for READ or MODIFY permission.
1181pub async fn search_apps_query_parameters(
1182    configuration: &configuration::Configuration,
1183    list_type: Option<models::ListTypeEnum>,
1184    limit: Option<i32>,
1185    order_by: Option<&str>,
1186    skip: Option<i32>,
1187    start_after: Option<&str>,
1188    compute_total: Option<bool>,
1189    select: Option<&str>,
1190) -> Result<models::RespApps, Error<SearchAppsQueryParametersError>> {
1191    // add a prefix to parameters to efficiently prevent name collisions
1192    let p_query_list_type = list_type;
1193    let p_query_limit = limit;
1194    let p_query_order_by = order_by;
1195    let p_query_skip = skip;
1196    let p_query_start_after = start_after;
1197    let p_query_compute_total = compute_total;
1198    let p_query_select = select;
1199
1200    let uri_str = format!("{}/v3/apps/search", configuration.base_path);
1201    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1202
1203    if let Some(ref param_value) = p_query_list_type {
1204        req_builder = req_builder.query(&[("listType", &serde_json::to_string(param_value)?)]);
1205    }
1206    if let Some(ref param_value) = p_query_limit {
1207        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1208    }
1209    if let Some(ref param_value) = p_query_order_by {
1210        req_builder = req_builder.query(&[("orderBy", &param_value.to_string())]);
1211    }
1212    if let Some(ref param_value) = p_query_skip {
1213        req_builder = req_builder.query(&[("skip", &param_value.to_string())]);
1214    }
1215    if let Some(ref param_value) = p_query_start_after {
1216        req_builder = req_builder.query(&[("startAfter", &param_value.to_string())]);
1217    }
1218    if let Some(ref param_value) = p_query_compute_total {
1219        req_builder = req_builder.query(&[("computeTotal", &param_value.to_string())]);
1220    }
1221    if let Some(ref param_value) = p_query_select {
1222        req_builder = req_builder.query(&[("select", &param_value.to_string())]);
1223    }
1224    if let Some(ref user_agent) = configuration.user_agent {
1225        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1226    }
1227    if let Some(ref apikey) = configuration.api_key {
1228        let key = apikey.key.clone();
1229        let value = match apikey.prefix {
1230            Some(ref prefix) => format!("{} {}", prefix, key),
1231            None => key,
1232        };
1233        req_builder = req_builder.header("X-Tapis-Token", value);
1234    };
1235
1236    let req = req_builder.build()?;
1237    let resp = configuration.client.execute(req).await?;
1238
1239    let status = resp.status();
1240    let content_type = resp
1241        .headers()
1242        .get("content-type")
1243        .and_then(|v| v.to_str().ok())
1244        .unwrap_or("application/octet-stream");
1245    let content_type = super::ContentType::from(content_type);
1246
1247    if !status.is_client_error() && !status.is_server_error() {
1248        let content = resp.text().await?;
1249        match content_type {
1250            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1251            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespApps`"))),
1252            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespApps`")))),
1253        }
1254    } else {
1255        let content = resp.text().await?;
1256        let entity: Option<SearchAppsQueryParametersError> = serde_json::from_str(&content).ok();
1257        Err(Error::ResponseError(ResponseContent {
1258            status,
1259            content,
1260            entity,
1261        }))
1262    }
1263}
1264
1265/// Retrieve details for applications. Use request body to specify SQL-like search conditions. Use *listType* and *select* query parameters to limit results. Query parameter *listType* allows for filtering results based on authorization. Options for *listType* are    - *OWNED* Include only items owned by requester (Default)   - *SHARED_PUBLIC* Include only items shared publicly   - *SHARED_DIRECT* Include only items shared directly with requester. Exclude publicly shared items.   - *READ_PERM* Include only items for which requester was granter READ or MODIFY permission.   - *MINE* Include items owned or shared directly with requester. Exclude publicly shared items.   - *ALL* Include all items requester is authorized to view. Includes check for READ or MODIFY permission.
1266pub async fn search_apps_request_body(
1267    configuration: &configuration::Configuration,
1268    req_search_apps: models::ReqSearchApps,
1269    list_type: Option<models::ListTypeEnum>,
1270    limit: Option<i32>,
1271    order_by: Option<&str>,
1272    skip: Option<i32>,
1273    start_after: Option<&str>,
1274    compute_total: Option<bool>,
1275    select: Option<&str>,
1276) -> Result<models::RespApps, Error<SearchAppsRequestBodyError>> {
1277    // add a prefix to parameters to efficiently prevent name collisions
1278    let p_body_req_search_apps = req_search_apps;
1279    let p_query_list_type = list_type;
1280    let p_query_limit = limit;
1281    let p_query_order_by = order_by;
1282    let p_query_skip = skip;
1283    let p_query_start_after = start_after;
1284    let p_query_compute_total = compute_total;
1285    let p_query_select = select;
1286
1287    let uri_str = format!("{}/v3/apps/search", configuration.base_path);
1288    let mut req_builder = configuration
1289        .client
1290        .request(reqwest::Method::POST, &uri_str);
1291
1292    if let Some(ref param_value) = p_query_list_type {
1293        req_builder = req_builder.query(&[("listType", &serde_json::to_string(param_value)?)]);
1294    }
1295    if let Some(ref param_value) = p_query_limit {
1296        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1297    }
1298    if let Some(ref param_value) = p_query_order_by {
1299        req_builder = req_builder.query(&[("orderBy", &param_value.to_string())]);
1300    }
1301    if let Some(ref param_value) = p_query_skip {
1302        req_builder = req_builder.query(&[("skip", &param_value.to_string())]);
1303    }
1304    if let Some(ref param_value) = p_query_start_after {
1305        req_builder = req_builder.query(&[("startAfter", &param_value.to_string())]);
1306    }
1307    if let Some(ref param_value) = p_query_compute_total {
1308        req_builder = req_builder.query(&[("computeTotal", &param_value.to_string())]);
1309    }
1310    if let Some(ref param_value) = p_query_select {
1311        req_builder = req_builder.query(&[("select", &param_value.to_string())]);
1312    }
1313    if let Some(ref user_agent) = configuration.user_agent {
1314        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1315    }
1316    if let Some(ref apikey) = configuration.api_key {
1317        let key = apikey.key.clone();
1318        let value = match apikey.prefix {
1319            Some(ref prefix) => format!("{} {}", prefix, key),
1320            None => key,
1321        };
1322        req_builder = req_builder.header("X-Tapis-Token", value);
1323    };
1324    req_builder = req_builder.json(&p_body_req_search_apps);
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("Received `text/plain` content type response that cannot be converted to `models::RespApps`"))),
1342            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespApps`")))),
1343        }
1344    } else {
1345        let content = resp.text().await?;
1346        let entity: Option<SearchAppsRequestBodyError> = serde_json::from_str(&content).ok();
1347        Err(Error::ResponseError(ResponseContent {
1348            status,
1349            content,
1350            entity,
1351        }))
1352    }
1353}
1354
1355/// Mark an application as not deleted. Application will appear in queries.
1356pub async fn undelete_app(
1357    configuration: &configuration::Configuration,
1358    app_id: &str,
1359) -> Result<models::RespChangeCount, Error<UndeleteAppError>> {
1360    // add a prefix to parameters to efficiently prevent name collisions
1361    let p_path_app_id = app_id;
1362
1363    let uri_str = format!(
1364        "{}/v3/apps/{appId}/undelete",
1365        configuration.base_path,
1366        appId = crate::apis::urlencode(p_path_app_id)
1367    );
1368    let mut req_builder = configuration
1369        .client
1370        .request(reqwest::Method::POST, &uri_str);
1371
1372    if let Some(ref user_agent) = configuration.user_agent {
1373        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1374    }
1375    if let Some(ref apikey) = configuration.api_key {
1376        let key = apikey.key.clone();
1377        let value = match apikey.prefix {
1378            Some(ref prefix) => format!("{} {}", prefix, key),
1379            None => key,
1380        };
1381        req_builder = req_builder.header("X-Tapis-Token", value);
1382    };
1383
1384    let req = req_builder.build()?;
1385    let resp = configuration.client.execute(req).await?;
1386
1387    let status = resp.status();
1388    let content_type = resp
1389        .headers()
1390        .get("content-type")
1391        .and_then(|v| v.to_str().ok())
1392        .unwrap_or("application/octet-stream");
1393    let content_type = super::ContentType::from(content_type);
1394
1395    if !status.is_client_error() && !status.is_server_error() {
1396        let content = resp.text().await?;
1397        match content_type {
1398            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1399            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
1400            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
1401        }
1402    } else {
1403        let content = resp.text().await?;
1404        let entity: Option<UndeleteAppError> = serde_json::from_str(&content).ok();
1405        Err(Error::ResponseError(ResponseContent {
1406            status,
1407            content,
1408            entity,
1409        }))
1410    }
1411}
1412
1413/// Unlock a version of an application to allow updates via PUT and PATCH. Requester must be owner of the app or a tenant administrator.
1414pub async fn unlock_app(
1415    configuration: &configuration::Configuration,
1416    app_id: &str,
1417    app_version: &str,
1418) -> Result<models::RespChangeCount, Error<UnlockAppError>> {
1419    // add a prefix to parameters to efficiently prevent name collisions
1420    let p_path_app_id = app_id;
1421    let p_path_app_version = app_version;
1422
1423    let uri_str = format!(
1424        "{}/v3/apps/{appId}/{appVersion}/unlock",
1425        configuration.base_path,
1426        appId = crate::apis::urlencode(p_path_app_id),
1427        appVersion = crate::apis::urlencode(p_path_app_version)
1428    );
1429    let mut req_builder = configuration
1430        .client
1431        .request(reqwest::Method::POST, &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 apikey) = configuration.api_key {
1437        let key = apikey.key.clone();
1438        let value = match apikey.prefix {
1439            Some(ref prefix) => format!("{} {}", prefix, key),
1440            None => key,
1441        };
1442        req_builder = req_builder.header("X-Tapis-Token", value);
1443    };
1444
1445    let req = req_builder.build()?;
1446    let resp = configuration.client.execute(req).await?;
1447
1448    let status = resp.status();
1449    let content_type = resp
1450        .headers()
1451        .get("content-type")
1452        .and_then(|v| v.to_str().ok())
1453        .unwrap_or("application/octet-stream");
1454    let content_type = super::ContentType::from(content_type);
1455
1456    if !status.is_client_error() && !status.is_server_error() {
1457        let content = resp.text().await?;
1458        match content_type {
1459            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1460            ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RespChangeCount`"))),
1461            ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RespChangeCount`")))),
1462        }
1463    } else {
1464        let content = resp.text().await?;
1465        let entity: Option<UnlockAppError> = serde_json::from_str(&content).ok();
1466        Err(Error::ResponseError(ResponseContent {
1467            status,
1468            content,
1469            entity,
1470        }))
1471    }
1472}