Skip to content

Latest commit

 

History

History
183 lines (116 loc) · 3.78 KB

users.md

File metadata and controls

183 lines (116 loc) · 3.78 KB

Users API

Back to the navigation

Searching users, getting user information and managing authenticated user account information. Wrap GitHub User API.

Search for users by keyword

$users = $client->api('user')->find('KnpLabs');

Returns an array of found users.

Lists all users, in the order they signed up, since the last user you've seen

$users = $client->api('user')->all(135);

Returns an array of all users that registered after the user whose ID is 135.

Lists all users, in the order they signed up

$users = $client->api('user')->all();

Returns an array of all users.

Get information about a user

$user = $client->api('user')->show('KnpLabs');

Returns an array of information about the user.

You can also use the User ID, but it will use an undocumented Github API

$user = $client->api('user')->showById(202732);

Update user information

Requires authentication.

Change user attributes: name, email, blog, company, location.

$client->api('current_user')->update(array(
    'location' => 'France',
    'blog'     => 'http://diem-project.org/blog'
));

Returns an array of information about the user.

Get users that a specific user is following

$users = $client->api('user')->following('KnpLabs');

Returns an array of followed users.

For authenticated user use.

Requires authentication.

$users = $client->api('current_user')->follow()->all();

Get users following a specific user

$users = $client->api('user')->followers('KnpLabs');

Returns an array of following users.

For authenticated user use.

Requires authentication.

$users = $client->api('current_user')->followers();

Follow a user

Requires authentication.

Make the authenticated user follow a user.

$client->api('current_user')->follow()->follow('symfony');

Returns an array of followed users.

Unfollow a user

Requires authentication.

Make the authenticated user unfollow a user.

$client->api('current_user')->follow()->unfollow('symfony');

Returns an array of followed users.

Get repos that a specific user is watching

See more.

$users = $client->api('user')->watched('ornicar');

For authenticated user use.

Requires authentication.

$users = $client->api('current_user')->watchers()->all();

Returns an array of watched repos.

Get repos that a specific user has starred

See more.

$users = $client->api('user')->starred('ornicar');

For authenticated user use.

Requires authentication.

$users = $client->api('current_user')->starring()->all();

Returns an array of starred repos.

Get the authenticated user emails

Requires authentication.

$emails = $client->api('current_user')->emails()->all();

Returns an array of the authenticated user emails.

Add an email to the authenticated user

Requires authentication.

$emails = $client->api('current_user')->emails()->add('[email protected]');
// or add few emails at once
$emails = $client->api('current_user')->emails()->add(array('[email protected]', '[email protected]'));

Returns an array of the authenticated user emails.

Remove an email from the authenticated user

Requires authentication.

$emails = $client->api('current_user')->emails()->remove('[email protected]');
// or remove few emails at once
$emails = $client->api('current_user')->emails()->remove(array('[email protected]', '[email protected]'));

Return an array of the authenticated user emails.