Get Participants
Retrieves the list of participants for a specific chatroom. This function allows users to fetch participant information with options for pagination and filtering.
Steps to get participants
- Create a GetParticipantsRequest object using
GetParticipantsRequest.builder()
class by passing all the required parameters. - Call
getParticipants()
function using the instance ofLMChatClient
. - Process the response LMResponse<GetParticipantsResponse> as per your requirement.
// object of GetParticipantsRequest
let request = GetParticipantsRequest.builder()
.chatroomId("ENTER_CHATROOM_ID")
.isChatroomSecret(false)
.page(1)
.pageSize(20)
.participantName(nil)
.build()
LMChatClient.shared.getParticipants(request: request) { response in
// response (LMResponse<GetParticipantsResponse>)
if let data = response.data {
// your function to process the response data
processParticipants(data)
} else if let error = response.error {
// your function to process error
handleError(error)
}
}
Models
GetParticipantsRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
isChatroomSecret | Bool | Indicates if the chatroom is secret | |
chatroomId | String | ID of the chatroom | |
participantName | String | Name to filter participants (if any) | ✔️ |
page | Int | Page number for pagination (default is 1) | |
pageSize | Int | Number of participants per page (default is 20) |
GetParticipantsResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
canEditParticipant | Bool | Indicates if the current user can edit participants | ✔️ |
participants | [Member] | Array of participant members | ✔️ |
totalParticipantsCount | Int | Total number of participants in the chatroom | ✔️ |