Skip to content

Commit 0005d74

Browse files
committed
Add Class for releases.
1 parent 0a14df1 commit 0005d74

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

lib/Github/Api/Repo.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Github\Api\Repository\Contents;
99
use Github\Api\Repository\DeployKeys;
1010
use Github\Api\Repository\Downloads;
11+
use Github\Api\Repository\Releases;
1112
use Github\Api\Repository\Forks;
1213
use Github\Api\Repository\Hooks;
1314
use Github\Api\Repository\Labels;
@@ -156,6 +157,17 @@ public function downloads()
156157
return new Downloads($this->client);
157158
}
158159

160+
/**
161+
* Manage the releases of a repository (Currently Undocumented)
162+
* @link http://developer.github.com/v3/repos/
163+
*
164+
* @return Releases
165+
*/
166+
public function releases()
167+
{
168+
return new Releases($this->client);
169+
}
170+
159171
/**
160172
* Manage the deploy keys of a repository
161173
* @link http://developer.github.com/v3/repos/keys/
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace Github\Api\Repository;
4+
5+
use Github\Api\AbstractApi;
6+
7+
/**
8+
* @author Matthew Simo <[email protected]>
9+
*/
10+
class Releases extends AbstractApi
11+
{
12+
/**
13+
* List releases in selected repository
14+
*
15+
* @param string $username the user who owns the repo
16+
* @param string $repository the name of the repo
17+
*
18+
* @return array
19+
*/
20+
public function all($username, $repository)
21+
{
22+
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/releases');
23+
}
24+
25+
/**
26+
* Get a release in selected repository
27+
*
28+
* @param string $username the user who owns the repo
29+
* @param string $repository the name of the repo
30+
* @param integer $id the id of the release
31+
*
32+
* @return array
33+
*/
34+
public function show($username, $repository, $id)
35+
{
36+
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/releases/'.urlencode($id));
37+
}
38+
39+
/**
40+
* Delete a download in selected repository
41+
*
42+
* @param string $username the user who owns the repo
43+
* @param string $repository the name of the repo
44+
* @param integer $id the id of the release
45+
*
46+
* @return array
47+
*/
48+
public function remove($username, $repository, $id)
49+
{
50+
return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/releases/'.urlencode($id));
51+
}
52+
}

0 commit comments

Comments
 (0)