Find Users
Finds Users matching your criteria. The Users.find()
method supports a fluent style where you can chain together your search criteria.
Method Signature
UsersPage find();
UsersPage find(Filter filter);
UsersPage find(String pageToken);
UsersPage find(Filter filter, String pageToken);
UsersPage find(Filter filter, String pageToken, Integer pageSize);
Parameters
Parameter | Type | Description |
---|---|---|
filter | Filter | The filter criteria to search by, or null to fetch all Users. |
pageToken | String | The token of the page to fetch. |
pageSize | Integer | The number of results per page to fetch. |
returns | UsersPage | The requested page of Users |
You can search for matches among the following attributes of the Where
class.
Name | Type | Description |
---|---|---|
Text | String | Match against the user's Full Name |
/*
* This example demonstrates listing all users
*/
import org.catalytic.sdk.CatalyticClient;
import org.catalytic.sdk.entities.User;
import org.catalytic.sdk.entities.UsersPage;
import java.util.List;
import java.util.ArrayList;
public class Program {
public static void main(String[] args) throws Exception {
// Create and initialize the Catalytic SDK Client
CatalyticClient catalytic = new CatalyticClient();
List<User> users = new ArrayList<>();
// Find all users that match "alice"
Where where = new Where().text().matches("alice");
UsersPage results = catalytic.users().find(where);
// Add the users to an array
users.addAll(results.getUsers());
// Loop through all the pages of users and add them to the users array
while(results.getNextPageToken() != null) {
results = catalytic.users().find(where, results.getNextPageToken());
users.addAll(results.getUsers());
}
}
}
Updated almost 3 years ago