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 {
15 Self {
16 config: Arc::new(config),
17 }
18 }
19
20 #[cfg(feature = "v1")]
21 pub fn v1(&self) -> crate::application::application::v1::ApplicationV1 {
22 crate::application::application::v1::ApplicationV1::new(self.config.clone())
23 }
24}
25
26#[cfg(test)]
27#[allow(unused_imports)]
28mod tests {
29
30 #[test]
31 fn test_serialization_roundtrip() {
32 let json = r#"{"test": "value"}"#;
34 assert!(serde_json::from_str::<serde_json::Value>(json).is_ok());
35 }
36
37 #[test]
38 fn test_deserialization_from_json() {
39 let json = r#"{"field": "data"}"#;
41 let value: serde_json::Value = serde_json::from_str(json).unwrap();
42 assert_eq!(value["field"], "data");
43 }
44}