Skip to content

Commit 59bdcf7

Browse files
committed
improved documentation
1 parent 4af5314 commit 59bdcf7

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

doc/activity.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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.

doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ APIs:
2020
* [Assets](repo/assets.md)
2121
* [Users](users.md)
2222
* [Meta](meta.md)
23+
* [Activity](activity.md)
2324

2425
Additional features:
2526

doc/users.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ $client->api('current_user')->follow()->unfollow('symfony');
108108
Returns an array of followed users.
109109

110110
### Get repos that a specific user is watching
111+
> See [more](activity.md).
111112
112113
```php
113114
$users = $client->api('user')->watched('ornicar');
@@ -124,6 +125,7 @@ $users = $client->api('current_user')->watched();
124125
Returns an array of watched repos.
125126

126127
### Get repos that a specific user has starred
128+
> See [more](activity.md).
127129
128130
```php
129131
$users = $client->api('user')->starred('ornicar');

0 commit comments

Comments
 (0)