use openlark_core::config::Config;
use std::sync::Arc;
#[derive(Clone)]
#[allow(dead_code)]
pub struct WorkflowService {
config: Arc<Config>,
}
impl WorkflowService {
pub fn new(config: Config) -> Self {
Self {
config: Arc::new(config),
}
}
#[cfg(feature = "v1")]
pub fn v1(&self) -> crate::v1::TaskV1 {
crate::v1::TaskV1::new(self.config.clone())
}
#[cfg(feature = "v2")]
pub fn v2(&self) -> crate::v2::TaskV2 {
crate::v2::TaskV2::new(self.config.clone())
}
#[cfg(feature = "v2")]
pub fn task(&self) -> crate::v2::task::Task {
crate::v2::task::Task::new(self.config.clone())
}
#[cfg(feature = "v2")]
pub fn tasklist(&self) -> crate::v2::tasklist::Tasklist {
crate::v2::tasklist::Tasklist::new(self.config.clone())
}
}
#[cfg(test)]
#[allow(unused_imports)]
mod tests {
#[test]
fn test_serialization_roundtrip() {
let json = r#"{"test": "value"}"#;
assert!(serde_json::from_str::<serde_json::Value>(json).is_ok());
}
#[test]
fn test_deserialization_from_json() {
let json = r#"{"field": "data"}"#;
let value: serde_json::Value = serde_json::from_str(json).unwrap();
assert_eq!(value["field"], "data");
}
}