This repository was archived by the owner on Nov 5, 2018. It is now read-only.
forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownloads.php
More file actions
56 lines (51 loc) · 1.75 KB
/
Copy pathDownloads.php
File metadata and controls
56 lines (51 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/repos/downloads/
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Downloads extends AbstractApi
{
/**
* List downloads in selected repository
* @link http://developer.github.com/v3/repos/downloads/#list-downloads-for-a-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/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads');
}
/**
* Get a download in selected repository
* @link http://developer.github.com/v3/repos/downloads/#get-a-single-download
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the download file
*
* @return array
*/
public function show($username, $repository, $id)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id));
}
/**
* Delete a download in selected repository
* @link http://developer.github.com/v3/repos/downloads/#delete-a-download
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the download file
*
* @return array
*/
public function remove($username, $repository, $id)
{
return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id));
}
}