Skip to content

Commit d6ac77c

Browse files
thewheatchoran
authored andcommitted
Update Readme with more user listing options (#165)
1 parent fe3accf commit d6ac77c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,27 @@ while(users.hasNext()) {
139139
System.out.println(users.next().getUserId());
140140
}
141141

142+
// List users (sorting)
143+
Map<String, String> params = Maps.newHashMap();
144+
params.put("sort", "updated_at");
145+
params.put("order", "asc");
146+
UserCollection users = User.list(params);
147+
148+
// List users (created within the past X days)
149+
Map<String, String> params = Maps.newHashMap();
150+
params.put("created_since", "2");
151+
UserCollection users = User.list(params);
152+
153+
// List users by tag
154+
Map<String, String> params = Maps.newHashMap();
155+
params.put("tag_id", "12345");
156+
UserCollection users = User.list(params);
157+
158+
// List users by segment
159+
Map<String, String> params = Maps.newHashMap();
160+
params.put("segment_id", "1234567890abcdef12345678");
161+
UserCollection users = User.list(params);
162+
142163
// Retrieve users via Scroll API
143164
ScrollableUserCollection usersScroll = User.scroll();
144165
List<User> users = usersScroll.getPage();

0 commit comments

Comments
 (0)