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