ConversationsRequest
class. To use this class i.e to create an object of the ConversationsRequest
class, you need to use the ConversationsRequestBuilder
class. The ConversationsRequestBuilder
class allows you to set the parameters based on which the conversations are to be fetched.
The ConversationsRequestBuilder
class allows you to set the below parameters:
setLimit(int limit)
- This method sets the limit i.e. the number of conversations that should be fetched in a single iteration.setConversationType(String conversationType)
- This method can be used to fetch user or group conversations specifically.conversationType
variable can hold one of the below two values:build()
method to get the object of the ConversationsRequest
class.
Once you have the object of the ConversationsRequest
class, you need to call the fetchNext()
method. Calling this method will return a list of Conversation
objects containing X number of users depending on the limit set.
Conversation
object consists of the below fields:
Field | Information |
---|---|
conversationId | id of the conversation |
conversationType | type of conversation (user/group) |
lastMessage | last message the conversation. |
conversationWith | User or Group object containing the details of the user or group. |
unreadMessageCount | unread message count for the conversation. |
getConversation
method. The getConversation
method accepts two parameters.
conversationWith
: UID/GUID of the user/group whose conversation you want to fetch.conversationType
: The conversationType
variable can hold one of the below two values:Conversation
object. You can use the getConversationFromMessage(BaseMessage message)
of the CometChatHelper
class.
Message
object to Conversation
object, the unreadMessagecount
will not be available in the Conversation
object. As this is for the real-time events, the unread message count needs to be managed in your client-side code.