toggle Vote
Toggles an upvote on a feature request via POST /api/v1/feature-requests/{id}/vote.
If the user has not voted yet, a vote is added; if they have already voted, their vote is removed. Returns the reconciled server vote state for optimistic UI synchronization.
Return
VoteResult containing the updated vote state (voted) and current total count (voteCount).
Parameters
feature Request Id
Unique ID of the target FeatureRequestItem.
user Token
Stable anonymous user token from UserTokenStore.
Throws
if anonymous voting is disallowed (HTTP 401).
on HTTP rejection.
on network or parsing failure.
Example:
val result = client.toggleVote(featureRequestId = "req_123", userToken = userToken)
println("Voted: ${result.voted}, New total: ${result.voteCount}")Content copied to clipboard