1use openlark_core::config::Config;
2use std::sync::Arc;
3
4#[derive(Clone)]
8#[allow(dead_code)]
9pub struct MailService {
10 config: Arc<Config>,
11}
12
13impl MailService {
14 pub fn new(config: Config) -> Self {
16 Self {
17 config: Arc::new(config),
18 }
19 }
20
21 #[cfg(feature = "v1")]
22 pub fn mail(&self) -> crate::mail::mail::Mail {
24 crate::mail::mail::Mail::new(self.config.clone())
25 }
26
27 #[cfg(feature = "v1")]
28 pub fn mailgroup(&self) -> crate::mail::mail::v1::mailgroup::MailGroup {
30 crate::mail::mail::v1::mailgroup::MailGroup::new(self.config.clone())
31 }
32}
33
34#[cfg(test)]
35#[allow(unused_imports)]
36mod tests {
37
38 #[test]
39 fn test_serialization_roundtrip() {
40 let json = r#"{"test": "value"}"#;
42 assert!(serde_json::from_str::<serde_json::Value>(json).is_ok());
43 }
44
45 #[test]
46 fn test_deserialization_from_json() {
47 let json = r#"{"field": "data"}"#;
49 let value: serde_json::Value = serde_json::from_str(json).expect("JSON 反序列化失败");
50 assert_eq!(value["field"], "data");
51 }
52}