hap-cli 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. hap_cli/README.md +194 -0
  2. hap_cli/README_CN.md +601 -0
  3. hap_cli/__init__.py +3 -0
  4. hap_cli/commands/__init__.py +1 -0
  5. hap_cli/commands/ai_cmd.py +224 -0
  6. hap_cli/commands/app_cmd.py +308 -0
  7. hap_cli/commands/calendar_cmd.py +138 -0
  8. hap_cli/commands/chat_cmd.py +101 -0
  9. hap_cli/commands/config_cmd.py +169 -0
  10. hap_cli/commands/contact_cmd.py +125 -0
  11. hap_cli/commands/department_cmd.py +168 -0
  12. hap_cli/commands/group_cmd.py +128 -0
  13. hap_cli/commands/instance_cmd.py +310 -0
  14. hap_cli/commands/node_cmd.py +538 -0
  15. hap_cli/commands/optionset_cmd.py +99 -0
  16. hap_cli/commands/page_cmd.py +102 -0
  17. hap_cli/commands/plugin_cmd.py +133 -0
  18. hap_cli/commands/post_cmd.py +155 -0
  19. hap_cli/commands/record_cmd.py +228 -0
  20. hap_cli/commands/role_cmd.py +221 -0
  21. hap_cli/commands/workflow_cmd.py +284 -0
  22. hap_cli/commands/worksheet_cmd.py +342 -0
  23. hap_cli/context.py +43 -0
  24. hap_cli/core/__init__.py +1 -0
  25. hap_cli/core/ai.py +133 -0
  26. hap_cli/core/app.py +307 -0
  27. hap_cli/core/auth.py +219 -0
  28. hap_cli/core/calendar_mod.py +114 -0
  29. hap_cli/core/chat.py +73 -0
  30. hap_cli/core/contact.py +85 -0
  31. hap_cli/core/department.py +131 -0
  32. hap_cli/core/flow_node.py +1001 -0
  33. hap_cli/core/group.py +99 -0
  34. hap_cli/core/instance.py +572 -0
  35. hap_cli/core/optionset.py +112 -0
  36. hap_cli/core/page.py +138 -0
  37. hap_cli/core/plugin.py +87 -0
  38. hap_cli/core/post.py +118 -0
  39. hap_cli/core/record.py +268 -0
  40. hap_cli/core/role.py +227 -0
  41. hap_cli/core/session.py +348 -0
  42. hap_cli/core/workflow.py +556 -0
  43. hap_cli/core/worksheet.py +403 -0
  44. hap_cli/hap_cli.py +105 -0
  45. hap_cli/skills/SKILL.md +383 -0
  46. hap_cli/skills/__init__.py +0 -0
  47. hap_cli/tests/__init__.py +1 -0
  48. hap_cli/tests/test_core.py +1824 -0
  49. hap_cli/tests/test_full_e2e.py +136 -0
  50. hap_cli/tests/test_integration.py +805 -0
  51. hap_cli/utils/__init__.py +1 -0
  52. hap_cli/utils/formatting.py +111 -0
  53. hap_cli/utils/options.py +10 -0
  54. hap_cli-0.5.0.dist-info/METADATA +223 -0
  55. hap_cli-0.5.0.dist-info/RECORD +58 -0
  56. hap_cli-0.5.0.dist-info/WHEEL +5 -0
  57. hap_cli-0.5.0.dist-info/entry_points.txt +2 -0
  58. hap_cli-0.5.0.dist-info/top_level.txt +1 -0
