openlark_workflow/v1/
mod.rs1pub mod task;
2
3use openlark_core::config::Config;
4use std::sync::Arc;
5
6#[derive(Clone)]
8pub struct TaskV1 {
9 config: Arc<Config>,
10}
11
12impl TaskV1 {
13 pub fn new(config: Arc<Config>) -> Self {
14 Self { config }
15 }
16
17 pub fn task(&self) -> task::Task {
19 task::Task::new(self.config.clone())
20 }
21}
22
23#[cfg(test)]
24#[allow(unused_imports)]
25mod tests {
26 use super::*;
27 use std::sync::Arc;
28
29 fn create_test_config() -> Arc<Config> {
30 Arc::new(
31 Config::builder()
32 .app_id("test_app")
33 .app_secret("test_secret")
34 .build(),
35 )
36 }
37
38 #[test]
39 fn test_task_v1_new() {
40 let config = create_test_config();
41 let _task_v1 = TaskV1::new(config);
42 }
43
44 #[test]
45 fn test_task_v1_task() {
46 let config = create_test_config();
47 let task_v1 = TaskV1::new(config);
48 let _task = task_v1.task();
49 }
50}