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
- Create a BlockMemberRequest object using
BlockMemberRequest.builder()
class by passing all the required parameters. - Call
blockDMMember()
function using the instance ofLMChatClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
status | BlockState | The blocking status to set (block or unblock) | |
chatroomId | String | ID of the chatroom where the action is performed |
BlockState Enum
VALUE | RAW VALUE | DESCRIPTION |
---|---|---|
block | 0 | Block the member |
unblock | 1 | Unblock the member |
BlockMemberResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversation | Conversation? | Information about the conversation | ✔️ |
chatroomData | Chatroom? | chatroom data | ✔️ |