Skip to main content

authentik_client/models/
telegram_source_request.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 crate::models;
12use serde::{Deserialize, Serialize};
13
14/// TelegramSourceRequest : Source Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TelegramSourceRequest {
17    /// Source's display Name.
18    #[serde(rename = "name")]
19    pub name: String,
20    /// Internal source name, used in URLs.
21    #[serde(rename = "slug")]
22    pub slug: String,
23    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
24    pub enabled: Option<bool>,
25    /// When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
26    #[serde(rename = "promoted", skip_serializing_if = "Option::is_none")]
27    pub promoted: Option<bool>,
28    /// Flow to use when authenticating existing users.
29    #[serde(
30        rename = "authentication_flow",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub authentication_flow: Option<Option<uuid::Uuid>>,
36    /// Flow to use when enrolling new users.
37    #[serde(
38        rename = "enrollment_flow",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub enrollment_flow: Option<Option<uuid::Uuid>>,
44    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
45    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
46    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
47    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
48    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
49    pub policy_engine_mode: Option<models::PolicyEngineMode>,
50    /// How the source determines if an existing user should be authenticated or a new user enrolled.
51    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
52    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
53    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
54    pub user_path_template: Option<String>,
55    #[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
56    pub icon: Option<String>,
57    /// Telegram bot username
58    #[serde(rename = "bot_username")]
59    pub bot_username: String,
60    /// Telegram bot token
61    #[serde(rename = "bot_token")]
62    pub bot_token: String,
63    /// Request access to send messages from your bot.
64    #[serde(rename = "request_message_access", skip_serializing_if = "Option::is_none")]
65    pub request_message_access: Option<bool>,
66    /// Flow used before authentication.
67    #[serde(rename = "pre_authentication_flow")]
68    pub pre_authentication_flow: uuid::Uuid,
69}
70
71impl TelegramSourceRequest {
72    /// Source Serializer
73    pub fn new(
74        name: String,
75        slug: String,
76        bot_username: String,
77        bot_token: String,
78        pre_authentication_flow: uuid::Uuid,
79    ) -> TelegramSourceRequest {
80        TelegramSourceRequest {
81            name,
82            slug,
83            enabled: None,
84            promoted: None,
85            authentication_flow: None,
86            enrollment_flow: None,
87            user_property_mappings: None,
88            group_property_mappings: None,
89            policy_engine_mode: None,
90            user_matching_mode: None,
91            user_path_template: None,
92            icon: None,
93            bot_username,
94            bot_token,
95            request_message_access: None,
96            pre_authentication_flow,
97        }
98    }
99}