Migrate mark-delivered, send-action, and partial-update-member request bodies to generated models#6569
Migrate mark-delivered, send-action, and partial-update-member request bodies to generated models#6569gpunto wants to merge 4 commits into
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
WalkthroughRequest models for delivery, member updates, and message actions were moved to the network layer. API2 endpoints and request construction now use the new models, with tests updated for the revised payload shapes and string form-data mapping. ChangesNetwork request model migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt (1)
1340-1349: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winAvoid coercing
formDatahere. InMoshiChatApi.kt:1340-1344,SendActionRequest.formDataisMap<Any, Any>, so.toString()changes any non-string values before serialization. Narrow the domain type toMap<String, String>or preserve the original values if that payload shape matters.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt` around lines 1340 - 1349, Update sendAction to avoid converting formData keys and values with toString(). Narrow SendActionRequest.formData to Map<String, String> and pass it directly into MessageActionRequest, or change the API model to preserve non-string values when they are required by the payload.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt`:
- Around line 1340-1349: Update sendAction to avoid converting formData keys and
values with toString(). Narrow SendActionRequest.formData to Map<String, String>
and pass it directly into MessageActionRequest, or change the API model to
preserve non-string values when they are required by the payload.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 940c67a7-284d-49ad-bc50-29a46c7eb907
📒 Files selected for processing (9)
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/ChannelApi.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/MessageApi.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/MarkDeliveredRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/DeliveredMessagePayload.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MarkDeliveredRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessageActionRequest.ktstream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UpdateMemberPartialRequest.ktstream-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/MarkDeliveredRequest.kt


Goal
Migrate three small request bodies to their generated
network.modelstypes. Batched together as they're each single-model swaps of the same shape. Part of the incremental OpenAPI model migration.Part of AND-1291
Implementation
Each endpoint swaps its hand-written request DTO for the generated model (real names, no migration aliases); no wire-shape changes.
markDelivered(POST /channels/delivered) -> generatedMarkDeliveredRequest+DeliveredMessagePayload.MarkDeliveredRequest.create(...)inlined asmessages.map { DeliveredMessagePayload(cid = it.cid, id = it.id) }. Dropped a redundant same-package qualifier on the nested type to fit detekt's line limit.sendAction(POST /messages/{id}/action) -> generatedMessageActionRequest(onlyform_data; the backend struct reads the message id from the path and ignoreschannel_id/type, verified against/chat).partialUpdateMember(PATCH /channels/{type}/{id}/member/{user_id}) -> generatedUpdateMemberPartialRequest. Call site switched to named args because the generated model orders fieldsunset, set(positional would swap them).Testing
spotlessApply,apiCheck(no API drift),detekt, and the clienttestDebugUnitTestsuite pass.markDelivered: real inbound delivery firedPOST /channels/delivered{"latest_delivered_messages":[{"cid","id"}]}-> 201.sendAction: giphy shuffle/send sent{"form_data":{"image_action":"…"}}-> 2xx.partialUpdateMember: set/unset a member custom field round-tripped (probe=v1->probe=null) -> 200.Summary by CodeRabbit