Skip to content

Migrate query channels, users, and grouped channels request bodies to generated models - #6597

Merged
gpunto merged 3 commits into
developfrom
migrate/query-request-bodies
Jul 29, 2026
Merged

Migrate query channels, users, and grouped channels request bodies to generated models#6597
gpunto merged 3 commits into
developfrom
migrate/query-request-bodies

Conversation

@gpunto

@gpunto gpunto commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the query-* request bodies to their generated OpenAPI models.

Part of AND-1291

Implementation

  • queryChannels -> generated QueryChannelsRequest (sort now via toSortParams(); filterValues/sortValues via .orEmpty()).
  • queryUsers -> generated QueryUsersPayload.
  • queryGroupedChannels -> generated GroupedQueryChannelsRequest + GroupedChannelsGroupRequest.
  • Removed the hand-written QueryChannelsRequest, QueryUsersRequest, QueryGroupedChannelsRequest request DTOs.
  • queryBannedUsers left hand-written on purpose: the generated QueryBannedUsersPayload omits the created_at_after/before(_or_equal) filter fields the current request sends, so migrating it would drop those filters.

Testing

  • Updated MoshiChatApiTest payload assertions to the generated models.
  • spotlessApply, apiCheck (no public-API change), detekt, full client testDebugUnitTest, and lint all pass.
  • Device probe (compose-sample) confirmed the live wire bodies:
    • queryChannels: sort:[{direction,field}], filter_conditions, and the new empty filter_values:{}/sort_values:{}/member_custom_include:[] accepted by the backend (201, real channels).
    • queryUsers: filter_conditions/sort/limit/offset/presence serialized correctly (200, real user).
    • queryGroupedChannels: body {"groups":{"messaging":{}},...} serialized correctly (endpoint is enterprise-gated, so it returns 403 on this app; serialization verified).

Summary by CodeRabbit

  • Bug Fixes
    • Improved channel, grouped-channel, and user query requests for more reliable API communication.
    • Preserved connection-dependent behavior when channel queries require watching or presence updates.
    • Improved handling of query filters, sorting, pagination, and message/member limits.

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

github-actions Bot commented Jul 29, 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 29, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.95 MB 5.96 MB 0.01 MB 🟢
stream-chat-android-ui-components 11.22 MB 11.23 MB 0.01 MB 🟢
stream-chat-android-compose 12.70 MB 12.70 MB 0.01 MB 🟢

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

coderabbitai Bot commented Jul 29, 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 Plus

Run ID: f768eee9-f521-4180-966e-eaabcbf025e1

📥 Commits

Reviewing files that changed from the base of the PR and between 610f17b and a329ed8.

📒 Files selected for processing (10)
  • 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/main/java/io/getstream/chat/android/client/api2/endpoint/UserApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryChannelsRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryGroupedChannelsRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GroupedChannelsGroupRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GroupedQueryChannelsRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/QueryChannelsRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/QueryUsersPayload.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
💤 Files with no reviewable changes (2)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryGroupedChannelsRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryChannelsRequest.kt

Walkthrough

Migrates channel, grouped-channel, and user query requests from client API models to Moshi-serializable network models, updates API signatures and field mappings, removes obsolete request definitions, and adjusts MoshiChatApiTest expectations.

Changes

Query payload model migration

Layer / File(s) Summary
Network query payload contracts
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/*Request.kt, .../QueryUsersPayload.kt
Adds network-layer Moshi models for channel, grouped-channel, grouped-channel group, and user query payloads.
API query mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt, .../endpoint/ChannelApi.kt, .../endpoint/UserApi.kt
Updates endpoint signatures and request construction to use the new payload types and revised field mappings.
Query payload expectations
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
Updates channel, grouped-channel, predefined-filter, and user query tests for the network models.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: andremion, velikovpetar

Poem

A rabbit hops through payload fields,
With network models neatly sealed.
Channels sort and users queue,
Grouped requests gain shapes anew.
Tests nibble every mapping bright—
All serialized just right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating query request bodies to generated models.
Description check ✅ Passed The description includes Goal, Implementation, and Testing, which cover the required core sections.
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 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate/query-request-bodies

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.

@gpunto
gpunto enabled auto-merge July 29, 2026 10:35

@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. Two small non-blocking comments inline.

@gpunto
gpunto force-pushed the migrate/query-request-bodies branch from a329ed8 to 03907bb Compare July 29, 2026 11:00
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
65.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@gpunto
gpunto added this pull request to the merge queue Jul 29, 2026
Merged via the queue into develop with commit 3b5627a Jul 29, 2026
23 of 25 checks passed
@gpunto
gpunto deleted the migrate/query-request-bodies branch July 29, 2026 12:48
@stream-public-bot stream-public-bot added the released Included in a release label Jul 30, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.7.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