openlark_workflow/v2/section/
mod.rs1pub mod create;
3pub mod delete;
5pub mod get;
7pub mod list;
9pub mod models;
11pub mod patch;
13pub mod tasks;
15pub mod update;
17
18use openlark_core::config::Config;
19use std::sync::Arc;
20
21#[derive(Clone)]
23pub struct Section {
24 config: Arc<Config>,
25}
26
27impl Section {
28 pub fn new(config: Arc<Config>) -> Self {
30 Self { config }
31 }
32
33 pub fn create(&self) -> create::CreateSectionRequest {
35 create::CreateSectionRequest::new(self.config.clone())
36 }
37
38 pub fn get(&self, section_guid: impl Into<String>) -> get::GetSectionRequest {
40 get::GetSectionRequest::new(self.config.clone(), section_guid.into())
41 }
42
43 pub fn update(&self, section_guid: impl Into<String>) -> update::UpdateSectionRequest {
45 update::UpdateSectionRequest::new(self.config.clone(), section_guid.into())
46 }
47
48 pub fn delete(&self, section_guid: impl Into<String>) -> delete::DeleteSectionRequest {
50 delete::DeleteSectionRequest::new(self.config.clone(), section_guid.into())
51 }
52
53 pub fn list(&self) -> list::ListSectionsRequest {
55 list::ListSectionsRequest::new(self.config.clone())
56 }
57
58 pub fn tasks(&self, section_guid: impl Into<String>) -> tasks::GetSectionTasksRequest {
60 tasks::GetSectionTasksRequest::new(self.config.clone(), section_guid.into())
61 }
62}
63
64pub use create::CreateSectionRequest;
66pub use delete::DeleteSectionRequest;
67pub use get::GetSectionRequest;
68pub use list::ListSectionsRequest;
69pub use patch::UpdateSectionRequest;
70pub use tasks::GetSectionTasksRequest;
71
72pub use models::{
74 CreateSectionBody, CreateSectionResponse, DeleteSectionResponse, GetSectionResponse,
75 ListSectionsResponse, SectionItem, UpdateSectionBody, UpdateSectionResponse,
76};
77pub use tasks::ListSectionTasksResponse;
78
79#[cfg(test)]
80#[allow(unused_imports)]
81mod tests {
82 use super::*;
83 use std::sync::Arc;
84
85 fn create_test_config() -> Arc<Config> {
86 Arc::new(
87 Config::builder()
88 .app_id("test_app")
89 .app_secret("test_secret")
90 .build(),
91 )
92 }
93
94 #[test]
95 fn test_section_new() {
96 let config = create_test_config();
97 let _section = Section::new(config);
98 }
99
100 #[test]
101 fn test_section_create() {
102 let config = create_test_config();
103 let section = Section::new(config);
104 let _request = section.create();
105 }
106
107 #[test]
108 fn test_section_get() {
109 let config = create_test_config();
110 let section = Section::new(config);
111 let _request = section.get("section_456");
112 }
113
114 #[test]
115 fn test_section_update() {
116 let config = create_test_config();
117 let section = Section::new(config);
118 let _request = section.update("section_456");
119 }
120
121 #[test]
122 fn test_section_delete() {
123 let config = create_test_config();
124 let section = Section::new(config);
125 let _request = section.delete("section_456");
126 }
127
128 #[test]
129 fn test_section_list() {
130 let config = create_test_config();
131 let section = Section::new(config);
132 let _request = section.list();
133 }
134}