Skip to main content

windmill_api/apis/
app_api.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.725.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`create_app`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateAppError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`custom_path_exists`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CustomPathExistsError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`delete_app`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteAppError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`delete_s3_file_from_app`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteS3FileFromAppError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`execute_component`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ExecuteComponentError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`exists_app`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ExistsAppError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_app_by_path`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetAppByPathError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_app_by_version`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetAppByVersionError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_app_history_by_path`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetAppHistoryByPathError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_app_latest_version`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetAppLatestVersionError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_app_lite_by_path`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetAppLiteByPathError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_hub_app_by_id`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetHubAppByIdError {
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`get_hub_raw_app_by_id`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetHubRawAppByIdError {
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`get_public_app_by_custom_path`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetPublicAppByCustomPathError {
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`get_public_app_by_secret`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetPublicAppBySecretError {
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`get_public_resource`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetPublicResourceError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`get_public_secret_of_app`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetPublicSecretOfAppError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`get_public_secret_of_latest_version_of_app`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetPublicSecretOfLatestVersionOfAppError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`get_raw_app_data`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetRawAppDataError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`list_app_paths_from_workspace_runnable`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum ListAppPathsFromWorkspaceRunnableError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`list_apps`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ListAppsError {
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`list_hub_apps`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum ListHubAppsError {
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`list_search_app`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ListSearchAppError {
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`sign_s3_objects`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum SignS3ObjectsError {
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`update_app`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum UpdateAppError {
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`update_app_history`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum UpdateAppHistoryError {
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`upload_s3_file_from_app`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum UploadS3FileFromAppError {
204    UnknownValue(serde_json::Value),
205}
206
207
208pub async fn create_app(configuration: &configuration::Configuration, workspace: &str, create_app_request: models::CreateAppRequest) -> Result<String, Error<CreateAppError>> {
209    let local_var_configuration = configuration;
210
211    let local_var_client = &local_var_configuration.client;
212
213    let local_var_uri_str = format!("{}/w/{workspace}/apps/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
214    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
215
216    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
217        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
218    }
219    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
220        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
221    };
222    local_var_req_builder = local_var_req_builder.json(&create_app_request);
223
224    let local_var_req = local_var_req_builder.build()?;
225    let local_var_resp = local_var_client.execute(local_var_req).await?;
226
227    let local_var_status = local_var_resp.status();
228    let local_var_content = local_var_resp.text().await?;
229
230    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
231        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
232    } else {
233        let local_var_entity: Option<CreateAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
234        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
235        Err(Error::ResponseError(local_var_error))
236    }
237}
238
239pub async fn custom_path_exists(configuration: &configuration::Configuration, workspace: &str, custom_path: &str) -> Result<bool, Error<CustomPathExistsError>> {
240    let local_var_configuration = configuration;
241
242    let local_var_client = &local_var_configuration.client;
243
244    let local_var_uri_str = format!("{}/w/{workspace}/apps/custom_path_exists/{custom_path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), custom_path=crate::apis::urlencode(custom_path));
245    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
246
247    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
248        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
249    }
250    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
251        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
252    };
253
254    let local_var_req = local_var_req_builder.build()?;
255    let local_var_resp = local_var_client.execute(local_var_req).await?;
256
257    let local_var_status = local_var_resp.status();
258    let local_var_content = local_var_resp.text().await?;
259
260    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
261        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
262    } else {
263        let local_var_entity: Option<CustomPathExistsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
264        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
265        Err(Error::ResponseError(local_var_error))
266    }
267}
268
269pub async fn delete_app(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteAppError>> {
270    let local_var_configuration = configuration;
271
272    let local_var_client = &local_var_configuration.client;
273
274    let local_var_uri_str = format!("{}/w/{workspace}/apps/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
275    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
276
277    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
278        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
279    }
280    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
281        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
282    };
283
284    let local_var_req = local_var_req_builder.build()?;
285    let local_var_resp = local_var_client.execute(local_var_req).await?;
286
287    let local_var_status = local_var_resp.status();
288    let local_var_content = local_var_resp.text().await?;
289
290    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
291        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
292    } else {
293        let local_var_entity: Option<DeleteAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
294        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
295        Err(Error::ResponseError(local_var_error))
296    }
297}
298
299pub async fn delete_s3_file_from_app(configuration: &configuration::Configuration, workspace: &str, delete_token: &str) -> Result<String, Error<DeleteS3FileFromAppError>> {
300    let local_var_configuration = configuration;
301
302    let local_var_client = &local_var_configuration.client;
303
304    let local_var_uri_str = format!("{}/w/{workspace}/apps_u/delete_s3_file", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
305    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
306
307    local_var_req_builder = local_var_req_builder.query(&[("delete_token", &delete_token.to_string())]);
308    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
309        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
310    }
311    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
312        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
313    };
314
315    let local_var_req = local_var_req_builder.build()?;
316    let local_var_resp = local_var_client.execute(local_var_req).await?;
317
318    let local_var_status = local_var_resp.status();
319    let local_var_content = local_var_resp.text().await?;
320
321    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
322        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
323    } else {
324        let local_var_entity: Option<DeleteS3FileFromAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
325        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
326        Err(Error::ResponseError(local_var_error))
327    }
328}
329
330pub async fn execute_component(configuration: &configuration::Configuration, workspace: &str, path: &str, execute_component_request: models::ExecuteComponentRequest) -> Result<String, Error<ExecuteComponentError>> {
331    let local_var_configuration = configuration;
332
333    let local_var_client = &local_var_configuration.client;
334
335    let local_var_uri_str = format!("{}/w/{workspace}/apps_u/execute_component/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
336    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
337
338    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
339        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
340    }
341    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
342        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
343    };
344    local_var_req_builder = local_var_req_builder.json(&execute_component_request);
345
346    let local_var_req = local_var_req_builder.build()?;
347    let local_var_resp = local_var_client.execute(local_var_req).await?;
348
349    let local_var_status = local_var_resp.status();
350    let local_var_content = local_var_resp.text().await?;
351
352    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
353        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
354    } else {
355        let local_var_entity: Option<ExecuteComponentError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
356        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
357        Err(Error::ResponseError(local_var_error))
358    }
359}
360
361pub async fn exists_app(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsAppError>> {
362    let local_var_configuration = configuration;
363
364    let local_var_client = &local_var_configuration.client;
365
366    let local_var_uri_str = format!("{}/w/{workspace}/apps/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
367    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
368
369    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
370        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
371    }
372    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
373        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
374    };
375
376    let local_var_req = local_var_req_builder.build()?;
377    let local_var_resp = local_var_client.execute(local_var_req).await?;
378
379    let local_var_status = local_var_resp.status();
380    let local_var_content = local_var_resp.text().await?;
381
382    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
383        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
384    } else {
385        let local_var_entity: Option<ExistsAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
386        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
387        Err(Error::ResponseError(local_var_error))
388    }
389}
390
391pub async fn get_app_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str, with_starred_info: Option<bool>, get_draft: Option<bool>, raw_app: Option<bool>) -> Result<models::GetAppByPath200Response, Error<GetAppByPathError>> {
392    let local_var_configuration = configuration;
393
394    let local_var_client = &local_var_configuration.client;
395
396    let local_var_uri_str = format!("{}/w/{workspace}/apps/get/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
397    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
398
399    if let Some(ref local_var_str) = with_starred_info {
400        local_var_req_builder = local_var_req_builder.query(&[("with_starred_info", &local_var_str.to_string())]);
401    }
402    if let Some(ref local_var_str) = get_draft {
403        local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
404    }
405    if let Some(ref local_var_str) = raw_app {
406        local_var_req_builder = local_var_req_builder.query(&[("raw_app", &local_var_str.to_string())]);
407    }
408    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
409        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
410    }
411    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
412        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
413    };
414
415    let local_var_req = local_var_req_builder.build()?;
416    let local_var_resp = local_var_client.execute(local_var_req).await?;
417
418    let local_var_status = local_var_resp.status();
419    let local_var_content = local_var_resp.text().await?;
420
421    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
422        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
423    } else {
424        let local_var_entity: Option<GetAppByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
425        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
426        Err(Error::ResponseError(local_var_error))
427    }
428}
429
430pub async fn get_app_by_version(configuration: &configuration::Configuration, workspace: &str, id: i32) -> Result<models::AppWithLastVersion, Error<GetAppByVersionError>> {
431    let local_var_configuration = configuration;
432
433    let local_var_client = &local_var_configuration.client;
434
435    let local_var_uri_str = format!("{}/w/{workspace}/apps/get/v/{id}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
436    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
437
438    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
439        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
440    }
441    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
442        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
443    };
444
445    let local_var_req = local_var_req_builder.build()?;
446    let local_var_resp = local_var_client.execute(local_var_req).await?;
447
448    let local_var_status = local_var_resp.status();
449    let local_var_content = local_var_resp.text().await?;
450
451    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
452        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
453    } else {
454        let local_var_entity: Option<GetAppByVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
455        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
456        Err(Error::ResponseError(local_var_error))
457    }
458}
459
460pub async fn get_app_history_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::AppHistory>, Error<GetAppHistoryByPathError>> {
461    let local_var_configuration = configuration;
462
463    let local_var_client = &local_var_configuration.client;
464
465    let local_var_uri_str = format!("{}/w/{workspace}/apps/history/p/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
466    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
467
468    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
469        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
470    }
471    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
472        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
473    };
474
475    let local_var_req = local_var_req_builder.build()?;
476    let local_var_resp = local_var_client.execute(local_var_req).await?;
477
478    let local_var_status = local_var_resp.status();
479    let local_var_content = local_var_resp.text().await?;
480
481    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
482        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
483    } else {
484        let local_var_entity: Option<GetAppHistoryByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
485        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
486        Err(Error::ResponseError(local_var_error))
487    }
488}
489
490pub async fn get_app_latest_version(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::AppHistory, Error<GetAppLatestVersionError>> {
491    let local_var_configuration = configuration;
492
493    let local_var_client = &local_var_configuration.client;
494
495    let local_var_uri_str = format!("{}/w/{workspace}/apps/get_latest_version/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
496    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
497
498    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
499        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
500    }
501    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
502        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
503    };
504
505    let local_var_req = local_var_req_builder.build()?;
506    let local_var_resp = local_var_client.execute(local_var_req).await?;
507
508    let local_var_status = local_var_resp.status();
509    let local_var_content = local_var_resp.text().await?;
510
511    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
512        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
513    } else {
514        let local_var_entity: Option<GetAppLatestVersionError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
515        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
516        Err(Error::ResponseError(local_var_error))
517    }
518}
519
520pub async fn get_app_lite_by_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::AppWithLastVersion, Error<GetAppLiteByPathError>> {
521    let local_var_configuration = configuration;
522
523    let local_var_client = &local_var_configuration.client;
524
525    let local_var_uri_str = format!("{}/w/{workspace}/apps/get/lite/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
526    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
527
528    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
529        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
530    }
531    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
532        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
533    };
534
535    let local_var_req = local_var_req_builder.build()?;
536    let local_var_resp = local_var_client.execute(local_var_req).await?;
537
538    let local_var_status = local_var_resp.status();
539    let local_var_content = local_var_resp.text().await?;
540
541    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
542        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
543    } else {
544        let local_var_entity: Option<GetAppLiteByPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
545        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
546        Err(Error::ResponseError(local_var_error))
547    }
548}
549
550pub async fn get_hub_app_by_id(configuration: &configuration::Configuration, id: i32) -> Result<models::GetHubAppById200Response, Error<GetHubAppByIdError>> {
551    let local_var_configuration = configuration;
552
553    let local_var_client = &local_var_configuration.client;
554
555    let local_var_uri_str = format!("{}/apps/hub/get/{id}", local_var_configuration.base_path, id=id);
556    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
557
558    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
559        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
560    }
561    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
562        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
563    };
564
565    let local_var_req = local_var_req_builder.build()?;
566    let local_var_resp = local_var_client.execute(local_var_req).await?;
567
568    let local_var_status = local_var_resp.status();
569    let local_var_content = local_var_resp.text().await?;
570
571    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
572        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
573    } else {
574        let local_var_entity: Option<GetHubAppByIdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
575        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
576        Err(Error::ResponseError(local_var_error))
577    }
578}
579
580pub async fn get_hub_raw_app_by_id(configuration: &configuration::Configuration, id: i32) -> Result<models::GetHubAppById200Response, Error<GetHubRawAppByIdError>> {
581    let local_var_configuration = configuration;
582
583    let local_var_client = &local_var_configuration.client;
584
585    let local_var_uri_str = format!("{}/apps/hub/get_raw/{id}", local_var_configuration.base_path, id=id);
586    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
587
588    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
589        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
590    }
591    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
592        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
593    };
594
595    let local_var_req = local_var_req_builder.build()?;
596    let local_var_resp = local_var_client.execute(local_var_req).await?;
597
598    let local_var_status = local_var_resp.status();
599    let local_var_content = local_var_resp.text().await?;
600
601    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
602        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
603    } else {
604        let local_var_entity: Option<GetHubRawAppByIdError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
605        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
606        Err(Error::ResponseError(local_var_error))
607    }
608}
609
610pub async fn get_public_app_by_custom_path(configuration: &configuration::Configuration, custom_path: &str) -> Result<models::GetPublicAppByCustomPath200Response, Error<GetPublicAppByCustomPathError>> {
611    let local_var_configuration = configuration;
612
613    let local_var_client = &local_var_configuration.client;
614
615    let local_var_uri_str = format!("{}/apps_u/public_app_by_custom_path/{custom_path}", local_var_configuration.base_path, custom_path=crate::apis::urlencode(custom_path));
616    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
617
618    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
619        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
620    }
621    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
622        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
623    };
624
625    let local_var_req = local_var_req_builder.build()?;
626    let local_var_resp = local_var_client.execute(local_var_req).await?;
627
628    let local_var_status = local_var_resp.status();
629    let local_var_content = local_var_resp.text().await?;
630
631    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
632        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
633    } else {
634        let local_var_entity: Option<GetPublicAppByCustomPathError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
635        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
636        Err(Error::ResponseError(local_var_error))
637    }
638}
639
640pub async fn get_public_app_by_secret(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::AppWithLastVersion, Error<GetPublicAppBySecretError>> {
641    let local_var_configuration = configuration;
642
643    let local_var_client = &local_var_configuration.client;
644
645    let local_var_uri_str = format!("{}/w/{workspace}/apps_u/public_app/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
646    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
647
648    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
649        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
650    }
651    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
652        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
653    };
654
655    let local_var_req = local_var_req_builder.build()?;
656    let local_var_resp = local_var_client.execute(local_var_req).await?;
657
658    let local_var_status = local_var_resp.status();
659    let local_var_content = local_var_resp.text().await?;
660
661    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
662        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
663    } else {
664        let local_var_entity: Option<GetPublicAppBySecretError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
665        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
666        Err(Error::ResponseError(local_var_error))
667    }
668}
669
670pub async fn get_public_resource(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<serde_json::Value, Error<GetPublicResourceError>> {
671    let local_var_configuration = configuration;
672
673    let local_var_client = &local_var_configuration.client;
674
675    let local_var_uri_str = format!("{}/w/{workspace}/apps_u/public_resource/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
676    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
677
678    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
679        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
680    }
681    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
682        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
683    };
684
685    let local_var_req = local_var_req_builder.build()?;
686    let local_var_resp = local_var_client.execute(local_var_req).await?;
687
688    let local_var_status = local_var_resp.status();
689    let local_var_content = local_var_resp.text().await?;
690
691    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
692        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
693    } else {
694        let local_var_entity: Option<GetPublicResourceError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
695        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
696        Err(Error::ResponseError(local_var_error))
697    }
698}
699
700pub async fn get_public_secret_of_app(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<GetPublicSecretOfAppError>> {
701    let local_var_configuration = configuration;
702
703    let local_var_client = &local_var_configuration.client;
704
705    let local_var_uri_str = format!("{}/w/{workspace}/apps/secret_of/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
706    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
707
708    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
709        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
710    }
711    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
712        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
713    };
714
715    let local_var_req = local_var_req_builder.build()?;
716    let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718    let local_var_status = local_var_resp.status();
719    let local_var_content = local_var_resp.text().await?;
720
721    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
723    } else {
724        let local_var_entity: Option<GetPublicSecretOfAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
725        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
726        Err(Error::ResponseError(local_var_error))
727    }
728}
729
730pub async fn get_public_secret_of_latest_version_of_app(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<GetPublicSecretOfLatestVersionOfAppError>> {
731    let local_var_configuration = configuration;
732
733    let local_var_client = &local_var_configuration.client;
734
735    let local_var_uri_str = format!("{}/w/{workspace}/apps/secret_of_latest_version/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
736    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
737
738    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
739        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
740    }
741    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
742        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
743    };
744
745    let local_var_req = local_var_req_builder.build()?;
746    let local_var_resp = local_var_client.execute(local_var_req).await?;
747
748    let local_var_status = local_var_resp.status();
749    let local_var_content = local_var_resp.text().await?;
750
751    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
752        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
753    } else {
754        let local_var_entity: Option<GetPublicSecretOfLatestVersionOfAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
755        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
756        Err(Error::ResponseError(local_var_error))
757    }
758}
759
760pub async fn get_raw_app_data(configuration: &configuration::Configuration, workspace: &str, secret_with_extension: &str) -> Result<String, Error<GetRawAppDataError>> {
761    let local_var_configuration = configuration;
762
763    let local_var_client = &local_var_configuration.client;
764
765    let local_var_uri_str = format!("{}/w/{workspace}/apps/get_data/v/{secretWithExtension}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), secretWithExtension=crate::apis::urlencode(secret_with_extension));
766    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
767
768    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
769        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
770    }
771    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
772        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
773    };
774
775    let local_var_req = local_var_req_builder.build()?;
776    let local_var_resp = local_var_client.execute(local_var_req).await?;
777
778    let local_var_status = local_var_resp.status();
779    let local_var_content = local_var_resp.text().await?;
780
781    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
782        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
783    } else {
784        let local_var_entity: Option<GetRawAppDataError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
785        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
786        Err(Error::ResponseError(local_var_error))
787    }
788}
789
790pub async fn list_app_paths_from_workspace_runnable(configuration: &configuration::Configuration, workspace: &str, runnable_kind: &str, path: &str) -> Result<Vec<String>, Error<ListAppPathsFromWorkspaceRunnableError>> {
791    let local_var_configuration = configuration;
792
793    let local_var_client = &local_var_configuration.client;
794
795    let local_var_uri_str = format!("{}/w/{workspace}/apps/list_paths_from_workspace_runnable/{runnable_kind}/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), runnable_kind=crate::apis::urlencode(runnable_kind), path=crate::apis::urlencode(path));
796    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
797
798    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
799        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
800    }
801    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
802        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
803    };
804
805    let local_var_req = local_var_req_builder.build()?;
806    let local_var_resp = local_var_client.execute(local_var_req).await?;
807
808    let local_var_status = local_var_resp.status();
809    let local_var_content = local_var_resp.text().await?;
810
811    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
812        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
813    } else {
814        let local_var_entity: Option<ListAppPathsFromWorkspaceRunnableError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
815        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
816        Err(Error::ResponseError(local_var_error))
817    }
818}
819
820pub async fn list_apps(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, order_desc: Option<bool>, created_by: Option<&str>, path_start: Option<&str>, path_exact: Option<&str>, starred_only: Option<bool>, include_draft_only: Option<bool>, with_deployment_msg: Option<bool>, label: Option<&str>) -> Result<Vec<models::ListableApp>, Error<ListAppsError>> {
821    let local_var_configuration = configuration;
822
823    let local_var_client = &local_var_configuration.client;
824
825    let local_var_uri_str = format!("{}/w/{workspace}/apps/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
826    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
827
828    if let Some(ref local_var_str) = page {
829        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
830    }
831    if let Some(ref local_var_str) = per_page {
832        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
833    }
834    if let Some(ref local_var_str) = order_desc {
835        local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
836    }
837    if let Some(ref local_var_str) = created_by {
838        local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
839    }
840    if let Some(ref local_var_str) = path_start {
841        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
842    }
843    if let Some(ref local_var_str) = path_exact {
844        local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
845    }
846    if let Some(ref local_var_str) = starred_only {
847        local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
848    }
849    if let Some(ref local_var_str) = include_draft_only {
850        local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
851    }
852    if let Some(ref local_var_str) = with_deployment_msg {
853        local_var_req_builder = local_var_req_builder.query(&[("with_deployment_msg", &local_var_str.to_string())]);
854    }
855    if let Some(ref local_var_str) = label {
856        local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
857    }
858    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
859        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
860    }
861    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
862        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
863    };
864
865    let local_var_req = local_var_req_builder.build()?;
866    let local_var_resp = local_var_client.execute(local_var_req).await?;
867
868    let local_var_status = local_var_resp.status();
869    let local_var_content = local_var_resp.text().await?;
870
871    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
872        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
873    } else {
874        let local_var_entity: Option<ListAppsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
875        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
876        Err(Error::ResponseError(local_var_error))
877    }
878}
879
880pub async fn list_hub_apps(configuration: &configuration::Configuration, ) -> Result<models::ListHubApps200Response, Error<ListHubAppsError>> {
881    let local_var_configuration = configuration;
882
883    let local_var_client = &local_var_configuration.client;
884
885    let local_var_uri_str = format!("{}/apps/hub/list", local_var_configuration.base_path);
886    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
887
888    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
889        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
890    }
891    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
892        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
893    };
894
895    let local_var_req = local_var_req_builder.build()?;
896    let local_var_resp = local_var_client.execute(local_var_req).await?;
897
898    let local_var_status = local_var_resp.status();
899    let local_var_content = local_var_resp.text().await?;
900
901    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
902        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
903    } else {
904        let local_var_entity: Option<ListHubAppsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
905        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
906        Err(Error::ResponseError(local_var_error))
907    }
908}
909
910pub async fn list_search_app(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::ListSearchResource200ResponseInner>, Error<ListSearchAppError>> {
911    let local_var_configuration = configuration;
912
913    let local_var_client = &local_var_configuration.client;
914
915    let local_var_uri_str = format!("{}/w/{workspace}/apps/list_search", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
916    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
917
918    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
919        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
920    }
921    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
922        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
923    };
924
925    let local_var_req = local_var_req_builder.build()?;
926    let local_var_resp = local_var_client.execute(local_var_req).await?;
927
928    let local_var_status = local_var_resp.status();
929    let local_var_content = local_var_resp.text().await?;
930
931    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
932        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
933    } else {
934        let local_var_entity: Option<ListSearchAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
935        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
936        Err(Error::ResponseError(local_var_error))
937    }
938}
939
940pub async fn sign_s3_objects(configuration: &configuration::Configuration, workspace: &str, sign_s3_objects_request: models::SignS3ObjectsRequest) -> Result<Vec<models::S3Object>, Error<SignS3ObjectsError>> {
941    let local_var_configuration = configuration;
942
943    let local_var_client = &local_var_configuration.client;
944
945    let local_var_uri_str = format!("{}/w/{workspace}/apps/sign_s3_objects", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
946    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
947
948    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
949        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
950    }
951    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
952        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
953    };
954    local_var_req_builder = local_var_req_builder.json(&sign_s3_objects_request);
955
956    let local_var_req = local_var_req_builder.build()?;
957    let local_var_resp = local_var_client.execute(local_var_req).await?;
958
959    let local_var_status = local_var_resp.status();
960    let local_var_content = local_var_resp.text().await?;
961
962    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
963        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
964    } else {
965        let local_var_entity: Option<SignS3ObjectsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
966        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
967        Err(Error::ResponseError(local_var_error))
968    }
969}
970
971pub async fn update_app(configuration: &configuration::Configuration, workspace: &str, path: &str, update_app_request: models::UpdateAppRequest) -> Result<String, Error<UpdateAppError>> {
972    let local_var_configuration = configuration;
973
974    let local_var_client = &local_var_configuration.client;
975
976    let local_var_uri_str = format!("{}/w/{workspace}/apps/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
977    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
978
979    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
980        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
981    }
982    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
983        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
984    };
985    local_var_req_builder = local_var_req_builder.json(&update_app_request);
986
987    let local_var_req = local_var_req_builder.build()?;
988    let local_var_resp = local_var_client.execute(local_var_req).await?;
989
990    let local_var_status = local_var_resp.status();
991    let local_var_content = local_var_resp.text().await?;
992
993    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
994        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
995    } else {
996        let local_var_entity: Option<UpdateAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
997        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
998        Err(Error::ResponseError(local_var_error))
999    }
1000}
1001
1002pub async fn update_app_history(configuration: &configuration::Configuration, workspace: &str, id: i32, version: i32, update_script_history_request: models::UpdateScriptHistoryRequest) -> Result<String, Error<UpdateAppHistoryError>> {
1003    let local_var_configuration = configuration;
1004
1005    let local_var_client = &local_var_configuration.client;
1006
1007    let local_var_uri_str = format!("{}/w/{workspace}/apps/history_update/a/{id}/v/{version}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id, version=version);
1008    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1009
1010    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1011        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1012    }
1013    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1014        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1015    };
1016    local_var_req_builder = local_var_req_builder.json(&update_script_history_request);
1017
1018    let local_var_req = local_var_req_builder.build()?;
1019    let local_var_resp = local_var_client.execute(local_var_req).await?;
1020
1021    let local_var_status = local_var_resp.status();
1022    let local_var_content = local_var_resp.text().await?;
1023
1024    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1025        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1026    } else {
1027        let local_var_entity: Option<UpdateAppHistoryError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1028        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1029        Err(Error::ResponseError(local_var_error))
1030    }
1031}
1032
1033pub async fn upload_s3_file_from_app(configuration: &configuration::Configuration, workspace: &str, path: &str, body: std::path::PathBuf, file_key: Option<&str>, file_extension: Option<&str>, s3_resource_path: Option<&str>, resource_type: Option<&str>, storage: Option<&str>, content_type: Option<&str>, content_disposition: Option<&str>) -> Result<models::UploadS3FileFromApp200Response, Error<UploadS3FileFromAppError>> {
1034    let local_var_configuration = configuration;
1035
1036    let local_var_client = &local_var_configuration.client;
1037
1038    let local_var_uri_str = format!("{}/w/{workspace}/apps_u/upload_s3_file/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
1039    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1040
1041    if let Some(ref local_var_str) = file_key {
1042        local_var_req_builder = local_var_req_builder.query(&[("file_key", &local_var_str.to_string())]);
1043    }
1044    if let Some(ref local_var_str) = file_extension {
1045        local_var_req_builder = local_var_req_builder.query(&[("file_extension", &local_var_str.to_string())]);
1046    }
1047    if let Some(ref local_var_str) = s3_resource_path {
1048        local_var_req_builder = local_var_req_builder.query(&[("s3_resource_path", &local_var_str.to_string())]);
1049    }
1050    if let Some(ref local_var_str) = resource_type {
1051        local_var_req_builder = local_var_req_builder.query(&[("resource_type", &local_var_str.to_string())]);
1052    }
1053    if let Some(ref local_var_str) = storage {
1054        local_var_req_builder = local_var_req_builder.query(&[("storage", &local_var_str.to_string())]);
1055    }
1056    if let Some(ref local_var_str) = content_type {
1057        local_var_req_builder = local_var_req_builder.query(&[("content_type", &local_var_str.to_string())]);
1058    }
1059    if let Some(ref local_var_str) = content_disposition {
1060        local_var_req_builder = local_var_req_builder.query(&[("content_disposition", &local_var_str.to_string())]);
1061    }
1062    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1063        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1064    }
1065    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1066        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1067    };
1068    local_var_req_builder = local_var_req_builder.json(&body);
1069
1070    let local_var_req = local_var_req_builder.build()?;
1071    let local_var_resp = local_var_client.execute(local_var_req).await?;
1072
1073    let local_var_status = local_var_resp.status();
1074    let local_var_content = local_var_resp.text().await?;
1075
1076    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1077        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
1078    } else {
1079        let local_var_entity: Option<UploadS3FileFromAppError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
1080        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1081        Err(Error::ResponseError(local_var_error))
1082    }
1083}
1084