Mute/Unmute Chatroom
Mutes or unmutes notifications for a specific chatroom. This function allows users to toggle the mute status of a chatroom.
Steps to mute or unmute a chatroom
- Create a MuteChatroomRequest object using the builder pattern.
- Call the
muteChatroom()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - Process the response LMResponse<NoData> to confirm whether the operation was successful or handle any errors.
let request = MuteChatroomRequest.builder()
.chatroomId("ENTER_CHATROOM_ID")
.value(true) // true to mute, false to unmute
.build()
LMChatClient.shared.muteChatroom(request: request) { response in
if response?.error == nil {
// Handle success
print("Chatroom mute status updated successfully.")
} else {
// Handle error
print("Error updating chatroom mute status: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}
Models
MuteChatroomRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
chatroomId | String | ID of the chatroom to be muted or unmuted | |
value | Bool | Set to true to mute the chatroom, false to unmute |