Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.

Commit 3ada418

Browse files
committed
updated examples
1 parent 2feff8b commit 3ada418

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

examples/user.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323
use GitHub\API\User\User;
24+
use GitHub\API\AuthenticationException;
2425

2526
// Lets access the User API
2627
$user = new User();
@@ -42,8 +43,24 @@
4243
$user->setCredentials('username', 'password');
4344
$user->login();
4445

45-
// Update some user details
46-
var_dump($user->update(array('location' => 'Wales, United Kingdom')));
46+
try
47+
{
48+
// Check if your following user
49+
var_dump($user->isFollowing("octocat"));
50+
51+
// Update some user details
52+
var_dump($user->update(array('location' => 'Wales, United Kingdom')));
53+
54+
// Get all emails for user
55+
var_dump($user->emails()->all());
56+
57+
// Add key for user
58+
var_dump($user->keys()->create("New Key", "ssh-rsa CCC"));
59+
}
60+
catch (AuthenticationException $exception)
61+
{
62+
echo $exception->getMessage();
63+
}
4764

4865
// Finally lets logout
4966
$user->logout();

0 commit comments

Comments
 (0)