Skip to main content

server_watchdog/domain/config/
client.rs

1use serde::{Deserialize, Serialize};
2use struct_input::StructInput;
3
4#[derive(Serialize, Deserialize, Clone, Debug, StructInput)]
5pub struct ClientConfig {
6    #[struct_input(format="Name")]
7    pub name: String,
8    #[struct_input(format="Name", message="--- kind (ex: telegram) ---")]
9    pub kind: String, // ex: telegram
10    #[struct_input(format="NotAllowWhitespace")]
11    pub token: Option<String>
12}
13
14impl ClientConfig {
15    pub fn new_telegram(name: &str, token: &str) -> Self {
16        Self {
17            name: String::from(name),
18            kind: String::from("telegram"),
19            token: Some(String::from(token))
20        }
21    }
22}