1#![allow(clippy::module_inception)]
40
41mod service;
42
43pub mod common;
45
46#[cfg(feature = "app-engine")]
48pub mod app_engine;
49
50#[cfg(feature = "directory")]
51pub mod directory;
52
53#[cfg(feature = "admin")]
54pub mod admin;
55
56#[cfg(feature = "mdm")]
57pub mod mdm;
58
59#[cfg(feature = "tenant")]
60pub mod tenant;
61
62#[cfg(feature = "trust_party")]
63pub mod trust_party;
64
65#[cfg(feature = "spark")]
66pub mod spark;
67
68pub mod prelude;
70
71pub use service::PlatformService;
73
74pub use openlark_core::config::Config;
76
77pub const VERSION: &str = env!("CARGO_PKG_VERSION");
79
80pub type PlatformConfig = Config;
82
83#[cfg(test)]
84mod tests {
85 use crate::VERSION;
86
87 #[test]
88 fn test_version() {
89 assert_ne!(VERSION, "");
90 }
91
92 #[test]
93 fn test_module_composition() {
94 assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
96 }
97}
98
99#[cfg(test)]
100mod service_tests {
101 use super::*;
102 use openlark_core::constants::AppType;
103
104 fn create_test_config() -> Config {
105 Config::builder()
106 .app_id("test_app")
107 .app_secret("test_secret")
108 .app_type(AppType::SelfBuild)
109 .build()
110 }
111
112 #[test]
113 fn test_platform_service_creation() {
114 let config = create_test_config();
115 let service = PlatformService::new(config).unwrap();
116 assert!(service.config().app_id() == "test_app");
117 }
118
119 #[test]
120 fn test_platform_service_clone() {
121 let config = create_test_config();
122 let service = PlatformService::new(config).unwrap();
123 let cloned = service.clone();
124 assert!(cloned.config().app_id() == "test_app");
125 }
126
127 #[test]
128 fn test_platform_config_alias() {
129 let config: PlatformConfig = Config::builder()
130 .app_id("test_app")
131 .app_secret("test_secret")
132 .build();
133 assert!(config.app_id() == "test_app");
134 }
135
136 #[cfg(feature = "app-engine")]
137 #[test]
138 fn test_platform_service_app_engine() {
139 let config = create_test_config();
140 let service = PlatformService::new(config).unwrap();
141 let _app_engine = service.app_engine();
142 }
143
144 #[cfg(feature = "directory")]
145 #[test]
146 fn test_platform_service_directory() {
147 let config = create_test_config();
148 let service = PlatformService::new(config).unwrap();
149 let _directory = service.directory();
150 }
151
152 #[cfg(feature = "admin")]
153 #[test]
154 fn test_platform_service_admin() {
155 let config = create_test_config();
156 let service = PlatformService::new(config).unwrap();
157 let _admin = service.admin();
158 }
159
160 #[cfg(all(feature = "spark", feature = "v1"))]
161 #[test]
162 fn test_platform_service_spark() {
163 let config = create_test_config();
164 let service = PlatformService::new(config).unwrap();
165 let _request = service.spark().v1().directory().user().id_convert();
166 }
167}