Repository navigation
Expand file tree
/
Copy pathReferences.php
More file actions
56 lines (45 loc) · 1.8 KB
/
Copy pathReferences.php
File metadata and controls
56 lines (45 loc) · 1.8 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\GitData;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/git/references/
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class References extends AbstractApi
{
public function all($username, $repository)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs');
}
public function branches($username, $repository)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads');
}
public function tags($username, $repository)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
}
public function show($username, $repository, $reference)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference));
}
public function create($username, $repository, array $params)
{
if (!isset($params['ref'], $params['sha'])) {
throw new MissingArgumentException(array('ref', 'sha'));
}
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params);
}
public function update($username, $repository, $reference, array $params)
{
if (!isset($params['sha'])) {
throw new MissingArgumentException('sha');
}
return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference), $params);
}
public function remove($username, $repository, $reference)
{
return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference));
}
}