From 1639bee626124c469313b658d96fe7e976cc6bfd Mon Sep 17 00:00:00 2001 From: Artem Kolesnikov Date: Tue, 12 Jun 2012 13:14:04 +0300 Subject: [PATCH] Added method getRepoContents for Repo API --- lib/Github/Api/Repo.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 86c926f486e..28833918b09 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -356,4 +356,19 @@ public function getRepoTeams($username, $repo) { return $this->get('repos/'.urlencode($username).'/'.urlencode($repo).'/teams'); } + + /** + * Get contents of any file or directory in a repository + * @link http://developer.github.com/v3/repos/contents/ + * + * @param string $username the user who owns the repo + * @param string $repo the name of the repo + * @param $path path to file or directory + * + * @return array information for file | information for each item in directory + */ + public function getRepoContents($username, $repo, $path) + { + return $this->get('repos/'.urlencode($username).'/'.urlencode($repo).'/contents/'.$path); + } }