diff --git a/src/im/api.ts b/src/im/api.ts index 955523a..ca9776c 100644 --- a/src/im/api.ts +++ b/src/im/api.ts @@ -112,6 +112,29 @@ export function listGroups(): Promise { return http.get('/api/im/groups', appQuery()) } +export function searchUsers(keyword: string, size = 20): Promise { + return http.get('/api/im/admin/users/search', appQuery({ keyword, size })) +} + +export function searchGroups(keyword: string, size = 20): Promise { + return http.get('/api/im/admin/groups/search', appQuery({ keyword, size })) +} + +export function searchMessages( + keyword: string | null = null, + chatType: ChatType | null = null, + msgType: string | null = null, + startTime: string | number | Date | null = null, + endTime: string | number | Date | null = null, + page = 0, + size = 20, +): Promise> { + return http.get>( + '/api/im/admin/messages/search', + appQuery({ keyword, chatType, msgType, startTime, endTime, page, size }), + ) +} + export function getGroupInfo(groupId: string): Promise { return http.get(`/api/im/groups/${encodeURIComponent(groupId)}`, appQuery()) } diff --git a/src/index.ts b/src/index.ts index 1972505..78ab265 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,9 @@ export { listConversations, markRead, getProfile, + searchGroups, + searchMessages, + searchUsers, rejectFriendRequest, rejectGroupJoinRequest, sendFriendRequest,