|
| 1 | +## Activity API (incomplete) |
| 2 | +[Back to the navigation](index.md) |
| 3 | + |
| 4 | +Access to Starring and Watching a Repository for authenticated users. |
| 5 | +Wrap [GitHub Activity API](https://developer.github.com/v3/activity/). |
| 6 | + |
| 7 | +> No authentication required. |
| 8 | +
|
| 9 | +### Get repos that a specific user has starred |
| 10 | + |
| 11 | +```php |
| 12 | +$users = $client->api('user')->starred('ornicar'); |
| 13 | +``` |
| 14 | + |
| 15 | +Returns an array of starred repos. |
| 16 | + |
| 17 | +> Requires [authentication](security.md). |
| 18 | +
|
| 19 | +### Get repos that a authenticated user has starred |
| 20 | + |
| 21 | +```php |
| 22 | +$activity = $client->api('current_user')->starred()->all(); |
| 23 | +``` |
| 24 | +Returns an array of starred repos. |
| 25 | + |
| 26 | +### Check if authenticated user has starred a specific repo |
| 27 | + |
| 28 | +```php |
| 29 | +$owner = "KnpLabs"; |
| 30 | +$repo = "php-github-api"; |
| 31 | +$activity = $client->api('current_user')->starred()->check($owner, $repo); |
| 32 | +``` |
| 33 | +Throws an Exception with code 404 in case that the repo is not starred by the authenticated user or NULL in case that it is starred by the authenticated user. |
| 34 | + |
| 35 | +### Star a specific repo for authenticated user |
| 36 | + |
| 37 | +```php |
| 38 | +$owner = "KnpLabs"; |
| 39 | +$repo = "php-github-api"; |
| 40 | +$activity = $client->api('current_user')->starred()->star($owner, $repo); |
| 41 | +``` |
| 42 | +Throws an Exception in case of failure or NULL in case of success. |
| 43 | + |
| 44 | +### Unstar a specific repo for authenticated user |
| 45 | + |
| 46 | +```php |
| 47 | +$owner = "KnpLabs"; |
| 48 | +$repo = "php-github-api"; |
| 49 | +$activity = $client->api('current_user')->starred()->unstar($owner, $repo); |
| 50 | +``` |
| 51 | +Throws an Exception in case of failure or NULL in case of success. |
0 commit comments