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: 2025.10.4
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    /// Flow to use when authenticating existing users.
28    #[serde(
29        rename = "authentication_flow",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub authentication_flow: Option<Option<uuid::Uuid>>,
35    /// Flow to use when enrolling new users.
36    #[serde(
37        rename = "enrollment_flow",
38        default,
39        with = "::serde_with::rust::double_option",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub enrollment_flow: Option<Option<uuid::Uuid>>,
43    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
44    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
45    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
46    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
47    /// Get object component so that we know how to edit the object
48    #[serde(rename = "component")]
49    pub component: String,
50    /// Return object's verbose_name
51    #[serde(rename = "verbose_name")]
52    pub verbose_name: String,
53    /// Return object's plural verbose_name
54    #[serde(rename = "verbose_name_plural")]
55    pub verbose_name_plural: String,
56    /// Return internal model name
57    #[serde(rename = "meta_model_name")]
58    pub meta_model_name: String,
59    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
60    pub policy_engine_mode: Option<models::PolicyEngineMode>,
61    /// How the source determines if an existing user should be authenticated or a new user enrolled.
62    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
63    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
64    /// 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.
65    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
66    pub managed: Option<String>,
67    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
68    pub user_path_template: Option<String>,
69    #[serde(rename = "icon", deserialize_with = "Option::deserialize")]
70    pub icon: Option<String>,
71    /// Telegram bot username
72    #[serde(rename = "bot_username")]
73    pub bot_username: String,
74    /// Request access to send messages from your bot.
75    #[serde(rename = "request_message_access", skip_serializing_if = "Option::is_none")]
76    pub request_message_access: Option<bool>,
77    /// Flow used before authentication.
78    #[serde(rename = "pre_authentication_flow")]
79    pub pre_authentication_flow: uuid::Uuid,
80}
81
82impl TelegramSource {
83    /// Source Serializer
84    pub fn new(
85        pk: uuid::Uuid,
86        name: String,
87        slug: String,
88        component: String,
89        verbose_name: String,
90        verbose_name_plural: String,
91        meta_model_name: String,
92        managed: Option<String>,
93        icon: Option<String>,
94        bot_username: String,
95        pre_authentication_flow: uuid::Uuid,
96    ) -> TelegramSource {
97        TelegramSource {
98            pk,
99            name,
100            slug,
101            enabled: None,
102            authentication_flow: None,
103            enrollment_flow: None,
104            user_property_mappings: None,
105            group_property_mappings: None,
106            component,
107            verbose_name,
108            verbose_name_plural,
109            meta_model_name,
110            policy_engine_mode: None,
111            user_matching_mode: None,
112            managed,
113            user_path_template: None,
114            icon,
115            bot_username,
116            request_message_access: None,
117            pre_authentication_flow,
118        }
119    }
120}