Skip to main content

authentik_client/models/
telegram_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2026.2.0
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    #[serde(rename = "icon_themed_urls", deserialize_with = "Option::deserialize")]
77    pub icon_themed_urls: Option<models::ThemedUrls>,
78    /// Telegram bot username
79    #[serde(rename = "bot_username")]
80    pub bot_username: String,
81    /// Request access to send messages from your bot.
82    #[serde(rename = "request_message_access", skip_serializing_if = "Option::is_none")]
83    pub request_message_access: Option<bool>,
84    /// Flow used before authentication.
85    #[serde(rename = "pre_authentication_flow")]
86    pub pre_authentication_flow: uuid::Uuid,
87}
88
89impl TelegramSource {
90    /// Source Serializer
91    pub fn new(
92        pk: uuid::Uuid,
93        name: String,
94        slug: String,
95        component: String,
96        verbose_name: String,
97        verbose_name_plural: String,
98        meta_model_name: String,
99        managed: Option<String>,
100        icon_url: Option<String>,
101        icon_themed_urls: Option<models::ThemedUrls>,
102        bot_username: String,
103        pre_authentication_flow: uuid::Uuid,
104    ) -> TelegramSource {
105        TelegramSource {
106            pk,
107            name,
108            slug,
109            enabled: None,
110            promoted: None,
111            authentication_flow: None,
112            enrollment_flow: None,
113            user_property_mappings: None,
114            group_property_mappings: None,
115            component,
116            verbose_name,
117            verbose_name_plural,
118            meta_model_name,
119            policy_engine_mode: None,
120            user_matching_mode: None,
121            managed,
122            user_path_template: None,
123            icon: None,
124            icon_url,
125            icon_themed_urls,
126            bot_username,
127            request_message_access: None,
128            pre_authentication_flow,
129        }
130    }
131}