Skip to main content

authentik_client/apis/
flows_api.rs

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