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
- Create a MarkReadChatroomRequest object using the builder pattern.
- Call the
markReadChatroom()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
chatroomId | String | ID of the chatroom to mark as read |