-
-
Notifications
You must be signed in to change notification settings - Fork 600
Allow getting repo info by id, not just user and repo name #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d6a23e3
b968895
d8501bd
2b328e2
4347959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,20 @@ public function show($username, $repository) | |
{ | ||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); | ||
} | ||
|
||
/** | ||
* Get extended information about a repository by its id. | ||
* | ||
* @link http://developer.github.com/v3/repos/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a note saying it isn't documented... |
||
* | ||
* @param int $id the id of the repository | ||
* | ||
* @return array information about the repository | ||
*/ | ||
public function showById($id) | ||
{ | ||
return $this->get('/repositories/'.rawurlencode($id)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the ID always an integer? Why do we ned rawurlencode? ´return $this->get(sprintf('/repositories/%d', $id));` There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it should always be an integer (currently anyway). I thought about checking that they'd input an integer and if not throwing an exception, but then figured that it was better than us assuming IDs never become non-integers to just pass it over to GitHub and let them respond accordingly. Having the There probably isn't much in it as I think it's highly unlikely that GH will ever start to issue non-integer IDs, but personally I prefer this way - it's GitHub's ID, let's let them validate it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
/** | ||
* Create repository. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the note about the undocumented feature also here in the docs. This makes it more visible for users using this api method. We can remove the note later when it's official mentioned in the docs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done too