authentik_client/models/
telegram_source_request.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TelegramSourceRequest {
17 #[serde(rename = "name")]
19 pub name: String,
20 #[serde(rename = "slug")]
22 pub slug: String,
23 #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
24 pub enabled: Option<bool>,
25 #[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 #[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 #[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 #[serde(rename = "bot_username")]
54 pub bot_username: String,
55 #[serde(rename = "bot_token")]
57 pub bot_token: String,
58 #[serde(rename = "request_message_access", skip_serializing_if = "Option::is_none")]
60 pub request_message_access: Option<bool>,
61 #[serde(rename = "pre_authentication_flow")]
63 pub pre_authentication_flow: uuid::Uuid,
64}
65
66impl TelegramSourceRequest {
67 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}