Repository navigation
Expand file tree
/
Copy pathGitHubIssuesComments.php
More file actions
104 lines (87 loc) · 2.83 KB
/
Copy pathGitHubIssuesComments.php
File metadata and controls
104 lines (87 loc) · 2.83 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
<?php
require_once(__DIR__ . '/../GitHubClient.php');
require_once(__DIR__ . '/../GitHubService.php');
require_once(__DIR__ . '/../objects/GitHubPullComment.php');
require_once(__DIR__ . '/../objects/GitHubIssueComment.php');
class GitHubIssuesComments extends GitHubService
{
/**
* List comments on an issue
*
* @param $sort String (Optional) `created` or `updated`
* @param $direction String (Optional) `asc` or `desc`. Ignored without `sort` parameter.
* @param $since String (Optional) of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
* @return array<GitHubPullComment>
*/
public function listCommentsOnAnIssue($owner, $repo, $number, $sort = null, $direction = null, $since = null)
{
$data = array();
if(!is_null($sort))
$data['sort'] = $sort;
if(!is_null($direction))
$data['direction'] = $direction;
if(!is_null($since))
$data['since'] = $since;
return $this->client->request("/repos/$owner/$repo/issues/$number/comments", 'GET', $data, 200, 'GitHubPullComment', true);
}
/**
* List comments in a repository
*
* @param $sort String (Optional) `created` or `updated`
* @param $direction String (Optional) `asc` or `desc`. Ignored without `sort` parameter.
* @param $since String (Optional) of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
* @return array<GitHubPullComment>
*/
public function listCommentsOnRepository($owner, $repo, $number, $sort = null, $direction = null, $since = null)
{
$data = array();
if(!is_null($sort))
$data['sort'] = $sort;
if(!is_null($direction))
$data['direction'] = $direction;
if(!is_null($since))
$data['since'] = $since;
return $this->client->request("/repos/$owner/$repo/issues/comments", 'GET', $data, 200, 'GitHubPullComment', true);
}
/**
* Get a single comment
*
* @return GitHubIssueComment
*/
public function getSingleComment($owner, $repo, $id)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/issues/comments/$id", 'GET', $data, 200, 'GitHubIssueComment');
}
/**
* Create a comment
*
* @return GitHubIssueComment
*/
public function createComment($owner, $repo, $issue, $body)
{
$data = array();
$data['body'] = $body;
return $this->client->request("/repos/$owner/$repo/issues/$issue/comments", 'POST', json_encode($data), 201, 'GitHubIssueComment');
}
/**
* Edit a comment
*
* @return GitHubIssueComment
*/
public function editComment($owner, $repo, $id, $body)
{
$data = array();
$data['body'] = $body;
return $this->client->request("/repos/$owner/$repo/issues/comments/$id", 'PATCH', json_encode($data), 200, 'GitHubIssueComment');
}
/**
* Delete a comment
*
*/
public function deleteComment($owner, $repo, $id)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/issues/comments/$id", 'DELETE', $data, 204, '');
}
}