Skip to content

Commit 839e518

Browse files
committed
Added way to list and delete repository downloads.
1 parent e692ef6 commit 839e518

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

lib/Github/Api/Repo.php

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,10 @@ public function getRepoContributors($username, $repo, $includingAnonymous = fals
363363
* Get the teams of a repository
364364
* @link http://developer.github.com/v3/repos/
365365
*
366-
* @param string $username the user who owns the repo
367-
* @param string $repo the name of the repo
368-
* @return array list of the languages
366+
* @param string $username the user who owns the repo
367+
* @param string $repo the name of the repo
368+
*
369+
* @return array list of the languages
369370
*/
370371
public function getRepoTeams($username, $repo)
371372
{
@@ -376,14 +377,43 @@ public function getRepoTeams($username, $repo)
376377
* Get contents of any file or directory in a repository
377378
* @link http://developer.github.com/v3/repos/contents/
378379
*
379-
* @param string $username the user who owns the repo
380-
* @param string $repo the name of the repo
381-
* @param string $path path to file or directory
380+
* @param string $username the user who owns the repo
381+
* @param string $repo the name of the repo
382+
* @param string $path path to file or directory
382383
*
383-
* @return array information for file | information for each item in directory
384+
* @return array information for file | information for each item in directory
384385
*/
385386
public function getRepoContents($username, $repo, $path)
386387
{
387388
return $this->get('repos/'.urlencode($username).'/'.urlencode($repo).'/contents/'.$path);
388389
}
390+
391+
/**
392+
* Get the downloads for selected repository
393+
* @link http://developer.github.com/v3/repos/downloads/#list-downloads-for-a-repository
394+
*
395+
* @param string $username the user who owns the repo
396+
* @param string $repo the name of the repo
397+
*
398+
* @return array
399+
*/
400+
public function getRepoDownloads($username, $repo)
401+
{
402+
return $this->get('repos/'.urlencode($username).'/'.urlencode($repo).'/downloads');
403+
}
404+
405+
/**
406+
* Delete a download in selected repository
407+
* @link http://developer.github.com/v3/repos/downloads/#delete-a-download
408+
*
409+
* @param string $username the user who owns the repo
410+
* @param string $repo the name of the repo
411+
* @param integer $id the id of the download file
412+
*
413+
* @return array
414+
*/
415+
public function deleteRepoDownload($username, $repo, $id)
416+
{
417+
return $this->delete('repos/'.urlencode($username).'/'.urlencode($repo).'/downloads/'.urlencode($id));
418+
}
389419
}

0 commit comments

Comments
 (0)