Skip to main content

Get Poll Users

Retrieves the list of users who selected a specific poll option in a poll conversation. This function fetches the users based on the provided poll option and conversation IDs.

Steps to get poll users

  1. Create a GetPollUsersRequest object using the builder pattern.
  2. Call the getPollUsers() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. Process the response LMResponse<GetPollUsersResponse> to handle the retrieved users or any errors.
let request = GetPollUsersRequest.builder()
.pollOptionId("ENTER_POLL_OPTION_ID")
.conversationId("ENTER_CONVERSATION_ID")
.build()

PollClient.shared.getPollUsers(request: request) { response in
if let result = response?.data {
// Handle success
print("Users who selected this poll option: \(result.members)")
} else if let error = response?.error {
// Handle error
print("Error fetching poll users: \(error.localizedDescription)")
}
}

Models

GetPollUsersRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
pollOptionIdStringID of the poll option to retrieve the users for
conversationIdStringID of the conversation the poll belongs to

GetPollUsersResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
members[Member]?List of members who selected the specific poll option✔️