Skip to content

Migrate castPollVote request body to generated CastPollVoteRequest and VoteData models#6567

Merged
gpunto merged 1 commit into
developfrom
migrate/cast-poll-vote
Jul 10, 2026
Merged

Migrate castPollVote request body to generated CastPollVoteRequest and VoteData models#6567
gpunto merged 1 commit into
developfrom
migrate/cast-poll-vote

Conversation

@gpunto

@gpunto gpunto commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the castPollVote request body (POST /messages/{id}/polls/{poll_id}/vote) to the generated CastPollVoteRequest + VoteData network models. Part of the incremental OpenAPI model migration.

Part of AND-1291

Implementation

  • Add generated internal CastPollVoteRequest (wraps vote) and VoteData (option_id/answer_text) in network.models. Remove the hand-written PollVoteRequest + UpstreamVoteDto from PollRequests.kt. Real names, no alias.
  • PollsApi.castPollVote and the MoshiChatApi vote/answer wiring use the generated types. No wire-shape change: still {"vote":{"option_id":…}} / {"vote":{"answer_text":…}}.

Testing

  • spotlessApply, apiCheck (no API drift), detekt, lint, and the full client testDebugUnitTest suite pass (the castPollVote/castPollAnswer tests assert the exact request body).
  • Verified on device against the real backend, both vote variants: {"vote":{"option_id":"…"}} returns 201, and {"vote":{"answer_text":"probe answer"}} returns 201; both return a valid Vote.

Summary by CodeRabbit

  • Bug Fixes

    • Improved poll voting request handling for both option votes and text-based answers.
    • Maintained compatibility with the poll voting API while using updated request formatting.
  • Tests

    • Updated poll voting coverage to verify option and answer submissions with the revised request format.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.94 MB 5.94 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.21 MB 11.21 MB 0.00 MB 🟢
stream-chat-android-compose 12.68 MB 12.68 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@gpunto gpunto marked this pull request as ready for review July 10, 2026 11:47
@gpunto gpunto requested a review from a team as a code owner July 10, 2026 11:47
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 520c6217-454c-42d8-a375-ac2652ecf399

📥 Commits

Reviewing files that changed from the base of the PR and between 5a468b4 and 42c06b3.

📒 Files selected for processing (6)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/PollsApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/PollRequests.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/CastPollVoteRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/VoteData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/PollRequests.kt

Walkthrough

Poll vote casting now uses new Moshi network models, updates the polls API request type, removes legacy vote DTOs, and adjusts client implementation and tests for option and answer votes.

Changes

Poll vote model migration

Layer / File(s) Summary
Network vote models and legacy type removal
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/*, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/PollRequests.kt
Adds CastPollVoteRequest and VoteData, and removes PollVoteRequest and UpstreamVoteDto.
Polls API request contract
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/PollsApi.kt
Changes castPollVote to accept CastPollVoteRequest.
Client vote flow and test expectations
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
Builds option and answer votes with VoteData inside CastPollVoteRequest, and updates corresponding test payloads.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: pr:improvement

Suggested reviewers: andremion

Poem

A bunny packs votes in a fresh little nest,
With option and answer tucked safely at rest.
Old DTOs hop away, new models take flight,
API paths now carry the payload just right.
Tests wiggle their noses: all signals are green!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating castPollVote to the generated CastPollVoteRequest and VoteData models.
Description check ✅ Passed The description covers Goal, Implementation, and Testing with concrete details and verification steps, so it is mostly complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate/cast-poll-vote

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Verified the generated names and wire shape against the backend, and no remaining references to the removed types.

@gpunto gpunto merged commit c962b26 into develop Jul 10, 2026
21 of 22 checks passed
@gpunto gpunto deleted the migrate/cast-poll-vote branch July 10, 2026 14:14
@stream-public-bot stream-public-bot added the released Included in a release label Jul 13, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:internal Internal changes / housekeeping released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants