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