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:
conversationType
variable can hold one of the below two values: a. CometChat.conversationType.user(user) - Only fetches user conversation. b. CometChat.conversationType.group(group)- Only fetches group conversations
If none is set, the list of conversations will include both user and group conversations.
Conversation
Object. By default the value is false.
false
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. |
tagConversation()
method. The tagConversation()
method accepts three 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:
tags
: The tags
variable will be a list of tags you want to add to a 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.