open_lark/service/
endpoints.rs1pub const AUTH_APP_ACCESS_TOKEN: &str = "/open-apis/auth/v3/app_access_token";
6pub const AUTH_TENANT_ACCESS_TOKEN: &str = "/open-apis/auth/v3/tenant_access_token";
7pub const AUTH_APP_TICKET_RESEND: &str = "/open-apis/auth/v3/app_ticket/resend";
8
9pub const WIKI_V2_SPACES: &str = "/open-apis/wiki/v2/spaces";
11pub const WIKI_V2_SPACE_NODES: &str = "/open-apis/wiki/v2/spaces/{space_id}/nodes";
12pub const WIKI_V2_TASKS: &str = "/open-apis/wiki/v2/tasks";
13
14pub const IM_V1_MESSAGES: &str = "/open-apis/im/v1/messages";
16pub const IM_V1_CHATS: &str = "/open-apis/im/v1/chats";
17pub const IM_V1_BATCH_MESSAGES: &str = "/open-apis/im/v1/batch_messages";
18
19pub const IM_V2_MESSAGES: &str = "/open-apis/im/v2/messages";
21
22pub const DOCS_V1_DOCUMENTS: &str = "/open-apis/docx/v1/documents";
24
25pub const DRIVE_V1_FILES: &str = "/open-apis/drive/v1/files";
27pub const DRIVE_V1_FOLDERS: &str = "/open-apis/drive/v1/folders";
28
29pub const DRIVE_V2_FILES: &str = "/open-apis/drive/v2/files";
31
32pub const SEARCH_V1_DATA_SOURCES: &str = "/open-apis/search/v1/data_sources";
34pub const SEARCH_V1_SCHEMA: &str = "/open-apis/search/v1/schema";
35
36pub const SHEETS_V2_SPREADSHEETS: &str = "/open-apis/sheets/v2/spreadsheets";
38
39pub const SHEETS_V3_SPREADSHEETS: &str = "/open-apis/sheets/v3/spreadsheets";
41
42pub const BITABLE_V1_APPS: &str = "/open-apis/bitable/v1/apps";
44
45pub const ATTENDANCE_V1_USER_FLOWS: &str = "/open-apis/attendance/v1/user_flows";
47
48pub const COMMENTS_V1_COMMENTS: &str = "/open-apis/drive/v1/files/{file_token}/comments";
50
51pub const PERMISSION_V1_SETTINGS: &str = "/open-apis/drive/permission/v1/settings";
53pub const PERMISSION_V2_SETTINGS: &str = "/open-apis/drive/permission/v2/settings";
54
55pub const BOARD_V1_WHITEBOARDS: &str = "/open-apis/board/v1/whiteboards";
57
58pub const ASSISTANT_V1_CONVERSATIONS: &str = "/open-apis/ai/v1/conversations";
60
61impl EndpointHelper {
63 pub fn replace_path_params(path: &str, params: &[(&str, &str)]) -> String {
74 let mut result = path.to_string();
75 for (key, value) in params {
76 let placeholder = format!("{{{key}}}");
77 result = result.replace(&placeholder, value);
78 }
79 result
80 }
81
82 pub fn has_unresolved_params(path: &str) -> bool {
84 path.contains('{') && path.contains('}')
85 }
86}
87
88pub struct EndpointHelper;
89
90#[cfg(test)]
91mod tests {
92 use super::*;
93
94 #[test]
95 fn test_replace_path_params() {
96 let result =
97 EndpointHelper::replace_path_params(WIKI_V2_SPACE_NODES, &[("space_id", "space123")]);
98 assert_eq!(result, "/open-apis/wiki/v2/spaces/space123/nodes");
99 }
100
101 #[test]
102 fn test_has_unresolved_params() {
103 assert!(EndpointHelper::has_unresolved_params(WIKI_V2_SPACE_NODES));
104 assert!(!EndpointHelper::has_unresolved_params(WIKI_V2_SPACES));
105 }
106}