io.getstream.client.ModerationClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stream-java Show documentation
Show all versions of stream-java Show documentation
Stream Feeds Java Client for backend and android integrations
package io.getstream.client;
import static io.getstream.core.utils.Auth.buildModerationToken;
import static io.getstream.core.utils.Auth.buildReactionsToken;
import static io.getstream.core.utils.Routes.*;
import static io.getstream.core.utils.Serialization.*;
import io.getstream.core.Moderation;
import io.getstream.core.exceptions.StreamException;
import io.getstream.core.http.Response;
import io.getstream.core.http.Token;
import io.getstream.core.utils.Auth;
import java.util.Map;
import java8.util.concurrent.CompletableFuture;
public class ModerationClient {
private final String secret;
private final Moderation mod;
ModerationClient(String secret, Moderation mod) {
this.secret = secret;
this.mod = mod;
}
public CompletableFuture flagUser(
String flaggedUserId,String reportingUser, String reason, Map options) throws StreamException {
return flag("stream:user", flaggedUserId, reportingUser, reason, options);
}
public CompletableFuture flagActivity(
String entityId, String reportingUser, String reason, Map options)
throws StreamException {
return flag("stream:feeds:v2:activity", entityId, reportingUser, reason, options);
}
public CompletableFuture flagReaction(
String entityId, String reportingUser, String reason, Map options)
throws StreamException {
return flag("stream:feeds:v2:reaction", entityId, reportingUser, reason, options);
}
private CompletableFuture flag(
String entityType,
String entityId,
String reportingUser,
String reason,
Map options)
throws StreamException {
final Token token = buildModerationToken(secret, Auth.TokenAction.WRITE);
return mod.flag(token, entityType, entityId, reportingUser, reason, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy