Repository navigation
Expand file tree
/
Copy pathGitHubReposComments.php
More file actions
91 lines (74 loc) · 2.08 KB
/
Copy pathGitHubReposComments.php
File metadata and controls
91 lines (74 loc) · 2.08 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
<?php
require_once(__DIR__ . '/../GitHubClient.php');
require_once(__DIR__ . '/../GitHubService.php');
require_once(__DIR__ . '/../objects/GitHubCommitComment.php');
class GitHubReposComments extends GitHubService
{
/**
* List commit comments for a repository
*
* @return array<GitHubCommitComment>
*/
public function listCommitCommentsForRepository($owner, $repo)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/comments", 'GET', $data, 200, 'GitHubCommitComment', true);
}
/**
* List comments for a single commit
*
* @return array<GitHubCommitComment>
*/
public function listCommentsForSingleCommit($owner, $repo, $sha)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/commits/$sha/comments", 'GET', $data, 200, 'GitHubCommitComment', true);
}
/**
* Create a commit comment
*
* @return GitHubCommitComment
*/
public function createCommitComment($owner, $repo, $sha, $body, $path = null, $position = null)
{
$data = array(
'body' => $body,
);
if (!is_null($path))
$data['path'] = $path;
if (!is_null($position))
$data['position'] = $position;
return $this->client->request("/repos/$owner/$repo/commits/$sha/comments", 'POST', json_encode($data), 201, 'GitHubCommitComment');
}
/**
* Get a single commit comment
*
* @return GitHubCommitComment
*/
public function getSingleCommitComment($owner, $repo, $id)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/comments/$id", 'GET', $data, 200, 'GitHubCommitComment');
}
/**
* Update a commit comment
*
* @return GitHubCommitComment
*/
public function updateCommitComment($owner, $repo, $id, $body)
{
$data = array(
'body' => $body,
);
return $this->client->request("/repos/$owner/$repo/comments/$id", 'PATCH', json_encode($data), 200, 'GitHubCommitComment');
}
/**
* Delete a commit comment
*
*/
public function deleteCommitComment($owner, $repo, $id)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/comments/$id", 'DELETE', $data, 204, '');
}
}