openlark_platform/directory/
mod.rs1use crate::PlatformConfig;
6use std::sync::Arc;
7
8#[derive(Debug, Clone)]
12pub struct DirectoryService {
13 config: Arc<PlatformConfig>,
15}
16
17impl DirectoryService {
18 pub fn new(config: Arc<PlatformConfig>) -> Self {
20 Self { config }
21 }
22
23 pub fn config(&self) -> Arc<PlatformConfig> {
25 self.config.clone()
26 }
27
28 pub fn v1(&self) -> crate::directory::v1::DirectoryV1 {
30 crate::directory::v1::DirectoryV1::new(self.config.clone())
31 }
32}
33
34pub mod v1;
35
36#[cfg(test)]
37mod tests {
38 use crate::{PlatformConfig, directory::DirectoryService};
39
40 #[test]
41 fn test_service_creation() {
42 let config = PlatformConfig::builder()
43 .app_id("test_app_id")
44 .app_secret("test_app_secret")
45 .build();
46
47 let service = DirectoryService::new(std::sync::Arc::new(config));
48 assert_eq!(service.config().app_id(), "test_app_id");
50 }
51}