Skip to main content

Get Direct Messages Chatrooms

The Home Feed for Direct Messages (DM) chatrooms is an essential feature in many applications, allowing users to easily access and interact with their private conversations. In the context of the Flutter SDK, this Home Feed is designed to provide a streamlined and dynamic interface specifically for DM chatrooms, enabling users to quickly find and engage with their direct messages.

Steps to Get Group Chatrooms

  1. Create an object of the GetHomeFeedRequest class.
  2. Call the getHomeFeed() function using the instance of the LMChatClient class.
  3. Process the response LMResponse<GetHomeFeedResponse> as per your requirement.
GetHomeFeedRequest request = (GetHomeFeedRequestBuilder()
..page(1) // Specify the page number
..pageSize(20) // Set the page size
..minTimestamp(1627683600) // Minimum timestamp
..maxTimestamp(1627770000) // Maximum timestamp
..chatroomTypes([10]) // Specify chatroom types
..isLocalDb(true)) // Use local database
.build();

final LMResponse<GetHomeFeedResponse> response =
await lmChatClient.getHomeFeed(request);

if (response.success) {
// Handle the home feed response
GetHomeFeedResponse homeFeed = response.data!;
handleHomeFeed(homeFeed);
} else {
// Handle error
handleError(response);
}

Models

GetHomeFeedRequest

List of parameters for the GetHomeFeedRequest class

VariableTypeDescriptionOptional
pageintPage number for paginated response
pageSizeint?Page size for paginated response✔️
minTimestampint?Minimum timestamp for filtering✔️
maxTimestampint?Maximum timestamp for filtering✔️
chatroomTypesList<int>?List of chatroom types to filter✔️
tagString?The tag filter for the home feed✔️
isLocalDbboolFlag to indicate local DB usage✔️

GetHomeFeedResponse

List of parameters for the GetHomeFeedResponse class

VariableTypeDescriptionOptional
communityMetaMap<String, Community>?Map of communities with their ID as the key✔️
chatroomsDataList<ChatRoom>?List of chatrooms✔️
conversationMetaMap<String, Conversation>?Map of conversations with their ID as the key✔️
userMetaMap<int, User>?Map of users with their ID as the key✔️
cardAttachmentsMetaMap<String, Attachment>?Map of card attachments✔️
conversationAttachmentsMetaMap<String, List<Attachment>?Map of conversation attachments with their ID as the key✔️
conversationPollsMetaMap<dynamic, dynamic>?Map of conversation polls✔️