Skip to content
Merged
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
22 changes: 14 additions & 8 deletions src/main/java/io/getstream/core/options/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

public final class Filter implements RequestOption {
enum OpType {
ID_GREATER_THEN_OR_EQUAL("id_gte"),
ID_GREATER_THEN("id_gt"),
ID_LESS_THEN_OR_EQUAL("id_lte"),
ID_LESS_THEN("id_lt");
ID_GREATER_THAN_OR_EQUAL("id_gte"),
ID_GREATER_THAN("id_gt"),
ID_LESS_THAN_OR_EQUAL("id_lte"),
ID_LESS_THAN("id_lt"),
REFRESH("refresh");

private String operator;

Expand All @@ -36,22 +37,27 @@ private static final class OpEntry {
private final List<OpEntry> ops = Lists.newArrayList();

public Filter idGreaterThan(String id) {
ops.add(new OpEntry(OpType.ID_GREATER_THEN, id));
ops.add(new OpEntry(OpType.ID_GREATER_THAN, id));
return this;
}

public Filter idGreaterThanEqual(String id) {
ops.add(new OpEntry(OpType.ID_GREATER_THEN_OR_EQUAL, id));
ops.add(new OpEntry(OpType.ID_GREATER_THAN_OR_EQUAL, id));
return this;
}

public Filter idLessThan(String id) {
ops.add(new OpEntry(OpType.ID_LESS_THEN, id));
ops.add(new OpEntry(OpType.ID_LESS_THAN, id));
return this;
}

public Filter idLessThanEqual(String id) {
ops.add(new OpEntry(OpType.ID_LESS_THEN_OR_EQUAL, id));
ops.add(new OpEntry(OpType.ID_LESS_THAN_OR_EQUAL, id));
return this;
}

public Filter refresh() {
ops.add(new OpEntry(OpType.REFRESH, "1"));
return this;
}

Expand Down