Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ APIs:
* [Pull Requests](pull_requests.md)
* [Comments](pull_request/comments.md)
* [Repositories](repos.md)
* [Releases](repo/releases.md)
* [Users](users.md)

Additional features:
Expand Down
25 changes: 25 additions & 0 deletions doc/repo/releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Repo / Releases API
[Back to the "Repos API"](../repos.md) | [Back to the navigation](../index.md)

This Github API Endpoint is currently undocumented because it's new, but works just fine.


### List all releases

```php
$releases = $client->api('repo')->releases()->all('twbs', 'bootstrap');
```

### List one release

```php
$release = $client->api('repo')->releases()->show('twbs', 'bootstrap', $id);
```

### Remove a release

This works, but isn't thoroughly tested, use at your own risk.

```php
$response = $client->api('repo')->releases()->remove('twbs', 'bootstrap', $id);
```
12 changes: 12 additions & 0 deletions lib/Github/Api/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Github\Api\Repository\Contents;
use Github\Api\Repository\DeployKeys;
use Github\Api\Repository\Downloads;
use Github\Api\Repository\Releases;
use Github\Api\Repository\Forks;
use Github\Api\Repository\Hooks;
use Github\Api\Repository\Labels;
Expand Down Expand Up @@ -156,6 +157,17 @@ public function downloads()
return new Downloads($this->client);
}

/**
* Manage the releases of a repository (Currently Undocumented)
* @link http://developer.github.com/v3/repos/
*
* @return Releases
*/
public function releases()
{
return new Releases($this->client);
}

/**
* Manage the deploy keys of a repository
* @link http://developer.github.com/v3/repos/keys/
Expand Down
52 changes: 52 additions & 0 deletions lib/Github/Api/Repository/Releases.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Github\Api\Repository;

use Github\Api\AbstractApi;

/**
* @author Matthew Simo <[email protected]>
*/
class Releases extends AbstractApi
{
/**
* List releases in selected repository
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
*
* @return array
*/
public function all($username, $repository)
{
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/releases');
}

/**
* Get a release in selected repository
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the release
*
* @return array
*/
public function show($username, $repository, $id)
{
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/releases/'.urlencode($id));
}

/**
* Delete a download in selected repository (Not thoroughly tested!)
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the release
*
* @return array
*/
public function remove($username, $repository, $id)
{
return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/releases/'.urlencode($id));
}
}