forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatuses.php
More file actions
62 lines (56 loc) · 1.74 KB
/
Statuses.php
File metadata and controls
62 lines (56 loc) · 1.74 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
57
58
59
60
61
62
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/repos/statuses/
* @author Joseph Bielawski <[email protected]>
*/
class Statuses extends AbstractApi
{
/**
* @link http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-sha
*
* @param string $username
* @param string $repository
* @param string $sha
*
* @return array
*/
public function show($username, $repository, $sha)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/statuses');
}
/**
* @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
*
* @param string $username
* @param string $repository
* @param string $sha
*
* @return array
*/
public function combined($username, $repository, $sha)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/status');
}
/**
* @link http://developer.github.com/v3/repos/statuses/#create-a-status
*
* @param string $username
* @param string $repository
* @param string $sha
* @param array $params
*
* @return array
*
* @throws MissingArgumentException
*/
public function create($username, $repository, $sha, array $params = array())
{
if (!isset($params['state'])) {
throw new MissingArgumentException('state');
}
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/statuses/'.rawurlencode($sha), $params);
}
}