-
Notifications
You must be signed in to change notification settings - Fork 3
/
GithubIssueComments.php
68 lines (59 loc) · 1.59 KB
/
GithubIssueComments.php
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
<?php
require_once('Github.php');
class GithubIssueComments extends Github {
/**
* List comments on an issue
*
* @param string $username
* @param string $repository
* @param int $issueNr
*/
public function listAll($username, $repository, $issueNr) {
return $this->request('/repos/'.$username.'/'.$repository.'/issues/'.$issueNr.'/comments');
}
/**
* Get a single comment
*
* @param string $username
* @param string $repository
* @param int $commentId
*/
public function get($username, $repository, $commentId) {
return $this->request('/repos/'.$username.'/'.$repository.'/issues/comments/'.$commentId);
}
/**
* Create a comment
*
* @param string $username
* @param string $repository
* @param int $commentId
*/
public function create($username, $repository, $issueNr, $body) {
return $this->request('/repos/'.$username.'/'.$repository.'/issues/'.$issueNr.'/comments', 'POST', array(
'body' => $body,
));
}
/**
* Edit a comment
*
* @param string $username
* @param string $repository
* @param int $commentId
*/
public function edit($username, $repository, $commentId, $body) {
return $this->request('/repos/'.$username.'/'.$repository.'/issues/comments/'.$commentId, 'POST', array(
'body' => $body,
));
}
/**
* Delete a comment
*
* @param string $username
* @param string $repository
* @param int $commentId
*/
public function delete($username, $repository, $commentId) {
return ($this->request('/repos/'.$username.'/'.$repository.'/issues/comments/'.$commentId, 'DELETE', array(), true) == 204) ? true : false;
}
}
?>