1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteAutoFlowsByIdError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetAutoConnectorsError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetAutoFlowsError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetAutoFlowsByIdError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetAutoFlowsByIdVersionsError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetAutoRunsError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetAutoRunsByIdError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PatchAutoFlowsByIdError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PostAutoConnectorsByIdRunError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PostAutoFlowsError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PostAutoFlowsByIdDisableError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PostAutoFlowsByIdEnableError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum PostAutoFlowsByIdOperationsError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum PostAutoFlowsByIdRunError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum PostAutoFlowsByIdVersionsError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum PostAutoHooksBySourceByEventError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum PostAutoRunsByIdResumeError {
134 UnknownValue(serde_json::Value),
135}
136
137
138pub async fn delete_auto_flows_by_id(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteAutoFlowsByIdError>> {
140 let p_id = id;
142
143 let uri_str = format!("{}/v1/auto/flows/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
144 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
145
146 if let Some(ref user_agent) = configuration.user_agent {
147 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
148 }
149 if let Some(ref token) = configuration.bearer_access_token {
150 req_builder = req_builder.bearer_auth(token.to_owned());
151 };
152
153 let req = req_builder.build()?;
154 let resp = configuration.client.execute(req).await?;
155
156 let status = resp.status();
157
158 if !status.is_client_error() && !status.is_server_error() {
159 Ok(())
160 } else {
161 let content = resp.text().await?;
162 let entity: Option<DeleteAutoFlowsByIdError> = serde_json::from_str(&content).ok();
163 Err(Error::ResponseError(ResponseContent { status, content, entity }))
164 }
165}
166
167pub async fn get_auto_connectors(configuration: &configuration::Configuration, ) -> Result<models::Catalog, Error<GetAutoConnectorsError>> {
169
170 let uri_str = format!("{}/v1/auto/connectors", configuration.base_path);
171 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
172
173 if let Some(ref user_agent) = configuration.user_agent {
174 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
175 }
176 if let Some(ref token) = configuration.bearer_access_token {
177 req_builder = req_builder.bearer_auth(token.to_owned());
178 };
179
180 let req = req_builder.build()?;
181 let resp = configuration.client.execute(req).await?;
182
183 let status = resp.status();
184 let content_type = resp
185 .headers()
186 .get("content-type")
187 .and_then(|v| v.to_str().ok())
188 .unwrap_or("application/octet-stream");
189 let content_type = super::ContentType::from(content_type);
190
191 if !status.is_client_error() && !status.is_server_error() {
192 let content = resp.text().await?;
193 match content_type {
194 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
195 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Catalog`"))),
196 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Catalog`")))),
197 }
198 } else {
199 let content = resp.text().await?;
200 let entity: Option<GetAutoConnectorsError> = serde_json::from_str(&content).ok();
201 Err(Error::ResponseError(ResponseContent { status, content, entity }))
202 }
203}
204
205pub async fn get_auto_flows(configuration: &configuration::Configuration, limit: Option<i32>) -> Result<models::FlowPage, Error<GetAutoFlowsError>> {
207 let p_limit = limit;
209
210 let uri_str = format!("{}/v1/auto/flows", configuration.base_path);
211 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
212
213 if let Some(ref param_value) = p_limit {
214 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
215 }
216 if let Some(ref user_agent) = configuration.user_agent {
217 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
218 }
219 if let Some(ref token) = configuration.bearer_access_token {
220 req_builder = req_builder.bearer_auth(token.to_owned());
221 };
222
223 let req = req_builder.build()?;
224 let resp = configuration.client.execute(req).await?;
225
226 let status = resp.status();
227 let content_type = resp
228 .headers()
229 .get("content-type")
230 .and_then(|v| v.to_str().ok())
231 .unwrap_or("application/octet-stream");
232 let content_type = super::ContentType::from(content_type);
233
234 if !status.is_client_error() && !status.is_server_error() {
235 let content = resp.text().await?;
236 match content_type {
237 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
238 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowPage`"))),
239 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FlowPage`")))),
240 }
241 } else {
242 let content = resp.text().await?;
243 let entity: Option<GetAutoFlowsError> = serde_json::from_str(&content).ok();
244 Err(Error::ResponseError(ResponseContent { status, content, entity }))
245 }
246}
247
248pub async fn get_auto_flows_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::PopulatedFlow, Error<GetAutoFlowsByIdError>> {
250 let p_id = id;
252
253 let uri_str = format!("{}/v1/auto/flows/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
254 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
255
256 if let Some(ref user_agent) = configuration.user_agent {
257 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
258 }
259 if let Some(ref token) = configuration.bearer_access_token {
260 req_builder = req_builder.bearer_auth(token.to_owned());
261 };
262
263 let req = req_builder.build()?;
264 let resp = configuration.client.execute(req).await?;
265
266 let status = resp.status();
267 let content_type = resp
268 .headers()
269 .get("content-type")
270 .and_then(|v| v.to_str().ok())
271 .unwrap_or("application/octet-stream");
272 let content_type = super::ContentType::from(content_type);
273
274 if !status.is_client_error() && !status.is_server_error() {
275 let content = resp.text().await?;
276 match content_type {
277 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
278 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PopulatedFlow`"))),
279 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PopulatedFlow`")))),
280 }
281 } else {
282 let content = resp.text().await?;
283 let entity: Option<GetAutoFlowsByIdError> = serde_json::from_str(&content).ok();
284 Err(Error::ResponseError(ResponseContent { status, content, entity }))
285 }
286}
287
288pub async fn get_auto_flows_by_id_versions(configuration: &configuration::Configuration, id: &str, limit: Option<i32>) -> Result<models::VersionPage, Error<GetAutoFlowsByIdVersionsError>> {
290 let p_id = id;
292 let p_limit = limit;
293
294 let uri_str = format!("{}/v1/auto/flows/{id}/versions", configuration.base_path, id=crate::apis::urlencode(p_id));
295 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
296
297 if let Some(ref param_value) = p_limit {
298 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
299 }
300 if let Some(ref user_agent) = configuration.user_agent {
301 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
302 }
303 if let Some(ref token) = configuration.bearer_access_token {
304 req_builder = req_builder.bearer_auth(token.to_owned());
305 };
306
307 let req = req_builder.build()?;
308 let resp = configuration.client.execute(req).await?;
309
310 let status = resp.status();
311 let content_type = resp
312 .headers()
313 .get("content-type")
314 .and_then(|v| v.to_str().ok())
315 .unwrap_or("application/octet-stream");
316 let content_type = super::ContentType::from(content_type);
317
318 if !status.is_client_error() && !status.is_server_error() {
319 let content = resp.text().await?;
320 match content_type {
321 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
322 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VersionPage`"))),
323 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VersionPage`")))),
324 }
325 } else {
326 let content = resp.text().await?;
327 let entity: Option<GetAutoFlowsByIdVersionsError> = serde_json::from_str(&content).ok();
328 Err(Error::ResponseError(ResponseContent { status, content, entity }))
329 }
330}
331
332pub async fn get_auto_runs(configuration: &configuration::Configuration, flow_id: Option<&str>, limit: Option<i32>) -> Result<models::RunPage, Error<GetAutoRunsError>> {
334 let p_flow_id = flow_id;
336 let p_limit = limit;
337
338 let uri_str = format!("{}/v1/auto/runs", configuration.base_path);
339 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
340
341 if let Some(ref param_value) = p_flow_id {
342 req_builder = req_builder.query(&[("flowId", ¶m_value.to_string())]);
343 }
344 if let Some(ref param_value) = p_limit {
345 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
346 }
347 if let Some(ref user_agent) = configuration.user_agent {
348 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
349 }
350 if let Some(ref token) = configuration.bearer_access_token {
351 req_builder = req_builder.bearer_auth(token.to_owned());
352 };
353
354 let req = req_builder.build()?;
355 let resp = configuration.client.execute(req).await?;
356
357 let status = resp.status();
358 let content_type = resp
359 .headers()
360 .get("content-type")
361 .and_then(|v| v.to_str().ok())
362 .unwrap_or("application/octet-stream");
363 let content_type = super::ContentType::from(content_type);
364
365 if !status.is_client_error() && !status.is_server_error() {
366 let content = resp.text().await?;
367 match content_type {
368 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
369 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunPage`"))),
370 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RunPage`")))),
371 }
372 } else {
373 let content = resp.text().await?;
374 let entity: Option<GetAutoRunsError> = serde_json::from_str(&content).ok();
375 Err(Error::ResponseError(ResponseContent { status, content, entity }))
376 }
377}
378
379pub async fn get_auto_runs_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::FlowRun, Error<GetAutoRunsByIdError>> {
381 let p_id = id;
383
384 let uri_str = format!("{}/v1/auto/runs/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
385 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
386
387 if let Some(ref user_agent) = configuration.user_agent {
388 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
389 }
390 if let Some(ref token) = configuration.bearer_access_token {
391 req_builder = req_builder.bearer_auth(token.to_owned());
392 };
393
394 let req = req_builder.build()?;
395 let resp = configuration.client.execute(req).await?;
396
397 let status = resp.status();
398 let content_type = resp
399 .headers()
400 .get("content-type")
401 .and_then(|v| v.to_str().ok())
402 .unwrap_or("application/octet-stream");
403 let content_type = super::ContentType::from(content_type);
404
405 if !status.is_client_error() && !status.is_server_error() {
406 let content = resp.text().await?;
407 match content_type {
408 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
409 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowRun`"))),
410 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FlowRun`")))),
411 }
412 } else {
413 let content = resp.text().await?;
414 let entity: Option<GetAutoRunsByIdError> = serde_json::from_str(&content).ok();
415 Err(Error::ResponseError(ResponseContent { status, content, entity }))
416 }
417}
418
419pub async fn patch_auto_flows_by_id(configuration: &configuration::Configuration, id: &str, patch_flow_in: models::PatchFlowIn) -> Result<models::Flow, Error<PatchAutoFlowsByIdError>> {
421 let p_id = id;
423 let p_patch_flow_in = patch_flow_in;
424
425 let uri_str = format!("{}/v1/auto/flows/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
426 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
427
428 if let Some(ref user_agent) = configuration.user_agent {
429 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
430 }
431 if let Some(ref token) = configuration.bearer_access_token {
432 req_builder = req_builder.bearer_auth(token.to_owned());
433 };
434 req_builder = req_builder.json(&p_patch_flow_in);
435
436 let req = req_builder.build()?;
437 let resp = configuration.client.execute(req).await?;
438
439 let status = resp.status();
440 let content_type = resp
441 .headers()
442 .get("content-type")
443 .and_then(|v| v.to_str().ok())
444 .unwrap_or("application/octet-stream");
445 let content_type = super::ContentType::from(content_type);
446
447 if !status.is_client_error() && !status.is_server_error() {
448 let content = resp.text().await?;
449 match content_type {
450 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
451 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Flow`"))),
452 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Flow`")))),
453 }
454 } else {
455 let content = resp.text().await?;
456 let entity: Option<PatchAutoFlowsByIdError> = serde_json::from_str(&content).ok();
457 Err(Error::ResponseError(ResponseContent { status, content, entity }))
458 }
459}
460
461pub async fn post_auto_connectors_by_id_run(configuration: &configuration::Configuration, id: &str, run_in: models::RunIn) -> Result<models::RunResp, Error<PostAutoConnectorsByIdRunError>> {
463 let p_id = id;
465 let p_run_in = run_in;
466
467 let uri_str = format!("{}/v1/auto/connectors/{id}/run", configuration.base_path, id=crate::apis::urlencode(p_id));
468 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
469
470 if let Some(ref user_agent) = configuration.user_agent {
471 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
472 }
473 if let Some(ref token) = configuration.bearer_access_token {
474 req_builder = req_builder.bearer_auth(token.to_owned());
475 };
476 req_builder = req_builder.json(&p_run_in);
477
478 let req = req_builder.build()?;
479 let resp = configuration.client.execute(req).await?;
480
481 let status = resp.status();
482 let content_type = resp
483 .headers()
484 .get("content-type")
485 .and_then(|v| v.to_str().ok())
486 .unwrap_or("application/octet-stream");
487 let content_type = super::ContentType::from(content_type);
488
489 if !status.is_client_error() && !status.is_server_error() {
490 let content = resp.text().await?;
491 match content_type {
492 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
493 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunResp`"))),
494 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RunResp`")))),
495 }
496 } else {
497 let content = resp.text().await?;
498 let entity: Option<PostAutoConnectorsByIdRunError> = serde_json::from_str(&content).ok();
499 Err(Error::ResponseError(ResponseContent { status, content, entity }))
500 }
501}
502
503pub async fn post_auto_flows(configuration: &configuration::Configuration, create_flow_req: models::CreateFlowReq) -> Result<models::PopulatedFlow, Error<PostAutoFlowsError>> {
505 let p_create_flow_req = create_flow_req;
507
508 let uri_str = format!("{}/v1/auto/flows", configuration.base_path);
509 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
510
511 if let Some(ref user_agent) = configuration.user_agent {
512 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
513 }
514 if let Some(ref token) = configuration.bearer_access_token {
515 req_builder = req_builder.bearer_auth(token.to_owned());
516 };
517 req_builder = req_builder.json(&p_create_flow_req);
518
519 let req = req_builder.build()?;
520 let resp = configuration.client.execute(req).await?;
521
522 let status = resp.status();
523 let content_type = resp
524 .headers()
525 .get("content-type")
526 .and_then(|v| v.to_str().ok())
527 .unwrap_or("application/octet-stream");
528 let content_type = super::ContentType::from(content_type);
529
530 if !status.is_client_error() && !status.is_server_error() {
531 let content = resp.text().await?;
532 match content_type {
533 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
534 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PopulatedFlow`"))),
535 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PopulatedFlow`")))),
536 }
537 } else {
538 let content = resp.text().await?;
539 let entity: Option<PostAutoFlowsError> = serde_json::from_str(&content).ok();
540 Err(Error::ResponseError(ResponseContent { status, content, entity }))
541 }
542}
543
544pub async fn post_auto_flows_by_id_disable(configuration: &configuration::Configuration, id: &str) -> Result<models::Flow, Error<PostAutoFlowsByIdDisableError>> {
546 let p_id = id;
548
549 let uri_str = format!("{}/v1/auto/flows/{id}/disable", configuration.base_path, id=crate::apis::urlencode(p_id));
550 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
551
552 if let Some(ref user_agent) = configuration.user_agent {
553 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
554 }
555 if let Some(ref token) = configuration.bearer_access_token {
556 req_builder = req_builder.bearer_auth(token.to_owned());
557 };
558
559 let req = req_builder.build()?;
560 let resp = configuration.client.execute(req).await?;
561
562 let status = resp.status();
563 let content_type = resp
564 .headers()
565 .get("content-type")
566 .and_then(|v| v.to_str().ok())
567 .unwrap_or("application/octet-stream");
568 let content_type = super::ContentType::from(content_type);
569
570 if !status.is_client_error() && !status.is_server_error() {
571 let content = resp.text().await?;
572 match content_type {
573 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
574 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Flow`"))),
575 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Flow`")))),
576 }
577 } else {
578 let content = resp.text().await?;
579 let entity: Option<PostAutoFlowsByIdDisableError> = serde_json::from_str(&content).ok();
580 Err(Error::ResponseError(ResponseContent { status, content, entity }))
581 }
582}
583
584pub async fn post_auto_flows_by_id_enable(configuration: &configuration::Configuration, id: &str) -> Result<models::Flow, Error<PostAutoFlowsByIdEnableError>> {
586 let p_id = id;
588
589 let uri_str = format!("{}/v1/auto/flows/{id}/enable", configuration.base_path, id=crate::apis::urlencode(p_id));
590 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
591
592 if let Some(ref user_agent) = configuration.user_agent {
593 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
594 }
595 if let Some(ref token) = configuration.bearer_access_token {
596 req_builder = req_builder.bearer_auth(token.to_owned());
597 };
598
599 let req = req_builder.build()?;
600 let resp = configuration.client.execute(req).await?;
601
602 let status = resp.status();
603 let content_type = resp
604 .headers()
605 .get("content-type")
606 .and_then(|v| v.to_str().ok())
607 .unwrap_or("application/octet-stream");
608 let content_type = super::ContentType::from(content_type);
609
610 if !status.is_client_error() && !status.is_server_error() {
611 let content = resp.text().await?;
612 match content_type {
613 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
614 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Flow`"))),
615 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Flow`")))),
616 }
617 } else {
618 let content = resp.text().await?;
619 let entity: Option<PostAutoFlowsByIdEnableError> = serde_json::from_str(&content).ok();
620 Err(Error::ResponseError(ResponseContent { status, content, entity }))
621 }
622}
623
624pub async fn post_auto_flows_by_id_operations(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<PostAutoFlowsByIdOperationsError>> {
626 let p_id = id;
628
629 let uri_str = format!("{}/v1/auto/flows/{id}/operations", configuration.base_path, id=crate::apis::urlencode(p_id));
630 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
631
632 if let Some(ref user_agent) = configuration.user_agent {
633 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
634 }
635 if let Some(ref token) = configuration.bearer_access_token {
636 req_builder = req_builder.bearer_auth(token.to_owned());
637 };
638
639 let req = req_builder.build()?;
640 let resp = configuration.client.execute(req).await?;
641
642 let status = resp.status();
643
644 if !status.is_client_error() && !status.is_server_error() {
645 Ok(())
646 } else {
647 let content = resp.text().await?;
648 let entity: Option<PostAutoFlowsByIdOperationsError> = serde_json::from_str(&content).ok();
649 Err(Error::ResponseError(ResponseContent { status, content, entity }))
650 }
651}
652
653pub async fn post_auto_flows_by_id_run(configuration: &configuration::Configuration, id: &str) -> Result<models::FlowRun, Error<PostAutoFlowsByIdRunError>> {
655 let p_id = id;
657
658 let uri_str = format!("{}/v1/auto/flows/{id}/run", configuration.base_path, id=crate::apis::urlencode(p_id));
659 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
660
661 if let Some(ref user_agent) = configuration.user_agent {
662 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
663 }
664 if let Some(ref token) = configuration.bearer_access_token {
665 req_builder = req_builder.bearer_auth(token.to_owned());
666 };
667
668 let req = req_builder.build()?;
669 let resp = configuration.client.execute(req).await?;
670
671 let status = resp.status();
672 let content_type = resp
673 .headers()
674 .get("content-type")
675 .and_then(|v| v.to_str().ok())
676 .unwrap_or("application/octet-stream");
677 let content_type = super::ContentType::from(content_type);
678
679 if !status.is_client_error() && !status.is_server_error() {
680 let content = resp.text().await?;
681 match content_type {
682 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
683 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowRun`"))),
684 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FlowRun`")))),
685 }
686 } else {
687 let content = resp.text().await?;
688 let entity: Option<PostAutoFlowsByIdRunError> = serde_json::from_str(&content).ok();
689 Err(Error::ResponseError(ResponseContent { status, content, entity }))
690 }
691}
692
693pub async fn post_auto_flows_by_id_versions(configuration: &configuration::Configuration, id: &str, create_version_in: models::CreateVersionIn) -> Result<models::FlowVersion, Error<PostAutoFlowsByIdVersionsError>> {
695 let p_id = id;
697 let p_create_version_in = create_version_in;
698
699 let uri_str = format!("{}/v1/auto/flows/{id}/versions", configuration.base_path, id=crate::apis::urlencode(p_id));
700 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
701
702 if let Some(ref user_agent) = configuration.user_agent {
703 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
704 }
705 if let Some(ref token) = configuration.bearer_access_token {
706 req_builder = req_builder.bearer_auth(token.to_owned());
707 };
708 req_builder = req_builder.json(&p_create_version_in);
709
710 let req = req_builder.build()?;
711 let resp = configuration.client.execute(req).await?;
712
713 let status = resp.status();
714 let content_type = resp
715 .headers()
716 .get("content-type")
717 .and_then(|v| v.to_str().ok())
718 .unwrap_or("application/octet-stream");
719 let content_type = super::ContentType::from(content_type);
720
721 if !status.is_client_error() && !status.is_server_error() {
722 let content = resp.text().await?;
723 match content_type {
724 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
725 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowVersion`"))),
726 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FlowVersion`")))),
727 }
728 } else {
729 let content = resp.text().await?;
730 let entity: Option<PostAutoFlowsByIdVersionsError> = serde_json::from_str(&content).ok();
731 Err(Error::ResponseError(ResponseContent { status, content, entity }))
732 }
733}
734
735pub async fn post_auto_hooks_by_source_by_event(configuration: &configuration::Configuration, source: &str, event: &str) -> Result<(), Error<PostAutoHooksBySourceByEventError>> {
737 let p_source = source;
739 let p_event = event;
740
741 let uri_str = format!("{}/v1/auto/hooks/{source}/{event}", configuration.base_path, source=crate::apis::urlencode(p_source), event=crate::apis::urlencode(p_event));
742 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
743
744 if let Some(ref user_agent) = configuration.user_agent {
745 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
746 }
747 if let Some(ref token) = configuration.bearer_access_token {
748 req_builder = req_builder.bearer_auth(token.to_owned());
749 };
750
751 let req = req_builder.build()?;
752 let resp = configuration.client.execute(req).await?;
753
754 let status = resp.status();
755
756 if !status.is_client_error() && !status.is_server_error() {
757 Ok(())
758 } else {
759 let content = resp.text().await?;
760 let entity: Option<PostAutoHooksBySourceByEventError> = serde_json::from_str(&content).ok();
761 Err(Error::ResponseError(ResponseContent { status, content, entity }))
762 }
763}
764
765pub async fn post_auto_runs_by_id_resume(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<PostAutoRunsByIdResumeError>> {
767 let p_id = id;
769
770 let uri_str = format!("{}/v1/auto/runs/{id}/resume", configuration.base_path, id=crate::apis::urlencode(p_id));
771 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
772
773 if let Some(ref user_agent) = configuration.user_agent {
774 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
775 }
776 if let Some(ref token) = configuration.bearer_access_token {
777 req_builder = req_builder.bearer_auth(token.to_owned());
778 };
779
780 let req = req_builder.build()?;
781 let resp = configuration.client.execute(req).await?;
782
783 let status = resp.status();
784
785 if !status.is_client_error() && !status.is_server_error() {
786 Ok(())
787 } else {
788 let content = resp.text().await?;
789 let entity: Option<PostAutoRunsByIdResumeError> = serde_json::from_str(&content).ok();
790 Err(Error::ResponseError(ResponseContent { status, content, entity }))
791 }
792}
793