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 DiscardHubProjectUpdateError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetHubProjectBySourceError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetHubProjectExportError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ListHubProjectsError {
43 Status400(),
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum PublishHubAppError {
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum PublishHubDraftError {
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum PublishHubFlowError {
65 UnknownValue(serde_json::Value),
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum PublishHubFlowRecordingError {
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum PublishHubMigrationsError {
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum PublishHubPipelineRecordingError {
86 UnknownValue(serde_json::Value),
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum PublishHubProjectLogoError {
93 UnknownValue(serde_json::Value),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum PublishHubRawAppError {
100 UnknownValue(serde_json::Value),
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum PublishHubRawAppRecordingError {
107 UnknownValue(serde_json::Value),
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum PublishHubResourceTypeError {
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum PublishHubResourcesError {
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum PublishHubScriptError {
128 UnknownValue(serde_json::Value),
129}
130
131#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum PublishHubScriptRecordingError {
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum PublishHubTriggersError {
142 UnknownValue(serde_json::Value),
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum SubmitHubProjectError {
149 UnknownValue(serde_json::Value),
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum WithdrawHubProjectError {
156 UnknownValue(serde_json::Value),
157}
158
159
160pub async fn discard_hub_project_update(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<DiscardHubProjectUpdateError>> {
162 let local_var_configuration = configuration;
163
164 let local_var_client = &local_var_configuration.client;
165
166 let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/discard_update", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
167 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
168
169 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
170 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
171 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
172 }
173 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
174 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
175 };
176
177 let local_var_req = local_var_req_builder.build()?;
178 let local_var_resp = local_var_client.execute(local_var_req).await?;
179
180 let local_var_status = local_var_resp.status();
181 let local_var_content = local_var_resp.text().await?;
182
183 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
184 crate::from_str_patched(&local_var_content).map_err(Error::from)
185 } else {
186 let local_var_entity: Option<DiscardHubProjectUpdateError> = crate::from_str_patched(&local_var_content).ok();
187 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
188 Err(Error::ResponseError(local_var_error))
189 }
190}
191
192pub async fn get_hub_project_by_source(configuration: &configuration::Configuration, workspace: &str, folder: &str) -> Result<String, Error<GetHubProjectBySourceError>> {
194 let local_var_configuration = configuration;
195
196 let local_var_client = &local_var_configuration.client;
197
198 let local_var_uri_str = format!("{}/w/{workspace}/hub/project", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
199 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
200
201 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
202 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
203 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
204 }
205 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
206 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
207 };
208
209 let local_var_req = local_var_req_builder.build()?;
210 let local_var_resp = local_var_client.execute(local_var_req).await?;
211
212 let local_var_status = local_var_resp.status();
213 let local_var_content = local_var_resp.text().await?;
214
215 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
216 crate::from_str_patched(&local_var_content).map_err(Error::from)
217 } else {
218 let local_var_entity: Option<GetHubProjectBySourceError> = crate::from_str_patched(&local_var_content).ok();
219 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
220 Err(Error::ResponseError(local_var_error))
221 }
222}
223
224pub async fn get_hub_project_export(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: Option<&str>, version: Option<i32>) -> Result<String, Error<GetHubProjectExportError>> {
226 let local_var_configuration = configuration;
227
228 let local_var_client = &local_var_configuration.client;
229
230 let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/export", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
231 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
232
233 if let Some(ref local_var_str) = folder {
234 local_var_req_builder = local_var_req_builder.query(&[("folder", &local_var_str.to_string())]);
235 }
236 if let Some(ref local_var_str) = version {
237 local_var_req_builder = local_var_req_builder.query(&[("version", &local_var_str.to_string())]);
238 }
239 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
240 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
241 }
242 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
243 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
244 };
245
246 let local_var_req = local_var_req_builder.build()?;
247 let local_var_resp = local_var_client.execute(local_var_req).await?;
248
249 let local_var_status = local_var_resp.status();
250 let local_var_content = local_var_resp.text().await?;
251
252 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
253 crate::from_str_patched(&local_var_content).map_err(Error::from)
254 } else {
255 let local_var_entity: Option<GetHubProjectExportError> = crate::from_str_patched(&local_var_content).ok();
256 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
257 Err(Error::ResponseError(local_var_error))
258 }
259}
260
261pub async fn list_hub_projects(configuration: &configuration::Configuration, workspace: &str) -> Result<String, Error<ListHubProjectsError>> {
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}/hub/projects", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
268 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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<ListHubProjectsError> = 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 publish_hub_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_app_body: models::PublishAppBody) -> Result<String, Error<PublishHubAppError>> {
294 let local_var_configuration = configuration;
295
296 let local_var_client = &local_var_configuration.client;
297
298 let local_var_uri_str = format!("{}/w/{workspace}/hub/apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
299 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
300
301 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
302 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
303 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
304 }
305 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
306 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
307 };
308 local_var_req_builder = local_var_req_builder.json(&publish_app_body);
309
310 let local_var_req = local_var_req_builder.build()?;
311 let local_var_resp = local_var_client.execute(local_var_req).await?;
312
313 let local_var_status = local_var_resp.status();
314 let local_var_content = local_var_resp.text().await?;
315
316 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
317 crate::from_str_patched(&local_var_content).map_err(Error::from)
318 } else {
319 let local_var_entity: Option<PublishHubAppError> = crate::from_str_patched(&local_var_content).ok();
320 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
321 Err(Error::ResponseError(local_var_error))
322 }
323}
324
325pub async fn publish_hub_draft(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_draft_body: models::PublishDraftBody) -> Result<String, Error<PublishHubDraftError>> {
327 let local_var_configuration = configuration;
328
329 let local_var_client = &local_var_configuration.client;
330
331 let local_var_uri_str = format!("{}/w/{workspace}/hub/publish_draft", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
332 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
333
334 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
335 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
336 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
337 }
338 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
339 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
340 };
341 local_var_req_builder = local_var_req_builder.json(&publish_draft_body);
342
343 let local_var_req = local_var_req_builder.build()?;
344 let local_var_resp = local_var_client.execute(local_var_req).await?;
345
346 let local_var_status = local_var_resp.status();
347 let local_var_content = local_var_resp.text().await?;
348
349 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
350 crate::from_str_patched(&local_var_content).map_err(Error::from)
351 } else {
352 let local_var_entity: Option<PublishHubDraftError> = crate::from_str_patched(&local_var_content).ok();
353 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
354 Err(Error::ResponseError(local_var_error))
355 }
356}
357
358pub async fn publish_hub_flow(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_flow_body: models::PublishFlowBody) -> Result<String, Error<PublishHubFlowError>> {
360 let local_var_configuration = configuration;
361
362 let local_var_client = &local_var_configuration.client;
363
364 let local_var_uri_str = format!("{}/w/{workspace}/hub/flows", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
365 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
366
367 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
368 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
369 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
370 }
371 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
372 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
373 };
374 local_var_req_builder = local_var_req_builder.json(&publish_flow_body);
375
376 let local_var_req = local_var_req_builder.build()?;
377 let local_var_resp = local_var_client.execute(local_var_req).await?;
378
379 let local_var_status = local_var_resp.status();
380 let local_var_content = local_var_resp.text().await?;
381
382 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
383 crate::from_str_patched(&local_var_content).map_err(Error::from)
384 } else {
385 let local_var_entity: Option<PublishHubFlowError> = crate::from_str_patched(&local_var_content).ok();
386 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
387 Err(Error::ResponseError(local_var_error))
388 }
389}
390
391pub async fn publish_hub_flow_recording(configuration: &configuration::Configuration, workspace: &str, flow_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubFlowRecordingError>> {
393 let local_var_configuration = configuration;
394
395 let local_var_client = &local_var_configuration.client;
396
397 let local_var_uri_str = format!("{}/w/{workspace}/hub/flows/{flow_id}/recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), flow_id=flow_id);
398 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
399
400 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
401 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
402 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
403 }
404 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
405 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
406 };
407 local_var_req_builder = local_var_req_builder.json(&recording_body);
408
409 let local_var_req = local_var_req_builder.build()?;
410 let local_var_resp = local_var_client.execute(local_var_req).await?;
411
412 let local_var_status = local_var_resp.status();
413 let local_var_content = local_var_resp.text().await?;
414
415 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
416 crate::from_str_patched(&local_var_content).map_err(Error::from)
417 } else {
418 let local_var_entity: Option<PublishHubFlowRecordingError> = crate::from_str_patched(&local_var_content).ok();
419 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
420 Err(Error::ResponseError(local_var_error))
421 }
422}
423
424pub async fn publish_hub_migrations(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_migrations_body: models::PublishMigrationsBody) -> Result<String, Error<PublishHubMigrationsError>> {
426 let local_var_configuration = configuration;
427
428 let local_var_client = &local_var_configuration.client;
429
430 let local_var_uri_str = format!("{}/w/{workspace}/hub/migrations", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
431 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
432
433 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
434 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
435 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
436 }
437 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
438 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
439 };
440 local_var_req_builder = local_var_req_builder.json(&publish_migrations_body);
441
442 let local_var_req = local_var_req_builder.build()?;
443 let local_var_resp = local_var_client.execute(local_var_req).await?;
444
445 let local_var_status = local_var_resp.status();
446 let local_var_content = local_var_resp.text().await?;
447
448 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
449 crate::from_str_patched(&local_var_content).map_err(Error::from)
450 } else {
451 let local_var_entity: Option<PublishHubMigrationsError> = crate::from_str_patched(&local_var_content).ok();
452 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
453 Err(Error::ResponseError(local_var_error))
454 }
455}
456
457pub async fn publish_hub_pipeline_recording(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, pipeline_recording_body: models::PipelineRecordingBody) -> Result<String, Error<PublishHubPipelineRecordingError>> {
459 let local_var_configuration = configuration;
460
461 let local_var_client = &local_var_configuration.client;
462
463 let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/pipeline_recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
464 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
465
466 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
467 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
468 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
469 }
470 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
471 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
472 };
473 local_var_req_builder = local_var_req_builder.json(&pipeline_recording_body);
474
475 let local_var_req = local_var_req_builder.build()?;
476 let local_var_resp = local_var_client.execute(local_var_req).await?;
477
478 let local_var_status = local_var_resp.status();
479 let local_var_content = local_var_resp.text().await?;
480
481 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
482 crate::from_str_patched(&local_var_content).map_err(Error::from)
483 } else {
484 let local_var_entity: Option<PublishHubPipelineRecordingError> = crate::from_str_patched(&local_var_content).ok();
485 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
486 Err(Error::ResponseError(local_var_error))
487 }
488}
489
490pub async fn publish_hub_project_logo(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, project_logo_body: models::ProjectLogoBody) -> Result<String, Error<PublishHubProjectLogoError>> {
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}/hub/projects/{slug}/logo", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
497 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
498
499 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
500 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
501 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
502 }
503 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
504 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
505 };
506 local_var_req_builder = local_var_req_builder.json(&project_logo_body);
507
508 let local_var_req = local_var_req_builder.build()?;
509 let local_var_resp = local_var_client.execute(local_var_req).await?;
510
511 let local_var_status = local_var_resp.status();
512 let local_var_content = local_var_resp.text().await?;
513
514 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
515 crate::from_str_patched(&local_var_content).map_err(Error::from)
516 } else {
517 let local_var_entity: Option<PublishHubProjectLogoError> = crate::from_str_patched(&local_var_content).ok();
518 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
519 Err(Error::ResponseError(local_var_error))
520 }
521}
522
523pub async fn publish_hub_raw_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_raw_app_body: models::PublishRawAppBody) -> Result<String, Error<PublishHubRawAppError>> {
525 let local_var_configuration = configuration;
526
527 let local_var_client = &local_var_configuration.client;
528
529 let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
530 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
531
532 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
533 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
534 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
535 }
536 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
537 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
538 };
539 local_var_req_builder = local_var_req_builder.json(&publish_raw_app_body);
540
541 let local_var_req = local_var_req_builder.build()?;
542 let local_var_resp = local_var_client.execute(local_var_req).await?;
543
544 let local_var_status = local_var_resp.status();
545 let local_var_content = local_var_resp.text().await?;
546
547 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
548 crate::from_str_patched(&local_var_content).map_err(Error::from)
549 } else {
550 let local_var_entity: Option<PublishHubRawAppError> = crate::from_str_patched(&local_var_content).ok();
551 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
552 Err(Error::ResponseError(local_var_error))
553 }
554}
555
556pub async fn publish_hub_raw_app_recording(configuration: &configuration::Configuration, workspace: &str, id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubRawAppRecordingError>> {
558 let local_var_configuration = configuration;
559
560 let local_var_client = &local_var_configuration.client;
561
562 let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps/{id}/recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
563 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
564
565 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
566 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
567 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
568 }
569 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
570 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
571 };
572 local_var_req_builder = local_var_req_builder.json(&recording_body);
573
574 let local_var_req = local_var_req_builder.build()?;
575 let local_var_resp = local_var_client.execute(local_var_req).await?;
576
577 let local_var_status = local_var_resp.status();
578 let local_var_content = local_var_resp.text().await?;
579
580 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
581 crate::from_str_patched(&local_var_content).map_err(Error::from)
582 } else {
583 let local_var_entity: Option<PublishHubRawAppRecordingError> = crate::from_str_patched(&local_var_content).ok();
584 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
585 Err(Error::ResponseError(local_var_error))
586 }
587}
588
589pub async fn publish_hub_resource_type(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resource_type_body: models::PublishResourceTypeBody) -> Result<String, Error<PublishHubResourceTypeError>> {
591 let local_var_configuration = configuration;
592
593 let local_var_client = &local_var_configuration.client;
594
595 let local_var_uri_str = format!("{}/w/{workspace}/hub/resource_types", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
596 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
597
598 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
599 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
600 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
601 }
602 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
603 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
604 };
605 local_var_req_builder = local_var_req_builder.json(&publish_resource_type_body);
606
607 let local_var_req = local_var_req_builder.build()?;
608 let local_var_resp = local_var_client.execute(local_var_req).await?;
609
610 let local_var_status = local_var_resp.status();
611 let local_var_content = local_var_resp.text().await?;
612
613 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
614 crate::from_str_patched(&local_var_content).map_err(Error::from)
615 } else {
616 let local_var_entity: Option<PublishHubResourceTypeError> = crate::from_str_patched(&local_var_content).ok();
617 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
618 Err(Error::ResponseError(local_var_error))
619 }
620}
621
622pub async fn publish_hub_resources(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resources_body: models::PublishResourcesBody) -> Result<String, Error<PublishHubResourcesError>> {
624 let local_var_configuration = configuration;
625
626 let local_var_client = &local_var_configuration.client;
627
628 let local_var_uri_str = format!("{}/w/{workspace}/hub/resources", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
629 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
630
631 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
632 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
633 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
634 }
635 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
636 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
637 };
638 local_var_req_builder = local_var_req_builder.json(&publish_resources_body);
639
640 let local_var_req = local_var_req_builder.build()?;
641 let local_var_resp = local_var_client.execute(local_var_req).await?;
642
643 let local_var_status = local_var_resp.status();
644 let local_var_content = local_var_resp.text().await?;
645
646 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
647 crate::from_str_patched(&local_var_content).map_err(Error::from)
648 } else {
649 let local_var_entity: Option<PublishHubResourcesError> = crate::from_str_patched(&local_var_content).ok();
650 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
651 Err(Error::ResponseError(local_var_error))
652 }
653}
654
655pub async fn publish_hub_script(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_script_body: models::PublishScriptBody) -> Result<String, Error<PublishHubScriptError>> {
657 let local_var_configuration = configuration;
658
659 let local_var_client = &local_var_configuration.client;
660
661 let local_var_uri_str = format!("{}/w/{workspace}/hub/scripts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
662 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
663
664 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
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 local_var_req_builder = local_var_req_builder.json(&publish_script_body);
672
673 let local_var_req = local_var_req_builder.build()?;
674 let local_var_resp = local_var_client.execute(local_var_req).await?;
675
676 let local_var_status = local_var_resp.status();
677 let local_var_content = local_var_resp.text().await?;
678
679 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
680 crate::from_str_patched(&local_var_content).map_err(Error::from)
681 } else {
682 let local_var_entity: Option<PublishHubScriptError> = crate::from_str_patched(&local_var_content).ok();
683 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
684 Err(Error::ResponseError(local_var_error))
685 }
686}
687
688pub async fn publish_hub_script_recording(configuration: &configuration::Configuration, workspace: &str, ask_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubScriptRecordingError>> {
690 let local_var_configuration = configuration;
691
692 let local_var_client = &local_var_configuration.client;
693
694 let local_var_uri_str = format!("{}/w/{workspace}/hub/scripts/{ask_id}/recording", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), ask_id=ask_id);
695 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
696
697 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
698 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
699 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
700 }
701 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
702 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
703 };
704 local_var_req_builder = local_var_req_builder.json(&recording_body);
705
706 let local_var_req = local_var_req_builder.build()?;
707 let local_var_resp = local_var_client.execute(local_var_req).await?;
708
709 let local_var_status = local_var_resp.status();
710 let local_var_content = local_var_resp.text().await?;
711
712 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
713 crate::from_str_patched(&local_var_content).map_err(Error::from)
714 } else {
715 let local_var_entity: Option<PublishHubScriptRecordingError> = crate::from_str_patched(&local_var_content).ok();
716 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
717 Err(Error::ResponseError(local_var_error))
718 }
719}
720
721pub async fn publish_hub_triggers(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_triggers_body: models::PublishTriggersBody) -> Result<String, Error<PublishHubTriggersError>> {
723 let local_var_configuration = configuration;
724
725 let local_var_client = &local_var_configuration.client;
726
727 let local_var_uri_str = format!("{}/w/{workspace}/hub/triggers", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
728 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
729
730 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
731 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
732 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
733 }
734 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
735 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
736 };
737 local_var_req_builder = local_var_req_builder.json(&publish_triggers_body);
738
739 let local_var_req = local_var_req_builder.build()?;
740 let local_var_resp = local_var_client.execute(local_var_req).await?;
741
742 let local_var_status = local_var_resp.status();
743 let local_var_content = local_var_resp.text().await?;
744
745 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
746 crate::from_str_patched(&local_var_content).map_err(Error::from)
747 } else {
748 let local_var_entity: Option<PublishHubTriggersError> = crate::from_str_patched(&local_var_content).ok();
749 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
750 Err(Error::ResponseError(local_var_error))
751 }
752}
753
754pub async fn submit_hub_project(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<SubmitHubProjectError>> {
756 let local_var_configuration = configuration;
757
758 let local_var_client = &local_var_configuration.client;
759
760 let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/submit", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
761 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
762
763 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
764 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
765 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
766 }
767 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
768 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
769 };
770
771 let local_var_req = local_var_req_builder.build()?;
772 let local_var_resp = local_var_client.execute(local_var_req).await?;
773
774 let local_var_status = local_var_resp.status();
775 let local_var_content = local_var_resp.text().await?;
776
777 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
778 crate::from_str_patched(&local_var_content).map_err(Error::from)
779 } else {
780 let local_var_entity: Option<SubmitHubProjectError> = crate::from_str_patched(&local_var_content).ok();
781 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
782 Err(Error::ResponseError(local_var_error))
783 }
784}
785
786pub async fn withdraw_hub_project(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<WithdrawHubProjectError>> {
788 let local_var_configuration = configuration;
789
790 let local_var_client = &local_var_configuration.client;
791
792 let local_var_uri_str = format!("{}/w/{workspace}/hub/projects/{slug}/withdraw", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), slug=crate::apis::urlencode(slug));
793 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
794
795 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
796 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
797 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
798 }
799 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
800 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
801 };
802
803 let local_var_req = local_var_req_builder.build()?;
804 let local_var_resp = local_var_client.execute(local_var_req).await?;
805
806 let local_var_status = local_var_resp.status();
807 let local_var_content = local_var_resp.text().await?;
808
809 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
810 crate::from_str_patched(&local_var_content).map_err(Error::from)
811 } else {
812 let local_var_entity: Option<WithdrawHubProjectError> = crate::from_str_patched(&local_var_content).ok();
813 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
814 Err(Error::ResponseError(local_var_error))
815 }
816}
817