Repository navigation
Expand file tree
/
Copy pathComments.php
More file actions
50 lines (40 loc) · 1.67 KB
/
Copy pathComments.php
File metadata and controls
50 lines (40 loc) · 1.67 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
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/repos/comments/
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Comments extends AbstractApi
{
public function all($username, $repository, $sha = null)
{
if (null === $sha) {
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/comments');
}
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha).'/comments');
}
public function show($username, $repository, $comment)
{
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/comments/'.urlencode($comment));
}
public function create($username, $repository, $sha, array $params)
{
if (!isset($params['body'], $params['path'], $params['position'])) {
throw new MissingArgumentException(array('body', 'path', 'position'));
}
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha).'/comments', $params);
}
public function update($username, $repository, $comment, array $params)
{
if (!isset($params['body'])) {
throw new MissingArgumentException('body');
}
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/comments/'.urlencode($comment), $params);
}
public function remove($username, $repository, $comment)
{
return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/comments/'.urlencode($comment));
}
}