Skip to main content

Mark Read Chatroom

Marks a specific chatroom as read. This function is used to clear the unread count for a chatroom by marking all messages in the chatroom as read.

Steps to mark a chatroom as read

  1. Create a MarkReadChatroomRequest object using the builder pattern.
  2. Call the markReadChatroom() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. Process the response LMResponse<NoData> to confirm if the operation was successful or handle any errors.
let request = MarkReadChatroomRequest.builder()
.chatroomId("ENTER_CHATROOM_ID")
.build()

LMChatClient.shared.markRead(request: request) { response in
if response?.error == nil {
// Handle success
print("Chatroom marked as read successfully.")
} else {
// Handle error
print("Error marking chatroom as read: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}

Models

MarkReadChatroomRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
chatroomIdStringID of the chatroom to mark as read