hap_cli/core/chat.py ADDED
@@ -0,0 +1,73 @@
1
+ """Chat and messaging management for MingDAO HAP."""
2
+
3
+ from typing import Any, Optional
4
+
5
+ from hap_cli.core.session import Session
6
+
7
+
8
+ def get_chat_list(
9
+ session: Session,
10
+ page_index: int = 1,
11
+ page_size: int = 20,
12
+ ) -> dict[str, Any]:
13
+ """Get chat session list."""
14
+ return session.api_call(
15
+ "Chat", "GetChatList",
16
+ {"pageIndex": page_index, "pageSize": page_size},
17
+ )
18
+
19
+
20
+ def send_message(
21
+ session: Session,
22
+ account_ids: list[str],
23
+ message: str,
24
+ ) -> dict[str, Any]:
25
+ """Send a chat message to one or more users."""
26
+ return session.api_call(
27
+ "Message", "SendMessageToAccountIds",
28
+ {"accountIds": account_ids, "message": message},
29
+ )
30
+
31
+
32
+ def send_file(
33
+ session: Session,
34
+ chat_id: str,
35
+ file_url: str,
36
+ ) -> dict[str, Any]:
37
+ """Send a file to a chat."""
38
+ return session.api_call(
39
+ "Chat", "SendFileToChat",
40
+ {"id": chat_id, "fileUrl": file_url},
41
+ )
42
+
43
+
44
+ def send_card(
45
+ session: Session,
46
+ chat_id: str,
47
+ card_data: dict[str, Any],
48
+ ) -> dict[str, Any]:
49
+ """Send a card to a chat."""
50
+ data: dict[str, Any] = {"id": chat_id}
51
+ data.update(card_data)
52
+ return session.api_call("Chat", "SendCardToChat", data)
53
+
54
+
55
+ def get_group_info(
56
+ session: Session,
57
+ group_id: str,
58
+ ) -> dict[str, Any]:
59
+ """Get chat group information."""
60
+ return session.api_call("Chat", "GetGroupInfo", {"groupId": group_id})
61
+
62
+
63
+ def get_group_files(
64
+ session: Session,
65
+ group_id: str,
66
+ page_index: int = 1,
67
+ page_size: int = 20,
68
+ ) -> dict[str, Any]:
69
+ """Get file list for a chat group."""
70
+ return session.api_call(
71
+ "Chat", "GetGroupFileList",
72
+ {"groupId": group_id, "pageIndex": page_index, "pageSize": page_size},
73
+ )
@@ -0,0 +1,85 @@
1
+ """Address book and contact management for MingDAO HAP."""
2
+
3
+ from typing import Any, Optional
4
+
5
+ from hap_cli.core.session import Session
6
+
7
+
8
+ def search_contacts(
9
+ session: Session,
10
+ keywords: str,
11
+ project_id: str = "",
12
+ ) -> dict[str, Any]:
13
+ """Search address book contacts and departments."""
14
+ data: dict[str, Any] = {"keywords": keywords}
15
+ if project_id:
16
+ data["projectId"] = project_id
17
+ return session.api_call("AddressBook", "SearchAddressbookAndDepartment", data)
18
+
19
+
20
+ def get_account_detail(
21
+ session: Session,
22
+ account_id: str,
23
+ ) -> dict[str, Any]:
24
+ """Get detailed information for a user account."""
25
+ return session.api_call("AddressBook", "GetAccountDetail", {"accountId": account_id})
26
+
27
+
28
+ def get_friends(
29
+ session: Session,
30
+ page_index: int = 1,
31
+ page_size: int = 20,
32
+ ) -> dict[str, Any]:
33
+ """Get all friends/contacts in address book."""
34
+ return session.api_call(
35
+ "AddressBook", "GetAllAddressbook",
36
+ {"pageIndex": page_index, "pageSize": page_size},
37
+ )
38
+
39
+
40
+ def add_friend(
41
+ session: Session,
42
+ account_id: str,
43
+ message: str = "",
44
+ ) -> dict[str, Any]:
45
+ """Send a friend request."""
46
+ data: dict[str, Any] = {"accountId": account_id}
47
+ if message:
48
+ data["message"] = message
49
+ return session.api_call("AddressBook", "AddFriend", data)
50
+
51
+
52
+ def remove_friend(
53
+ session: Session,
54
+ account_id: str,
55
+ ) -> dict[str, Any]:
56
+ """Remove a friend from address book."""
57
+ return session.api_call("AddressBook", "RemoveFriend", {"accountId": account_id})
58
+
59
+
60
+ def get_friend_requests(
61
+ session: Session,
62
+ page_index: int = 1,
63
+ page_size: int = 20,
64
+ ) -> dict[str, Any]:
65
+ """Get pending friend requests."""
66
+ return session.api_call(
67
+ "AddressBook", "GetNewFriends",
68
+ {"pageIndex": page_index, "pageSize": page_size},
69
+ )
70
+
71
+
72
+ def accept_friend(
73
+ session: Session,
74
+ account_id: str,
75
+ ) -> dict[str, Any]:
76
+ """Accept a friend request."""
77
+ return session.api_call("AddressBook", "EditAgreeFriend", {"accountId": account_id})
78
+
79
+
80
+ def reject_friend(
81
+ session: Session,
82
+ account_id: str,
83
+ ) -> dict[str, Any]:
84
+ """Reject a friend request."""
85
+ return session.api_call("AddressBook", "EditRefuseFriend", {"accountId": account_id})
@@ -0,0 +1,131 @@
1
+ """Department management for MingDAO HAP."""
2
+
3
+ from typing import Any, Optional
4
+
5
+ from hap_cli.core.session import Session
6
+
7
+
8
+ def list_departments(
9
+ session: Session,
10
+ project_id: str,
11
+ parent_id: str = "",
12
+ page_index: int = 1,
13
+ page_size: int = 50,
14
+ ) -> dict[str, Any]:
15
+ """List sub-departments (paginated)."""
16
+ data: dict[str, Any] = {
17
+ "projectId": project_id,
18
+ "pageIndex": page_index,
19
+ "pageSize": page_size,
20
+ }
21
+ if parent_id:
22
+ data["parentId"] = parent_id
23
+ return session.api_call("Department", "PagedSubDepartments", data)
24
+
25
+
26
+ def get_department_tree(
27
+ session: Session,
28
+ project_id: str,
29
+ department_id: str = "",
30
+ ) -> dict[str, Any]:
31
+ """Get the full department tree."""
32
+ data: dict[str, Any] = {"projectId": project_id}
33
+ if department_id:
34
+ data["departmentId"] = department_id
35
+ return session.api_call("Department", "GetOneDepartmentFullTree", data)
36
+
37
+
38
+ def get_department_info(
39
+ session: Session,
40
+ department_id: str,
41
+ ) -> dict[str, Any]:
42
+ """Get department details."""
43
+ return session.api_call("Department", "GetDepartmentInfo", {"departmentId": department_id})
44
+
45
+
46
+ def create_department(
47
+ session: Session,
48
+ project_id: str,
49
+ department_name: str,
50
+ parent_id: str = "",
51
+ ) -> dict[str, Any]:
52
+ """Create a new department."""
53
+ data: dict[str, Any] = {
54
+ "projectId": project_id,
55
+ "departmentName": department_name,
56
+ }
57
+ if parent_id:
58
+ data["parentId"] = parent_id
59
+ return session.api_call("Department", "AddDepartment", data)
60
+
61
+
62
+ def update_department(
63
+ session: Session,
64
+ department_id: str,
65
+ department_name: str,
66
+ ) -> dict[str, Any]:
67
+ """Update department name."""
68
+ return session.api_call(
69
+ "Department", "EditDepartment",
70
+ {"departmentId": department_id, "departmentName": department_name},
71
+ )
72
+
73
+
74
+ def delete_departments(
75
+ session: Session,
76
+ project_id: str,
77
+ department_ids: list[str],
78
+ ) -> dict[str, Any]:
79
+ """Delete one or more departments."""
80
+ return session.api_call(
81
+ "Department", "DeleteDepartments",
82
+ {"projectId": project_id, "departmentIds": department_ids},
83
+ )
84
+
85
+
86
+ def get_department_users(
87
+ session: Session,
88
+ project_id: str,
89
+ department_id: str,
90
+ page_index: int = 1,
91
+ page_size: int = 50,
92
+ ) -> dict[str, Any]:
93
+ """Get users in a department."""
94
+ return session.api_call(
95
+ "Department", "GetProjectDepartmentUsers",
96
+ {
97
+ "projectId": project_id,
98
+ "departmentId": department_id,
99
+ "pageIndex": page_index,
100
+ "pageSize": page_size,
101
+ },
102
+ )
103
+
104
+
105
+ def search_dept_and_users(
106
+ session: Session,
107
+ project_id: str,
108
+ keywords: str,
109
+ ) -> dict[str, Any]:
110
+ """Search departments and users."""
111
+ return session.api_call(
112
+ "Department", "SearchDeptAndUsers",
113
+ {"projectId": project_id, "keywords": keywords},
114
+ )
115
+
116
+
117
+ def move_department(
118
+ session: Session,
119
+ project_id: str,
120
+ department_id: str,
121
+ target_dept_id: str,
122
+ ) -> dict[str, Any]:
123
+ """Move a department under a new parent."""
124
+ return session.api_call(
125
+ "Department", "MoveDepartment",
126
+ {
127
+ "projectId": project_id,
128
+ "departmentId": department_id,
129
+ "targetDepartmentId": target_dept_id,
130
+ },
131
+ )