authentik_client/models/
telegram_source.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 crate::models;
12use serde::{Deserialize, Serialize};
13
14/// TelegramSource : Source Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TelegramSource {
17    #[serde(rename = "pk")]
18    pub pk: uuid::Uuid,
19    /// Source's display Name.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// Internal source name, used in URLs.
23    #[serde(rename = "slug")]
24    pub slug: String,
25    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
26    pub enabled: Option<bool>,
27    /// When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
28    #[serde(rename = "promoted", skip_serializing_if = "Option::is_none")]
29    pub promoted: Option<bool>,
30    /// Flow to use when authenticating existing users.
31    #[serde(
32        rename = "authentication_flow",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub authentication_flow: Option<Option<uuid::Uuid>>,
38    /// Flow to use when enrolling new users.
39    #[serde(
40        rename = "enrollment_flow",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub enrollment_flow: Option<Option<uuid::Uuid>>,
46    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
47    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
48    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
49    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
50    /// Get object component so that we know how to edit the object
51    #[serde(rename = "component")]
52    pub component: String,
53    /// Return object's verbose_name
54    #[serde(rename = "verbose_name")]
55    pub verbose_name: String,
56    /// Return object's plural verbose_name
57    #[serde(rename = "verbose_name_plural")]
58    pub verbose_name_plural: String,
59    /// Return internal model name
60    #[serde(rename = "meta_model_name")]
61    pub meta_model_name: String,
62    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
63    pub policy_engine_mode: Option<models::PolicyEngineMode>,
64    /// How the source determines if an existing user should be authenticated or a new user enrolled.
65    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
66    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
67    /// Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
68    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
69    pub managed: Option<String>,
70    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
71    pub user_path_template: Option<String>,
72    #[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
73    pub icon: Option<String>,
74    #[serde(rename = "icon_url", deserialize_with = "Option::deserialize")]
75    pub icon_url: Option<String>,
76    /// Telegram bot username
77    #[serde(rename = "bot_username")]
78    pub bot_username: String,
79    /// Request access to send messages from your bot.
80    #[serde(rename = "request_message_access", skip_serializing_if = "Option::is_none")]
81    pub request_message_access: Option<bool>,
82    /// Flow used before authentication.
83    #[serde(rename = "pre_authentication_flow")]
84    pub pre_authentication_flow: uuid::Uuid,
85}
86
87impl TelegramSource {
88    /// Source Serializer
89    pub fn new(
90        pk: uuid::Uuid,
91        name: String,
92        slug: String,
93        component: String,
94        verbose_name: String,
95        verbose_name_plural: String,
96        meta_model_name: String,
97        managed: Option<String>,
98        icon_url: Option<String>,
99        bot_username: String,
100        pre_authentication_flow: uuid::Uuid,
101    ) -> TelegramSource {
102        TelegramSource {
103            pk,
104            name,
105            slug,
106            enabled: None,
107            promoted: None,
108            authentication_flow: None,
109            enrollment_flow: None,
110            user_property_mappings: None,
111            group_property_mappings: None,
112            component,
113            verbose_name,
114            verbose_name_plural,
115            meta_model_name,
116            policy_engine_mode: None,
117            user_matching_mode: None,
118            managed,
119            user_path_template: None,
120            icon: None,
121            icon_url,
122            bot_username,
123            request_message_access: None,
124            pre_authentication_flow,
125        }
126    }
127}