Skip to content

Migrate read-state request bodies to generated models#6550

Merged
gpunto merged 3 commits into
developfrom
migrate/read-state-requests
Jul 9, 2026
Merged

Migrate read-state request bodies to generated models#6550
gpunto merged 3 commits into
developfrom
migrate/read-state-requests

Conversation

@gpunto

@gpunto gpunto commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the read-state request bodies (markRead, markUnread) to generated models. Part of the incremental OpenAPI model migration.

Part of AND-1291

Implementation

  • Add generated internal MarkReadRequest and MarkUnreadRequest in network.models; delete the hand-written ones. Point ChannelApi/MoshiChatApi/tests at them.
  • Field names move to camelCase with @Json names preserved (message_id -> messageId, message_timestamp -> messageTimestamp, thread_id -> threadId), so the wire format is unchanged; only positional/named args at the call sites change.
  • markAllRead sends no body, so there is no MarkChannelsReadRequest to migrate here.

Testing

  • Project-wide spotlessApply, apiDump (no API drift), detekt, and testDebugUnitTest all pass.
  • Verified on device: markMessageRead -> 200, markUnread -> 200.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of read and unread status updates, including threaded conversations.
    • Updated request data handling for better compatibility and consistency across the app.

@github-actions

github-actions Bot commented Jul 6, 2026

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

github-actions Bot commented Jul 6, 2026

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.20 MB 11.20 MB 0.00 MB 🟢
stream-chat-android-compose 12.68 MB 12.68 MB 0.00 MB 🟢

@gpunto gpunto force-pushed the migrate/read-state-requests branch from 96c6a70 to 760bea1 Compare July 7, 2026 13:23
@gpunto gpunto added the pr:internal Internal changes / housekeeping label Jul 7, 2026
@gpunto gpunto force-pushed the migrate/read-state-requests branch from 760bea1 to 17cefd6 Compare July 8, 2026 15:13
@gpunto gpunto marked this pull request as ready for review July 8, 2026 15:20
@gpunto gpunto requested a review from a team as a code owner July 8, 2026 15:20
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

MarkReadRequest and MarkUnreadRequest are moved from client.api2.model.requests to network.models, with fields renamed from snake_case to camelCase and Moshi @Json annotations added to preserve wire field names. ChannelApi, MoshiChatApi, and their tests are updated accordingly.

Changes

MarkRead/MarkUnread request relocation

Layer / File(s) Summary
Redefine request models
stream-chat-android-client/.../network/models/MarkReadRequest.kt, stream-chat-android-client/.../network/models/MarkUnreadRequest.kt
Both request classes moved to network.models package with camelCase fields (messageId, threadId, messageTimestamp) and @Json(name=...) annotations mapping to original snake_case wire keys.
Update API and construction call sites
stream-chat-android-client/.../api2/endpoint/ChannelApi.kt, stream-chat-android-client/.../api2/MoshiChatApi.kt
Imports updated to the new package; markRead, markThreadRead, and markUnread construct requests using camelCase parameter names.
Update tests
stream-chat-android-client/src/test/.../MoshiChatApiTest.kt
Test imports and expected request objects in testMarkRead, testMarkThreadRead, and testMarkUnread updated to use camelCase constructor parameters.

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

Possibly related PRs

Suggested reviewers: andremion

Poem

A rabbit hopped through fields of code,
Snake_case gone, camelCase now flowed,
MarkRead, MarkUnread found new homes,
With @Json tags like little gnomes,
Hop hop hooray, the tests still pass! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: migrating read-state request bodies to generated models.
Description check ✅ Passed The description includes Goal, Implementation, and Testing, and the missing UI/GIF sections are reasonable for this non-visual change.
✨ 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/read-state-requests

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.

One thing to verify inline before merge.

# Conflicts:
#	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/ChannelApi.kt
#	stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@gpunto gpunto merged commit e26038e into develop Jul 9, 2026
24 of 25 checks passed
@gpunto gpunto deleted the migrate/read-state-requests branch July 9, 2026 13:19
@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