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
- Create a GetPollUsersRequest object using the builder pattern.
- Call the
getPollUsers()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
pollOptionId | String | ID of the poll option to retrieve the users for | |
conversationId | String | ID of the conversation the poll belongs to |
GetPollUsersResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
members | [Member]? | List of members who selected the specific poll option | ✔️ |