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
- Create a
GetPollUsersRequest
object with the required parameters:pollId
andconversationId
. - Call the
getPollUsers()
function using the instance of theLMChatClient
class. - 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:
Variable | Type | Description | Optional |
---|---|---|---|
pollId | int | The ID of the poll | |
conversationId | int | The ID of the conversation |
GetPollUsersResponse
List of parameters for the GetPollUsersResponse
class:
Variable | Type | Description | Optional |
---|---|---|---|
data | List<User> | A list of users who participated in the poll | ✔️ |