EMGroupManager

EMGroupManager

new EMGroupManager(manager)

Source:
EMGroupManager constructor.
Parameters:
Name Type Description
manager Object 组管理对象

Methods

acceptInvitationFromGroup(groupId, inviter) → {Object}

Source:
accept invitation to join a group.
Parameters:
Name Type Description
groupId String Group ID.
inviter String Inviter
Returns:
{code,description,data} The group user has accepted.
Type
Object

acceptJoinGroupApplication(groupId, user) → {Object}

Source:
Accept user's group joining request. Note: Only group's owner and admin can approval user's request to join group.
Parameters:
Name Type Description
groupId String Group ID.
user String The user that made the request.
Returns:
{code,description,data} The group.
Type
Object

addGroupAdmin(groupId, admin) → {Object}

Source:
add group admin. Note: Only group owner can add admin.
Parameters:
Name Type Description
groupId String Group ID.
admin String New group admin.
Returns:
{code,description,data} The group.
Type
Object

addGroupMembers(groupId, members, welcomeMessage) → {Object}

Source:
Add members to a group. Note: whether if user has permission to invite other user depends on group's setting
Parameters:
Name Type Description
groupId String Group ID
members Array string members array, Invited users.
welcomeMessage String Welcome message that will be sent to invited user.
Returns:
{code,description,data} The group.
Type
Object

addListener(listener) → {void}

Source:
Add group manager listener.
Parameters:
Name Type Description
listener EMGroupManagerListener 组管理的回调监听对象
Returns:
Type
void

allMyGroups() → {Array}

Source:
Get groups for login user from cache, or from local database if not in cache.
Returns:
EMGroup array.
Type
Array

applyJoinPublicGroup(groupId, nickName, message) → {Object}

Source:
Request to join a public group, need owner or admin's approval. Note: The group's style must be PUBLIC_JOIN_APPROVAL, or will return error.
Parameters:
Name Type Description
groupId String Group ID.
nickName String user's nickname in the group.
message String requesting message, that will be sent to group owner.
Returns:
{code,description,data} The group to join.
Type
Object

blockGroupMembers(groupId, members, reason) → {Object}

Source:
Block group's members, the blocked user cannot send message in the group. Note: ONLY group owner and admin owner can block members. ONLY group owner can block both admin and members.
Parameters:
Name Type Description
groupId String Group ID.
members Array string members array, Blocked members.
reason String The reason of blocking members.
Returns:
{code,description,data} The group.
Type
Object

blockGroupMessage(groupId) → {Object}

Source:
Block group message. Note: Owner cannot block the group message.
Parameters:
Name Type Description
groupId String Group ID.
Returns:
{code,description,data} The group.
Type
Object

changeGroupDescription(groupId, newDescription, error) → {Object}

Source:
Change group's description. Note: Only group's owner can change group's description.
Parameters:
Name Type Description
groupId String Group ID.
newDescription String The new group description.
error EMError EMError used for output.
Returns:
{code,description,data} The group.
Type
Object

changeGroupExtension(groupId, newDescription, error) → {Object}

Source:
Change group's extension. Note: Only group's owner can change group's extension.
Parameters:
Name Type Description
groupId String Group ID.
newDescription String The new group extension.
error EMError EMError used for output.
Returns:
{code,description,data} The group.
Type
Object

changeGroupSubject(groupId, newSubject, error) → {Object}

Source:
Change group's subject. Note: Only group's owner can change group's subject.
Parameters:
Name Type Description
groupId String Group ID.
newSubject String The new group subject.
error EMError EMError used for output.
Returns:
{code,description,data} The group.
Type
Object

clearListeners() → {void}

Source:
Remove all the listeners.
Returns:
Type
void

createGroup(subject, description, welcomeMessage, setting, members) → {Object}

Source:
Create a new group. Note: user will be the owner of the group created.
Parameters:
Name Type Description
subject String Group's subject.
description String Group's description.
welcomeMessage String Welcoming message that will be sent to invited user.
setting String Group's setting.
members Array Group's members. String array.
Returns:
{code,description,data} The group created.
Type
Object

