File tree Expand file tree Collapse file tree 4 files changed +90
-0
lines changed Expand file tree Collapse file tree 4 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1414* [ Pull Requests] ( pull_requests.md )
1515 * [ Comments] ( pull_request/comments.md )
1616* [ Repositories] ( repos.md )
17+ * [ Releases] ( repo/releases.md )
1718* [ Users] ( users.md )
1819
1920Additional features:
Original file line number Diff line number Diff line change 1+ ## Repo / Releases API
2+ [ Back to the "Repos API"] ( ../repos.md ) | [ Back to the navigation] ( ../index.md )
3+
4+ This Github API Endpoint is currently undocumented because it's new, but works just fine.
5+
6+
7+ ### List all releases
8+
9+ ``` php
10+ $releases = $client->api('repo')->releases()->all('twbs', 'bootstrap');
11+ ```
12+
13+ ### List one release
14+
15+ ``` php
16+ $release = $client->api('repo')->releases()->show('twbs', 'bootstrap', $id);
17+ ```
18+
19+ ### Remove a release
20+
21+ This works, but isn't thoroughly tested, use at your own risk.
22+
23+ ``` php
24+ $response = $client->api('repo')->releases()->remove('twbs', 'bootstrap', $id);
25+ ```
Original file line number Diff line number Diff line change 88use Github \Api \Repository \Contents ;
99use Github \Api \Repository \DeployKeys ;
1010use Github \Api \Repository \Downloads ;
11+ use Github \Api \Repository \Releases ;
1112use Github \Api \Repository \Forks ;
1213use Github \Api \Repository \Hooks ;
1314use Github \Api \Repository \Labels ;
@@ -198,6 +199,17 @@ public function downloads()
198199 return new Downloads ($ this ->client );
199200 }
200201
202+ /**
203+ * Manage the releases of a repository (Currently Undocumented)
204+ * @link http://developer.github.com/v3/repos/
205+ *
206+ * @return Releases
207+ */
208+ public function releases ()
209+ {
210+ return new Releases ($ this ->client );
211+ }
212+
201213 /**
202214 * Manage the deploy keys of a repository
203215 * @link http://developer.github.com/v3/repos/keys/
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Github \Api \Repository ;
4+
5+ use Github \Api \AbstractApi ;
6+
7+ /**
8+ * @author Matthew Simo <matthew.a.simo@gmail.com>
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 (Not thoroughly tested!)
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+ }
You can’t perform that action at this time.
0 commit comments