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