declineInvitationFromGroup(groupId, inviter, reason) → {Object}

Source:
decline invitation to join a group.
Parameters:
Name Type Description
groupId String Group ID.
inviter String Inviter.
reason String The decline reason.
Returns:
{code,description,data} The group user has accepted.
Type
Object

declineJoinGroupApplication(groupId, user) → {Object}

Source:
Decline user's join application. Note: Only group's owner and admin can decline user's request to join group.
Parameters:
Name Type Description
groupId String Group ID.
user String The user that made the request.
Returns:
{code,description,data} The group.
Type
Object

deleteGroupSharedFile(groupId, fileId) → {Object}

Source:
delete a shared file. Note: ONLY group's admin and owner or file uploader can delete shared file.
Parameters:
Name Type Description
groupId String Group ID.
fileId String shared file id.
Returns:
{code,description,data} The group.
Type
Object

destroyGroup(groupId) → {Object}

Source:
Destroy a group. Note: Only group owner can destroy the group.
Parameters:
Name Type Description
groupId String Group ID.
Returns:
{code,description,data}
Type
Object

downloadGroupSharedFile(groupId, filePath, fileId, callback) → {Object}

Source:
delete a shared file. Note: ONLY group's admin and owner or file uploader can delete shared file.
Parameters:
Name Type Description
groupId String Group ID.
filePath String store file to this path.
fileId String shared file id.
callback EMCallback EMCallback contains onProgress of file uploading progress.
Returns:
{code,description,data} The group.
Type
Object

fetchAllMyGroups() → {Object}

Source:
Fetch all groups for login user from server. Note: Groups in memory will be updated.
Returns:
{code,description,data} EMGroup array.
Type
Object

fetchGroupAnnouncement(groupId) → {Object}

Source:
fetch group's announcement. Note: Only group's members can fetch group's announcement.
Parameters:
Name Type Description
groupId String Group ID.
Returns:
{code,description,data} The group's announcement in string.
Type
Object

fetchGroupBans(groupId, pageNum, pageSize) → {Object}

Source:
Get group's bans member list Note: User can input empty string as cursor at the first time
Parameters:
Name Type Description
groupId String Group ID.
pageNum Number Page's cursor.
pageSize Number Page size. ex. 20 for 20 objects.
Returns:
{code,description,data} the cursor store the list of group members.
Type
Object

fetchGroupMembers(groupId, cursor, pageSize) → {Object}

Source:
Get group's member list Note: User can input empty string as cursor at the first time
Parameters:
Name Type Description
groupId String Group ID.
cursor String Page's cursor.
pageSize Number Page size. ex. 20 for 20 objects.
Returns:
{code,description,data} the cursor store the list of group members.
Type
Object

fetchGroupMutes(groupId, pageNum, pageSizePage) → {Object}

Source:
Get the list of group muted users.
Parameters:
Name Type Description
groupId String Group ID.
pageNum Number mute members to be removed.
pageSizePage Number size. ex. 20 for 20 objects.
Returns:
{code,description,data} The list of mute users. object like { "key" : name, "value" : 111 }.
Type
Object

fetchGroupSharedFiles(groupId, pageNum, pageSize) → {Object}

Source:
fetch group's shared files list.
Parameters:
Name Type Description
groupId String Group ID.
pageNum Number page number of pagination.
pageSize Number Page size. ex. 20 for 20 objects.
Returns:
{code,description,data} EMMucSharedFile list.
Type
Object

fetchGroupSpecification(groupId, error, fetchMembers) → {Object}

Source:
Get group's specification.
Parameters:
Name Type Description
groupId String Group ID.
error EMError EMError used for output.
fetchMembers Bool Whether get group's members.
Returns:
{code,description,data} The group.
Type
Object

fetchPublicGroupsWithPage(pageNum, pageSize) → {Object}

