authentik_rust/models/
prompt.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2024.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13/// Prompt : Prompt Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Prompt {
16    #[serde(rename = "pk")]
17    pub pk: uuid::Uuid,
18    #[serde(rename = "name")]
19    pub name: String,
20    /// Name of the form field, also used to store the value
21    #[serde(rename = "field_key")]
22    pub field_key: String,
23    #[serde(rename = "label")]
24    pub label: String,
25    #[serde(rename = "type")]
26    pub r#type: models::PromptTypeEnum,
27    #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
28    pub required: Option<bool>,
29    /// Optionally provide a short hint that describes the expected input value. When creating a fixed choice field, enable interpreting as expression and return a list to return multiple choices.
30    #[serde(rename = "placeholder", skip_serializing_if = "Option::is_none")]
31    pub placeholder: Option<String>,
32    /// Optionally pre-fill the input with an initial value. When creating a fixed choice field, enable interpreting as expression and return a list to return multiple default choices.
33    #[serde(rename = "initial_value", skip_serializing_if = "Option::is_none")]
34    pub initial_value: Option<String>,
35    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
36    pub order: Option<i32>,
37    #[serde(rename = "promptstage_set", skip_serializing_if = "Option::is_none")]
38    pub promptstage_set: Option<Vec<models::Stage>>,
39    #[serde(rename = "sub_text", skip_serializing_if = "Option::is_none")]
40    pub sub_text: Option<String>,
41    #[serde(rename = "placeholder_expression", skip_serializing_if = "Option::is_none")]
42    pub placeholder_expression: Option<bool>,
43    #[serde(rename = "initial_value_expression", skip_serializing_if = "Option::is_none")]
44    pub initial_value_expression: Option<bool>,
45}
46
47impl Prompt {
48    /// Prompt Serializer
49    pub fn new(pk: uuid::Uuid, name: String, field_key: String, label: String, r#type: models::PromptTypeEnum) -> Prompt {
50        Prompt {
51            pk,
52            name,
53            field_key,
54            label,
55            r#type,
56            required: None,
57            placeholder: None,
58            initial_value: None,
59            order: None,
60            promptstage_set: None,
61            sub_text: None,
62            placeholder_expression: None,
63            initial_value_expression: None,
64        }
65    }
66}
67