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 GetHubProjectBySourceError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetHubProjectExportError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum PublishHubAppError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum PublishHubDraftError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum PublishHubFlowError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum PublishHubFlowRecordingError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum PublishHubMigrationsError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PublishHubPipelineRecordingError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PublishHubProjectLogoError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PublishHubRawAppError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PublishHubRawAppEmbedError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PublishHubResourceTypeError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum PublishHubResourcesError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum PublishHubScriptError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum PublishHubScriptRecordingError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum PublishHubTriggersError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum SubmitHubProjectError {
134 UnknownValue(serde_json::Value),
135}
136
137
138pub async fn get_hub_project_by_source(configuration: &configuration::Configuration, workspace: &str, folder: &str) -> Result<String, Error<GetHubProjectBySourceError>> {
140 let local_var_configuration = configuration;
141
142 let local_var_client = &local_var_configuration.client;
143
144 let local_var_uri_str = format!("{}/w/{workspace}/hub/project", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
145 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
146
147 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
148 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
149 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
150 }
151 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
152 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
153 };
154
155 let local_var_req = local_var_req_builder.build()?;
156 let local_var_resp = local_var_client.execute(local_var_req).await?;
157
158 let local_var_status = local_var_resp.status();
159 let local_var_content = local_var_resp.text().await?;
160
161 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
162 crate::from_str_patched(&local_var_content).map_err(Error::from)
163 } else {
164 let local_var_entity: Option<GetHubProjectBySourceError> = crate::from_str_patched(&local_var_content).ok();
165 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
166 Err(Error::ResponseError(local_var_error))
167 }
168}
169
170pub async fn get_hub_project_export(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: Option<&str>) -> Result<String, Error<GetHubProjectExportError>> {
172 let local_var_configuration = configuration;
173
174 let local_var_client = &local_var_configuration.client;
175
176 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));
177 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
178
179 if let Some(ref local_var_str) = folder {
180 local_var_req_builder = local_var_req_builder.query(&[("folder", &local_var_str.to_string())]);
181 }
182 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
183 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184 }
185 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
186 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
187 };
188
189 let local_var_req = local_var_req_builder.build()?;
190 let local_var_resp = local_var_client.execute(local_var_req).await?;
191
192 let local_var_status = local_var_resp.status();
193 let local_var_content = local_var_resp.text().await?;
194
195 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
196 crate::from_str_patched(&local_var_content).map_err(Error::from)
197 } else {
198 let local_var_entity: Option<GetHubProjectExportError> = crate::from_str_patched(&local_var_content).ok();
199 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
200 Err(Error::ResponseError(local_var_error))
201 }
202}
203
204pub async fn publish_hub_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_app_body: models::PublishAppBody) -> Result<String, Error<PublishHubAppError>> {
206 let local_var_configuration = configuration;
207
208 let local_var_client = &local_var_configuration.client;
209
210 let local_var_uri_str = format!("{}/w/{workspace}/hub/apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
211 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
212
213 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
214 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
215 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
216 }
217 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
218 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
219 };
220 local_var_req_builder = local_var_req_builder.json(&publish_app_body);
221
222 let local_var_req = local_var_req_builder.build()?;
223 let local_var_resp = local_var_client.execute(local_var_req).await?;
224
225 let local_var_status = local_var_resp.status();
226 let local_var_content = local_var_resp.text().await?;
227
228 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
229 crate::from_str_patched(&local_var_content).map_err(Error::from)
230 } else {
231 let local_var_entity: Option<PublishHubAppError> = crate::from_str_patched(&local_var_content).ok();
232 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
233 Err(Error::ResponseError(local_var_error))
234 }
235}
236
237pub async fn publish_hub_draft(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_draft_body: models::PublishDraftBody) -> Result<String, Error<PublishHubDraftError>> {
239 let local_var_configuration = configuration;
240
241 let local_var_client = &local_var_configuration.client;
242
243 let local_var_uri_str = format!("{}/w/{workspace}/hub/publish_draft", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
244 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
245
246 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
247 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
248 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
249 }
250 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
251 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
252 };
253 local_var_req_builder = local_var_req_builder.json(&publish_draft_body);
254
255 let local_var_req = local_var_req_builder.build()?;
256 let local_var_resp = local_var_client.execute(local_var_req).await?;
257
258 let local_var_status = local_var_resp.status();
259 let local_var_content = local_var_resp.text().await?;
260
261 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
262 crate::from_str_patched(&local_var_content).map_err(Error::from)
263 } else {
264 let local_var_entity: Option<PublishHubDraftError> = crate::from_str_patched(&local_var_content).ok();
265 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
266 Err(Error::ResponseError(local_var_error))
267 }
268}
269
270pub async fn publish_hub_flow(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_flow_body: models::PublishFlowBody) -> Result<String, Error<PublishHubFlowError>> {
272 let local_var_configuration = configuration;
273
274 let local_var_client = &local_var_configuration.client;
275
276 let local_var_uri_str = format!("{}/w/{workspace}/hub/flows", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
277 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
278
279 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
280 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
281 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
282 }
283 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
284 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
285 };
286 local_var_req_builder = local_var_req_builder.json(&publish_flow_body);
287
288 let local_var_req = local_var_req_builder.build()?;
289 let local_var_resp = local_var_client.execute(local_var_req).await?;
290
291 let local_var_status = local_var_resp.status();
292 let local_var_content = local_var_resp.text().await?;
293
294 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
295 crate::from_str_patched(&local_var_content).map_err(Error::from)
296 } else {
297 let local_var_entity: Option<PublishHubFlowError> = crate::from_str_patched(&local_var_content).ok();
298 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
299 Err(Error::ResponseError(local_var_error))
300 }
301}
302
303pub async fn publish_hub_flow_recording(configuration: &configuration::Configuration, workspace: &str, flow_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubFlowRecordingError>> {
305 let local_var_configuration = configuration;
306
307 let local_var_client = &local_var_configuration.client;
308
309 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);
310 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
311
312 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
313 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
314 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
315 }
316 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
317 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
318 };
319 local_var_req_builder = local_var_req_builder.json(&recording_body);
320
321 let local_var_req = local_var_req_builder.build()?;
322 let local_var_resp = local_var_client.execute(local_var_req).await?;
323
324 let local_var_status = local_var_resp.status();
325 let local_var_content = local_var_resp.text().await?;
326
327 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
328 crate::from_str_patched(&local_var_content).map_err(Error::from)
329 } else {
330 let local_var_entity: Option<PublishHubFlowRecordingError> = crate::from_str_patched(&local_var_content).ok();
331 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
332 Err(Error::ResponseError(local_var_error))
333 }
334}
335
336pub async fn publish_hub_migrations(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_migrations_body: models::PublishMigrationsBody) -> Result<String, Error<PublishHubMigrationsError>> {
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}/hub/migrations", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
343 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
344
345 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
346 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
347 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
348 }
349 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
350 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
351 };
352 local_var_req_builder = local_var_req_builder.json(&publish_migrations_body);
353
354 let local_var_req = local_var_req_builder.build()?;
355 let local_var_resp = local_var_client.execute(local_var_req).await?;
356
357 let local_var_status = local_var_resp.status();
358 let local_var_content = local_var_resp.text().await?;
359
360 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
361 crate::from_str_patched(&local_var_content).map_err(Error::from)
362 } else {
363 let local_var_entity: Option<PublishHubMigrationsError> = crate::from_str_patched(&local_var_content).ok();
364 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
365 Err(Error::ResponseError(local_var_error))
366 }
367}
368
369pub async fn publish_hub_pipeline_recording(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, pipeline_recording_body: models::PipelineRecordingBody) -> Result<String, Error<PublishHubPipelineRecordingError>> {
371 let local_var_configuration = configuration;
372
373 let local_var_client = &local_var_configuration.client;
374
375 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));
376 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
377
378 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
379 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
380 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
381 }
382 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
383 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
384 };
385 local_var_req_builder = local_var_req_builder.json(&pipeline_recording_body);
386
387 let local_var_req = local_var_req_builder.build()?;
388 let local_var_resp = local_var_client.execute(local_var_req).await?;
389
390 let local_var_status = local_var_resp.status();
391 let local_var_content = local_var_resp.text().await?;
392
393 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
394 crate::from_str_patched(&local_var_content).map_err(Error::from)
395 } else {
396 let local_var_entity: Option<PublishHubPipelineRecordingError> = crate::from_str_patched(&local_var_content).ok();
397 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
398 Err(Error::ResponseError(local_var_error))
399 }
400}
401
402pub async fn publish_hub_project_logo(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str, project_logo_body: models::ProjectLogoBody) -> Result<String, Error<PublishHubProjectLogoError>> {
404 let local_var_configuration = configuration;
405
406 let local_var_client = &local_var_configuration.client;
407
408 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));
409 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
410
411 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
412 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
413 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
414 }
415 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
416 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
417 };
418 local_var_req_builder = local_var_req_builder.json(&project_logo_body);
419
420 let local_var_req = local_var_req_builder.build()?;
421 let local_var_resp = local_var_client.execute(local_var_req).await?;
422
423 let local_var_status = local_var_resp.status();
424 let local_var_content = local_var_resp.text().await?;
425
426 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
427 crate::from_str_patched(&local_var_content).map_err(Error::from)
428 } else {
429 let local_var_entity: Option<PublishHubProjectLogoError> = crate::from_str_patched(&local_var_content).ok();
430 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
431 Err(Error::ResponseError(local_var_error))
432 }
433}
434
435pub async fn publish_hub_raw_app(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_raw_app_body: models::PublishRawAppBody) -> Result<String, Error<PublishHubRawAppError>> {
437 let local_var_configuration = configuration;
438
439 let local_var_client = &local_var_configuration.client;
440
441 let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
442 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
443
444 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
445 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
446 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
447 }
448 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
449 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
450 };
451 local_var_req_builder = local_var_req_builder.json(&publish_raw_app_body);
452
453 let local_var_req = local_var_req_builder.build()?;
454 let local_var_resp = local_var_client.execute(local_var_req).await?;
455
456 let local_var_status = local_var_resp.status();
457 let local_var_content = local_var_resp.text().await?;
458
459 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
460 crate::from_str_patched(&local_var_content).map_err(Error::from)
461 } else {
462 let local_var_entity: Option<PublishHubRawAppError> = crate::from_str_patched(&local_var_content).ok();
463 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
464 Err(Error::ResponseError(local_var_error))
465 }
466}
467
468pub async fn publish_hub_raw_app_embed(configuration: &configuration::Configuration, workspace: &str, id: i64, folder: &str, raw_app_embed_body: models::RawAppEmbedBody) -> Result<String, Error<PublishHubRawAppEmbedError>> {
470 let local_var_configuration = configuration;
471
472 let local_var_client = &local_var_configuration.client;
473
474 let local_var_uri_str = format!("{}/w/{workspace}/hub/raw_apps/{id}/embed", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), id=id);
475 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
476
477 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
478 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
479 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
480 }
481 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
482 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
483 };
484 local_var_req_builder = local_var_req_builder.json(&raw_app_embed_body);
485
486 let local_var_req = local_var_req_builder.build()?;
487 let local_var_resp = local_var_client.execute(local_var_req).await?;
488
489 let local_var_status = local_var_resp.status();
490 let local_var_content = local_var_resp.text().await?;
491
492 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
493 crate::from_str_patched(&local_var_content).map_err(Error::from)
494 } else {
495 let local_var_entity: Option<PublishHubRawAppEmbedError> = crate::from_str_patched(&local_var_content).ok();
496 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
497 Err(Error::ResponseError(local_var_error))
498 }
499}
500
501pub async fn publish_hub_resource_type(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resource_type_body: models::PublishResourceTypeBody) -> Result<String, Error<PublishHubResourceTypeError>> {
503 let local_var_configuration = configuration;
504
505 let local_var_client = &local_var_configuration.client;
506
507 let local_var_uri_str = format!("{}/w/{workspace}/hub/resource_types", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
508 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
509
510 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
511 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
512 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
513 }
514 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
515 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
516 };
517 local_var_req_builder = local_var_req_builder.json(&publish_resource_type_body);
518
519 let local_var_req = local_var_req_builder.build()?;
520 let local_var_resp = local_var_client.execute(local_var_req).await?;
521
522 let local_var_status = local_var_resp.status();
523 let local_var_content = local_var_resp.text().await?;
524
525 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
526 crate::from_str_patched(&local_var_content).map_err(Error::from)
527 } else {
528 let local_var_entity: Option<PublishHubResourceTypeError> = crate::from_str_patched(&local_var_content).ok();
529 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
530 Err(Error::ResponseError(local_var_error))
531 }
532}
533
534pub async fn publish_hub_resources(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_resources_body: models::PublishResourcesBody) -> Result<String, Error<PublishHubResourcesError>> {
536 let local_var_configuration = configuration;
537
538 let local_var_client = &local_var_configuration.client;
539
540 let local_var_uri_str = format!("{}/w/{workspace}/hub/resources", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
541 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
542
543 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
544 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
545 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
546 }
547 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
548 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
549 };
550 local_var_req_builder = local_var_req_builder.json(&publish_resources_body);
551
552 let local_var_req = local_var_req_builder.build()?;
553 let local_var_resp = local_var_client.execute(local_var_req).await?;
554
555 let local_var_status = local_var_resp.status();
556 let local_var_content = local_var_resp.text().await?;
557
558 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
559 crate::from_str_patched(&local_var_content).map_err(Error::from)
560 } else {
561 let local_var_entity: Option<PublishHubResourcesError> = crate::from_str_patched(&local_var_content).ok();
562 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
563 Err(Error::ResponseError(local_var_error))
564 }
565}
566
567pub async fn publish_hub_script(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_script_body: models::PublishScriptBody) -> Result<String, Error<PublishHubScriptError>> {
569 let local_var_configuration = configuration;
570
571 let local_var_client = &local_var_configuration.client;
572
573 let local_var_uri_str = format!("{}/w/{workspace}/hub/scripts", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
574 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
575
576 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
577 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
578 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
579 }
580 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
581 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
582 };
583 local_var_req_builder = local_var_req_builder.json(&publish_script_body);
584
585 let local_var_req = local_var_req_builder.build()?;
586 let local_var_resp = local_var_client.execute(local_var_req).await?;
587
588 let local_var_status = local_var_resp.status();
589 let local_var_content = local_var_resp.text().await?;
590
591 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
592 crate::from_str_patched(&local_var_content).map_err(Error::from)
593 } else {
594 let local_var_entity: Option<PublishHubScriptError> = crate::from_str_patched(&local_var_content).ok();
595 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
596 Err(Error::ResponseError(local_var_error))
597 }
598}
599
600pub async fn publish_hub_script_recording(configuration: &configuration::Configuration, workspace: &str, ask_id: i64, folder: &str, recording_body: models::RecordingBody) -> Result<String, Error<PublishHubScriptRecordingError>> {
602 let local_var_configuration = configuration;
603
604 let local_var_client = &local_var_configuration.client;
605
606 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);
607 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
608
609 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
610 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
611 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
612 }
613 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
614 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
615 };
616 local_var_req_builder = local_var_req_builder.json(&recording_body);
617
618 let local_var_req = local_var_req_builder.build()?;
619 let local_var_resp = local_var_client.execute(local_var_req).await?;
620
621 let local_var_status = local_var_resp.status();
622 let local_var_content = local_var_resp.text().await?;
623
624 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
625 crate::from_str_patched(&local_var_content).map_err(Error::from)
626 } else {
627 let local_var_entity: Option<PublishHubScriptRecordingError> = crate::from_str_patched(&local_var_content).ok();
628 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
629 Err(Error::ResponseError(local_var_error))
630 }
631}
632
633pub async fn publish_hub_triggers(configuration: &configuration::Configuration, workspace: &str, folder: &str, publish_triggers_body: models::PublishTriggersBody) -> Result<String, Error<PublishHubTriggersError>> {
635 let local_var_configuration = configuration;
636
637 let local_var_client = &local_var_configuration.client;
638
639 let local_var_uri_str = format!("{}/w/{workspace}/hub/triggers", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
640 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
641
642 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
643 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
644 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
645 }
646 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
647 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
648 };
649 local_var_req_builder = local_var_req_builder.json(&publish_triggers_body);
650
651 let local_var_req = local_var_req_builder.build()?;
652 let local_var_resp = local_var_client.execute(local_var_req).await?;
653
654 let local_var_status = local_var_resp.status();
655 let local_var_content = local_var_resp.text().await?;
656
657 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
658 crate::from_str_patched(&local_var_content).map_err(Error::from)
659 } else {
660 let local_var_entity: Option<PublishHubTriggersError> = crate::from_str_patched(&local_var_content).ok();
661 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
662 Err(Error::ResponseError(local_var_error))
663 }
664}
665
666pub async fn submit_hub_project(configuration: &configuration::Configuration, workspace: &str, slug: &str, folder: &str) -> Result<String, Error<SubmitHubProjectError>> {
668 let local_var_configuration = configuration;
669
670 let local_var_client = &local_var_configuration.client;
671
672 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));
673 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
674
675 local_var_req_builder = local_var_req_builder.query(&[("folder", &folder.to_string())]);
676 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678 }
679 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
680 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
681 };
682
683 let local_var_req = local_var_req_builder.build()?;
684 let local_var_resp = local_var_client.execute(local_var_req).await?;
685
686 let local_var_status = local_var_resp.status();
687 let local_var_content = local_var_resp.text().await?;
688
689 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
690 crate::from_str_patched(&local_var_content).map_err(Error::from)
691 } else {
692 let local_var_entity: Option<SubmitHubProjectError> = crate::from_str_patched(&local_var_content).ok();
693 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
694 Err(Error::ResponseError(local_var_error))
695 }
696}
697