1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15use tokio::fs::File as TokioFile;
16use tokio_util::codec::{BytesCodec, FramedRead};
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum FlowsBindingsCreateError {
22 Status400(models::ValidationError),
23 Status403(models::GenericError),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum FlowsBindingsDestroyError {
31 Status400(models::ValidationError),
32 Status403(models::GenericError),
33 UnknownValue(serde_json::Value),
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum FlowsBindingsListError {
40 Status400(models::ValidationError),
41 Status403(models::GenericError),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum FlowsBindingsPartialUpdateError {
49 Status400(models::ValidationError),
50 Status403(models::GenericError),
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum FlowsBindingsRetrieveError {
58 Status400(models::ValidationError),
59 Status403(models::GenericError),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum FlowsBindingsUpdateError {
67 Status400(models::ValidationError),
68 Status403(models::GenericError),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum FlowsBindingsUsedByListError {
76 Status400(models::ValidationError),
77 Status403(models::GenericError),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum FlowsExecutorGetError {
85 Status400(models::ValidationError),
86 Status403(models::GenericError),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum FlowsExecutorSolveError {
94 Status400(models::ValidationError),
95 Status403(models::GenericError),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum FlowsInspectorGetError {
103 Status400(),
104 Status403(models::GenericError),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum FlowsInstancesCacheClearCreateError {
112 Status400(),
113 Status403(models::GenericError),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum FlowsInstancesCacheInfoRetrieveError {
121 Status400(models::ValidationError),
122 Status403(models::GenericError),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum FlowsInstancesCreateError {
130 Status400(models::ValidationError),
131 Status403(models::GenericError),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum FlowsInstancesDestroyError {
139 Status400(models::ValidationError),
140 Status403(models::GenericError),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum FlowsInstancesDiagramRetrieveError {
148 Status400(models::ValidationError),
149 Status403(models::GenericError),
150 UnknownValue(serde_json::Value),
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum FlowsInstancesExecuteRetrieveError {
157 Status400(),
158 Status403(models::GenericError),
159 UnknownValue(serde_json::Value),
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum FlowsInstancesExportRetrieveError {
166 Status400(models::ValidationError),
167 Status403(models::GenericError),
168 UnknownValue(serde_json::Value),
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum FlowsInstancesImportCreateError {
175 Status400(models::FlowImportResult),
176 Status403(models::GenericError),
177 UnknownValue(serde_json::Value),
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum FlowsInstancesListError {
184 Status400(models::ValidationError),
185 Status403(models::GenericError),
186 UnknownValue(serde_json::Value),
187}
188
189#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum FlowsInstancesPartialUpdateError {
193 Status400(models::ValidationError),
194 Status403(models::GenericError),
195 UnknownValue(serde_json::Value),
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum FlowsInstancesRetrieveError {
202 Status400(models::ValidationError),
203 Status403(models::GenericError),
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum FlowsInstancesSetBackgroundCreateError {
211 Status400(),
212 Status403(models::GenericError),
213 UnknownValue(serde_json::Value),
214}
215
216#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum FlowsInstancesSetBackgroundUrlCreateError {
220 Status400(),
221 Status403(models::GenericError),
222 UnknownValue(serde_json::Value),
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum FlowsInstancesUpdateError {
229 Status400(models::ValidationError),
230 Status403(models::GenericError),
231 UnknownValue(serde_json::Value),
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum FlowsInstancesUsedByListError {
238 Status400(models::ValidationError),
239 Status403(models::GenericError),
240 UnknownValue(serde_json::Value),
241}
242
243pub async fn flows_bindings_create(
245 configuration: &configuration::Configuration,
246 flow_stage_binding_request: models::FlowStageBindingRequest,
247) -> Result<models::FlowStageBinding, Error<FlowsBindingsCreateError>> {
248 let p_body_flow_stage_binding_request = flow_stage_binding_request;
250
251 let uri_str = format!("{}/flows/bindings/", configuration.base_path);
252 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
253
254 if let Some(ref user_agent) = configuration.user_agent {
255 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
256 }
257 if let Some(ref token) = configuration.bearer_access_token {
258 req_builder = req_builder.bearer_auth(token.to_owned());
259 };
260 req_builder = req_builder.json(&p_body_flow_stage_binding_request);
261
262 let req = req_builder.build()?;
263 let resp = configuration.client.execute(req).await?;
264
265 let status = resp.status();
266 let content_type = resp
267 .headers()
268 .get("content-type")
269 .and_then(|v| v.to_str().ok())
270 .unwrap_or("application/octet-stream");
271 let content_type = super::ContentType::from(content_type);
272
273 if !status.is_client_error() && !status.is_server_error() {
274 let content = resp.text().await?;
275 match content_type {
276 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
277 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
278 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::FlowStageBinding`")))),
279 }
280 } else {
281 let content = resp.text().await?;
282 let entity: Option<FlowsBindingsCreateError> = serde_json::from_str(&content).ok();
283 Err(Error::ResponseError(ResponseContent {
284 status,
285 content,
286 entity,
287 }))
288 }
289}
290
291pub async fn flows_bindings_destroy(
293 configuration: &configuration::Configuration,
294 fsb_uuid: &str,
295) -> Result<(), Error<FlowsBindingsDestroyError>> {
296 let p_path_fsb_uuid = fsb_uuid;
298
299 let uri_str = format!(
300 "{}/flows/bindings/{fsb_uuid}/",
301 configuration.base_path,
302 fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
303 );
304 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
305
306 if let Some(ref user_agent) = configuration.user_agent {
307 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
308 }
309 if let Some(ref token) = configuration.bearer_access_token {
310 req_builder = req_builder.bearer_auth(token.to_owned());
311 };
312
313 let req = req_builder.build()?;
314 let resp = configuration.client.execute(req).await?;
315
316 let status = resp.status();
317
318 if !status.is_client_error() && !status.is_server_error() {
319 Ok(())
320 } else {
321 let content = resp.text().await?;
322 let entity: Option<FlowsBindingsDestroyError> = serde_json::from_str(&content).ok();
323 Err(Error::ResponseError(ResponseContent {
324 status,
325 content,
326 entity,
327 }))
328 }
329}
330
331pub async fn flows_bindings_list(
333 configuration: &configuration::Configuration,
334 evaluate_on_plan: Option<bool>,
335 fsb_uuid: Option<&str>,
336 invalid_response_action: Option<&str>,
337 order: Option<i32>,
338 ordering: Option<&str>,
339 page: Option<i32>,
340 page_size: Option<i32>,
341 pbm_uuid: Option<&str>,
342 policies: Option<Vec<uuid::Uuid>>,
343 policy_engine_mode: Option<&str>,
344 re_evaluate_policies: Option<bool>,
345 search: Option<&str>,
346 stage: Option<&str>,
347 target: Option<&str>,
348) -> Result<models::PaginatedFlowStageBindingList, Error<FlowsBindingsListError>> {
349 let p_query_evaluate_on_plan = evaluate_on_plan;
351 let p_query_fsb_uuid = fsb_uuid;
352 let p_query_invalid_response_action = invalid_response_action;
353 let p_query_order = order;
354 let p_query_ordering = ordering;
355 let p_query_page = page;
356 let p_query_page_size = page_size;
357 let p_query_pbm_uuid = pbm_uuid;
358 let p_query_policies = policies;
359 let p_query_policy_engine_mode = policy_engine_mode;
360 let p_query_re_evaluate_policies = re_evaluate_policies;
361 let p_query_search = search;
362 let p_query_stage = stage;
363 let p_query_target = target;
364
365 let uri_str = format!("{}/flows/bindings/", configuration.base_path);
366 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
367
368 if let Some(ref param_value) = p_query_evaluate_on_plan {
369 req_builder = req_builder.query(&[("evaluate_on_plan", ¶m_value.to_string())]);
370 }
371 if let Some(ref param_value) = p_query_fsb_uuid {
372 req_builder = req_builder.query(&[("fsb_uuid", ¶m_value.to_string())]);
373 }
374 if let Some(ref param_value) = p_query_invalid_response_action {
375 req_builder = req_builder.query(&[("invalid_response_action", ¶m_value.to_string())]);
376 }
377 if let Some(ref param_value) = p_query_order {
378 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
379 }
380 if let Some(ref param_value) = p_query_ordering {
381 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
382 }
383 if let Some(ref param_value) = p_query_page {
384 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
385 }
386 if let Some(ref param_value) = p_query_page_size {
387 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
388 }
389 if let Some(ref param_value) = p_query_pbm_uuid {
390 req_builder = req_builder.query(&[("pbm_uuid", ¶m_value.to_string())]);
391 }
392 if let Some(ref param_value) = p_query_policies {
393 req_builder = match "multi" {
394 "multi" => req_builder.query(
395 ¶m_value
396 .into_iter()
397 .map(|p| ("policies".to_owned(), p.to_string()))
398 .collect::<Vec<(std::string::String, std::string::String)>>(),
399 ),
400 _ => req_builder.query(&[(
401 "policies",
402 ¶m_value
403 .into_iter()
404 .map(|p| p.to_string())
405 .collect::<Vec<String>>()
406 .join(",")
407 .to_string(),
408 )]),
409 };
410 }
411 if let Some(ref param_value) = p_query_policy_engine_mode {
412 req_builder = req_builder.query(&[("policy_engine_mode", ¶m_value.to_string())]);
413 }
414 if let Some(ref param_value) = p_query_re_evaluate_policies {
415 req_builder = req_builder.query(&[("re_evaluate_policies", ¶m_value.to_string())]);
416 }
417 if let Some(ref param_value) = p_query_search {
418 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
419 }
420 if let Some(ref param_value) = p_query_stage {
421 req_builder = req_builder.query(&[("stage", ¶m_value.to_string())]);
422 }
423 if let Some(ref param_value) = p_query_target {
424 req_builder = req_builder.query(&[("target", ¶m_value.to_string())]);
425 }
426 if let Some(ref user_agent) = configuration.user_agent {
427 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
428 }
429 if let Some(ref token) = configuration.bearer_access_token {
430 req_builder = req_builder.bearer_auth(token.to_owned());
431 };
432
433 let req = req_builder.build()?;
434 let resp = configuration.client.execute(req).await?;
435
436 let status = resp.status();
437 let content_type = resp
438 .headers()
439 .get("content-type")
440 .and_then(|v| v.to_str().ok())
441 .unwrap_or("application/octet-stream");
442 let content_type = super::ContentType::from(content_type);
443
444 if !status.is_client_error() && !status.is_server_error() {
445 let content = resp.text().await?;
446 match content_type {
447 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
448 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedFlowStageBindingList`"))),
449 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::PaginatedFlowStageBindingList`")))),
450 }
451 } else {
452 let content = resp.text().await?;
453 let entity: Option<FlowsBindingsListError> = serde_json::from_str(&content).ok();
454 Err(Error::ResponseError(ResponseContent {
455 status,
456 content,
457 entity,
458 }))
459 }
460}
461
462pub async fn flows_bindings_partial_update(
464 configuration: &configuration::Configuration,
465 fsb_uuid: &str,
466 patched_flow_stage_binding_request: Option<models::PatchedFlowStageBindingRequest>,
467) -> Result<models::FlowStageBinding, Error<FlowsBindingsPartialUpdateError>> {
468 let p_path_fsb_uuid = fsb_uuid;
470 let p_body_patched_flow_stage_binding_request = patched_flow_stage_binding_request;
471
472 let uri_str = format!(
473 "{}/flows/bindings/{fsb_uuid}/",
474 configuration.base_path,
475 fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
476 );
477 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
478
479 if let Some(ref user_agent) = configuration.user_agent {
480 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
481 }
482 if let Some(ref token) = configuration.bearer_access_token {
483 req_builder = req_builder.bearer_auth(token.to_owned());
484 };
485 req_builder = req_builder.json(&p_body_patched_flow_stage_binding_request);
486
487 let req = req_builder.build()?;
488 let resp = configuration.client.execute(req).await?;
489
490 let status = resp.status();
491 let content_type = resp
492 .headers()
493 .get("content-type")
494 .and_then(|v| v.to_str().ok())
495 .unwrap_or("application/octet-stream");
496 let content_type = super::ContentType::from(content_type);
497
498 if !status.is_client_error() && !status.is_server_error() {
499 let content = resp.text().await?;
500 match content_type {
501 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
502 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
503 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::FlowStageBinding`")))),
504 }
505 } else {
506 let content = resp.text().await?;
507 let entity: Option<FlowsBindingsPartialUpdateError> = serde_json::from_str(&content).ok();
508 Err(Error::ResponseError(ResponseContent {
509 status,
510 content,
511 entity,
512 }))
513 }
514}
515
516pub async fn flows_bindings_retrieve(
518 configuration: &configuration::Configuration,
519 fsb_uuid: &str,
520) -> Result<models::FlowStageBinding, Error<FlowsBindingsRetrieveError>> {
521 let p_path_fsb_uuid = fsb_uuid;
523
524 let uri_str = format!(
525 "{}/flows/bindings/{fsb_uuid}/",
526 configuration.base_path,
527 fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
528 );
529 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
530
531 if let Some(ref user_agent) = configuration.user_agent {
532 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
533 }
534 if let Some(ref token) = configuration.bearer_access_token {
535 req_builder = req_builder.bearer_auth(token.to_owned());
536 };
537
538 let req = req_builder.build()?;
539 let resp = configuration.client.execute(req).await?;
540
541 let status = resp.status();
542 let content_type = resp
543 .headers()
544 .get("content-type")
545 .and_then(|v| v.to_str().ok())
546 .unwrap_or("application/octet-stream");
547 let content_type = super::ContentType::from(content_type);
548
549 if !status.is_client_error() && !status.is_server_error() {
550 let content = resp.text().await?;
551 match content_type {
552 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
553 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
554 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::FlowStageBinding`")))),
555 }
556 } else {
557 let content = resp.text().await?;
558 let entity: Option<FlowsBindingsRetrieveError> = serde_json::from_str(&content).ok();
559 Err(Error::ResponseError(ResponseContent {
560 status,
561 content,
562 entity,
563 }))
564 }
565}
566
567pub async fn flows_bindings_update(
569 configuration: &configuration::Configuration,
570 fsb_uuid: &str,
571 flow_stage_binding_request: models::FlowStageBindingRequest,
572) -> Result<models::FlowStageBinding, Error<FlowsBindingsUpdateError>> {
573 let p_path_fsb_uuid = fsb_uuid;
575 let p_body_flow_stage_binding_request = flow_stage_binding_request;
576
577 let uri_str = format!(
578 "{}/flows/bindings/{fsb_uuid}/",
579 configuration.base_path,
580 fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
581 );
582 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
583
584 if let Some(ref user_agent) = configuration.user_agent {
585 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
586 }
587 if let Some(ref token) = configuration.bearer_access_token {
588 req_builder = req_builder.bearer_auth(token.to_owned());
589 };
590 req_builder = req_builder.json(&p_body_flow_stage_binding_request);
591
592 let req = req_builder.build()?;
593 let resp = configuration.client.execute(req).await?;
594
595 let status = resp.status();
596 let content_type = resp
597 .headers()
598 .get("content-type")
599 .and_then(|v| v.to_str().ok())
600 .unwrap_or("application/octet-stream");
601 let content_type = super::ContentType::from(content_type);
602
603 if !status.is_client_error() && !status.is_server_error() {
604 let content = resp.text().await?;
605 match content_type {
606 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
607 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
608 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::FlowStageBinding`")))),
609 }
610 } else {
611 let content = resp.text().await?;
612 let entity: Option<FlowsBindingsUpdateError> = serde_json::from_str(&content).ok();
613 Err(Error::ResponseError(ResponseContent {
614 status,
615 content,
616 entity,
617 }))
618 }
619}
620
621pub async fn flows_bindings_used_by_list(
623 configuration: &configuration::Configuration,
624 fsb_uuid: &str,
625) -> Result<Vec<models::UsedBy>, Error<FlowsBindingsUsedByListError>> {
626 let p_path_fsb_uuid = fsb_uuid;
628
629 let uri_str = format!(
630 "{}/flows/bindings/{fsb_uuid}/used_by/",
631 configuration.base_path,
632 fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
633 );
634 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
635
636 if let Some(ref user_agent) = configuration.user_agent {
637 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
638 }
639 if let Some(ref token) = configuration.bearer_access_token {
640 req_builder = req_builder.bearer_auth(token.to_owned());
641 };
642
643 let req = req_builder.build()?;
644 let resp = configuration.client.execute(req).await?;
645
646 let status = resp.status();
647 let content_type = resp
648 .headers()
649 .get("content-type")
650 .and_then(|v| v.to_str().ok())
651 .unwrap_or("application/octet-stream");
652 let content_type = super::ContentType::from(content_type);
653
654 if !status.is_client_error() && !status.is_server_error() {
655 let content = resp.text().await?;
656 match content_type {
657 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
658 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
659 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
660 }
661 } else {
662 let content = resp.text().await?;
663 let entity: Option<FlowsBindingsUsedByListError> = serde_json::from_str(&content).ok();
664 Err(Error::ResponseError(ResponseContent {
665 status,
666 content,
667 entity,
668 }))
669 }
670}
671
672pub async fn flows_executor_get(
674 configuration: &configuration::Configuration,
675 flow_slug: &str,
676 query: &str,
677) -> Result<models::ChallengeTypes, Error<FlowsExecutorGetError>> {
678 let p_path_flow_slug = flow_slug;
680 let p_query_query = query;
681
682 let uri_str = format!(
683 "{}/flows/executor/{flow_slug}/",
684 configuration.base_path,
685 flow_slug = crate::apis::urlencode(p_path_flow_slug)
686 );
687 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
688
689 req_builder = req_builder.query(&[("query", &p_query_query.to_string())]);
690 if let Some(ref user_agent) = configuration.user_agent {
691 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
692 }
693 if let Some(ref token) = configuration.bearer_access_token {
694 req_builder = req_builder.bearer_auth(token.to_owned());
695 };
696
697 let req = req_builder.build()?;
698 let resp = configuration.client.execute(req).await?;
699
700 let status = resp.status();
701 let content_type = resp
702 .headers()
703 .get("content-type")
704 .and_then(|v| v.to_str().ok())
705 .unwrap_or("application/octet-stream");
706 let content_type = super::ContentType::from(content_type);
707
708 if !status.is_client_error() && !status.is_server_error() {
709 let content = resp.text().await?;
710 match content_type {
711 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
712 ContentType::Text => {
713 return Err(Error::from(serde_json::Error::custom(
714 "Received `text/plain` content type response that cannot be converted to `models::ChallengeTypes`",
715 )))
716 }
717 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
718 "Received `{unknown_type}` content type response that cannot be converted to `models::ChallengeTypes`"
719 )))),
720 }
721 } else {
722 let content = resp.text().await?;
723 let entity: Option<FlowsExecutorGetError> = serde_json::from_str(&content).ok();
724 Err(Error::ResponseError(ResponseContent {
725 status,
726 content,
727 entity,
728 }))
729 }
730}
731
732pub async fn flows_executor_solve(
734 configuration: &configuration::Configuration,
735 flow_slug: &str,
736 query: &str,
737 flow_challenge_response_request: Option<models::FlowChallengeResponseRequest>,
738) -> Result<models::ChallengeTypes, Error<FlowsExecutorSolveError>> {
739 let p_path_flow_slug = flow_slug;
741 let p_query_query = query;
742 let p_body_flow_challenge_response_request = flow_challenge_response_request;
743
744 let uri_str = format!(
745 "{}/flows/executor/{flow_slug}/",
746 configuration.base_path,
747 flow_slug = crate::apis::urlencode(p_path_flow_slug)
748 );
749 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
750
751 req_builder = req_builder.query(&[("query", &p_query_query.to_string())]);
752 if let Some(ref user_agent) = configuration.user_agent {
753 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
754 }
755 if let Some(ref token) = configuration.bearer_access_token {
756 req_builder = req_builder.bearer_auth(token.to_owned());
757 };
758 req_builder = req_builder.json(&p_body_flow_challenge_response_request);
759
760 let req = req_builder.build()?;
761 let resp = configuration.client.execute(req).await?;
762
763 let status = resp.status();
764 let content_type = resp
765 .headers()
766 .get("content-type")
767 .and_then(|v| v.to_str().ok())
768 .unwrap_or("application/octet-stream");
769 let content_type = super::ContentType::from(content_type);
770
771 if !status.is_client_error() && !status.is_server_error() {
772 let content = resp.text().await?;
773 match content_type {
774 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
775 ContentType::Text => {
776 return Err(Error::from(serde_json::Error::custom(
777 "Received `text/plain` content type response that cannot be converted to `models::ChallengeTypes`",
778 )))
779 }
780 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
781 "Received `{unknown_type}` content type response that cannot be converted to `models::ChallengeTypes`"
782 )))),
783 }
784 } else {
785 let content = resp.text().await?;
786 let entity: Option<FlowsExecutorSolveError> = serde_json::from_str(&content).ok();
787 Err(Error::ResponseError(ResponseContent {
788 status,
789 content,
790 entity,
791 }))
792 }
793}
794
795pub async fn flows_inspector_get(
797 configuration: &configuration::Configuration,
798 flow_slug: &str,
799) -> Result<models::FlowInspection, Error<FlowsInspectorGetError>> {
800 let p_path_flow_slug = flow_slug;
802
803 let uri_str = format!(
804 "{}/flows/inspector/{flow_slug}/",
805 configuration.base_path,
806 flow_slug = crate::apis::urlencode(p_path_flow_slug)
807 );
808 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
809
810 if let Some(ref user_agent) = configuration.user_agent {
811 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
812 }
813 if let Some(ref token) = configuration.bearer_access_token {
814 req_builder = req_builder.bearer_auth(token.to_owned());
815 };
816
817 let req = req_builder.build()?;
818 let resp = configuration.client.execute(req).await?;
819
820 let status = resp.status();
821 let content_type = resp
822 .headers()
823 .get("content-type")
824 .and_then(|v| v.to_str().ok())
825 .unwrap_or("application/octet-stream");
826 let content_type = super::ContentType::from(content_type);
827
828 if !status.is_client_error() && !status.is_server_error() {
829 let content = resp.text().await?;
830 match content_type {
831 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
832 ContentType::Text => {
833 return Err(Error::from(serde_json::Error::custom(
834 "Received `text/plain` content type response that cannot be converted to `models::FlowInspection`",
835 )))
836 }
837 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
838 "Received `{unknown_type}` content type response that cannot be converted to `models::FlowInspection`"
839 )))),
840 }
841 } else {
842 let content = resp.text().await?;
843 let entity: Option<FlowsInspectorGetError> = serde_json::from_str(&content).ok();
844 Err(Error::ResponseError(ResponseContent {
845 status,
846 content,
847 entity,
848 }))
849 }
850}
851
852pub async fn flows_instances_cache_clear_create(
854 configuration: &configuration::Configuration,
855) -> Result<(), Error<FlowsInstancesCacheClearCreateError>> {
856 let uri_str = format!("{}/flows/instances/cache_clear/", configuration.base_path);
857 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
858
859 if let Some(ref user_agent) = configuration.user_agent {
860 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
861 }
862 if let Some(ref token) = configuration.bearer_access_token {
863 req_builder = req_builder.bearer_auth(token.to_owned());
864 };
865
866 let req = req_builder.build()?;
867 let resp = configuration.client.execute(req).await?;
868
869 let status = resp.status();
870
871 if !status.is_client_error() && !status.is_server_error() {
872 Ok(())
873 } else {
874 let content = resp.text().await?;
875 let entity: Option<FlowsInstancesCacheClearCreateError> = serde_json::from_str(&content).ok();
876 Err(Error::ResponseError(ResponseContent {
877 status,
878 content,
879 entity,
880 }))
881 }
882}
883
884pub async fn flows_instances_cache_info_retrieve(
886 configuration: &configuration::Configuration,
887) -> Result<models::Cache, Error<FlowsInstancesCacheInfoRetrieveError>> {
888 let uri_str = format!("{}/flows/instances/cache_info/", configuration.base_path);
889 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
890
891 if let Some(ref user_agent) = configuration.user_agent {
892 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
893 }
894 if let Some(ref token) = configuration.bearer_access_token {
895 req_builder = req_builder.bearer_auth(token.to_owned());
896 };
897
898 let req = req_builder.build()?;
899 let resp = configuration.client.execute(req).await?;
900
901 let status = resp.status();
902 let content_type = resp
903 .headers()
904 .get("content-type")
905 .and_then(|v| v.to_str().ok())
906 .unwrap_or("application/octet-stream");
907 let content_type = super::ContentType::from(content_type);
908
909 if !status.is_client_error() && !status.is_server_error() {
910 let content = resp.text().await?;
911 match content_type {
912 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
913 ContentType::Text => {
914 return Err(Error::from(serde_json::Error::custom(
915 "Received `text/plain` content type response that cannot be converted to `models::Cache`",
916 )))
917 }
918 ContentType::Unsupported(unknown_type) => {
919 return Err(Error::from(serde_json::Error::custom(format!(
920 "Received `{unknown_type}` content type response that cannot be converted to `models::Cache`"
921 ))))
922 }
923 }
924 } else {
925 let content = resp.text().await?;
926 let entity: Option<FlowsInstancesCacheInfoRetrieveError> = serde_json::from_str(&content).ok();
927 Err(Error::ResponseError(ResponseContent {
928 status,
929 content,
930 entity,
931 }))
932 }
933}
934
935pub async fn flows_instances_create(
937 configuration: &configuration::Configuration,
938 flow_request: models::FlowRequest,
939) -> Result<models::Flow, Error<FlowsInstancesCreateError>> {
940 let p_body_flow_request = flow_request;
942
943 let uri_str = format!("{}/flows/instances/", configuration.base_path);
944 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
945
946 if let Some(ref user_agent) = configuration.user_agent {
947 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
948 }
949 if let Some(ref token) = configuration.bearer_access_token {
950 req_builder = req_builder.bearer_auth(token.to_owned());
951 };
952 req_builder = req_builder.json(&p_body_flow_request);
953
954 let req = req_builder.build()?;
955 let resp = configuration.client.execute(req).await?;
956
957 let status = resp.status();
958 let content_type = resp
959 .headers()
960 .get("content-type")
961 .and_then(|v| v.to_str().ok())
962 .unwrap_or("application/octet-stream");
963 let content_type = super::ContentType::from(content_type);
964
965 if !status.is_client_error() && !status.is_server_error() {
966 let content = resp.text().await?;
967 match content_type {
968 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
969 ContentType::Text => {
970 return Err(Error::from(serde_json::Error::custom(
971 "Received `text/plain` content type response that cannot be converted to `models::Flow`",
972 )))
973 }
974 ContentType::Unsupported(unknown_type) => {
975 return Err(Error::from(serde_json::Error::custom(format!(
976 "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
977 ))))
978 }
979 }
980 } else {
981 let content = resp.text().await?;
982 let entity: Option<FlowsInstancesCreateError> = serde_json::from_str(&content).ok();
983 Err(Error::ResponseError(ResponseContent {
984 status,
985 content,
986 entity,
987 }))
988 }
989}
990
991pub async fn flows_instances_destroy(
993 configuration: &configuration::Configuration,
994 slug: &str,
995) -> Result<(), Error<FlowsInstancesDestroyError>> {
996 let p_path_slug = slug;
998
999 let uri_str = format!(
1000 "{}/flows/instances/{slug}/",
1001 configuration.base_path,
1002 slug = crate::apis::urlencode(p_path_slug)
1003 );
1004 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1005
1006 if let Some(ref user_agent) = configuration.user_agent {
1007 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1008 }
1009 if let Some(ref token) = configuration.bearer_access_token {
1010 req_builder = req_builder.bearer_auth(token.to_owned());
1011 };
1012
1013 let req = req_builder.build()?;
1014 let resp = configuration.client.execute(req).await?;
1015
1016 let status = resp.status();
1017
1018 if !status.is_client_error() && !status.is_server_error() {
1019 Ok(())
1020 } else {
1021 let content = resp.text().await?;
1022 let entity: Option<FlowsInstancesDestroyError> = serde_json::from_str(&content).ok();
1023 Err(Error::ResponseError(ResponseContent {
1024 status,
1025 content,
1026 entity,
1027 }))
1028 }
1029}
1030
1031pub async fn flows_instances_diagram_retrieve(
1033 configuration: &configuration::Configuration,
1034 slug: &str,
1035) -> Result<models::FlowDiagram, Error<FlowsInstancesDiagramRetrieveError>> {
1036 let p_path_slug = slug;
1038
1039 let uri_str = format!(
1040 "{}/flows/instances/{slug}/diagram/",
1041 configuration.base_path,
1042 slug = crate::apis::urlencode(p_path_slug)
1043 );
1044 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1045
1046 if let Some(ref user_agent) = configuration.user_agent {
1047 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1048 }
1049 if let Some(ref token) = configuration.bearer_access_token {
1050 req_builder = req_builder.bearer_auth(token.to_owned());
1051 };
1052
1053 let req = req_builder.build()?;
1054 let resp = configuration.client.execute(req).await?;
1055
1056 let status = resp.status();
1057 let content_type = resp
1058 .headers()
1059 .get("content-type")
1060 .and_then(|v| v.to_str().ok())
1061 .unwrap_or("application/octet-stream");
1062 let content_type = super::ContentType::from(content_type);
1063
1064 if !status.is_client_error() && !status.is_server_error() {
1065 let content = resp.text().await?;
1066 match content_type {
1067 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1068 ContentType::Text => {
1069 return Err(Error::from(serde_json::Error::custom(
1070 "Received `text/plain` content type response that cannot be converted to `models::FlowDiagram`",
1071 )))
1072 }
1073 ContentType::Unsupported(unknown_type) => {
1074 return Err(Error::from(serde_json::Error::custom(format!(
1075 "Received `{unknown_type}` content type response that cannot be converted to `models::FlowDiagram`"
1076 ))))
1077 }
1078 }
1079 } else {
1080 let content = resp.text().await?;
1081 let entity: Option<FlowsInstancesDiagramRetrieveError> = serde_json::from_str(&content).ok();
1082 Err(Error::ResponseError(ResponseContent {
1083 status,
1084 content,
1085 entity,
1086 }))
1087 }
1088}
1089
1090pub async fn flows_instances_execute_retrieve(
1092 configuration: &configuration::Configuration,
1093 slug: &str,
1094) -> Result<models::Link, Error<FlowsInstancesExecuteRetrieveError>> {
1095 let p_path_slug = slug;
1097
1098 let uri_str = format!(
1099 "{}/flows/instances/{slug}/execute/",
1100 configuration.base_path,
1101 slug = crate::apis::urlencode(p_path_slug)
1102 );
1103 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1104
1105 if let Some(ref user_agent) = configuration.user_agent {
1106 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1107 }
1108 if let Some(ref token) = configuration.bearer_access_token {
1109 req_builder = req_builder.bearer_auth(token.to_owned());
1110 };
1111
1112 let req = req_builder.build()?;
1113 let resp = configuration.client.execute(req).await?;
1114
1115 let status = resp.status();
1116 let content_type = resp
1117 .headers()
1118 .get("content-type")
1119 .and_then(|v| v.to_str().ok())
1120 .unwrap_or("application/octet-stream");
1121 let content_type = super::ContentType::from(content_type);
1122
1123 if !status.is_client_error() && !status.is_server_error() {
1124 let content = resp.text().await?;
1125 match content_type {
1126 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1127 ContentType::Text => {
1128 return Err(Error::from(serde_json::Error::custom(
1129 "Received `text/plain` content type response that cannot be converted to `models::Link`",
1130 )))
1131 }
1132 ContentType::Unsupported(unknown_type) => {
1133 return Err(Error::from(serde_json::Error::custom(format!(
1134 "Received `{unknown_type}` content type response that cannot be converted to `models::Link`"
1135 ))))
1136 }
1137 }
1138 } else {
1139 let content = resp.text().await?;
1140 let entity: Option<FlowsInstancesExecuteRetrieveError> = serde_json::from_str(&content).ok();
1141 Err(Error::ResponseError(ResponseContent {
1142 status,
1143 content,
1144 entity,
1145 }))
1146 }
1147}
1148
1149pub async fn flows_instances_export_retrieve(
1151 configuration: &configuration::Configuration,
1152 slug: &str,
1153) -> Result<reqwest::Response, Error<FlowsInstancesExportRetrieveError>> {
1154 let p_path_slug = slug;
1156
1157 let uri_str = format!(
1158 "{}/flows/instances/{slug}/export/",
1159 configuration.base_path,
1160 slug = crate::apis::urlencode(p_path_slug)
1161 );
1162 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1163
1164 if let Some(ref user_agent) = configuration.user_agent {
1165 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1166 }
1167 if let Some(ref token) = configuration.bearer_access_token {
1168 req_builder = req_builder.bearer_auth(token.to_owned());
1169 };
1170
1171 let req = req_builder.build()?;
1172 let resp = configuration.client.execute(req).await?;
1173
1174 let status = resp.status();
1175
1176 if !status.is_client_error() && !status.is_server_error() {
1177 Ok(resp)
1178 } else {
1179 let content = resp.text().await?;
1180 let entity: Option<FlowsInstancesExportRetrieveError> = serde_json::from_str(&content).ok();
1181 Err(Error::ResponseError(ResponseContent {
1182 status,
1183 content,
1184 entity,
1185 }))
1186 }
1187}
1188
1189pub async fn flows_instances_import_create(
1191 configuration: &configuration::Configuration,
1192 file: Option<std::path::PathBuf>,
1193 clear: Option<bool>,
1194) -> Result<models::FlowImportResult, Error<FlowsInstancesImportCreateError>> {
1195 let p_form_file = file;
1197 let p_form_clear = clear;
1198
1199 let uri_str = format!("{}/flows/instances/import/", configuration.base_path);
1200 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1201
1202 if let Some(ref user_agent) = configuration.user_agent {
1203 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1204 }
1205 if let Some(ref token) = configuration.bearer_access_token {
1206 req_builder = req_builder.bearer_auth(token.to_owned());
1207 };
1208 let mut multipart_form = reqwest::multipart::Form::new();
1209 if let Some(param_value) = p_form_clear {
1211 multipart_form = multipart_form.text("clear", param_value.to_string());
1212 }
1213 req_builder = req_builder.multipart(multipart_form);
1214
1215 let req = req_builder.build()?;
1216 let resp = configuration.client.execute(req).await?;
1217
1218 let status = resp.status();
1219 let content_type = resp
1220 .headers()
1221 .get("content-type")
1222 .and_then(|v| v.to_str().ok())
1223 .unwrap_or("application/octet-stream");
1224 let content_type = super::ContentType::from(content_type);
1225
1226 if !status.is_client_error() && !status.is_server_error() {
1227 let content = resp.text().await?;
1228 match content_type {
1229 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1230 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowImportResult`"))),
1231 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::FlowImportResult`")))),
1232 }
1233 } else {
1234 let content = resp.text().await?;
1235 let entity: Option<FlowsInstancesImportCreateError> = serde_json::from_str(&content).ok();
1236 Err(Error::ResponseError(ResponseContent {
1237 status,
1238 content,
1239 entity,
1240 }))
1241 }
1242}
1243
1244pub async fn flows_instances_list(
1246 configuration: &configuration::Configuration,
1247 denied_action: Option<&str>,
1248 designation: Option<&str>,
1249 flow_uuid: Option<&str>,
1250 name: Option<&str>,
1251 ordering: Option<&str>,
1252 page: Option<i32>,
1253 page_size: Option<i32>,
1254 search: Option<&str>,
1255 slug: Option<&str>,
1256) -> Result<models::PaginatedFlowList, Error<FlowsInstancesListError>> {
1257 let p_query_denied_action = denied_action;
1259 let p_query_designation = designation;
1260 let p_query_flow_uuid = flow_uuid;
1261 let p_query_name = name;
1262 let p_query_ordering = ordering;
1263 let p_query_page = page;
1264 let p_query_page_size = page_size;
1265 let p_query_search = search;
1266 let p_query_slug = slug;
1267
1268 let uri_str = format!("{}/flows/instances/", configuration.base_path);
1269 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1270
1271 if let Some(ref param_value) = p_query_denied_action {
1272 req_builder = req_builder.query(&[("denied_action", ¶m_value.to_string())]);
1273 }
1274 if let Some(ref param_value) = p_query_designation {
1275 req_builder = req_builder.query(&[("designation", ¶m_value.to_string())]);
1276 }
1277 if let Some(ref param_value) = p_query_flow_uuid {
1278 req_builder = req_builder.query(&[("flow_uuid", ¶m_value.to_string())]);
1279 }
1280 if let Some(ref param_value) = p_query_name {
1281 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1282 }
1283 if let Some(ref param_value) = p_query_ordering {
1284 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1285 }
1286 if let Some(ref param_value) = p_query_page {
1287 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1288 }
1289 if let Some(ref param_value) = p_query_page_size {
1290 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1291 }
1292 if let Some(ref param_value) = p_query_search {
1293 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1294 }
1295 if let Some(ref param_value) = p_query_slug {
1296 req_builder = req_builder.query(&[("slug", ¶m_value.to_string())]);
1297 }
1298 if let Some(ref user_agent) = configuration.user_agent {
1299 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1300 }
1301 if let Some(ref token) = configuration.bearer_access_token {
1302 req_builder = req_builder.bearer_auth(token.to_owned());
1303 };
1304
1305 let req = req_builder.build()?;
1306 let resp = configuration.client.execute(req).await?;
1307
1308 let status = resp.status();
1309 let content_type = resp
1310 .headers()
1311 .get("content-type")
1312 .and_then(|v| v.to_str().ok())
1313 .unwrap_or("application/octet-stream");
1314 let content_type = super::ContentType::from(content_type);
1315
1316 if !status.is_client_error() && !status.is_server_error() {
1317 let content = resp.text().await?;
1318 match content_type {
1319 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1320 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedFlowList`"))),
1321 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::PaginatedFlowList`")))),
1322 }
1323 } else {
1324 let content = resp.text().await?;
1325 let entity: Option<FlowsInstancesListError> = serde_json::from_str(&content).ok();
1326 Err(Error::ResponseError(ResponseContent {
1327 status,
1328 content,
1329 entity,
1330 }))
1331 }
1332}
1333
1334pub async fn flows_instances_partial_update(
1336 configuration: &configuration::Configuration,
1337 slug: &str,
1338 patched_flow_request: Option<models::PatchedFlowRequest>,
1339) -> Result<models::Flow, Error<FlowsInstancesPartialUpdateError>> {
1340 let p_path_slug = slug;
1342 let p_body_patched_flow_request = patched_flow_request;
1343
1344 let uri_str = format!(
1345 "{}/flows/instances/{slug}/",
1346 configuration.base_path,
1347 slug = crate::apis::urlencode(p_path_slug)
1348 );
1349 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1350
1351 if let Some(ref user_agent) = configuration.user_agent {
1352 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1353 }
1354 if let Some(ref token) = configuration.bearer_access_token {
1355 req_builder = req_builder.bearer_auth(token.to_owned());
1356 };
1357 req_builder = req_builder.json(&p_body_patched_flow_request);
1358
1359 let req = req_builder.build()?;
1360 let resp = configuration.client.execute(req).await?;
1361
1362 let status = resp.status();
1363 let content_type = resp
1364 .headers()
1365 .get("content-type")
1366 .and_then(|v| v.to_str().ok())
1367 .unwrap_or("application/octet-stream");
1368 let content_type = super::ContentType::from(content_type);
1369
1370 if !status.is_client_error() && !status.is_server_error() {
1371 let content = resp.text().await?;
1372 match content_type {
1373 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1374 ContentType::Text => {
1375 return Err(Error::from(serde_json::Error::custom(
1376 "Received `text/plain` content type response that cannot be converted to `models::Flow`",
1377 )))
1378 }
1379 ContentType::Unsupported(unknown_type) => {
1380 return Err(Error::from(serde_json::Error::custom(format!(
1381 "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
1382 ))))
1383 }
1384 }
1385 } else {
1386 let content = resp.text().await?;
1387 let entity: Option<FlowsInstancesPartialUpdateError> = serde_json::from_str(&content).ok();
1388 Err(Error::ResponseError(ResponseContent {
1389 status,
1390 content,
1391 entity,
1392 }))
1393 }
1394}
1395
1396pub async fn flows_instances_retrieve(
1398 configuration: &configuration::Configuration,
1399 slug: &str,
1400) -> Result<models::Flow, Error<FlowsInstancesRetrieveError>> {
1401 let p_path_slug = slug;
1403
1404 let uri_str = format!(
1405 "{}/flows/instances/{slug}/",
1406 configuration.base_path,
1407 slug = crate::apis::urlencode(p_path_slug)
1408 );
1409 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1410
1411 if let Some(ref user_agent) = configuration.user_agent {
1412 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1413 }
1414 if let Some(ref token) = configuration.bearer_access_token {
1415 req_builder = req_builder.bearer_auth(token.to_owned());
1416 };
1417
1418 let req = req_builder.build()?;
1419 let resp = configuration.client.execute(req).await?;
1420
1421 let status = resp.status();
1422 let content_type = resp
1423 .headers()
1424 .get("content-type")
1425 .and_then(|v| v.to_str().ok())
1426 .unwrap_or("application/octet-stream");
1427 let content_type = super::ContentType::from(content_type);
1428
1429 if !status.is_client_error() && !status.is_server_error() {
1430 let content = resp.text().await?;
1431 match content_type {
1432 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1433 ContentType::Text => {
1434 return Err(Error::from(serde_json::Error::custom(
1435 "Received `text/plain` content type response that cannot be converted to `models::Flow`",
1436 )))
1437 }
1438 ContentType::Unsupported(unknown_type) => {
1439 return Err(Error::from(serde_json::Error::custom(format!(
1440 "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
1441 ))))
1442 }
1443 }
1444 } else {
1445 let content = resp.text().await?;
1446 let entity: Option<FlowsInstancesRetrieveError> = serde_json::from_str(&content).ok();
1447 Err(Error::ResponseError(ResponseContent {
1448 status,
1449 content,
1450 entity,
1451 }))
1452 }
1453}
1454
1455pub async fn flows_instances_set_background_create(
1457 configuration: &configuration::Configuration,
1458 slug: &str,
1459 file: Option<std::path::PathBuf>,
1460 clear: Option<bool>,
1461) -> Result<(), Error<FlowsInstancesSetBackgroundCreateError>> {
1462 let p_path_slug = slug;
1464 let p_form_file = file;
1465 let p_form_clear = clear;
1466
1467 let uri_str = format!(
1468 "{}/flows/instances/{slug}/set_background/",
1469 configuration.base_path,
1470 slug = crate::apis::urlencode(p_path_slug)
1471 );
1472 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1473
1474 if let Some(ref user_agent) = configuration.user_agent {
1475 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1476 }
1477 if let Some(ref token) = configuration.bearer_access_token {
1478 req_builder = req_builder.bearer_auth(token.to_owned());
1479 };
1480 let mut multipart_form = reqwest::multipart::Form::new();
1481 if let Some(param_value) = p_form_clear {
1483 multipart_form = multipart_form.text("clear", param_value.to_string());
1484 }
1485 req_builder = req_builder.multipart(multipart_form);
1486
1487 let req = req_builder.build()?;
1488 let resp = configuration.client.execute(req).await?;
1489
1490 let status = resp.status();
1491
1492 if !status.is_client_error() && !status.is_server_error() {
1493 Ok(())
1494 } else {
1495 let content = resp.text().await?;
1496 let entity: Option<FlowsInstancesSetBackgroundCreateError> = serde_json::from_str(&content).ok();
1497 Err(Error::ResponseError(ResponseContent {
1498 status,
1499 content,
1500 entity,
1501 }))
1502 }
1503}
1504
1505pub async fn flows_instances_set_background_url_create(
1507 configuration: &configuration::Configuration,
1508 slug: &str,
1509 file_path_request: models::FilePathRequest,
1510) -> Result<(), Error<FlowsInstancesSetBackgroundUrlCreateError>> {
1511 let p_path_slug = slug;
1513 let p_body_file_path_request = file_path_request;
1514
1515 let uri_str = format!(
1516 "{}/flows/instances/{slug}/set_background_url/",
1517 configuration.base_path,
1518 slug = crate::apis::urlencode(p_path_slug)
1519 );
1520 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1521
1522 if let Some(ref user_agent) = configuration.user_agent {
1523 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1524 }
1525 if let Some(ref token) = configuration.bearer_access_token {
1526 req_builder = req_builder.bearer_auth(token.to_owned());
1527 };
1528 req_builder = req_builder.json(&p_body_file_path_request);
1529
1530 let req = req_builder.build()?;
1531 let resp = configuration.client.execute(req).await?;
1532
1533 let status = resp.status();
1534
1535 if !status.is_client_error() && !status.is_server_error() {
1536 Ok(())
1537 } else {
1538 let content = resp.text().await?;
1539 let entity: Option<FlowsInstancesSetBackgroundUrlCreateError> = serde_json::from_str(&content).ok();
1540 Err(Error::ResponseError(ResponseContent {
1541 status,
1542 content,
1543 entity,
1544 }))
1545 }
1546}
1547
1548pub async fn flows_instances_update(
1550 configuration: &configuration::Configuration,
1551 slug: &str,
1552 flow_request: models::FlowRequest,
1553) -> Result<models::Flow, Error<FlowsInstancesUpdateError>> {
1554 let p_path_slug = slug;
1556 let p_body_flow_request = flow_request;
1557
1558 let uri_str = format!(
1559 "{}/flows/instances/{slug}/",
1560 configuration.base_path,
1561 slug = crate::apis::urlencode(p_path_slug)
1562 );
1563 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1564
1565 if let Some(ref user_agent) = configuration.user_agent {
1566 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1567 }
1568 if let Some(ref token) = configuration.bearer_access_token {
1569 req_builder = req_builder.bearer_auth(token.to_owned());
1570 };
1571 req_builder = req_builder.json(&p_body_flow_request);
1572
1573 let req = req_builder.build()?;
1574 let resp = configuration.client.execute(req).await?;
1575
1576 let status = resp.status();
1577 let content_type = resp
1578 .headers()
1579 .get("content-type")
1580 .and_then(|v| v.to_str().ok())
1581 .unwrap_or("application/octet-stream");
1582 let content_type = super::ContentType::from(content_type);
1583
1584 if !status.is_client_error() && !status.is_server_error() {
1585 let content = resp.text().await?;
1586 match content_type {
1587 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1588 ContentType::Text => {
1589 return Err(Error::from(serde_json::Error::custom(
1590 "Received `text/plain` content type response that cannot be converted to `models::Flow`",
1591 )))
1592 }
1593 ContentType::Unsupported(unknown_type) => {
1594 return Err(Error::from(serde_json::Error::custom(format!(
1595 "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
1596 ))))
1597 }
1598 }
1599 } else {
1600 let content = resp.text().await?;
1601 let entity: Option<FlowsInstancesUpdateError> = serde_json::from_str(&content).ok();
1602 Err(Error::ResponseError(ResponseContent {
1603 status,
1604 content,
1605 entity,
1606 }))
1607 }
1608}
1609
1610pub async fn flows_instances_used_by_list(
1612 configuration: &configuration::Configuration,
1613 slug: &str,
1614) -> Result<Vec<models::UsedBy>, Error<FlowsInstancesUsedByListError>> {
1615 let p_path_slug = slug;
1617
1618 let uri_str = format!(
1619 "{}/flows/instances/{slug}/used_by/",
1620 configuration.base_path,
1621 slug = crate::apis::urlencode(p_path_slug)
1622 );
1623 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1624
1625 if let Some(ref user_agent) = configuration.user_agent {
1626 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1627 }
1628 if let Some(ref token) = configuration.bearer_access_token {
1629 req_builder = req_builder.bearer_auth(token.to_owned());
1630 };
1631
1632 let req = req_builder.build()?;
1633 let resp = configuration.client.execute(req).await?;
1634
1635 let status = resp.status();
1636 let content_type = resp
1637 .headers()
1638 .get("content-type")
1639 .and_then(|v| v.to_str().ok())
1640 .unwrap_or("application/octet-stream");
1641 let content_type = super::ContentType::from(content_type);
1642
1643 if !status.is_client_error() && !status.is_server_error() {
1644 let content = resp.text().await?;
1645 match content_type {
1646 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1647 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1648 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1649 }
1650 } else {
1651 let content = resp.text().await?;
1652 let entity: Option<FlowsInstancesUsedByListError> = serde_json::from_str(&content).ok();
1653 Err(Error::ResponseError(ResponseContent {
1654 status,
1655 content,
1656 entity,
1657 }))
1658 }
1659}