authentik_client/models/
telegram_source_request.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.10.2
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    /// Flow to use when authenticating existing users.
26    #[serde(
27        rename = "authentication_flow",
28        default,
29        with = "::serde_with::rust::double_option",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub authentication_flow: Option<Option<uuid::Uuid>>,
33    /// Flow to use when enrolling new users.
34    #[serde(
35        rename = "enrollment_flow",
36        default,
37        with = "::serde_with::rust::double_option",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub enrollment_flow: Option<Option<uuid::Uuid>>,
41    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
42    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
43    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
44    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
45    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
46    pub policy_engine_mode: Option<models::PolicyEngineMode>,
47    /// How the source determines if an existing user should be authenticated or a new user enrolled.
48    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
49    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
50    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
51    pub user_path_template: Option<String>,
52    /// Telegram bot username
53    #[serde(rename = "bot_username")]
54    pub bot_username: String,
55    /// Telegram bot token
56    #[serde(rename = "bot_token")]
57    pub bot_token: String,
58    /// Request access to send messages from your bot.
59    #[serde(rename = "request_message_access", skip_serializing_if = "Option::is_none")]
60    pub request_message_access: Option<bool>,
61    /// Flow used before authentication.
62    #[serde(rename = "pre_authentication_flow")]
63    pub pre_authentication_flow: uuid::Uuid,
64}
65
66impl TelegramSourceRequest {
67    /// Source Serializer
68    pub fn new(
69        name: String,
70        slug: String,
71        bot_username: String,
72        bot_token: String,
73        pre_authentication_flow: uuid::Uuid,
74    ) -> TelegramSourceRequest {
75        TelegramSourceRequest {
76            name,
77            slug,
78            enabled: None,
79            authentication_flow: None,
80            enrollment_flow: None,
81            user_property_mappings: None,
82            group_property_mappings: None,
83            policy_engine_mode: None,
84            user_matching_mode: None,
85            user_path_template: None,
86            bot_username,
87            bot_token,
88            request_message_access: None,
89            pre_authentication_flow,
90        }
91    }
92}