use crate::PlatformConfig;
use std::sync::Arc;
#[derive(Debug, Clone)]
pub struct PlatformService {
config: Arc<PlatformConfig>,
}
impl PlatformService {
pub fn new(config: PlatformConfig) -> Self {
Self {
config: Arc::new(config),
}
}
pub fn config(&self) -> Arc<PlatformConfig> {
self.config.clone()
}
#[cfg(feature = "app-engine")]
pub fn app_engine(&self) -> crate::app_engine::AppEngineService {
crate::app_engine::AppEngineService::new(self.config.clone())
}
#[cfg(feature = "directory")]
pub fn directory(&self) -> crate::directory::DirectoryService {
crate::directory::DirectoryService::new(self.config.clone())
}
#[cfg(feature = "admin")]
pub fn admin(&self) -> crate::admin::AdminService {
crate::admin::AdminService::new(self.config.clone())
}
#[cfg(feature = "spark")]
pub fn spark(&self) -> crate::spark::SparkService {
crate::spark::SparkService::new(self.config.clone())
}
}
#[cfg(test)]
mod tests {
use crate::{PlatformConfig, PlatformService};
#[test]
fn test_service_creation() {
let config = PlatformConfig::builder()
.app_id("test_app_id")
.app_secret("test_app_secret")
.build();
let _service = PlatformService::new(config);
}
}