Source:
Fetch app's public groups with page. If PageNum=0, then there is no pagination and will get all the users on the list. If PageNum=1, then will start from the first page of pagination.
Parameters:
Name Type Description
pageNum Number 获取的页数
pageSize Number 每页的群组计数
Returns:
{code,description,data} cursor store the public groups.
Type
Object

groupWithId(groupId) → {EMGroup}

Source:
Get a group with groupId, create the group if not exist.
Parameters:
Name Type Description
groupId String 群组ID
Returns:
返回群组对象
Type
EMGroup

joinPublicGroup(groupId) → {Object}

Source:
Join a public group. Note: The group's style must be PUBLIC_JOIN_OPEN, or will return error.
Parameters:
Name Type Description
groupId String Group ID.
Returns:
{code,description,data} The group joined.
Type
Object

leaveGroup(groupId) → {Object}

Source:
Leave a group. Note: Group owner cannot leave the group.
Parameters:
Name Type Description
groupId String Group ID.
Returns:
{code,description,data}
Type
Object

muteGroupMembers(groupId, members, muteDuration) → {Object}

Source:
add group mute members. Note: Temporary mute members will not be able to talk in the chat room for period of time.
Parameters:
Name Type Description
groupId String Group ID.
members Array Group's mute members.
muteDuration Number mute duration in milliseconds.
Returns:
{code,description,data} The group.
Type
Object

removeGroupAdmin(groupId, admin) → {Object}

Source:
remove group admin. Note: ONLY group owner can remove admin, not other admin.
Parameters:
Name Type Description
groupId String Group ID.
admin String Group admin member.
Returns:
{code,description,data} The group.
Type
Object

removeGroupMembers(groupId, members) → {Object}

Source:
Remove members from a group. Note: ONLY group owner and admin owner can remove members. ONLY group owner can remove both admin and members.
Parameters:
Name Type Description
groupId String Group ID.
members Array string members array, Removed members.
Returns:
{code,description,data} The group.
Type
Object

removeListener(listener) → {void}

Source:
Remove group manager listener.
Parameters:
Name Type Description
listener EMGroupManagerListener 组管理的回调监听对象
Returns:
Type
void

searchPublicGroup(groupId) → {Object}

Source:
Search for a public group.
Parameters:
Name Type Description
groupId String Group ID to be found.
Returns:
{code,description,data} The group with specified id.
Type
Object

transferGroupOwner(groupId, newOwner) → {Object}

Source:
transfer to new group owner. Note: Only group owner can transfer ownership
Parameters:
Name Type Description
groupId String Group ID of the current owner.
newOwner String Group ID of the new owner.
Returns:
{code,description,data} The group user has accepted.
Type
Object

unblockGroupMembers(groupId, members, error) → {Object}

Source:
Unblock group's members. Note: ONLY group owner and admin owner can unblock members. ONLY group owner can unblock both admin and members.
Parameters:
Name Type Description
groupId String Group ID.
members Array string members array, Unblocked users.
error EMError EMError used for output.
Returns:
{code,description,data} The group.
Type
Object

unblockGroupMessage(groupId) → {Object}

Source:
Unblock group message.
Parameters:
Name Type Description
groupId String Group ID.
Returns:
{code,description,data} The group.
Type
Object

unmuteGroupMembers(groupId, members) → {Object}

Source:
remove group muted members.
Parameters:
Name Type Description
groupId String Group ID.
members Array mute members to be removed.
Returns:
{code,description,data} The group.
Type
Object

updateGroupAnnouncement(groupId, newAnnouncement) → {Object}

Source:
Update group's announcement.
Parameters:
Name Type Description
groupId String Group ID.
newAnnouncement String a new group announcement.
Returns:
{code,description,data} The group.
Type
Object

uploadGroupSharedFile(groupId, filePath, callback) → {Object}

Source:
upload a sharing file to group.
Parameters:
Name Type Description
groupId String Group ID.
filePath String file path to be uploaded to on server. Can be used for file downloading later.
callback EMCallback EMCallback contains onProgress of file uploading progress.
Returns:
{code,description,data} EMMucSharedFile list.
Type
Object