Skip to content

Commit 6645fce

Browse files
author
Max Klyga
committed
Version 3.1.0
* Add create and getOrCreate version w/o parameters to user classes * Split Filter and Pagination options into Filter, Offset and Limit to avoid including limit twice in request * Update feed classes to use new options * Fix enriched activity allowing verb attribute enrichment * Allow specifying user ID when using enrichment flags w/ server token * Create private constructors for utils static classes * Add tests for enriched activity feed URL * Formating fixes
1 parent d42d357 commit 6645fce

37 files changed

+1441
-565
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group 'io.getstream.client'
12-
version = '3.0.1'
12+
version = '3.1.0'
1313

1414
dependencies {
1515
testCompile 'org.junit.jupiter:junit-jupiter-api:5.3.1'

src/main/java/io/getstream/client/AggregatedFeed.java

Lines changed: 207 additions & 66 deletions
Large diffs are not rendered by default.

src/main/java/io/getstream/client/Feed.java

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import io.getstream.core.models.FeedID;
88
import io.getstream.core.models.FollowRelation;
99
import io.getstream.core.options.CustomQueryParameter;
10-
import io.getstream.core.options.Pagination;
10+
import io.getstream.core.options.Limit;
11+
import io.getstream.core.options.Offset;
1112
import io.getstream.core.options.RequestOption;
1213
import io.getstream.core.utils.DefaultOptions;
1314

@@ -86,7 +87,7 @@ public final <T> CompletableFuture<List<T>> addCustomActivities(Iterable<T> acti
8687
.addActivities(id, custom)
8788
.thenApply(response -> {
8889
try {
89-
Class<T> element = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()) .getActualTypeArguments()[0];
90+
Class<T> element = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
9091
return deserializeContainer(response, "activities", element);
9192
} catch (StreamException | IOException e) {
9293
throw new CompletionException(e);
@@ -165,26 +166,42 @@ public final CompletableFuture<Void> follow(FlatFeed feed, int activityCopyLimit
165166
}
166167

167168
public final CompletableFuture<List<FollowRelation>> getFollowers(Iterable<FeedID> feedIDs) throws StreamException {
168-
return getFollowers(DefaultOptions.DEFAULT_PAGINATION, Iterables.toArray(feedIDs, FeedID.class));
169+
return getFollowers(DefaultOptions.DEFAULT_LIMIT, DefaultOptions.DEFAULT_OFFSET, Iterables.toArray(feedIDs, FeedID.class));
169170
}
170171

171172
public final CompletableFuture<List<FollowRelation>> getFollowers(FeedID... feedIDs) throws StreamException {
172-
return getFollowers(DefaultOptions.DEFAULT_PAGINATION, feedIDs);
173+
return getFollowers(DefaultOptions.DEFAULT_LIMIT, DefaultOptions.DEFAULT_OFFSET, feedIDs);
173174
}
174175

175-
public final CompletableFuture<List<FollowRelation>> getFollowers(Pagination pagination, Iterable<FeedID> feedIDs) throws StreamException {
176-
return getFollowers(pagination, Iterables.toArray(feedIDs, FeedID.class));
176+
public final CompletableFuture<List<FollowRelation>> getFollowers(Limit limit, Iterable<FeedID> feedIDs) throws StreamException {
177+
return getFollowers(limit, DefaultOptions.DEFAULT_OFFSET, Iterables.toArray(feedIDs, FeedID.class));
177178
}
178179

179-
public final CompletableFuture<List<FollowRelation>> getFollowers(Pagination pagination, FeedID... feeds) throws StreamException {
180+
public final CompletableFuture<List<FollowRelation>> getFollowers(Limit limit, FeedID... feedIDs) throws StreamException {
181+
return getFollowers(limit, DefaultOptions.DEFAULT_OFFSET, feedIDs);
182+
}
183+
184+
public final CompletableFuture<List<FollowRelation>> getFollowers(Offset offset, Iterable<FeedID> feedIDs) throws StreamException {
185+
return getFollowers(DefaultOptions.DEFAULT_LIMIT, offset, Iterables.toArray(feedIDs, FeedID.class));
186+
}
187+
188+
public final CompletableFuture<List<FollowRelation>> getFollowers(Offset offset, FeedID... feedIDs) throws StreamException {
189+
return getFollowers(DefaultOptions.DEFAULT_LIMIT, offset, feedIDs);
190+
}
191+
192+
public final CompletableFuture<List<FollowRelation>> getFollowers(Limit limit, Offset offset, Iterable<FeedID> feedIDs) throws StreamException {
193+
return getFollowers(limit, offset, Iterables.toArray(feedIDs, FeedID.class));
194+
}
195+
196+
public final CompletableFuture<List<FollowRelation>> getFollowers(Limit limit, Offset offset, FeedID... feeds) throws StreamException {
180197
checkNotNull(feeds, "No feed ids to filter on");
181198

182199
final String[] feedIDs = Arrays.stream(feeds)
183200
.map(id -> id.toString())
184201
.toArray(String[]::new);
185202
final RequestOption[] options = feedIDs.length == 0
186-
? new RequestOption[] { pagination }
187-
: new RequestOption[] { pagination, new CustomQueryParameter("filter", String.join(",", feedIDs)) };
203+
? new RequestOption[]{limit, offset}
204+
: new RequestOption[]{limit, offset, new CustomQueryParameter("filter", String.join(",", feedIDs))};
188205
return client
189206
.getFollowers(id, options)
190207
.thenApply(response -> {
@@ -197,26 +214,42 @@ public final CompletableFuture<List<FollowRelation>> getFollowers(Pagination pag
197214
}
198215

199216
public final CompletableFuture<List<FollowRelation>> getFollowed(Iterable<FeedID> feedIDs) throws StreamException {
200-
return getFollowed(DefaultOptions.DEFAULT_PAGINATION, Iterables.toArray(feedIDs, FeedID.class));
217+
return getFollowed(DefaultOptions.DEFAULT_LIMIT, DefaultOptions.DEFAULT_OFFSET, Iterables.toArray(feedIDs, FeedID.class));
201218
}
202219

203220
public final CompletableFuture<List<FollowRelation>> getFollowed(FeedID... feedIDs) throws StreamException {
204-
return getFollowed(DefaultOptions.DEFAULT_PAGINATION, feedIDs);
221+
return getFollowed(DefaultOptions.DEFAULT_LIMIT, DefaultOptions.DEFAULT_OFFSET, feedIDs);
222+
}
223+
224+
public final CompletableFuture<List<FollowRelation>> getFollowed(Offset offset, Iterable<FeedID> feedIDs) throws StreamException {
225+
return getFollowed(DefaultOptions.DEFAULT_LIMIT, offset, Iterables.toArray(feedIDs, FeedID.class));
226+
}
227+
228+
public final CompletableFuture<List<FollowRelation>> getFollowed(Offset offset, FeedID... feedIDs) throws StreamException {
229+
return getFollowed(DefaultOptions.DEFAULT_LIMIT, offset, feedIDs);
230+
}
231+
232+
public final CompletableFuture<List<FollowRelation>> getFollowed(Limit limit, Iterable<FeedID> feedIDs) throws StreamException {
233+
return getFollowed(limit, DefaultOptions.DEFAULT_OFFSET, Iterables.toArray(feedIDs, FeedID.class));
234+
}
235+
236+
public final CompletableFuture<List<FollowRelation>> getFollowed(Limit limit, FeedID... feedIDs) throws StreamException {
237+
return getFollowed(limit, DefaultOptions.DEFAULT_OFFSET, feedIDs);
205238
}
206239

207-
public final CompletableFuture<List<FollowRelation>> getFollowed(Pagination pagination, Iterable<FeedID> feedIDs) throws StreamException {
208-
return getFollowed(pagination, Iterables.toArray(feedIDs, FeedID.class));
240+
public final CompletableFuture<List<FollowRelation>> getFollowed(Limit limit, Offset offset, Iterable<FeedID> feedIDs) throws StreamException {
241+
return getFollowed(limit, offset, Iterables.toArray(feedIDs, FeedID.class));
209242
}
210243

211-
public final CompletableFuture<List<FollowRelation>> getFollowed(Pagination pagination, FeedID... feeds) throws StreamException {
244+
public final CompletableFuture<List<FollowRelation>> getFollowed(Limit limit, Offset offset, FeedID... feeds) throws StreamException {
212245
checkNotNull(feeds, "No feed ids to filter on");
213246

214247
final String[] feedIDs = Arrays.stream(feeds)
215248
.map(id -> id.toString())
216249
.toArray(String[]::new);
217250
final RequestOption[] options = feedIDs.length == 0
218-
? new RequestOption[] { pagination }
219-
: new RequestOption[] { pagination, new CustomQueryParameter("filter", String.join(",", feedIDs)) };
251+
? new RequestOption[]{limit, offset}
252+
: new RequestOption[]{limit, offset, new CustomQueryParameter("filter", String.join(",", feedIDs))};
220253
return client
221254
.getFollowed(id, options)
222255
.thenApply(response -> {

0 commit comments

Comments
 (0)