authentik_client/apis/
flows_api.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.12.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for typed errors of method [`flows_bindings_create`]
17#[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/// struct for typed errors of method [`flows_bindings_destroy`]
26#[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/// struct for typed errors of method [`flows_bindings_list`]
35#[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/// struct for typed errors of method [`flows_bindings_partial_update`]
44#[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/// struct for typed errors of method [`flows_bindings_retrieve`]
53#[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/// struct for typed errors of method [`flows_bindings_update`]
62#[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/// struct for typed errors of method [`flows_bindings_used_by_list`]
71#[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/// struct for typed errors of method [`flows_executor_get`]
80#[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/// struct for typed errors of method [`flows_executor_solve`]
89#[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/// struct for typed errors of method [`flows_inspector_get`]
98#[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/// struct for typed errors of method [`flows_instances_cache_clear_create`]
107#[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/// struct for typed errors of method [`flows_instances_cache_info_retrieve`]
116#[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/// struct for typed errors of method [`flows_instances_create`]
125#[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/// struct for typed errors of method [`flows_instances_destroy`]
134#[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/// struct for typed errors of method [`flows_instances_diagram_retrieve`]
143#[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/// struct for typed errors of method [`flows_instances_execute_retrieve`]
152#[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/// struct for typed errors of method [`flows_instances_export_retrieve`]
161#[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/// struct for typed errors of method [`flows_instances_import_create`]
170#[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/// struct for typed errors of method [`flows_instances_list`]
179#[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/// struct for typed errors of method [`flows_instances_partial_update`]
188#[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/// struct for typed errors of method [`flows_instances_retrieve`]
197#[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/// struct for typed errors of method [`flows_instances_update`]
206#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum FlowsInstancesUpdateError {
209    Status400(models::ValidationError),
210    Status403(models::GenericError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`flows_instances_used_by_list`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum FlowsInstancesUsedByListError {
218    Status400(models::ValidationError),
219    Status403(models::GenericError),
220    UnknownValue(serde_json::Value),
221}
222
223/// FlowStageBinding Viewset
224pub async fn flows_bindings_create(
225    configuration: &configuration::Configuration,
226    flow_stage_binding_request: models::FlowStageBindingRequest,
227) -> Result<models::FlowStageBinding, Error<FlowsBindingsCreateError>> {
228    // add a prefix to parameters to efficiently prevent name collisions
229    let p_body_flow_stage_binding_request = flow_stage_binding_request;
230
231    let uri_str = format!("{}/flows/bindings/", configuration.base_path);
232    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
233
234    if let Some(ref user_agent) = configuration.user_agent {
235        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
236    }
237    if let Some(ref token) = configuration.bearer_access_token {
238        req_builder = req_builder.bearer_auth(token.to_owned());
239    };
240    req_builder = req_builder.json(&p_body_flow_stage_binding_request);
241
242    let req = req_builder.build()?;
243    let resp = configuration.client.execute(req).await?;
244
245    let status = resp.status();
246    let content_type = resp
247        .headers()
248        .get("content-type")
249        .and_then(|v| v.to_str().ok())
250        .unwrap_or("application/octet-stream");
251    let content_type = super::ContentType::from(content_type);
252
253    if !status.is_client_error() && !status.is_server_error() {
254        let content = resp.text().await?;
255        match content_type {
256            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
257            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
258            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`")))),
259        }
260    } else {
261        let content = resp.text().await?;
262        let entity: Option<FlowsBindingsCreateError> = serde_json::from_str(&content).ok();
263        Err(Error::ResponseError(ResponseContent {
264            status,
265            content,
266            entity,
267        }))
268    }
269}
270
271/// FlowStageBinding Viewset
272pub async fn flows_bindings_destroy(
273    configuration: &configuration::Configuration,
274    fsb_uuid: &str,
275) -> Result<(), Error<FlowsBindingsDestroyError>> {
276    // add a prefix to parameters to efficiently prevent name collisions
277    let p_path_fsb_uuid = fsb_uuid;
278
279    let uri_str = format!(
280        "{}/flows/bindings/{fsb_uuid}/",
281        configuration.base_path,
282        fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
283    );
284    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
285
286    if let Some(ref user_agent) = configuration.user_agent {
287        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
288    }
289    if let Some(ref token) = configuration.bearer_access_token {
290        req_builder = req_builder.bearer_auth(token.to_owned());
291    };
292
293    let req = req_builder.build()?;
294    let resp = configuration.client.execute(req).await?;
295
296    let status = resp.status();
297
298    if !status.is_client_error() && !status.is_server_error() {
299        Ok(())
300    } else {
301        let content = resp.text().await?;
302        let entity: Option<FlowsBindingsDestroyError> = serde_json::from_str(&content).ok();
303        Err(Error::ResponseError(ResponseContent {
304            status,
305            content,
306            entity,
307        }))
308    }
309}
310
311/// FlowStageBinding Viewset
312pub async fn flows_bindings_list(
313    configuration: &configuration::Configuration,
314    evaluate_on_plan: Option<bool>,
315    fsb_uuid: Option<&str>,
316    invalid_response_action: Option<&str>,
317    order: Option<i32>,
318    ordering: Option<&str>,
319    page: Option<i32>,
320    page_size: Option<i32>,
321    pbm_uuid: Option<&str>,
322    policies: Option<Vec<uuid::Uuid>>,
323    policy_engine_mode: Option<&str>,
324    re_evaluate_policies: Option<bool>,
325    search: Option<&str>,
326    stage: Option<&str>,
327    target: Option<&str>,
328) -> Result<models::PaginatedFlowStageBindingList, Error<FlowsBindingsListError>> {
329    // add a prefix to parameters to efficiently prevent name collisions
330    let p_query_evaluate_on_plan = evaluate_on_plan;
331    let p_query_fsb_uuid = fsb_uuid;
332    let p_query_invalid_response_action = invalid_response_action;
333    let p_query_order = order;
334    let p_query_ordering = ordering;
335    let p_query_page = page;
336    let p_query_page_size = page_size;
337    let p_query_pbm_uuid = pbm_uuid;
338    let p_query_policies = policies;
339    let p_query_policy_engine_mode = policy_engine_mode;
340    let p_query_re_evaluate_policies = re_evaluate_policies;
341    let p_query_search = search;
342    let p_query_stage = stage;
343    let p_query_target = target;
344
345    let uri_str = format!("{}/flows/bindings/", configuration.base_path);
346    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
347
348    if let Some(ref param_value) = p_query_evaluate_on_plan {
349        req_builder = req_builder.query(&[("evaluate_on_plan", &param_value.to_string())]);
350    }
351    if let Some(ref param_value) = p_query_fsb_uuid {
352        req_builder = req_builder.query(&[("fsb_uuid", &param_value.to_string())]);
353    }
354    if let Some(ref param_value) = p_query_invalid_response_action {
355        req_builder = req_builder.query(&[("invalid_response_action", &param_value.to_string())]);
356    }
357    if let Some(ref param_value) = p_query_order {
358        req_builder = req_builder.query(&[("order", &param_value.to_string())]);
359    }
360    if let Some(ref param_value) = p_query_ordering {
361        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
362    }
363    if let Some(ref param_value) = p_query_page {
364        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
365    }
366    if let Some(ref param_value) = p_query_page_size {
367        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
368    }
369    if let Some(ref param_value) = p_query_pbm_uuid {
370        req_builder = req_builder.query(&[("pbm_uuid", &param_value.to_string())]);
371    }
372    if let Some(ref param_value) = p_query_policies {
373        req_builder = match "multi" {
374            "multi" => req_builder.query(
375                &param_value
376                    .into_iter()
377                    .map(|p| ("policies".to_owned(), p.to_string()))
378                    .collect::<Vec<(std::string::String, std::string::String)>>(),
379            ),
380            _ => req_builder.query(&[(
381                "policies",
382                &param_value
383                    .into_iter()
384                    .map(|p| p.to_string())
385                    .collect::<Vec<String>>()
386                    .join(",")
387                    .to_string(),
388            )]),
389        };
390    }
391    if let Some(ref param_value) = p_query_policy_engine_mode {
392        req_builder = req_builder.query(&[("policy_engine_mode", &param_value.to_string())]);
393    }
394    if let Some(ref param_value) = p_query_re_evaluate_policies {
395        req_builder = req_builder.query(&[("re_evaluate_policies", &param_value.to_string())]);
396    }
397    if let Some(ref param_value) = p_query_search {
398        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
399    }
400    if let Some(ref param_value) = p_query_stage {
401        req_builder = req_builder.query(&[("stage", &param_value.to_string())]);
402    }
403    if let Some(ref param_value) = p_query_target {
404        req_builder = req_builder.query(&[("target", &param_value.to_string())]);
405    }
406    if let Some(ref user_agent) = configuration.user_agent {
407        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
408    }
409    if let Some(ref token) = configuration.bearer_access_token {
410        req_builder = req_builder.bearer_auth(token.to_owned());
411    };
412
413    let req = req_builder.build()?;
414    let resp = configuration.client.execute(req).await?;
415
416    let status = resp.status();
417    let content_type = resp
418        .headers()
419        .get("content-type")
420        .and_then(|v| v.to_str().ok())
421        .unwrap_or("application/octet-stream");
422    let content_type = super::ContentType::from(content_type);
423
424    if !status.is_client_error() && !status.is_server_error() {
425        let content = resp.text().await?;
426        match content_type {
427            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
428            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedFlowStageBindingList`"))),
429            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`")))),
430        }
431    } else {
432        let content = resp.text().await?;
433        let entity: Option<FlowsBindingsListError> = serde_json::from_str(&content).ok();
434        Err(Error::ResponseError(ResponseContent {
435            status,
436            content,
437            entity,
438        }))
439    }
440}
441
442/// FlowStageBinding Viewset
443pub async fn flows_bindings_partial_update(
444    configuration: &configuration::Configuration,
445    fsb_uuid: &str,
446    patched_flow_stage_binding_request: Option<models::PatchedFlowStageBindingRequest>,
447) -> Result<models::FlowStageBinding, Error<FlowsBindingsPartialUpdateError>> {
448    // add a prefix to parameters to efficiently prevent name collisions
449    let p_path_fsb_uuid = fsb_uuid;
450    let p_body_patched_flow_stage_binding_request = patched_flow_stage_binding_request;
451
452    let uri_str = format!(
453        "{}/flows/bindings/{fsb_uuid}/",
454        configuration.base_path,
455        fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
456    );
457    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
458
459    if let Some(ref user_agent) = configuration.user_agent {
460        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
461    }
462    if let Some(ref token) = configuration.bearer_access_token {
463        req_builder = req_builder.bearer_auth(token.to_owned());
464    };
465    req_builder = req_builder.json(&p_body_patched_flow_stage_binding_request);
466
467    let req = req_builder.build()?;
468    let resp = configuration.client.execute(req).await?;
469
470    let status = resp.status();
471    let content_type = resp
472        .headers()
473        .get("content-type")
474        .and_then(|v| v.to_str().ok())
475        .unwrap_or("application/octet-stream");
476    let content_type = super::ContentType::from(content_type);
477
478    if !status.is_client_error() && !status.is_server_error() {
479        let content = resp.text().await?;
480        match content_type {
481            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
482            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
483            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`")))),
484        }
485    } else {
486        let content = resp.text().await?;
487        let entity: Option<FlowsBindingsPartialUpdateError> = serde_json::from_str(&content).ok();
488        Err(Error::ResponseError(ResponseContent {
489            status,
490            content,
491            entity,
492        }))
493    }
494}
495
496/// FlowStageBinding Viewset
497pub async fn flows_bindings_retrieve(
498    configuration: &configuration::Configuration,
499    fsb_uuid: &str,
500) -> Result<models::FlowStageBinding, Error<FlowsBindingsRetrieveError>> {
501    // add a prefix to parameters to efficiently prevent name collisions
502    let p_path_fsb_uuid = fsb_uuid;
503
504    let uri_str = format!(
505        "{}/flows/bindings/{fsb_uuid}/",
506        configuration.base_path,
507        fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
508    );
509    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
510
511    if let Some(ref user_agent) = configuration.user_agent {
512        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
513    }
514    if let Some(ref token) = configuration.bearer_access_token {
515        req_builder = req_builder.bearer_auth(token.to_owned());
516    };
517
518    let req = req_builder.build()?;
519    let resp = configuration.client.execute(req).await?;
520
521    let status = resp.status();
522    let content_type = resp
523        .headers()
524        .get("content-type")
525        .and_then(|v| v.to_str().ok())
526        .unwrap_or("application/octet-stream");
527    let content_type = super::ContentType::from(content_type);
528
529    if !status.is_client_error() && !status.is_server_error() {
530        let content = resp.text().await?;
531        match content_type {
532            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
533            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
534            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`")))),
535        }
536    } else {
537        let content = resp.text().await?;
538        let entity: Option<FlowsBindingsRetrieveError> = serde_json::from_str(&content).ok();
539        Err(Error::ResponseError(ResponseContent {
540            status,
541            content,
542            entity,
543        }))
544    }
545}
546
547/// FlowStageBinding Viewset
548pub async fn flows_bindings_update(
549    configuration: &configuration::Configuration,
550    fsb_uuid: &str,
551    flow_stage_binding_request: models::FlowStageBindingRequest,
552) -> Result<models::FlowStageBinding, Error<FlowsBindingsUpdateError>> {
553    // add a prefix to parameters to efficiently prevent name collisions
554    let p_path_fsb_uuid = fsb_uuid;
555    let p_body_flow_stage_binding_request = flow_stage_binding_request;
556
557    let uri_str = format!(
558        "{}/flows/bindings/{fsb_uuid}/",
559        configuration.base_path,
560        fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
561    );
562    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
563
564    if let Some(ref user_agent) = configuration.user_agent {
565        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
566    }
567    if let Some(ref token) = configuration.bearer_access_token {
568        req_builder = req_builder.bearer_auth(token.to_owned());
569    };
570    req_builder = req_builder.json(&p_body_flow_stage_binding_request);
571
572    let req = req_builder.build()?;
573    let resp = configuration.client.execute(req).await?;
574
575    let status = resp.status();
576    let content_type = resp
577        .headers()
578        .get("content-type")
579        .and_then(|v| v.to_str().ok())
580        .unwrap_or("application/octet-stream");
581    let content_type = super::ContentType::from(content_type);
582
583    if !status.is_client_error() && !status.is_server_error() {
584        let content = resp.text().await?;
585        match content_type {
586            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
587            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowStageBinding`"))),
588            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`")))),
589        }
590    } else {
591        let content = resp.text().await?;
592        let entity: Option<FlowsBindingsUpdateError> = serde_json::from_str(&content).ok();
593        Err(Error::ResponseError(ResponseContent {
594            status,
595            content,
596            entity,
597        }))
598    }
599}
600
601/// Get a list of all objects that use this object
602pub async fn flows_bindings_used_by_list(
603    configuration: &configuration::Configuration,
604    fsb_uuid: &str,
605) -> Result<Vec<models::UsedBy>, Error<FlowsBindingsUsedByListError>> {
606    // add a prefix to parameters to efficiently prevent name collisions
607    let p_path_fsb_uuid = fsb_uuid;
608
609    let uri_str = format!(
610        "{}/flows/bindings/{fsb_uuid}/used_by/",
611        configuration.base_path,
612        fsb_uuid = crate::apis::urlencode(p_path_fsb_uuid)
613    );
614    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
615
616    if let Some(ref user_agent) = configuration.user_agent {
617        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
618    }
619    if let Some(ref token) = configuration.bearer_access_token {
620        req_builder = req_builder.bearer_auth(token.to_owned());
621    };
622
623    let req = req_builder.build()?;
624    let resp = configuration.client.execute(req).await?;
625
626    let status = resp.status();
627    let content_type = resp
628        .headers()
629        .get("content-type")
630        .and_then(|v| v.to_str().ok())
631        .unwrap_or("application/octet-stream");
632    let content_type = super::ContentType::from(content_type);
633
634    if !status.is_client_error() && !status.is_server_error() {
635        let content = resp.text().await?;
636        match content_type {
637            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
638            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
639            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&lt;models::UsedBy&gt;`")))),
640        }
641    } else {
642        let content = resp.text().await?;
643        let entity: Option<FlowsBindingsUsedByListError> = serde_json::from_str(&content).ok();
644        Err(Error::ResponseError(ResponseContent {
645            status,
646            content,
647            entity,
648        }))
649    }
650}
651
652/// Get the next pending challenge from the currently active flow.
653pub async fn flows_executor_get(
654    configuration: &configuration::Configuration,
655    flow_slug: &str,
656    query: &str,
657) -> Result<models::ChallengeTypes, Error<FlowsExecutorGetError>> {
658    // add a prefix to parameters to efficiently prevent name collisions
659    let p_path_flow_slug = flow_slug;
660    let p_query_query = query;
661
662    let uri_str = format!(
663        "{}/flows/executor/{flow_slug}/",
664        configuration.base_path,
665        flow_slug = crate::apis::urlencode(p_path_flow_slug)
666    );
667    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
668
669    req_builder = req_builder.query(&[("query", &p_query_query.to_string())]);
670    if let Some(ref user_agent) = configuration.user_agent {
671        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
672    }
673    if let Some(ref token) = configuration.bearer_access_token {
674        req_builder = req_builder.bearer_auth(token.to_owned());
675    };
676
677    let req = req_builder.build()?;
678    let resp = configuration.client.execute(req).await?;
679
680    let status = resp.status();
681    let content_type = resp
682        .headers()
683        .get("content-type")
684        .and_then(|v| v.to_str().ok())
685        .unwrap_or("application/octet-stream");
686    let content_type = super::ContentType::from(content_type);
687
688    if !status.is_client_error() && !status.is_server_error() {
689        let content = resp.text().await?;
690        match content_type {
691            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
692            ContentType::Text => {
693                return Err(Error::from(serde_json::Error::custom(
694                    "Received `text/plain` content type response that cannot be converted to `models::ChallengeTypes`",
695                )))
696            }
697            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
698                "Received `{unknown_type}` content type response that cannot be converted to `models::ChallengeTypes`"
699            )))),
700        }
701    } else {
702        let content = resp.text().await?;
703        let entity: Option<FlowsExecutorGetError> = serde_json::from_str(&content).ok();
704        Err(Error::ResponseError(ResponseContent {
705            status,
706            content,
707            entity,
708        }))
709    }
710}
711
712/// Solve the previously retrieved challenge and advanced to the next stage.
713pub async fn flows_executor_solve(
714    configuration: &configuration::Configuration,
715    flow_slug: &str,
716    query: &str,
717    flow_challenge_response_request: Option<models::FlowChallengeResponseRequest>,
718) -> Result<models::ChallengeTypes, Error<FlowsExecutorSolveError>> {
719    // add a prefix to parameters to efficiently prevent name collisions
720    let p_path_flow_slug = flow_slug;
721    let p_query_query = query;
722    let p_body_flow_challenge_response_request = flow_challenge_response_request;
723
724    let uri_str = format!(
725        "{}/flows/executor/{flow_slug}/",
726        configuration.base_path,
727        flow_slug = crate::apis::urlencode(p_path_flow_slug)
728    );
729    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
730
731    req_builder = req_builder.query(&[("query", &p_query_query.to_string())]);
732    if let Some(ref user_agent) = configuration.user_agent {
733        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
734    }
735    if let Some(ref token) = configuration.bearer_access_token {
736        req_builder = req_builder.bearer_auth(token.to_owned());
737    };
738    req_builder = req_builder.json(&p_body_flow_challenge_response_request);
739
740    let req = req_builder.build()?;
741    let resp = configuration.client.execute(req).await?;
742
743    let status = resp.status();
744    let content_type = resp
745        .headers()
746        .get("content-type")
747        .and_then(|v| v.to_str().ok())
748        .unwrap_or("application/octet-stream");
749    let content_type = super::ContentType::from(content_type);
750
751    if !status.is_client_error() && !status.is_server_error() {
752        let content = resp.text().await?;
753        match content_type {
754            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
755            ContentType::Text => {
756                return Err(Error::from(serde_json::Error::custom(
757                    "Received `text/plain` content type response that cannot be converted to `models::ChallengeTypes`",
758                )))
759            }
760            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
761                "Received `{unknown_type}` content type response that cannot be converted to `models::ChallengeTypes`"
762            )))),
763        }
764    } else {
765        let content = resp.text().await?;
766        let entity: Option<FlowsExecutorSolveError> = serde_json::from_str(&content).ok();
767        Err(Error::ResponseError(ResponseContent {
768            status,
769            content,
770            entity,
771        }))
772    }
773}
774
775/// Get current flow state and record it
776pub async fn flows_inspector_get(
777    configuration: &configuration::Configuration,
778    flow_slug: &str,
779) -> Result<models::FlowInspection, Error<FlowsInspectorGetError>> {
780    // add a prefix to parameters to efficiently prevent name collisions
781    let p_path_flow_slug = flow_slug;
782
783    let uri_str = format!(
784        "{}/flows/inspector/{flow_slug}/",
785        configuration.base_path,
786        flow_slug = crate::apis::urlencode(p_path_flow_slug)
787    );
788    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
789
790    if let Some(ref user_agent) = configuration.user_agent {
791        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
792    }
793    if let Some(ref token) = configuration.bearer_access_token {
794        req_builder = req_builder.bearer_auth(token.to_owned());
795    };
796
797    let req = req_builder.build()?;
798    let resp = configuration.client.execute(req).await?;
799
800    let status = resp.status();
801    let content_type = resp
802        .headers()
803        .get("content-type")
804        .and_then(|v| v.to_str().ok())
805        .unwrap_or("application/octet-stream");
806    let content_type = super::ContentType::from(content_type);
807
808    if !status.is_client_error() && !status.is_server_error() {
809        let content = resp.text().await?;
810        match content_type {
811            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
812            ContentType::Text => {
813                return Err(Error::from(serde_json::Error::custom(
814                    "Received `text/plain` content type response that cannot be converted to `models::FlowInspection`",
815                )))
816            }
817            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
818                "Received `{unknown_type}` content type response that cannot be converted to `models::FlowInspection`"
819            )))),
820        }
821    } else {
822        let content = resp.text().await?;
823        let entity: Option<FlowsInspectorGetError> = serde_json::from_str(&content).ok();
824        Err(Error::ResponseError(ResponseContent {
825            status,
826            content,
827            entity,
828        }))
829    }
830}
831
832/// Clear flow cache
833pub async fn flows_instances_cache_clear_create(
834    configuration: &configuration::Configuration,
835) -> Result<(), Error<FlowsInstancesCacheClearCreateError>> {
836    let uri_str = format!("{}/flows/instances/cache_clear/", configuration.base_path);
837    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
838
839    if let Some(ref user_agent) = configuration.user_agent {
840        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
841    }
842    if let Some(ref token) = configuration.bearer_access_token {
843        req_builder = req_builder.bearer_auth(token.to_owned());
844    };
845
846    let req = req_builder.build()?;
847    let resp = configuration.client.execute(req).await?;
848
849    let status = resp.status();
850
851    if !status.is_client_error() && !status.is_server_error() {
852        Ok(())
853    } else {
854        let content = resp.text().await?;
855        let entity: Option<FlowsInstancesCacheClearCreateError> = serde_json::from_str(&content).ok();
856        Err(Error::ResponseError(ResponseContent {
857            status,
858            content,
859            entity,
860        }))
861    }
862}
863
864/// Info about cached flows
865pub async fn flows_instances_cache_info_retrieve(
866    configuration: &configuration::Configuration,
867) -> Result<models::Cache, Error<FlowsInstancesCacheInfoRetrieveError>> {
868    let uri_str = format!("{}/flows/instances/cache_info/", configuration.base_path);
869    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
870
871    if let Some(ref user_agent) = configuration.user_agent {
872        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
873    }
874    if let Some(ref token) = configuration.bearer_access_token {
875        req_builder = req_builder.bearer_auth(token.to_owned());
876    };
877
878    let req = req_builder.build()?;
879    let resp = configuration.client.execute(req).await?;
880
881    let status = resp.status();
882    let content_type = resp
883        .headers()
884        .get("content-type")
885        .and_then(|v| v.to_str().ok())
886        .unwrap_or("application/octet-stream");
887    let content_type = super::ContentType::from(content_type);
888
889    if !status.is_client_error() && !status.is_server_error() {
890        let content = resp.text().await?;
891        match content_type {
892            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
893            ContentType::Text => {
894                return Err(Error::from(serde_json::Error::custom(
895                    "Received `text/plain` content type response that cannot be converted to `models::Cache`",
896                )))
897            }
898            ContentType::Unsupported(unknown_type) => {
899                return Err(Error::from(serde_json::Error::custom(format!(
900                    "Received `{unknown_type}` content type response that cannot be converted to `models::Cache`"
901                ))))
902            }
903        }
904    } else {
905        let content = resp.text().await?;
906        let entity: Option<FlowsInstancesCacheInfoRetrieveError> = serde_json::from_str(&content).ok();
907        Err(Error::ResponseError(ResponseContent {
908            status,
909            content,
910            entity,
911        }))
912    }
913}
914
915/// Flow Viewset
916pub async fn flows_instances_create(
917    configuration: &configuration::Configuration,
918    flow_request: models::FlowRequest,
919) -> Result<models::Flow, Error<FlowsInstancesCreateError>> {
920    // add a prefix to parameters to efficiently prevent name collisions
921    let p_body_flow_request = flow_request;
922
923    let uri_str = format!("{}/flows/instances/", configuration.base_path);
924    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
925
926    if let Some(ref user_agent) = configuration.user_agent {
927        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
928    }
929    if let Some(ref token) = configuration.bearer_access_token {
930        req_builder = req_builder.bearer_auth(token.to_owned());
931    };
932    req_builder = req_builder.json(&p_body_flow_request);
933
934    let req = req_builder.build()?;
935    let resp = configuration.client.execute(req).await?;
936
937    let status = resp.status();
938    let content_type = resp
939        .headers()
940        .get("content-type")
941        .and_then(|v| v.to_str().ok())
942        .unwrap_or("application/octet-stream");
943    let content_type = super::ContentType::from(content_type);
944
945    if !status.is_client_error() && !status.is_server_error() {
946        let content = resp.text().await?;
947        match content_type {
948            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
949            ContentType::Text => {
950                return Err(Error::from(serde_json::Error::custom(
951                    "Received `text/plain` content type response that cannot be converted to `models::Flow`",
952                )))
953            }
954            ContentType::Unsupported(unknown_type) => {
955                return Err(Error::from(serde_json::Error::custom(format!(
956                    "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
957                ))))
958            }
959        }
960    } else {
961        let content = resp.text().await?;
962        let entity: Option<FlowsInstancesCreateError> = serde_json::from_str(&content).ok();
963        Err(Error::ResponseError(ResponseContent {
964            status,
965            content,
966            entity,
967        }))
968    }
969}
970
971/// Flow Viewset
972pub async fn flows_instances_destroy(
973    configuration: &configuration::Configuration,
974    slug: &str,
975) -> Result<(), Error<FlowsInstancesDestroyError>> {
976    // add a prefix to parameters to efficiently prevent name collisions
977    let p_path_slug = slug;
978
979    let uri_str = format!(
980        "{}/flows/instances/{slug}/",
981        configuration.base_path,
982        slug = crate::apis::urlencode(p_path_slug)
983    );
984    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
985
986    if let Some(ref user_agent) = configuration.user_agent {
987        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
988    }
989    if let Some(ref token) = configuration.bearer_access_token {
990        req_builder = req_builder.bearer_auth(token.to_owned());
991    };
992
993    let req = req_builder.build()?;
994    let resp = configuration.client.execute(req).await?;
995
996    let status = resp.status();
997
998    if !status.is_client_error() && !status.is_server_error() {
999        Ok(())
1000    } else {
1001        let content = resp.text().await?;
1002        let entity: Option<FlowsInstancesDestroyError> = serde_json::from_str(&content).ok();
1003        Err(Error::ResponseError(ResponseContent {
1004            status,
1005            content,
1006            entity,
1007        }))
1008    }
1009}
1010
1011/// Return diagram for flow with slug `slug`, in the format used by flowchart.js
1012pub async fn flows_instances_diagram_retrieve(
1013    configuration: &configuration::Configuration,
1014    slug: &str,
1015) -> Result<models::FlowDiagram, Error<FlowsInstancesDiagramRetrieveError>> {
1016    // add a prefix to parameters to efficiently prevent name collisions
1017    let p_path_slug = slug;
1018
1019    let uri_str = format!(
1020        "{}/flows/instances/{slug}/diagram/",
1021        configuration.base_path,
1022        slug = crate::apis::urlencode(p_path_slug)
1023    );
1024    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1025
1026    if let Some(ref user_agent) = configuration.user_agent {
1027        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1028    }
1029    if let Some(ref token) = configuration.bearer_access_token {
1030        req_builder = req_builder.bearer_auth(token.to_owned());
1031    };
1032
1033    let req = req_builder.build()?;
1034    let resp = configuration.client.execute(req).await?;
1035
1036    let status = resp.status();
1037    let content_type = resp
1038        .headers()
1039        .get("content-type")
1040        .and_then(|v| v.to_str().ok())
1041        .unwrap_or("application/octet-stream");
1042    let content_type = super::ContentType::from(content_type);
1043
1044    if !status.is_client_error() && !status.is_server_error() {
1045        let content = resp.text().await?;
1046        match content_type {
1047            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1048            ContentType::Text => {
1049                return Err(Error::from(serde_json::Error::custom(
1050                    "Received `text/plain` content type response that cannot be converted to `models::FlowDiagram`",
1051                )))
1052            }
1053            ContentType::Unsupported(unknown_type) => {
1054                return Err(Error::from(serde_json::Error::custom(format!(
1055                    "Received `{unknown_type}` content type response that cannot be converted to `models::FlowDiagram`"
1056                ))))
1057            }
1058        }
1059    } else {
1060        let content = resp.text().await?;
1061        let entity: Option<FlowsInstancesDiagramRetrieveError> = serde_json::from_str(&content).ok();
1062        Err(Error::ResponseError(ResponseContent {
1063            status,
1064            content,
1065            entity,
1066        }))
1067    }
1068}
1069
1070/// Execute flow for current user
1071pub async fn flows_instances_execute_retrieve(
1072    configuration: &configuration::Configuration,
1073    slug: &str,
1074) -> Result<models::Link, Error<FlowsInstancesExecuteRetrieveError>> {
1075    // add a prefix to parameters to efficiently prevent name collisions
1076    let p_path_slug = slug;
1077
1078    let uri_str = format!(
1079        "{}/flows/instances/{slug}/execute/",
1080        configuration.base_path,
1081        slug = crate::apis::urlencode(p_path_slug)
1082    );
1083    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1084
1085    if let Some(ref user_agent) = configuration.user_agent {
1086        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1087    }
1088    if let Some(ref token) = configuration.bearer_access_token {
1089        req_builder = req_builder.bearer_auth(token.to_owned());
1090    };
1091
1092    let req = req_builder.build()?;
1093    let resp = configuration.client.execute(req).await?;
1094
1095    let status = resp.status();
1096    let content_type = resp
1097        .headers()
1098        .get("content-type")
1099        .and_then(|v| v.to_str().ok())
1100        .unwrap_or("application/octet-stream");
1101    let content_type = super::ContentType::from(content_type);
1102
1103    if !status.is_client_error() && !status.is_server_error() {
1104        let content = resp.text().await?;
1105        match content_type {
1106            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1107            ContentType::Text => {
1108                return Err(Error::from(serde_json::Error::custom(
1109                    "Received `text/plain` content type response that cannot be converted to `models::Link`",
1110                )))
1111            }
1112            ContentType::Unsupported(unknown_type) => {
1113                return Err(Error::from(serde_json::Error::custom(format!(
1114                    "Received `{unknown_type}` content type response that cannot be converted to `models::Link`"
1115                ))))
1116            }
1117        }
1118    } else {
1119        let content = resp.text().await?;
1120        let entity: Option<FlowsInstancesExecuteRetrieveError> = serde_json::from_str(&content).ok();
1121        Err(Error::ResponseError(ResponseContent {
1122            status,
1123            content,
1124            entity,
1125        }))
1126    }
1127}
1128
1129/// Export flow to .yaml file
1130pub async fn flows_instances_export_retrieve(
1131    configuration: &configuration::Configuration,
1132    slug: &str,
1133) -> Result<reqwest::Response, Error<FlowsInstancesExportRetrieveError>> {
1134    // add a prefix to parameters to efficiently prevent name collisions
1135    let p_path_slug = slug;
1136
1137    let uri_str = format!(
1138        "{}/flows/instances/{slug}/export/",
1139        configuration.base_path,
1140        slug = crate::apis::urlencode(p_path_slug)
1141    );
1142    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1143
1144    if let Some(ref user_agent) = configuration.user_agent {
1145        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1146    }
1147    if let Some(ref token) = configuration.bearer_access_token {
1148        req_builder = req_builder.bearer_auth(token.to_owned());
1149    };
1150
1151    let req = req_builder.build()?;
1152    let resp = configuration.client.execute(req).await?;
1153
1154    let status = resp.status();
1155
1156    if !status.is_client_error() && !status.is_server_error() {
1157        Ok(resp)
1158    } else {
1159        let content = resp.text().await?;
1160        let entity: Option<FlowsInstancesExportRetrieveError> = serde_json::from_str(&content).ok();
1161        Err(Error::ResponseError(ResponseContent {
1162            status,
1163            content,
1164            entity,
1165        }))
1166    }
1167}
1168
1169/// Import flow from .yaml file
1170pub async fn flows_instances_import_create(
1171    configuration: &configuration::Configuration,
1172    file: Option<std::path::PathBuf>,
1173    clear: Option<bool>,
1174) -> Result<models::FlowImportResult, Error<FlowsInstancesImportCreateError>> {
1175    // add a prefix to parameters to efficiently prevent name collisions
1176    let p_form_file = file;
1177    let p_form_clear = clear;
1178
1179    let uri_str = format!("{}/flows/instances/import/", configuration.base_path);
1180    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1181
1182    if let Some(ref user_agent) = configuration.user_agent {
1183        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1184    }
1185    if let Some(ref token) = configuration.bearer_access_token {
1186        req_builder = req_builder.bearer_auth(token.to_owned());
1187    };
1188    let mut multipart_form = reqwest::multipart::Form::new();
1189    // TODO: support file upload for 'file' parameter
1190    if let Some(param_value) = p_form_clear {
1191        multipart_form = multipart_form.text("clear", param_value.to_string());
1192    }
1193    req_builder = req_builder.multipart(multipart_form);
1194
1195    let req = req_builder.build()?;
1196    let resp = configuration.client.execute(req).await?;
1197
1198    let status = resp.status();
1199    let content_type = resp
1200        .headers()
1201        .get("content-type")
1202        .and_then(|v| v.to_str().ok())
1203        .unwrap_or("application/octet-stream");
1204    let content_type = super::ContentType::from(content_type);
1205
1206    if !status.is_client_error() && !status.is_server_error() {
1207        let content = resp.text().await?;
1208        match content_type {
1209            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1210            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FlowImportResult`"))),
1211            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`")))),
1212        }
1213    } else {
1214        let content = resp.text().await?;
1215        let entity: Option<FlowsInstancesImportCreateError> = serde_json::from_str(&content).ok();
1216        Err(Error::ResponseError(ResponseContent {
1217            status,
1218            content,
1219            entity,
1220        }))
1221    }
1222}
1223
1224/// Flow Viewset
1225pub async fn flows_instances_list(
1226    configuration: &configuration::Configuration,
1227    denied_action: Option<&str>,
1228    designation: Option<&str>,
1229    flow_uuid: Option<&str>,
1230    name: Option<&str>,
1231    ordering: Option<&str>,
1232    page: Option<i32>,
1233    page_size: Option<i32>,
1234    search: Option<&str>,
1235    slug: Option<&str>,
1236) -> Result<models::PaginatedFlowList, Error<FlowsInstancesListError>> {
1237    // add a prefix to parameters to efficiently prevent name collisions
1238    let p_query_denied_action = denied_action;
1239    let p_query_designation = designation;
1240    let p_query_flow_uuid = flow_uuid;
1241    let p_query_name = name;
1242    let p_query_ordering = ordering;
1243    let p_query_page = page;
1244    let p_query_page_size = page_size;
1245    let p_query_search = search;
1246    let p_query_slug = slug;
1247
1248    let uri_str = format!("{}/flows/instances/", configuration.base_path);
1249    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1250
1251    if let Some(ref param_value) = p_query_denied_action {
1252        req_builder = req_builder.query(&[("denied_action", &param_value.to_string())]);
1253    }
1254    if let Some(ref param_value) = p_query_designation {
1255        req_builder = req_builder.query(&[("designation", &param_value.to_string())]);
1256    }
1257    if let Some(ref param_value) = p_query_flow_uuid {
1258        req_builder = req_builder.query(&[("flow_uuid", &param_value.to_string())]);
1259    }
1260    if let Some(ref param_value) = p_query_name {
1261        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
1262    }
1263    if let Some(ref param_value) = p_query_ordering {
1264        req_builder = req_builder.query(&[("ordering", &param_value.to_string())]);
1265    }
1266    if let Some(ref param_value) = p_query_page {
1267        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1268    }
1269    if let Some(ref param_value) = p_query_page_size {
1270        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
1271    }
1272    if let Some(ref param_value) = p_query_search {
1273        req_builder = req_builder.query(&[("search", &param_value.to_string())]);
1274    }
1275    if let Some(ref param_value) = p_query_slug {
1276        req_builder = req_builder.query(&[("slug", &param_value.to_string())]);
1277    }
1278    if let Some(ref user_agent) = configuration.user_agent {
1279        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1280    }
1281    if let Some(ref token) = configuration.bearer_access_token {
1282        req_builder = req_builder.bearer_auth(token.to_owned());
1283    };
1284
1285    let req = req_builder.build()?;
1286    let resp = configuration.client.execute(req).await?;
1287
1288    let status = resp.status();
1289    let content_type = resp
1290        .headers()
1291        .get("content-type")
1292        .and_then(|v| v.to_str().ok())
1293        .unwrap_or("application/octet-stream");
1294    let content_type = super::ContentType::from(content_type);
1295
1296    if !status.is_client_error() && !status.is_server_error() {
1297        let content = resp.text().await?;
1298        match content_type {
1299            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1300            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedFlowList`"))),
1301            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`")))),
1302        }
1303    } else {
1304        let content = resp.text().await?;
1305        let entity: Option<FlowsInstancesListError> = serde_json::from_str(&content).ok();
1306        Err(Error::ResponseError(ResponseContent {
1307            status,
1308            content,
1309            entity,
1310        }))
1311    }
1312}
1313
1314/// Flow Viewset
1315pub async fn flows_instances_partial_update(
1316    configuration: &configuration::Configuration,
1317    slug: &str,
1318    patched_flow_request: Option<models::PatchedFlowRequest>,
1319) -> Result<models::Flow, Error<FlowsInstancesPartialUpdateError>> {
1320    // add a prefix to parameters to efficiently prevent name collisions
1321    let p_path_slug = slug;
1322    let p_body_patched_flow_request = patched_flow_request;
1323
1324    let uri_str = format!(
1325        "{}/flows/instances/{slug}/",
1326        configuration.base_path,
1327        slug = crate::apis::urlencode(p_path_slug)
1328    );
1329    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1330
1331    if let Some(ref user_agent) = configuration.user_agent {
1332        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1333    }
1334    if let Some(ref token) = configuration.bearer_access_token {
1335        req_builder = req_builder.bearer_auth(token.to_owned());
1336    };
1337    req_builder = req_builder.json(&p_body_patched_flow_request);
1338
1339    let req = req_builder.build()?;
1340    let resp = configuration.client.execute(req).await?;
1341
1342    let status = resp.status();
1343    let content_type = resp
1344        .headers()
1345        .get("content-type")
1346        .and_then(|v| v.to_str().ok())
1347        .unwrap_or("application/octet-stream");
1348    let content_type = super::ContentType::from(content_type);
1349
1350    if !status.is_client_error() && !status.is_server_error() {
1351        let content = resp.text().await?;
1352        match content_type {
1353            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1354            ContentType::Text => {
1355                return Err(Error::from(serde_json::Error::custom(
1356                    "Received `text/plain` content type response that cannot be converted to `models::Flow`",
1357                )))
1358            }
1359            ContentType::Unsupported(unknown_type) => {
1360                return Err(Error::from(serde_json::Error::custom(format!(
1361                    "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
1362                ))))
1363            }
1364        }
1365    } else {
1366        let content = resp.text().await?;
1367        let entity: Option<FlowsInstancesPartialUpdateError> = serde_json::from_str(&content).ok();
1368        Err(Error::ResponseError(ResponseContent {
1369            status,
1370            content,
1371            entity,
1372        }))
1373    }
1374}
1375
1376/// Flow Viewset
1377pub async fn flows_instances_retrieve(
1378    configuration: &configuration::Configuration,
1379    slug: &str,
1380) -> Result<models::Flow, Error<FlowsInstancesRetrieveError>> {
1381    // add a prefix to parameters to efficiently prevent name collisions
1382    let p_path_slug = slug;
1383
1384    let uri_str = format!(
1385        "{}/flows/instances/{slug}/",
1386        configuration.base_path,
1387        slug = crate::apis::urlencode(p_path_slug)
1388    );
1389    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1390
1391    if let Some(ref user_agent) = configuration.user_agent {
1392        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1393    }
1394    if let Some(ref token) = configuration.bearer_access_token {
1395        req_builder = req_builder.bearer_auth(token.to_owned());
1396    };
1397
1398    let req = req_builder.build()?;
1399    let resp = configuration.client.execute(req).await?;
1400
1401    let status = resp.status();
1402    let content_type = resp
1403        .headers()
1404        .get("content-type")
1405        .and_then(|v| v.to_str().ok())
1406        .unwrap_or("application/octet-stream");
1407    let content_type = super::ContentType::from(content_type);
1408
1409    if !status.is_client_error() && !status.is_server_error() {
1410        let content = resp.text().await?;
1411        match content_type {
1412            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1413            ContentType::Text => {
1414                return Err(Error::from(serde_json::Error::custom(
1415                    "Received `text/plain` content type response that cannot be converted to `models::Flow`",
1416                )))
1417            }
1418            ContentType::Unsupported(unknown_type) => {
1419                return Err(Error::from(serde_json::Error::custom(format!(
1420                    "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
1421                ))))
1422            }
1423        }
1424    } else {
1425        let content = resp.text().await?;
1426        let entity: Option<FlowsInstancesRetrieveError> = serde_json::from_str(&content).ok();
1427        Err(Error::ResponseError(ResponseContent {
1428            status,
1429            content,
1430            entity,
1431        }))
1432    }
1433}
1434
1435/// Flow Viewset
1436pub async fn flows_instances_update(
1437    configuration: &configuration::Configuration,
1438    slug: &str,
1439    flow_request: models::FlowRequest,
1440) -> Result<models::Flow, Error<FlowsInstancesUpdateError>> {
1441    // add a prefix to parameters to efficiently prevent name collisions
1442    let p_path_slug = slug;
1443    let p_body_flow_request = flow_request;
1444
1445    let uri_str = format!(
1446        "{}/flows/instances/{slug}/",
1447        configuration.base_path,
1448        slug = crate::apis::urlencode(p_path_slug)
1449    );
1450    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1451
1452    if let Some(ref user_agent) = configuration.user_agent {
1453        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1454    }
1455    if let Some(ref token) = configuration.bearer_access_token {
1456        req_builder = req_builder.bearer_auth(token.to_owned());
1457    };
1458    req_builder = req_builder.json(&p_body_flow_request);
1459
1460    let req = req_builder.build()?;
1461    let resp = configuration.client.execute(req).await?;
1462
1463    let status = resp.status();
1464    let content_type = resp
1465        .headers()
1466        .get("content-type")
1467        .and_then(|v| v.to_str().ok())
1468        .unwrap_or("application/octet-stream");
1469    let content_type = super::ContentType::from(content_type);
1470
1471    if !status.is_client_error() && !status.is_server_error() {
1472        let content = resp.text().await?;
1473        match content_type {
1474            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1475            ContentType::Text => {
1476                return Err(Error::from(serde_json::Error::custom(
1477                    "Received `text/plain` content type response that cannot be converted to `models::Flow`",
1478                )))
1479            }
1480            ContentType::Unsupported(unknown_type) => {
1481                return Err(Error::from(serde_json::Error::custom(format!(
1482                    "Received `{unknown_type}` content type response that cannot be converted to `models::Flow`"
1483                ))))
1484            }
1485        }
1486    } else {
1487        let content = resp.text().await?;
1488        let entity: Option<FlowsInstancesUpdateError> = serde_json::from_str(&content).ok();
1489        Err(Error::ResponseError(ResponseContent {
1490            status,
1491            content,
1492            entity,
1493        }))
1494    }
1495}
1496
1497/// Get a list of all objects that use this object
1498pub async fn flows_instances_used_by_list(
1499    configuration: &configuration::Configuration,
1500    slug: &str,
1501) -> Result<Vec<models::UsedBy>, Error<FlowsInstancesUsedByListError>> {
1502    // add a prefix to parameters to efficiently prevent name collisions
1503    let p_path_slug = slug;
1504
1505    let uri_str = format!(
1506        "{}/flows/instances/{slug}/used_by/",
1507        configuration.base_path,
1508        slug = crate::apis::urlencode(p_path_slug)
1509    );
1510    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1511
1512    if let Some(ref user_agent) = configuration.user_agent {
1513        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1514    }
1515    if let Some(ref token) = configuration.bearer_access_token {
1516        req_builder = req_builder.bearer_auth(token.to_owned());
1517    };
1518
1519    let req = req_builder.build()?;
1520    let resp = configuration.client.execute(req).await?;
1521
1522    let status = resp.status();
1523    let content_type = resp
1524        .headers()
1525        .get("content-type")
1526        .and_then(|v| v.to_str().ok())
1527        .unwrap_or("application/octet-stream");
1528    let content_type = super::ContentType::from(content_type);
1529
1530    if !status.is_client_error() && !status.is_server_error() {
1531        let content = resp.text().await?;
1532        match content_type {
1533            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1534            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::UsedBy&gt;`"))),
1535            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&lt;models::UsedBy&gt;`")))),
1536        }
1537    } else {
1538        let content = resp.text().await?;
1539        let entity: Option<FlowsInstancesUsedByListError> = serde_json::from_str(&content).ok();
1540        Err(Error::ResponseError(ResponseContent {
1541            status,
1542            content,
1543            entity,
1544        }))
1545    }
1546}