public interface ChatRoomService
Modifier and Type | Method and Description |
---|---|
InvocationFuture<java.util.List<java.lang.String>> |
batchUpdateQueue(java.lang.String roomId,
java.util.List<Entry<java.lang.String,java.lang.String>> queues,
boolean needNotify,
java.util.Map<java.lang.String,java.lang.Object> notifyExt)
Update multiple elements in a chat room queue.
|
AbortableFuture<java.lang.Void> |
downloadAttachment(ChatRoomMessage msg,
boolean thumb)
In most cases, attachments will be automatically downloaded when messages are received.
|
InvocationFuture<java.lang.Void> |
dropQueue(java.lang.String roomId)
Delete a queue
|
AbortableFuture<EnterChatRoomResultData> |
enterChatRoom(EnterChatRoomData roomData)
Join a chat room
|
AbortableFuture<EnterChatRoomResultData> |
enterChatRoomEx(EnterChatRoomData roomData,
int retryCount)
Join a chat room
|
void |
exitChatRoom(java.lang.String roomId)
Leave a chat room
|
void |
exitChatRooms(ChatRoomModeEnum mode)
Leave a chat room
|
InvocationFuture<java.util.List<Entry<java.lang.String,java.lang.String>>> |
fetchQueue(java.lang.String roomId)
Sort all elements in a queue
|
InvocationFuture<ChatRoomInfo> |
fetchRoomInfo(java.lang.String roomId)
Get the messages in the current chat room
|
InvocationFuture<java.util.List<ChatRoomMember>> |
fetchRoomMembers(java.lang.String roomId,
MemberQueryType memberQueryType,
long time,
int limit)
Get the members in a chat room
|
InvocationFuture<java.util.List<ChatRoomMember>> |
fetchRoomMembersByIds(java.lang.String roomId,
java.util.List<java.lang.String> accounts)
Get member profiles based on user IDs
|
InvocationFuture<java.util.List<ChatRoomMember>> |
fetchRoomMembersByTag(java.lang.String roomId,
java.lang.String tag,
long time,
int limit)
Get the members in a chat room
|
int |
getEnterErrorCode(java.lang.String roomId)
Get an error code for failures to join a chat room
An error code is returned in the callback for enterChatRoom if a user manually logs in.
|
InvocationFuture<java.lang.Void> |
kickMember(java.lang.String roomId,
java.lang.String account,
java.util.Map<java.lang.String,java.lang.Object> notifyExtension)
Remove a specified member
|
InvocationFuture<ChatRoomMember> |
markChatRoomBlackList(boolean isAdd,
MemberOption memberOption)
Add to or remove from the blacklist of a chat room
|
InvocationFuture<ChatRoomMember> |
markChatRoomManager(boolean isAdd,
MemberOption memberOption)
Assign or revoke the adminstrator role
|
InvocationFuture<ChatRoomMember> |
markChatRoomMutedList(boolean isAdd,
MemberOption memberOption)
Add to or removed from the muted list of a chat room
|
InvocationFuture<java.lang.Void> |
markChatRoomTempMute(boolean needNotify,
long duration,
MemberOption memberOption)
Temporarily mute a member in a chat room
|
InvocationFuture<java.lang.Void> |
markChatRoomTempMuteByTag(java.lang.String roomId,
java.lang.String targetTag,
boolean needNotify,
long duration,
java.util.Map<java.lang.String,java.lang.Object> notifyExtension,
java.lang.String notifyTargetTags)
Mute members with a specified tag.
|
InvocationFuture<ChatRoomMember> |
markNormalMember(boolean isAdd,
MemberOption memberOption)
Assign or revoke membership of a user
|
InvocationFuture<Entry<java.lang.String,java.lang.String>> |
pollQueue(java.lang.String roomId,
java.lang.String key)
Get the head of a queue or specified elements
|
InvocationFuture<java.util.List<NimRobotInfo>> |
pullAllRobots(java.lang.String roomId)
Get all the current chat bots
|
InvocationFuture<java.util.List<ChatRoomMessage>> |
pullMessageHistory(java.lang.String roomId,
long startTime,
int limit)
Get history messages.
|
InvocationFuture<java.util.List<ChatRoomMessage>> |
pullMessageHistoryEx(java.lang.String roomId,
long startTime,
int limit,
QueryDirectionEnum direction)
Get history messages.
|
InvocationFuture<java.util.List<ChatRoomMessage>> |
pullMessageHistoryExType(java.lang.String roomId,
long startTime,
int limit,
QueryDirectionEnum direction,
MsgTypeEnum[] typeEnums)
Get history messages.
|
InvocationFuture<java.lang.Long> |
queryTagMembersCount(java.lang.String roomId,
java.lang.String tag)
Get member profiles based on user IDs
|
InvocationFuture<java.lang.Void> |
sendMessage(ChatRoomMessage msg,
boolean resend)
Send a message in a chat room
|
InvocationFuture<java.lang.Void> |
updateChatRoomTags(java.lang.String roomId,
ChatRoomTagsInfo tagsInfo)
Update tags of a chat room
|
InvocationFuture<java.lang.Void> |
updateLocation(java.lang.String roomId,
ChatRoomSpatialLocation location)
Update the location info
Note: the location can be reported to the server every 300ms.
|
InvocationFuture<java.lang.Void> |
updateMyRoomRole(java.lang.String roomId,
ChatRoomMemberUpdate chatRoomMemberUpdate,
boolean needNotify,
java.util.Map<java.lang.String,java.lang.Object> notifyExtension)
Update the profile of the current user in a chat room
|
InvocationFuture<java.lang.Void> |
updateMyRoomRole(java.lang.String roomId,
ChatRoomMemberUpdate chatRoomMemberUpdate,
boolean needNotify,
java.util.Map<java.lang.String,java.lang.Object> notifyExtension,
AntiSpamConfig antiSpamConfig)
Update the profile of the current user in a chat room
|
InvocationFuture<java.lang.Void> |
updateQueue(java.lang.String roomId,
java.lang.String key,
java.lang.String value)
Chat room queue service.
|
InvocationFuture<java.lang.Void> |
updateQueue(java.lang.String roomId,
java.lang.String key,
java.lang.String value,
boolean isTransient,
java.lang.String elementAccid)
Chat room queue service.
|
InvocationFuture<java.lang.Void> |
updateQueueEx(java.lang.String roomId,
java.lang.String key,
java.lang.String value,
boolean isTransient)
Chat room queue service.
|
InvocationFuture<java.lang.Void> |
updateRoomInfo(java.lang.String roomId,
ChatRoomUpdateInfo chatRoomUpdateInfo,
boolean needNotify,
java.util.Map<java.lang.String,java.lang.Object> notifyExtension)
Update the chat room profile
|
InvocationFuture<java.lang.Void> |
updateRoomInfo(java.lang.String roomId,
ChatRoomUpdateInfo chatRoomUpdateInfo,
boolean needNotify,
java.util.Map<java.lang.String,java.lang.Object> notifyExtension,
AntiSpamConfig antiSpamConfig)
Update the chat room profile
|
AbortableFuture<EnterChatRoomResultData> enterChatRoom(EnterChatRoomData roomData)
roomData
- chat room info. The chat room ID is required.AbortableFuture<EnterChatRoomResultData> enterChatRoomEx(EnterChatRoomData roomData, int retryCount)
roomData
- chat room info. The chat room ID is required.retryCount
- retry count for failuresint getEnterErrorCode(java.lang.String roomId)
roomId
- chat room IDvoid exitChatRoom(java.lang.String roomId)
roomId
- chat room IDvoid exitChatRooms(ChatRoomModeEnum mode)
mode
- chat room modeInvocationFuture<java.lang.Void> sendMessage(ChatRoomMessage msg, boolean resend)
msg
- message body constructed using ChatRoomMessageBuilder
.resend
- set to true for reconnections after failure. Otherwise, set to false.AbortableFuture<java.lang.Void> downloadAttachment(ChatRoomMessage msg, boolean thumb)
msg
- The message enclosed with an attachmentthumb
- Specify whether to download the thumbnail or the original file. If the value is set to true, only the thumbnail will be downloaded. InvocationFuture<java.util.List<ChatRoomMessage>> pullMessageHistory(java.lang.String roomId, long startTime, int limit)
roomId
- chat room IDstartTime
- start time in millisecondslimit
- limit of returned messagesInvocationFuture<java.util.List<ChatRoomMessage>> pullMessageHistoryEx(java.lang.String roomId, long startTime, int limit, QueryDirectionEnum direction)
roomId
- chat room IDstartTime
- start time in millisecondslimit
- limit of returned messagesdirection
- Query directionInvocationFuture<java.util.List<ChatRoomMessage>> pullMessageHistoryExType(java.lang.String roomId, long startTime, int limit, QueryDirectionEnum direction, MsgTypeEnum[] typeEnums)
If a query starts from an early point to the newest date, the result is displayed in descending order. Otherwise, in ascending order.
Message types, 0: text; 1: image; 2: audio; 3: video; 4: location; 5: notification; 6: file; 10: Tip; 11: custom; 100: custom. Other types are invalid.
roomId
- chat room IDstartTime
- start time in millisecondslimit
- limit of returned messagesdirection
- Query directiontypeEnums
- message types in arrayInvocationFuture<ChatRoomInfo> fetchRoomInfo(java.lang.String roomId)
roomId
- The ID of a chat roomInvocationFuture<java.util.List<ChatRoomMember>> fetchRoomMembers(java.lang.String roomId, MemberQueryType memberQueryType, long time, int limit)
roomId
- chat room IDmemberQueryType
- member types. For more information, see MemberQueryType
time
- use updateTime for permanent members,
use enterTime for temporary users.
A value of 0 starts the query from the current time or the first page in milliseconds.limit
- limit of returned entriesInvocationFuture<java.util.List<ChatRoomMember>> fetchRoomMembersByTag(java.lang.String roomId, java.lang.String tag, long time, int limit)
roomId
- chat room IDtag
- tagtime
- the start ime in descending order. A value of 0 starts the query from the current time to the earliest.limit
- limit of returned entriesInvocationFuture<java.util.List<ChatRoomMember>> fetchRoomMembersByIds(java.lang.String roomId, java.util.List<java.lang.String> accounts)
roomId
- chat room IDaccounts
- The list of accounts in a chat roomInvocationFuture<java.lang.Long> queryTagMembersCount(java.lang.String roomId, java.lang.String tag)
roomId
- chat room IDtag
- tagInvocationFuture<ChatRoomMember> markChatRoomBlackList(boolean isAdd, MemberOption memberOption)
isAdd
- true: added, false: removedmemberOption
- Request parameters, such as chat room ID, account ID, and optional extension fieldsInvocationFuture<ChatRoomMember> markChatRoomMutedList(boolean isAdd, MemberOption memberOption)
isAdd
- true: added; false: removedmemberOption
- Request parameters, such as chat room ID, account ID, and optional extension fieldsInvocationFuture<java.lang.Void> markChatRoomTempMute(boolean needNotify, long duration, MemberOption memberOption)
needNotify
- broadcast the notification. True: sends a notification to all members; false:does not send a notification to all membersduration
- Mute duration in secondsmemberOption
- Request parameters, such as chat room ID, account ID, and optional extension fieldsInvocationFuture<java.lang.Void> markChatRoomTempMuteByTag(java.lang.String roomId, java.lang.String targetTag, boolean needNotify, long duration, java.util.Map<java.lang.String,java.lang.Object> notifyExtension, java.lang.String notifyTargetTags)
roomId
- chat room IDtargetTag
- the tag for mutingneedNotify
- broadcast the notification. True: sends a notification to all members; false:does not send a notification to all membersduration
- Mute duration in secondsnotifyExtension
- Custom extension field defined by developers. Optional.notifyTargetTags
- Tags for broadcast messages. The default value is TARGET_TAG. It is a tag expression.InvocationFuture<ChatRoomMember> markChatRoomManager(boolean isAdd, MemberOption memberOption)
isAdd
- true: assign an administrator; false: revoke the administrator role of a member.memberOption
- Request parameters, such as chat room ID, account ID, and optional extension fieldsInvocationFuture<ChatRoomMember> markNormalMember(boolean isAdd, MemberOption memberOption)
isAdd
- true: assign an administrator; false: revoke the administrator role of a member.memberOption
- Request parameters, such as chat room ID, account ID, and optional extension fieldsInvocationFuture<java.lang.Void> kickMember(java.lang.String roomId, java.lang.String account, java.util.Map<java.lang.String,java.lang.Object> notifyExtension)
roomId
- chat room IDaccount
- account to be removed Only administrators can remove members. Only the owner can remove administrators.notifyExtension
- notification extension field for being removed in a notificationInvocationFuture<java.lang.Void> updateRoomInfo(java.lang.String roomId, ChatRoomUpdateInfo chatRoomUpdateInfo, boolean needNotify, java.util.Map<java.lang.String,java.lang.Object> notifyExtension)
roomId
- chat room IDchatRoomUpdateInfo
- chat room profile to be updatedneedNotify
- enable or disable notificationsnotifyExtension
- extension field for updating the chat room profile in a notificationInvocationFuture<java.lang.Void> updateRoomInfo(java.lang.String roomId, ChatRoomUpdateInfo chatRoomUpdateInfo, boolean needNotify, java.util.Map<java.lang.String,java.lang.Object> notifyExtension, AntiSpamConfig antiSpamConfig)
roomId
- chat room IDchatRoomUpdateInfo
- chat room profile to be updatedneedNotify
- enable or disable notificationsnotifyExtension
- extension field for updating the chat room profile in a notificationantiSpamConfig
- Anti-spam configurationInvocationFuture<java.lang.Void> updateMyRoomRole(java.lang.String roomId, ChatRoomMemberUpdate chatRoomMemberUpdate, boolean needNotify, java.util.Map<java.lang.String,java.lang.Object> notifyExtension)
roomId
- chat room IDchatRoomMemberUpdate
- profile to be updatedneedNotify
- enable or disable notificationsnotifyExtension
- extension field for updating the chat room profile in a notification. A maximum of 2000 characters are allowed.InvocationFuture<java.lang.Void> updateMyRoomRole(java.lang.String roomId, ChatRoomMemberUpdate chatRoomMemberUpdate, boolean needNotify, java.util.Map<java.lang.String,java.lang.Object> notifyExtension, AntiSpamConfig antiSpamConfig)
roomId
- chat room IDchatRoomMemberUpdate
- profile to be updatedneedNotify
- enable or disable notificationsnotifyExtension
- extension field for updating the chat room profile in a notification. A maximum of 2000 characters are allowed.antiSpamConfig
- Anti-spam configurationInvocationFuture<java.lang.Void> updateQueue(java.lang.String roomId, java.lang.String key, java.lang.String value)
roomId
- The ID of a chat roomkey
- unique key for new elements or elements to be updated.value
- value of a new element or an element to be updatedInvocationFuture<java.lang.Void> updateQueueEx(java.lang.String roomId, java.lang.String key, java.lang.String value, boolean isTransient)
roomId
- chat room IDkey
- unique key for new elements or elements to be updated.value
- value of a new element or an element to be updatedisTransient
- true: delete an element when a user gets disconnected or leaves a chat room. The default false value indicates that an element is not deleted.InvocationFuture<java.lang.Void> updateQueue(java.lang.String roomId, java.lang.String key, java.lang.String value, boolean isTransient, java.lang.String elementAccid)
roomId
- chat room IDkey
- unique key for new elements or elements to be updated.value
- value of a new element or an element to be updatedisTransient
- true: delete an element when a user gets disconnected or leaves a chat room. The default false value indicates that an element is not deleted.elementAccid
- accounts to which an element belongs. No argument is taken by default. The element belongs to the current user. Administrators can assign specified elements to other valid accounts.InvocationFuture<java.util.List<java.lang.String>> batchUpdateQueue(java.lang.String roomId, java.util.List<Entry<java.lang.String,java.lang.String>> queues, boolean needNotify, java.util.Map<java.lang.String,java.lang.Object> notifyExt)
roomId
- chat room IDqueues
- elements to be updatedneedNotify
- Enable or disable broadcastnotifyExt
- extension field in a notification. A maximum of 2000 characters are allowedInvocationFuture<Entry<java.lang.String,java.lang.String>> pollQueue(java.lang.String roomId, java.lang.String key)
roomId
- The ID of a chat roomkey
- unique key of an element If a value of null is taken, the head elements are selected.InvocationFuture<java.util.List<Entry<java.lang.String,java.lang.String>>> fetchQueue(java.lang.String roomId)
roomId
- The ID of a chat roomInvocationFuture<java.lang.Void> dropQueue(java.lang.String roomId)
roomId
- The ID of a chat roomInvocationFuture<java.util.List<NimRobotInfo>> pullAllRobots(java.lang.String roomId)
roomId
- chat room IDInvocationFuture<java.lang.Void> updateChatRoomTags(java.lang.String roomId, ChatRoomTagsInfo tagsInfo)
roomId
- chat room IDtagsInfo
- tag infoInvocationFuture<java.lang.Void> updateLocation(java.lang.String roomId, ChatRoomSpatialLocation location)
roomId
- chat room IDlocation
- location info