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