openlark_workflow/common/
mod.rs1pub mod api_endpoints;
5pub mod api_utils;
7pub mod board_v1_endpoints;
9pub mod task_v2_endpoints;
11
12pub use api_endpoints::TaskApiV2;
14pub use board_v1_endpoints::BoardV1Endpoint;
15pub use task_v2_endpoints::TaskV2Endpoint;
16
17pub mod constants {
19 pub const DEFAULT_PAGE_SIZE: i32 = 20;
21 pub const MAX_PAGE_SIZE: i32 = 100;
23}
24
25pub mod types {
27 pub type TaskGuid = String;
29 pub type TasklistGuid = String;
31 pub type SectionGuid = String;
33 pub type CustomFieldGuid = String;
35 pub type CommentGuid = String;
37 pub type AttachmentGuid = String;
39}
40
41#[cfg(test)]
42#[allow(unused_imports)]
43mod tests {
44 use super::constants;
45 use super::types;
46 use super::{board_v1_endpoints::BoardV1Endpoint, task_v2_endpoints::TaskV2Endpoint};
47
48 #[test]
49 fn test_default_page_size() {
50 assert_eq!(constants::DEFAULT_PAGE_SIZE, 20);
51 }
52
53 #[test]
54 fn test_max_page_size() {
55 assert_eq!(constants::MAX_PAGE_SIZE, 100);
56 }
57
58 #[test]
59 fn test_task_guid_type() {
60 let guid: types::TaskGuid = "test_guid".to_string();
61 assert_eq!(guid, "test_guid");
62 }
63
64 #[test]
65 fn test_tasklist_guid_type() {
66 let guid: types::TasklistGuid = "test_tasklist".to_string();
67 assert_eq!(guid, "test_tasklist");
68 }
69
70 #[test]
71 fn test_section_guid_type() {
72 let guid: types::SectionGuid = "test_section".to_string();
73 assert_eq!(guid, "test_section");
74 }
75
76 #[test]
77 fn test_custom_field_guid_type() {
78 let guid: types::CustomFieldGuid = "test_field".to_string();
79 assert_eq!(guid, "test_field");
80 }
81
82 #[test]
83 fn test_comment_guid_type() {
84 let guid: types::CommentGuid = "test_comment".to_string();
85 assert_eq!(guid, "test_comment");
86 }
87
88 #[test]
89 fn test_attachment_guid_type() {
90 let guid: types::AttachmentGuid = "test_attachment".to_string();
91 assert_eq!(guid, "test_attachment");
92 }
93
94 #[test]
95 fn issue_194_split_endpoint_paths() {
96 assert_eq!(
97 BoardV1Endpoint::WhiteboardNodeBatchDelete("board_123".to_string()).to_url(),
98 "/open-apis/board/v1/whiteboards/board_123/nodes/batch_delete"
99 );
100 assert_eq!(
101 TaskV2Endpoint::TaskSetAncestorTask("task_123".to_string()).to_url(),
102 "/open-apis/task/v2/tasks/task_123/set_ancestor_task"
103 );
104 assert_eq!(
105 TaskV2Endpoint::ListRelatedTask.to_url(),
106 "/open-apis/task/v2/task_v2/list_related_task"
107 );
108 assert_eq!(
109 TaskV2Endpoint::TaskSubscription.to_url(),
110 "/open-apis/task/v2/task_v2/task_subscription"
111 );
112 }
113}