Poll

@Immutable
data class Poll(val id: String, val name: String, val description: String, val options: List<Option>, val votingVisibility: VotingVisibility, val enforceUniqueVote: Boolean, val maxVotesAllowed: Int, val allowUserSuggestedOptions: Boolean, val allowAnswers: Boolean, val voteCount: Int, val voteCountsByOption: Map<String, Int>, val votes: List<Vote>, val ownVotes: List<Vote>, val createdAt: Date, val updatedAt: Date, val closed: Boolean, val answersCount: Int, val answers: List<Answer> = emptyList(), val createdBy: User?, val extraData: Map<String, Any> = emptyMap()) : ComparableFieldProvider

The Poll object represents a poll in a channel.

Constructors

Link copied to clipboard
constructor(id: String, name: String, description: String, options: List<Option>, votingVisibility: VotingVisibility, enforceUniqueVote: Boolean, maxVotesAllowed: Int, allowUserSuggestedOptions: Boolean, allowAnswers: Boolean, voteCount: Int, voteCountsByOption: Map<String, Int>, votes: List<Vote>, ownVotes: List<Vote>, createdAt: Date, updatedAt: Date, closed: Boolean, answersCount: Int, answers: List<Answer> = emptyList(), createdBy: User?, extraData: Map<String, Any> = emptyMap())

Properties

Link copied to clipboard

If set to true, users can vote.

Link copied to clipboard

If set to true, users can suggest new options.

Link copied to clipboard

The list of poll answers.

Link copied to clipboard

The total number of answers in the poll.

Link copied to clipboard

If set to true, the poll is closed and no more votes can be cast.

Link copied to clipboard

The creation date of the poll.

Link copied to clipboard

The user who created the poll. This property is optional and might be null.

Link copied to clipboard

The description of the poll.

Link copied to clipboard

If set to true, a user can only vote once.

Link copied to clipboard

Any additional data associated with the poll.

Link copied to clipboard
val id: String

The unique identifier of the poll.

Link copied to clipboard

The maximum number of votes a user can cast.

Link copied to clipboard

The name of the poll.

Link copied to clipboard

The list of options for the poll.

Link copied to clipboard

The list of votes cast by the current user.

Link copied to clipboard

The last update date of the poll.

Link copied to clipboard

The total number of votes cast in the poll.

Link copied to clipboard

The number of votes for each option.

Link copied to clipboard

The list of votes.

Link copied to clipboard

The visibility of the votes. If set to VotingVisibility.ANONYMOUS, the votes will be anonymous.

Functions

Link copied to clipboard
open override fun getComparableField(fieldName: String): Comparable<*>?

Gets a comparable fields from a name.

Link copied to clipboard
fun getVotes(option: Option): List<Vote>

Get the votes for a specific option.