Repository navigation
Expand file tree
/
Copy pathChecks.php
More file actions
110 lines (96 loc) · 3.52 KB
/
Copy pathChecks.php
File metadata and controls
110 lines (96 loc) · 3.52 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;
/**
* @link https://developer.github.com/v3/checks/
*
* @author Zack Galbreath <zack.galbreath@kitware.com>
*/
class Checks extends AbstractApi
{
use AcceptHeaderTrait;
/**
* @link https://developer.github.com/v3/checks/runs/#create-a-check-run
*
* @param string $username
* @param string $repository
* @param array $params
*
* @throws MissingArgumentException
*
* @return array
*/
public function create($username, $repository, array $params = [])
{
if (!isset($params['name'], $params['head_sha'])) {
throw new MissingArgumentException(['name', 'head_sha']);
}
// This api is in preview mode, so set the correct accept-header.
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs', $params);
}
/**
* @link https://developer.github.com/v3/checks/runs/#update-a-check-run
*
* @param string $username
* @param string $repository
* @param string $checkRunId
* @param array $params
*
* @return array
*/
public function update($username, $repository, $checkRunId, array $params = [])
{
// This api is in preview mode, so set the correct accept-header.
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId), $params);
}
/**
* @link https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-git-reference
*
* @param string $username
* @param string $repository
* @param string $ref
* @param array $params
*
* @return array
*/
public function all($username, $repository, $ref, $params = [])
{
// This api is in preview mode, so set the correct accept-header.
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($ref).'/check-runs', $params);
}
/**
* @link https://developer.github.com/v3/checks/runs/#get-a-check-run
*
* @param string $username
* @param string $repository
* @param string $checkRunId
*
* @return array
*/
public function show($username, $repository, $checkRunId)
{
// This api is in preview mode, so set the correct accept-header.
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId));
}
/**
* @link https://developer.github.com/v3/checks/runs/#list-check-run-annotations
*
* @param string $username
* @param string $repository
* @param string $checkRunId
*
* @return array
*/
public function annotations($username, $repository, $checkRunId)
{
// This api is in preview mode, so set the correct accept-header.
$this->acceptHeaderValue = 'application/vnd.github.antiope-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/check-runs/'.rawurlencode($checkRunId).'/annotations');
}
}