Skip to main content

Get Poll Users

The getPollUsers() method is used to fetch users who participated in a poll within a specific conversation. The request requires pollId and conversationId to retrieve the poll users. The response returns a list of User entities.

Steps to Get Poll Users

  1. Create a GetPollUsersRequest object with the required parameters: pollId and conversationId.
  2. Call the getPollUsers() function using the instance of the LMChatClient class.
  3. Use the response LMResponse<GetPollUsersResponse> to get the list of users who participated in the poll.
GetPollUsersRequest request = (GetPollUsersRequestBuilder()
..pollId("ENTER_POLL_ID") // Provide the poll ID
..conversationId("ENTER_CONVERSATION_ID")) // Provide the conversation ID
.build();

final LMResponse<GetPollUsersResponse> response =
await lmChatClient.getPollUsers(request);

if (response.success) {
// Handle the list of users
List<User> pollUsers = response.data?.data ?? [];
handlePollUsers(pollUsers);
} else {
// Handle error
handleError(response);
}
tip

Ensure that both pollId and conversationId are provided to fetch the correct list of poll users.

Models

GetPollUsersRequest

List of parameters for the GetPollUsersRequest class:

VariableTypeDescriptionOptional
pollIdintThe ID of the poll
conversationIdintThe ID of the conversation

GetPollUsersResponse

List of parameters for the GetPollUsersResponse class:

VariableTypeDescriptionOptional
dataList<User>A list of users who participated in the poll✔️