Skip to main content

Block Member

Blocks or unblocks a member in a direct message conversation. This function allows users to manage their interactions with other members by controlling the blocking status within a specific chatroom.

Steps to block/unblock a member in a DM Chatroom

  1. Create a BlockMemberRequest object using BlockMemberRequest.builder() class by passing all the required parameters.
  2. Call blockDMMember() function using the instance of LMChatClient.
  3. Process the response LMResponse<BlockMemberResponse> as per your requirement.
let request = BlockMemberRequest.builder()
.status(.block)
.chatroomId("ENTER_CHATROOM_ID")
.build()

LMChatClient.shared.blockDMMember(request: request) { response in
if let data = response.data {
// Process the block member response
processBlockMemberResponse(data)
} else if let error = response.error {
// Handle the error
handleError(error)
}
}

Models

BlockMemberRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
statusBlockStateThe blocking status to set (block or unblock)
chatroomIdStringID of the chatroom where the action is performed

BlockState Enum

VALUERAW VALUEDESCRIPTION
block0Block the member
unblock1Unblock the member

BlockMemberResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationConversation?Information about the conversation✔️
chatroomDataChatroom?chatroom data✔️