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 #[cfg(feature = "v1")]
27 pub fn v1(&self) -> crate::spark::spark::v1::SparkV1 {
28 crate::spark::spark::v1::SparkV1::new(self.config.clone())
29 }
30}
31
32#[cfg(feature = "v1")]
33pub mod spark;
34
35#[cfg(test)]
36mod tests {
37 use crate::{PlatformConfig, spark::SparkService};
38
39 #[test]
40 fn test_service_creation() {
41 let config = PlatformConfig::builder()
42 .app_id("test_app_id")
43 .app_secret("test_app_secret")
44 .build();
45
46 let service = SparkService::new(std::sync::Arc::new(config));
47 assert_eq!(service.config().app_id(), "test_app_id");
48 }
49}