Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/io/getstream/client/ReactionsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ public CompletableFuture<Reaction> get(String id) throws StreamException {

public CompletableFuture<ReactionBatch> getBatch(List<String> ids) throws StreamException {
final Token token = buildReactionsToken(secret, TokenAction.READ);
return reactions.getBatchReactions(token, ids);
return reactions.getBatchReactions(token, ids, false);
}

public CompletableFuture<ReactionBatch> getBatch(List<String> ids, Boolean includeDeleted) throws StreamException {
final Token token = buildReactionsToken(secret, TokenAction.READ);
return reactions.getBatchReactions(token, ids, includeDeleted);
}

public CompletableFuture<List<Reaction>> filter(LookupKind lookup, String id)
throws StreamException {
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/io/getstream/core/StreamReactions.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,23 @@ public CompletableFuture<Void> restore(Token token, String id) throws StreamExce
}
}

public CompletableFuture<ReactionBatch> getBatchReactions(Token token, List<String> ids) throws StreamException {
public CompletableFuture<ReactionBatch> getBatchReactions(Token token, List<String> ids, Boolean includeDeleted) throws StreamException {
checkNotNull(ids, "Reaction IDs can't be null");
checkArgument(!ids.isEmpty(), "Reaction IDs can't be empty");

try {
final URL url = buildGetReactionsBatchURL(baseURL);
RequestOption optionIds =
new CustomQueryParameter(
"ids", String.join(",", ids));
"ids", String.join(",", ids)
);
RequestOption includeDeletedOption =
new CustomQueryParameter(
"include_deleted", includeDeleted.toString()
);

return httpClient
.execute(buildGet(url, key, token, optionIds))
.execute(buildGet(url, key, token, optionIds, includeDeletedOption))
.thenApply(
response -> {
try {
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/io/getstream/client/ReactionsClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ public void batchFetchReactions() throws Exception {
assertEquals(req.getActivityID(), r.getActivityID());
assertEquals(req.getKind(), r.getKind());
}

client.reactions().delete(r1.getId()).join();
response = client.reactions().getBatch(List.of(r1.getId(), r2.getId(), r3.getId(), r4.getId(), r5.getId(), r6.getId()), true).join();
result = response.getReactions();
//Deleted reaction should be present in the response
assertEquals(6, resultMap.size());
for (Reaction r : result) {
Reaction req = reactionsRequest.get(r.getId());
assertEquals(req.getActivityID(), r.getActivityID());
assertEquals(req.getKind(), r.getKind());
}
}

@Test
Expand Down
Loading