openlark_platform/
admin.rs1use crate::PlatformConfig;
6use std::sync::Arc;
7
8#[derive(Debug, Clone)]
12pub struct AdminService {
13 config: Arc<PlatformConfig>,
15}
16
17impl AdminService {
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 #[cfg(feature = "v1")]
30 pub fn v1(&self) -> crate::admin::admin::v1::AdminV1 {
31 crate::admin::admin::v1::AdminV1::new(self.config.clone())
32 }
33}
34
35#[cfg(feature = "v1")]
36pub mod admin;
37
38#[cfg(test)]
39mod tests {
40 use crate::{PlatformConfig, admin::AdminService};
41
42 #[test]
43 fn test_service_creation() {
44 let config = PlatformConfig::builder()
45 .app_id("test_app_id")
46 .app_secret("test_app_secret")
47 .build();
48
49 let service = AdminService::new(std::sync::Arc::new(config));
50 assert_eq!(service.config().app_id(), "test_app_id");
52 }
53}