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
find(Filter $filter = null, string $pageToken = null, int $pageSize = null): UsersPage
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 | int | The number of results per page to fetch. |
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 |
Example
<?php
/*
* This example demonstrates listing all users
*/
require_once(__DIR__ . '/vendor/autoload.php');
use Catalytic\SDK\CatalyticClient;
use Catalytic\SDK\Search\Where;
$catalytic = new CatalyticClient();
$where = (new Where())->text()->matches('alice');
$results = $catalytic->users()->find($where);
$users = $results->getUsers();
// Fetch all pages and push the users into $users
while (!empty($results->getNextPageToken())) {
$results = $catalytic->users()->find($where, $results->getNextPageToken());
$users = array_merge($users, $results->getUsers());
}
Updated almost 3 years ago