Skip to content

Commit 1413f07

Browse files
committed
Merge remote-tracking branch 'original/master'
Conflicts: lib/Github/Api/Repo.php
2 parents 58b9835 + 1b1042f commit 1413f07

28 files changed

+279
-248
lines changed

lib/Github/Api/CurrentUser.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,14 @@ public function watched($page = 1)
100100
'page' => $page
101101
));
102102
}
103+
104+
/**
105+
* @link http://developer.github.com/changes/2012-9-5-watcher-api/
106+
*/
107+
public function starred($page = 1)
108+
{
109+
return $this->get('user/starred', array(
110+
'page' => $page
111+
));
112+
}
103113
}

lib/Github/Api/CurrentUser/Followers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Followers extends AbstractApi
1414
* List followed users by the authenticated user
1515
* @link http://developer.github.com/v3/repos/followers/
1616
*
17-
* @param integer $page
17+
* @param integer $page
1818
* @return array
1919
*/
2020
public function all($page = 1)
@@ -28,7 +28,7 @@ public function all($page = 1)
2828
* Check that the authenticated user follows a user
2929
* @link http://developer.github.com/v3/repos/followers/
3030
*
31-
* @param string $username the username to follow
31+
* @param string $username the username to follow
3232
* @return array
3333
*/
3434
public function check($username)
@@ -40,7 +40,7 @@ public function check($username)
4040
* Make the authenticated user follow a user
4141
* @link http://developer.github.com/v3/repos/followers/
4242
*
43-
* @param string $username the username to follow
43+
* @param string $username the username to follow
4444
* @return array
4545
*/
4646
public function follow($username)
@@ -52,7 +52,7 @@ public function follow($username)
5252
* Make the authenticated user un-follow a user
5353
* @link http://developer.github.com/v3/repos/followers/
5454
*
55-
* @param string $username the username to un-follow
55+
* @param string $username the username to un-follow
5656
* @return array
5757
*/
5858
public function unfollow($username)

