1
1
## Activity API (incomplete)
2
2
[ Back to the navigation] ( index.md )
3
3
4
- Access to Starring and Watching a Repository for authenticated users.
4
+ Access to Starring and Watching a Repository for [ non ] authenticated users.
5
5
Wrap [ GitHub Activity API] ( https://developer.github.com/v3/activity/ ) .
6
6
7
- > No authentication required.
7
+ > ** * No authentication required. ** *
8
8
9
9
### Get repos that a specific user has starred
10
10
@@ -14,7 +14,15 @@ $users = $client->api('user')->starred('ornicar');
14
14
15
15
Returns an array of starred repos.
16
16
17
- > Requires [ authentication] ( security.md ) .
17
+ ### Get repos that a specific user is watching
18
+
19
+ ``` php
20
+ $users = $client->api('user')->watched('ornicar');
21
+ ```
22
+
23
+ Returns an array of watched repos.
24
+
25
+ > ** * Requires [ authentication] ( security.md ) . ** *
18
26
19
27
### Get repos that a authenticated user has starred
20
28
@@ -48,4 +56,39 @@ $owner = "KnpLabs";
48
56
$repo = "php-github-api";
49
57
$activity = $client->api('current_user')->starred()->unstar($owner, $repo);
50
58
```
59
+ Throws an Exception in case of failure or NULL in case of success.
60
+
61
+
62
+ ### Get repos that a authenticated user is watching
63
+
64
+ ``` php
65
+ $activity = $client->api('current_user')->watchers()->all();
66
+ ```
67
+ Returns an array of watched repos.
68
+
69
+ ### Check if authenticated user is watching a specific repo
70
+
71
+ ``` php
72
+ $owner = "KnpLabs";
73
+ $repo = "php-github-api";
74
+ $activity = $client->api('current_user')->watchers()->check($owner, $repo);
75
+ ```
76
+ Throws an Exception with code 404 in case that the repo is not beeing watched by the authenticated user or NULL in case that it is beeing watched by the authenticated user.
77
+
78
+ ### Watch a specific repo for authenticated user
79
+
80
+ ``` php
81
+ $owner = "KnpLabs";
82
+ $repo = "php-github-api";
83
+ $activity = $client->api('current_user')->watchers()->watch($owner, $repo);
84
+ ```
85
+ Throws an Exception in case of failure or NULL in case of success.
86
+
87
+ ### Stop watching a specific repo for authenticated user
88
+
89
+ ``` php
90
+ $owner = "KnpLabs";
91
+ $repo = "php-github-api";
92
+ $activity = $client->api('current_user')->watchers()->unwatch($owner, $repo);
93
+ ```
51
94
Throws an Exception in case of failure or NULL in case of success.
0 commit comments