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