lib/Github/Api/CurrentUser/Notifications.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Notifications extends AbstractApi
1414
* List all notifications for the authenticated user
1515
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications
1616
*
17-
* @param array $params
17+
* @param array $params
1818
* @return array
1919
*/
2020
public function all(array $params = array())
@@ -26,9 +26,9 @@ public function all(array $params = array())
2626
* List all notifications for the authenticated user in selected repository
2727
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
2828
*
29-
* @param string $username the user who owns the repo
30-
* @param string $repository the name of the repo
31-
* @param array $params
29+
* @param string $username the user who owns the repo
30+
* @param string $repository the name of the repo
31+
* @param array $params
3232
* @return array
3333
*/
3434
public function allInRepository($username, $repository, array $params = array())
@@ -39,7 +39,7 @@ public function allInRepository($username, $repository, array $params = array())
3939
/**
4040
* @link http://developer.github.com/v3/activity/notifications/#mark-as-read
4141
*
42-
* @param array $params
42+
* @param array $params
4343
* @return array
4444
*/
4545
public function markAsReadAll(array $params = array())
@@ -50,9 +50,9 @@ public function markAsReadAll(array $params = array())
5050
/**
5151
* @link http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
5252
*
53-
* @param string $username the user who owns the repo
54-
* @param string $repository the name of the repo
55-
* @param array $params
53+
* @param string $username the user who owns the repo
54+
* @param string $repository the name of the repo
55+
* @param array $params
5656
* @return array
5757
*/
5858
public function markAsReadInRepository($username, $repository, array $params = array())
@@ -63,8 +63,8 @@ public function markAsReadInRepository($username, $repository, array $params = a
6363
/**
6464
* @link http://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
6565
*
66-
* @param string $id the notification number
67-
* @param array $params
66+
* @param string $id the notification number
67+
* @param array $params
6868
* @return array
6969
*/
7070
public function markAsRead($id, array $params)
@@ -75,7 +75,7 @@ public function markAsRead($id, array $params)
7575
/**
7676
* @link http://developer.github.com/v3/activity/notifications/#view-a-single-thread
7777
*
78-
* @param string $id the notification number
78+
* @param string $id the notification number
7979
* @return array
8080
*/
8181
public function show($id)
@@ -86,7 +86,7 @@ public function show($id)
8686
/**
8787
* @link http://developer.github.com/v3/activity/notifications/#get-a-thread-subscription
8888
*
89-
* @param string $id the notification number
89+
* @param string $id the notification number
9090
* @return array
9191
*/
9292
public function showSubscription($id)
@@ -97,8 +97,8 @@ public function showSubscription($id)
9797
/**
9898
* @link http://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
9999
*
100-
* @param string $id the notification number
101-
* @param array $params
100+
* @param string $id the notification number
101+
* @param array $params
102102
* @return array
103103
*/
104104
public function createSubscription($id, array $params)
@@ -109,7 +109,7 @@ public function createSubscription($id, array $params)
109109
/**
110110
* @link http://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
111111
*
112-
* @param string $id the notification number
112+
* @param string $id the notification number
113113
* @return array
114114
*/
115115
public function removeSubscription($id)

lib/Github/Api/CurrentUser/Watchers.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Watchers extends AbstractApi
1414
* List repositories watched by the authenticated user
1515
* @link http://developer.github.com/v3/repos/watching/
1616
*
17-
* @param integer $page
17+
* @param integer $page
1818
* @return array
1919
*/
2020
public function all($page = 1)
@@ -28,8 +28,8 @@ public function all($page = 1)
2828
* Check that the authenticated user watches a repository
2929
* @link http://developer.github.com/v3/repos/watching/
3030
*
31-
* @param string $username the user who owns the repo
32-
* @param string $repository the name of the repo
31+
* @param string $username the user who owns the repo
32+
* @param string $repository the name of the repo
3333
* @return array
3434
*/
3535
public function check($username, $repository)
@@ -41,8 +41,8 @@ public function check($username, $repository)
4141
* Make the authenticated user watch a repository
4242
* @link http://developer.github.com/v3/repos/watching/
4343
*
44-
* @param string $username the user who owns the repo
45-
* @param string $repository the name of the repo
44+
* @param string $username the user who owns the repo
45+
* @param string $repository the name of the repo
4646
* @return array
4747
*/
4848
public function watch($username, $repository)
@@ -54,8 +54,8 @@ public function watch($username, $repository)
5454
* Make the authenticated user unwatch a repository
5555
* @link http://developer.github.com/v3/repos/watching/
5656
*
57-
* @param string $username the user who owns the repo
58-
* @param string $repository the name of the repo
57+
* @param string $username the user who owns the repo
58+
* @param string $repository the name of the repo
5959
* @return array
6060
*/
6161
public function unwatch($username, $repository)

lib/Github/Api/Issue.php

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class Issue extends AbstractApi
2121
* List issues by username, repo and state
2222
* @link http://developer.github.com/v3/issues/
2323
*
24-
* @param string $username the username
25-
* @param string $repository the repository
26-
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
27-
* @return array list of issues found
24+
* @param string $username the username
25+
* @param string $repository the repository
26+
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
27+
* @return array list of issues found
2828
*/
2929
public function all($username, $repository, array $params = array())
3030
{
@@ -35,12 +35,12 @@ public function all($username, $repository, array $params = array())
3535
* Search issues by username, repo, state and keyword
3636
* @link http://developer.github.com/v3/search/#search-issues
3737
*
38-
* @param string $username the username
39-
* @param string $repository the repository
40-
* @param string $state the issue state, can be open or closed
41-
* @param string $keyword the keyword to filter issues by
38+
* @param string $username the username
39+
* @param string $repository the repository
40+
* @param string $state the issue state, can be open or closed
41+
* @param string $keyword the keyword to filter issues by
4242
*
43-
* @return array list of issues found
43+
* @return array list of issues found
4444
*/
4545
public function find($username, $repository, $state, $keyword)
4646
{
@@ -51,14 +51,32 @@ public function find($username, $repository, $state, $keyword)
5151
return $this->get('legacy/issues/search/'.urlencode($username).'/'.urlencode($repository).'/'.urlencode($state).'/'.urlencode($keyword));
5252
}
5353

54+
/**
55+
* List issues by organization
56+
* @link http://developer.github.com/v3/issues/
57+
*
58+
* @param string $organization the organization
59+
* @param string $state the issue state, can be open or closed
60+
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
61+
* @return array list of issues found
62+
*/
63+
public function org($organization, $state, array $params = array())
64+
{
65+
if (!in_array($state, array('open', 'closed'))) {
66+
$state = 'open';
67+
}
68+
69+
return $this->get('orgs/'.urlencode($organization).'/issues', array_merge(array('page' => 1, 'state' => $state), $params));
70+
}
71+
5472
/**
5573
* Get extended information about an issue by its username, repo and number
5674
* @link http://developer.github.com/v3/issues/
5775
*
58-
* @param string $username the username
59-
* @param string $repository the repository
60-
* @param string $id the issue number
61-
* @return array information about the issue
76+
* @param string $username the username
77+
* @param string $repository the repository
78+
* @param string $id the issue number
79+
* @return array information about the issue
6280
*/
6381
public function show($username, $repository, $id)
6482
{
@@ -70,10 +88,10 @@ public function show($username, $repository, $id)
7088
* The issue is assigned to the authenticated user. Requires authentication.
7189
* @link http://developer.github.com/v3/issues/
7290
*
73-
* @param string $username the username
74-
* @param string $repository the repository
75-
* @param array $params the new issue data
76-
* @return array information about the issue
91+
* @param string $username the username
92+
* @param string $repository the repository
93+
* @param array $params the new issue data
94+
* @return array information about the issue
7795
*
7896
* @throws MissingArgumentException
7997
*/
@@ -90,12 +108,12 @@ public function create($username, $repository, array $params)
90108
* Update issue information's by username, repo and issue number. Requires authentication.
91109
* @link http://developer.github.com/v3/issues/
92110
*
93-
* @param string $username the username
94-
* @param string $repository the repository
95-
* @param string $id the issue number
96-
* @param array $params key=>value user attributes to update.
97-
* key can be title or body
98-
* @return array information about the issue
111+
* @param string $username the username
112+
* @param string $repository the repository
113+
* @param string $id the issue number
114+
* @param array $params key=>value user attributes to update.
115+
* key can be title or body
116+
* @return array information about the issue
99117
*/
100118
public function update($username, $repository, $id, array $params)
101119
{

lib/Github/Api/Organization.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class Organization extends AbstractApi
1818
* Get extended information about an organization by its name
1919
* @link http://developer.github.com/v3/orgs/#get
2020
*
21-
* @param string $organization the organization to show
21+
* @param string $organization the organization to show
2222
*
23-
* @return array informations about the organization
23+
* @return array informations about the organization
2424
*/
2525
public function show($organization)
2626
{
@@ -36,10 +36,10 @@ public function update($organization, array $params)
3636
* List all repositories across all the organizations that you can access
3737
* @link http://developer.github.com/v3/repos/#list-organization-repositories
3838
*
39-
* @param string $organization the user name
40-
* @param string $type the type of repositories
39+
* @param string $organization the user name
40+
* @param string $type the type of repositories
4141
*
42-
* @return array the repositories
42+
* @return array the repositories
4343
*/
4444
public function repositories($organization, $type = 'all')
4545
{

lib/Github/Api/PullRequest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ class PullRequest extends AbstractApi
1717
* Get a listing of a project's pull requests by the username, repository and (optionally) state.
1818
* @link http://developer.github.com/v3/pulls/
1919
*
20-
* @param string $username the username
21-
* @param string $repository the repository
22-
* @param string $state the state of the fetched pull requests.
23-
* The API seems to automatically default to 'open'
24-
* @param integer $page the page
25-
* @param integer $perPage the per page
20+
* @param string $username the username
21+
* @param string $repository the repository
22+
* @param string $state the state of the fetched pull requests.
23+
* The API seems to automatically default to 'open'
24+
* @param integer $page the page
25+
* @param integer $perPage the per page
2626
*
27-
* @return array array of pull requests for the project
27+
* @return array array of pull requests for the project
2828
*/
2929
public function all($username, $repository, $state = null, $page = 1, $perPage = 30)
3030
{
@@ -41,11 +41,11 @@ public function all($username, $repository, $state = null, $page = 1, $perPage =
4141
* Show all details of a pull request, including the discussions.
4242
* @link http://developer.github.com/v3/pulls/
4343
*
44-
* @param string $username the username
45-
* @param string $repository the repository
46-
* @param string $id the ID of the pull request for which details are retrieved
44+
* @param string $username the username
45+
* @param string $repository the repository
46+
* @param string $id the ID of the pull request for which details are retrieved
4747
*
48-
* @return array array of pull requests for the project
48+
* @return array array of pull requests for the project
4949
*/
5050
public function show($username, $repository, $id)
5151
{
@@ -71,13 +71,13 @@ public function comments()
7171
* Create a pull request
7272
* @link http://developer.github.com/v3/pulls/
7373
*
74-
* @param string $username the username
75-
* @param string $repository the repository
76-
* @param array $params A String of the branch or commit SHA that you want your changes to be pulled to.
77-
* A String of the branch or commit SHA of your changes. Typically this will be a branch.
78-
* If the branch is in a fork of the original repository, specify the username first:
79-
* "my-user:some-branch". The String title of the Pull Request. The String body of
80-
* the Pull Request. The issue number. Used when title and body is not set.
74+
* @param string $username the username
75+
* @param string $repository the repository
76+
* @param array $params A String of the branch or commit SHA that you want your changes to be pulled to.
77+
* A String of the branch or commit SHA of your changes. Typically this will be a branch.
78+
* If the branch is in a fork of the original repository, specify the username first:
79+
* "my-user:some-branch". The String title of the Pull Request. The String body of
80+
* the Pull Request. The issue number. Used when title and body is not set.
8181
*
8282
* @return array
8383
*
@@ -102,13 +102,13 @@ public function create($username, $repository, array $params)
102102
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params);
103103
}
104104

105-
public function update($username, $repository, array $params)
105+
public function update($username, $repository, $id, array $params)
106106
{
107107
if (isset($params['state']) && !in_array($params['state'], array('open', 'closed'))) {
108108
$params['state'] = 'open';
109109
}
110110

111-
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params);
111+
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id), $params);
112112
}
113113

114114
public function merged($username, $repository, $id)

0 commit comments

Comments
 (0)