Search Conversation in Chatroom
Search Conversation
Searching a conversation allows you to find specific conversations based on a search term, follow status, chatroom, and pagination details.
Steps to Search a Conversation
- Create an object of the
ConversationSearchRequest
class using theConversationSearchRequestBuilder
class. - Call the
searchConversation()
method from theLMChatClient
class using your request object. - Process the response
LMResponse<ConversationSearchResponse>
as per your requirement.
ConversationSearchRequest request = (ConversationSearchRequestBuilder()
..searchTerm("ENTER_SEARCH_TERM")
..followStatus(true) // or false
..page(1)
..pageSize(10)
..chatroomId(ENTER_CHATROOM_ID))
.build();
LMResponse<ConversationSearchResponse> response = await lmChatClient.searchConversation(request);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response.errorMessage);
}
Models
ConversationSearchRequest
List of parameters for the ConversationSearchRequest
class.
Variable | Type | Description | Optional |
---|---|---|---|
searchTerm | String | Keyword for searching conversations | |
followStatus | bool | Filter by follow status (true or false ) | |
page | int | Page number for paginated results | |
pageSize | int | Number of results per page | |
chatroomId | int | ID of the chatroom |
ConversationSearchResponse
List of parameters for the ConversationSearchResponse
class.
Variable | Type | Description | Optional |
---|---|---|---|
conversations | List<Conversation> | List of matched conversations | ✔️ |
widgets | Map<String, Widget>? | Map of conversation widget | ✔️ |