Skip to content

Commit 895c7c1

Browse files
committed
added 'user/repos' missing endpoint
1 parent 5620395 commit 895c7c1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/Github/Api/User.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ public function subscriptions($username)
145145
}
146146

147147
/**
148+
* @deprecated use repos($username, $options) instead
149+
*
148150
* Get the repositories of a user.
149151
*
150152
* @link http://developer.github.com/v3/repos/
@@ -158,13 +160,26 @@ public function subscriptions($username)
158160
*/
159161
public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc')
160162
{
161-
return $this->get('/users/'.rawurlencode($username).'/repos', array(
163+
return $this->repos($username, array(
162164
'type' => $type,
163165
'sort' => $sort,
164166
'direction' => $direction
165167
));
166168
}
167169

170+
/**
171+
* @param null $username
172+
* @param array $options
173+
*
174+
* @return array list of the user repositories
175+
*/
176+
public function repos($username = null, array $options = array())
177+
{
178+
$url = $username ? 'users/'.rawurldecode($username).'/repos' : 'user/repos';
179+
180+
return $this->get($url, $options);
181+
}
182+
168183
/**
169184
* Get the public gists for a user.
170185
*

0 commit comments

Comments
 (0)