Skip to content

Commit

Permalink
chore: improve cast poll vote api
Browse files Browse the repository at this point in the history
  • Loading branch information
xsahil03x committed Dec 10, 2024
1 parent 8ad085d commit 687d2c5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/stream_chat/lib/src/client/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1271,10 +1271,12 @@ class StreamChatClient {
/// Cast a [vote] for the Poll [pollId].
Future<CastPollVoteResponse> castPollVote(
String messageId,
String pollId,
PollVote vote,
) =>
_chatApi.polls.castPollVote(messageId, pollId, vote);
String pollId, {
required String optionId,
}) {
final vote = PollVote(optionId: optionId);
return _chatApi.polls.castPollVote(messageId, pollId, vote);
}

/// Adds a answer with [answerText] for the Poll [pollId].
Future<CastPollVoteResponse> addPollAnswer(
Expand All @@ -1283,7 +1285,7 @@ class StreamChatClient {
required String answerText,
}) {
final vote = PollVote(answerText: answerText);
return castPollVote(messageId, pollId, vote);
return _chatApi.polls.castPollVote(messageId, pollId, vote);
}

/// Removes a vote by [voteId] for the Poll [pollId].
Expand Down

0 comments on commit 687d2c5

Please sign in to comment.