mod service;
pub mod common;
#[cfg(feature = "app-engine")]
pub mod app_engine;
#[cfg(feature = "directory")]
pub mod directory;
#[cfg(feature = "admin")]
pub mod admin;
#[cfg(feature = "mdm")]
pub mod mdm;
#[cfg(feature = "tenant")]
pub mod tenant;
#[cfg(feature = "trust_party")]
pub mod trust_party;
#[cfg(feature = "spark")]
pub mod spark;
pub mod prelude;
pub use service::PlatformService;
pub type PlatformClient = PlatformService;
pub use openlark_core::config::Config;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub type PlatformConfig = Config;
#[cfg(test)]
mod tests {
use crate::VERSION;
#[test]
fn test_version() {
assert_ne!(VERSION, "");
}
#[test]
fn test_module_composition() {
assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
}
}
#[cfg(test)]
mod service_tests {
use super::*;
use openlark_core::constants::AppType;
fn create_test_config() -> Config {
Config::builder()
.app_id("test_app")
.app_secret("test_secret")
.app_type(AppType::SelfBuild)
.build()
}
#[test]
fn test_platform_service_creation() {
let config = create_test_config();
let service = PlatformService::new(config);
assert!(service.config().app_id() == "test_app");
}
#[test]
fn test_platform_service_clone() {
let config = create_test_config();
let service = PlatformService::new(config);
let cloned = service.clone();
assert!(cloned.config().app_id() == "test_app");
}
#[test]
fn test_platform_config_alias() {
let config: PlatformConfig = Config::builder()
.app_id("test_app")
.app_secret("test_secret")
.build();
assert!(config.app_id() == "test_app");
}
#[cfg(feature = "app-engine")]
#[test]
fn test_platform_service_app_engine() {
let config = create_test_config();
let service = PlatformService::new(config);
let _app_engine = service.app_engine();
}
#[cfg(feature = "directory")]
#[test]
fn test_platform_service_directory() {
let config = create_test_config();
let service = PlatformService::new(config);
let _directory = service.directory();
}
#[cfg(feature = "admin")]
#[test]
fn test_platform_service_admin() {
let config = create_test_config();
let service = PlatformService::new(config);
let _admin = service.admin();
}
#[cfg(feature = "spark")]
#[test]
fn test_platform_service_spark() {
let config = create_test_config();
let service = PlatformService::new(config);
let _request = service.spark().v1().directory().user().id_convert();
}
}