openlark_workflow/v1/task/
mod.rs1pub mod collaborator;
2pub mod comment;
3pub mod complete;
4pub mod create;
5pub mod delete;
6pub mod follower;
7pub mod get;
8pub mod list;
9pub mod patch;
10pub mod reminder;
11pub mod uncomplete;
12
13pub use collaborator::{
15 BatchDeleteTaskCollaboratorRequestV1, CreateTaskCollaboratorRequestV1,
16 DeleteTaskCollaboratorRequestV1, ListTaskCollaboratorRequestV1,
17};
18pub use comment::{
19 CreateTaskCommentRequestV1, DeleteTaskCommentRequestV1, GetTaskCommentRequestV1,
20 ListTaskCommentRequestV1, UpdateTaskCommentRequestV1,
21};
22pub use complete::CompleteTaskRequestV1;
23pub use create::CreateTaskRequestV1;
24pub use delete::DeleteTaskRequestV1;
25pub use follower::{
26 BatchDeleteTaskFollowerRequestV1, CreateTaskFollowerRequestV1, DeleteTaskFollowerRequestV1,
27 ListTaskFollowerRequestV1,
28};
29pub use get::GetTaskRequestV1;
30pub use list::ListTaskRequestV1;
31pub use patch::UpdateTaskRequestV1;
32pub use reminder::{
33 CreateTaskReminderRequestV1, DeleteTaskReminderRequestV1, ListTaskReminderRequestV1,
34};
35pub use uncomplete::UncompleteTaskRequestV1;
36
37use openlark_core::config::Config;
38use std::sync::Arc;
39
40#[derive(Clone)]
42pub struct Task {
43 config: Arc<Config>,
44}
45
46impl Task {
47 pub fn new(config: Arc<Config>) -> Self {
48 Self { config }
49 }
50
51 pub fn create(&self) -> CreateTaskRequestV1 {
52 CreateTaskRequestV1::new(self.config.clone())
53 }
54
55 pub fn get(&self, task_id: impl Into<String>) -> GetTaskRequestV1 {
56 GetTaskRequestV1::new(self.config.clone(), task_id)
57 }
58
59 pub fn update(&self, task_id: impl Into<String>) -> UpdateTaskRequestV1 {
60 UpdateTaskRequestV1::new(self.config.clone(), task_id)
61 }
62
63 pub fn delete(&self, task_id: impl Into<String>) -> DeleteTaskRequestV1 {
64 DeleteTaskRequestV1::new(self.config.clone(), task_id)
65 }
66
67 pub fn complete(&self, task_id: impl Into<String>) -> CompleteTaskRequestV1 {
68 CompleteTaskRequestV1::new(self.config.clone(), task_id)
69 }
70
71 pub fn uncomplete(&self, task_id: impl Into<String>) -> UncompleteTaskRequestV1 {
72 UncompleteTaskRequestV1::new(self.config.clone(), task_id)
73 }
74
75 pub fn list(&self) -> ListTaskRequestV1 {
76 ListTaskRequestV1::new(self.config.clone())
77 }
78
79 pub fn follower_create(&self, task_id: impl Into<String>) -> CreateTaskFollowerRequestV1 {
81 CreateTaskFollowerRequestV1::new(self.config.clone(), task_id)
82 }
83
84 pub fn follower_delete(
85 &self,
86 task_id: impl Into<String>,
87 follower_id: impl Into<String>,
88 ) -> DeleteTaskFollowerRequestV1 {
89 DeleteTaskFollowerRequestV1::new(self.config.clone(), task_id, follower_id)
90 }
91
92 pub fn follower_list(&self, task_id: impl Into<String>) -> ListTaskFollowerRequestV1 {
93 ListTaskFollowerRequestV1::new(self.config.clone(), task_id)
94 }
95
96 pub fn follower_batch_delete(
97 &self,
98 task_id: impl Into<String>,
99 ) -> BatchDeleteTaskFollowerRequestV1 {
100 BatchDeleteTaskFollowerRequestV1::new(self.config.clone(), task_id)
101 }
102
103 pub fn collaborator_create(
105 &self,
106 task_id: impl Into<String>,
107 ) -> CreateTaskCollaboratorRequestV1 {
108 CreateTaskCollaboratorRequestV1::new(self.config.clone(), task_id)
109 }
110
111 pub fn collaborator_delete(
112 &self,
113 task_id: impl Into<String>,
114 collaborator_id: impl Into<String>,
115 ) -> DeleteTaskCollaboratorRequestV1 {
116 DeleteTaskCollaboratorRequestV1::new(self.config.clone(), task_id, collaborator_id)
117 }
118
119 pub fn collaborator_list(&self, task_id: impl Into<String>) -> ListTaskCollaboratorRequestV1 {
120 ListTaskCollaboratorRequestV1::new(self.config.clone(), task_id)
121 }
122
123 pub fn collaborator_batch_delete(
124 &self,
125 task_id: impl Into<String>,
126 ) -> BatchDeleteTaskCollaboratorRequestV1 {
127 BatchDeleteTaskCollaboratorRequestV1::new(self.config.clone(), task_id)
128 }
129
130 pub fn reminder_create(&self, task_id: impl Into<String>) -> CreateTaskReminderRequestV1 {
132 CreateTaskReminderRequestV1::new(self.config.clone(), task_id)
133 }
134
135 pub fn reminder_delete(
136 &self,
137 task_id: impl Into<String>,
138 reminder_id: impl Into<String>,
139 ) -> DeleteTaskReminderRequestV1 {
140 DeleteTaskReminderRequestV1::new(self.config.clone(), task_id, reminder_id)
141 }
142
143 pub fn reminder_list(&self, task_id: impl Into<String>) -> ListTaskReminderRequestV1 {
144 ListTaskReminderRequestV1::new(self.config.clone(), task_id)
145 }
146
147 pub fn comment_create(&self, task_id: impl Into<String>) -> CreateTaskCommentRequestV1 {
149 CreateTaskCommentRequestV1::new(self.config.clone(), task_id)
150 }
151
152 pub fn comment_get(
153 &self,
154 task_id: impl Into<String>,
155 comment_id: impl Into<String>,
156 ) -> GetTaskCommentRequestV1 {
157 GetTaskCommentRequestV1::new(self.config.clone(), task_id, comment_id)
158 }
159
160 pub fn comment_update(
161 &self,
162 task_id: impl Into<String>,
163 comment_id: impl Into<String>,
164 ) -> UpdateTaskCommentRequestV1 {
165 UpdateTaskCommentRequestV1::new(self.config.clone(), task_id, comment_id)
166 }
167
168 pub fn comment_delete(
169 &self,
170 task_id: impl Into<String>,
171 comment_id: impl Into<String>,
172 ) -> DeleteTaskCommentRequestV1 {
173 DeleteTaskCommentRequestV1::new(self.config.clone(), task_id, comment_id)
174 }
175
176 pub fn comment_list(&self, task_id: impl Into<String>) -> ListTaskCommentRequestV1 {
177 ListTaskCommentRequestV1::new(self.config.clone(), task_id)
178 }
179}
180
181#[cfg(test)]
182#[allow(unused_variables)]
183#[allow(unused_imports)]
184mod tests {
185 use super::*;
186 use std::sync::Arc;
187
188 fn create_test_config() -> Arc<Config> {
189 Arc::new(
190 Config::builder()
191 .app_id("test_app")
192 .app_secret("test_secret")
193 .build(),
194 )
195 }
196
197 #[test]
198 fn test_task_new() {
199 let config = create_test_config();
200 let _ = Task::new(config);
201 }
202
203 #[test]
204 fn test_task_create() {
205 let config = create_test_config();
206 let task = Task::new(config);
207 let _ = task.create();
208 }
209
210 #[test]
211 fn test_task_get() {
212 let config = create_test_config();
213 let task = Task::new(config);
214 let _ = task.get("task_123");
215 }
216
217 #[test]
218 fn test_task_update() {
219 let config = create_test_config();
220 let task = Task::new(config);
221 let _ = task.update("task_123");
222 }
223
224 #[test]
225 fn test_task_delete() {
226 let config = create_test_config();
227 let task = Task::new(config);
228 let _ = task.delete("task_123");
229 }
230
231 #[test]
232 fn test_task_complete() {
233 let config = create_test_config();
234 let task = Task::new(config);
235 let _ = task.complete("task_123");
236 }
237
238 #[test]
239 fn test_task_uncomplete() {
240 let config = create_test_config();
241 let task = Task::new(config);
242 let _ = task.uncomplete("task_123");
243 }
244
245 #[test]
246 fn test_task_list() {
247 let config = create_test_config();
248 let task = Task::new(config);
249 let _ = task.list();
250 }
251
252 #[test]
254 fn test_task_follower_create() {
255 let config = create_test_config();
256 let task = Task::new(config);
257 let _ = task.follower_create("task_123");
258 }
259
260 #[test]
261 fn test_task_follower_delete() {
262 let config = create_test_config();
263 let task = Task::new(config);
264 let _ = task.follower_delete("task_123", "follower_456");
265 }
266
267 #[test]
268 fn test_task_follower_list() {
269 let config = create_test_config();
270 let task = Task::new(config);
271 let _ = task.follower_list("task_123");
272 }
273
274 #[test]
275 fn test_task_follower_batch_delete() {
276 let config = create_test_config();
277 let task = Task::new(config);
278 let _ = task.follower_batch_delete("task_123");
279 }
280
281 #[test]
283 fn test_task_collaborator_create() {
284 let config = create_test_config();
285 let task = Task::new(config);
286 let _ = task.collaborator_create("task_123");
287 }
288
289 #[test]
290 fn test_task_collaborator_delete() {
291 let config = create_test_config();
292 let task = Task::new(config);
293 let _ = task.collaborator_delete("task_123", "collaborator_456");
294 }
295
296 #[test]
297 fn test_task_collaborator_list() {
298 let config = create_test_config();
299 let task = Task::new(config);
300 let _ = task.collaborator_list("task_123");
301 }
302
303 #[test]
304 fn test_task_collaborator_batch_delete() {
305 let config = create_test_config();
306 let task = Task::new(config);
307 let _ = task.collaborator_batch_delete("task_123");
308 }
309
310 #[test]
312 fn test_task_reminder_create() {
313 let config = create_test_config();
314 let task = Task::new(config);
315 let _ = task.reminder_create("task_123");
316 }
317
318 #[test]
319 fn test_task_reminder_delete() {
320 let config = create_test_config();
321 let task = Task::new(config);
322 let _ = task.reminder_delete("task_123", "reminder_456");
323 }
324
325 #[test]
326 fn test_task_reminder_list() {
327 let config = create_test_config();
328 let task = Task::new(config);
329 let _ = task.reminder_list("task_123");
330 }
331
332 #[test]
334 fn test_task_comment_create() {
335 let config = create_test_config();
336 let task = Task::new(config);
337 let _ = task.comment_create("task_123");
338 }
339
340 #[test]
341 fn test_task_comment_get() {
342 let config = create_test_config();
343 let task = Task::new(config);
344 let _ = task.comment_get("task_123", "comment_456");
345 }
346
347 #[test]
348 fn test_task_comment_update() {
349 let config = create_test_config();
350 let task = Task::new(config);
351 let _ = task.comment_update("task_123", "comment_456");
352 }
353
354 #[test]
355 fn test_task_comment_delete() {
356 let config = create_test_config();
357 let task = Task::new(config);
358 let _ = task.comment_delete("task_123", "comment_456");
359 }
360
361 #[test]
362 fn test_task_comment_list() {
363 let config = create_test_config();
364 let task = Task::new(config);
365 let _ = task.comment_list("task_123");
366 }
367}