Skip to content

Migrate block/unblock user endpoints to generated models#6544

Merged
gpunto merged 1 commit into
developfrom
migrate/block-unblock-users
Jul 6, 2026
Merged

Migrate block/unblock user endpoints to generated models#6544
gpunto merged 1 commit into
developfrom
migrate/block-unblock-users

Conversation

@gpunto

@gpunto gpunto commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the /users/block and /users/unblock endpoints to generated request/response models. Part of the incremental OpenAPI model migration: generated models keep their generated package (io.getstream.chat.android.network.models) as internal classes inside the client module, one endpoint at a time.

Part of AND-1291

Implementation

  • Add generated BlockUsersRequest, BlockUsersResponse, UnblockUsersRequest, UnblockUsersResponse and delete the four hand-written DTOs.
  • Point UserApi, MoshiChatApi, and the toDomain() mapper at the generated types (real names, no import aliases), updating field access to the generated camelCase names.
  • queryBlockedUsers is left untouched (independent). Also fixes a pre-existing copy-paste where the unblock test argument used the block response type.

Testing

  • Project-wide spotlessApply, apiDump (no API drift), lint, detekt, and testDebugUnitTest all pass.
  • Verified on device: block a real user, confirm the id round-trips through request -> response (UserBlock), then unblock succeeds.

Summary by CodeRabbit

  • New Features

    • Updated user blocking and unblocking support to work with the latest API format.
    • Block/unblock actions now handle the newer response details, including duration information where available.
  • Tests

    • Refreshed automated coverage to match the updated block/unblock behavior and data handling.

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

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

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.93 MB 5.93 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.20 MB 11.20 MB 0.00 MB 🟢
stream-chat-android-compose 12.66 MB 12.66 MB 0.00 MB 🟢

@gpunto gpunto force-pushed the migrate/block-unblock-users branch from 08a4ba4 to 10f78c0 Compare July 6, 2026 07:37
@gpunto gpunto marked this pull request as ready for review July 6, 2026 10:30
@gpunto gpunto requested a review from a team as a code owner July 6, 2026 10:30
@coderabbitai

coderabbitai Bot commented Jul 6, 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: ce8ab8fc-edc5-4311-924a-052e7aaf4365

📥 Commits

Reviewing files that changed from the base of the PR and between 2fdde71 and 10f78c0.

📒 Files selected for processing (11)
  • 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/UserApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/BlockUsersRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/BlockUsersResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UnblockUsersRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/UnblockUsersResponse.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt

Walkthrough

Block and unblock user request/response DTOs are renamed from singular (BlockUserRequest/Response, UnblockUserRequest/Response) to plural bulk types (BlockUsersRequest/Response, UnblockUsersRequest/Response), moved to io.getstream.chat.android.network.models, switched to camelCase fields with explicit JSON mappings, and a new duration field is added to BlockUsersResponse. All consumers (UserApi, MoshiChatApi, DomainMapping, tests) are updated accordingly.

Changes

Block/Unblock user model migration

Layer / File(s) Summary
New bulk request/response models
stream-chat-android-client/.../network/models/BlockUsersRequest.kt, BlockUsersResponse.kt, UnblockUsersRequest.kt, UnblockUsersResponse.kt
Defines new Moshi DTOs with camelCase fields, explicit @Json name mappings, and a new duration field on BlockUsersResponse, replacing prior singular models in a different package.
Endpoint signature updates
stream-chat-android-client/.../api2/endpoint/UserApi.kt
blockUser/unblockUser Retrofit methods now accept/return the new bulk request/response types.
Client implementation updates
stream-chat-android-client/.../api2/MoshiChatApi.kt
Imports and request-body construction for blockUser/unblockUser switch to the new bulk request types.
Domain mapping updates
stream-chat-android-client/.../api2/mapping/DomainMapping.kt
toDomain() maps BlockUsersResponse to UserBlock using camelCase source fields instead of snake_case.
Test fixtures and cases
stream-chat-android-client/src/test/.../Mother.kt, MoshiChatApiTest.kt, MoshiChatApiTestArguments.kt, DomainMappingTest.kt
Test helpers and assertions updated to construct and verify the new bulk DTOs and camelCase fields.

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

Suggested labels: pr:improvement

Suggested reviewers: andremion

Poem

A rabbit hops through fields of code,
Where "User" turns to "Users" mode,
CamelCase now dances free,
Snake_case gone, as bright as can be!
Duration joins the response train,
Hop hop hooray, no fields remain plain! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating block/unblock user endpoints to generated models.
Description check ✅ Passed The description covers Goal, Implementation, and Testing clearly and is mostly complete despite missing optional sections.
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/block-unblock-users

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 force-pushed the migrate/block-unblock-users branch from 10f78c0 to cdc0754 Compare July 6, 2026 13:07
@gpunto gpunto enabled auto-merge (squash) July 6, 2026 13:09
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

@gpunto gpunto merged commit 81166d9 into develop Jul 6, 2026
19 checks passed
@gpunto gpunto deleted the migrate/block-unblock-users branch July 6, 2026 13:49
@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