Skip to content

Commit 711ceca

Browse files
committed
test: update ModerationTest for regenerated flag/ban return types
flag() now returns FlagItemResponse and ban() returns ModerationBanResponse after the OpenAPI regeneration. Update the hand-maintained ModerationTest assignments accordingly, and add the ban() return-type change to the CHANGELOG breaking list (it was missed in the first pass).
1 parent 5951f01 commit 711ceca

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ All notable changes to this project will be documented in this file. See [standa
5151

5252
These come from regenerating against the latest chat OpenAPI spec. They are source- and binary-incompatible for Java consumers (changed return types and removed/retyped getters), so this release is a major version bump.
5353

54+
- `Moderation.ban(...)` now returns `StreamRequest<ModerationBanResponse>` (was `StreamRequest<BanResponse>`). `BanResponse` is unchanged and still used elsewhere (e.g. `getBans()`); only the `ban()` action return type moved to the dedicated `ModerationBanResponse`.
5455
- `Moderation.flag(...)` now returns `StreamRequest<FlagItemResponse>` (was `StreamRequest<FlagResponse>`). The moderation flag-action acknowledgement, which carries `itemID` and `duration`, moved to the new `FlagItemResponse`; `FlagResponse` now models the full flag record (`createdAt`, `updatedAt`, `targetMessage`, `targetUser`, `user`, `reason`, `details`, `custom`, and related fields). This resolves an upstream OpenAPI name collision where the acknowledgement was shadowing the rich record. The `/api/v2/moderation/flag` wire response is unchanged; call sites typed on `FlagResponse` must switch to `FlagItemResponse`.
5556
- Removed getters: `FlagResponse.getItemID()`, `FlagResponse.getDuration()`, `FlagDetails.getExtra()`.
5657
- Changed getter return types: `ChannelInput.getConfigOverrides()` and `ChannelDataUpdate.getConfigOverrides()` now return `ChannelConfigOverrides` (was `ChannelConfig`); `FlagDetails.getAutomod()` now returns `AutomodDetailsResponse` (was `AutomodDetails`); `ChatMessageResponse.getAttachments()` now returns `List<Attachment>` (was `List<Object>`); `ChatMessageResponse.getOwnReactions()` and `getLatestReactions()` now return `List<ChatReactionResponse>` (was `List<Object>`).

src/test/java/io/getstream/ModerationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void testBanWithReason() throws Exception {
7777
.bannedByID(testModeratorId)
7878
.build();
7979

80-
BanResponse response = moderation.ban(request).execute().getData();
80+
ModerationBanResponse response = moderation.ban(request).execute().getData();
8181
// snippet-end: BanWithReason
8282

8383
Assertions.assertNotNull(response);
@@ -109,7 +109,7 @@ void testFlagActivity() throws Exception {
109109
.userID(testUserId2)
110110
.build();
111111

112-
FlagResponse response = moderation.flag(request).execute().getData();
112+
FlagItemResponse response = moderation.flag(request).execute().getData();
113113
// snippet-end: FlagActivity
114114

115115
Assertions.assertNotNull(response);
@@ -145,7 +145,7 @@ void testFlagUser() throws Exception {
145145
.userID(testUserId2)
146146
.build();
147147

148-
FlagResponse response = moderation.flag(request).execute().getData();
148+
FlagItemResponse response = moderation.flag(request).execute().getData();
149149
// snippet-end: FlagUser
150150

151151
Assertions.assertNotNull(response);

0 commit comments

Comments
 (0)