@@ -38,20 +38,64 @@ public function configure($bodyType = null, $apiVersion = null)
38
38
return $ this ;
39
39
}
40
40
41
- public function all ($ username , $ repository , $ pullRequest = null )
41
+ /**
42
+ * Get a listing of a pull request's comments by the username, repository and pull request number
43
+ * or all repository comments by the username and repository.
44
+ *
45
+ * @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
46
+ * @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
47
+ *
48
+ * @param string $username the username
49
+ * @param string $repository the repository
50
+ * @param int|null $pullRequest the pull request number
51
+ * @param array $params a list of extra parameters.
52
+ *
53
+ * @return array
54
+ */
55
+ public function all ($ username , $ repository , $ pullRequest = null , array $ params = [])
42
56
{
43
57
if (null !== $ pullRequest ) {
44
58
return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/ ' .rawurlencode ($ pullRequest ).'/comments ' );
45
59
}
46
60
47
- return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments ' );
61
+ $ parameters = array_merge ([
62
+ 'page ' => 1 ,
63
+ 'per_page ' => 30
64
+ ], $ params );
65
+
66
+ return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments ' , $ parameters );
48
67
}
49
68
69
+ /**
70
+ * Get a single pull request comment by the username, repository and comment id.
71
+ *
72
+ * @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment
73
+ *
74
+ * @param string $username the username
75
+ * @param string $repository the repository
76
+ * @param int $comment the comment id
77
+ *
78
+ * @return array
79
+ */
50
80
public function show ($ username , $ repository , $ comment )
51
81
{
52
82
return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments/ ' .rawurlencode ($ comment ));
53
83
}
54
84
85
+ /**
86
+ * Create a pull request comment by the username, repository and pull request number.
87
+ *
88
+ * @link https://developer.github.com/v3/pulls/comments/#create-a-comment
89
+ *
90
+ * @param string $username the username
91
+ * @param string $repository the repository
92
+ * @param int $pullRequest the pull request number
93
+ * @param array $params a list of extra parameters.
94
+ *
95
+ * @throws MissingArgumentException
96
+ *
97
+ * @return array
98
+ */
55
99
public function create ($ username , $ repository , $ pullRequest , array $ params )
56
100
{
57
101
if (!isset ($ params ['body ' ])) {
@@ -66,6 +110,20 @@ public function create($username, $repository, $pullRequest, array $params)
66
110
return $ this ->post ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/ ' .rawurlencode ($ pullRequest ).'/comments ' , $ params );
67
111
}
68
112
113
+ /**
114
+ * Update a pull request comment by the username, repository and comment id.
115
+ *
116
+ * @link https://developer.github.com/v3/pulls/comments/#edit-a-comment
117
+ *
118
+ * @param string $username the username
119
+ * @param string $repository the repository
120
+ * @param int $comment the comment id
121
+ * @param array $params a list of extra parameters.
122
+ *
123
+ * @throws MissingArgumentException
124
+ *
125
+ * @return array
126
+ */
69
127
public function update ($ username , $ repository , $ comment , array $ params )
70
128
{
71
129
if (!isset ($ params ['body ' ])) {
@@ -75,6 +133,17 @@ public function update($username, $repository, $comment, array $params)
75
133
return $ this ->patch ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments/ ' .rawurlencode ($ comment ), $ params );
76
134
}
77
135
136
+ /**
137
+ * Delete a pull request comment by the username, repository and comment id.
138
+ *
139
+ * @link https://developer.github.com/v3/pulls/comments/#delete-a-comment
140
+ *
141
+ * @param string $username the username
142
+ * @param string $repository the repository
143
+ * @param int $comment the comment id
144
+ *
145
+ * @return string
146
+ */
78
147
public function remove ($ username , $ repository , $ comment )
79
148
{
80
149
return $ this ->delete ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments/ ' .rawurlencode ($ comment ));
0 commit comments