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