@@ -38,20 +38,64 @@ public function configure($bodyType = null, $apiVersion = null)
3838 return $ this ;
3939 }
4040
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 = [])
4256 {
4357 if (null !== $ pullRequest ) {
4458 return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/ ' .rawurlencode ($ pullRequest ).'/comments ' );
4559 }
4660
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 );
4867 }
4968
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+ */
5080 public function show ($ username , $ repository , $ comment )
5181 {
5282 return $ this ->get ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments/ ' .rawurlencode ($ comment ));
5383 }
5484
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+ */
5599 public function create ($ username , $ repository , $ pullRequest , array $ params )
56100 {
57101 if (!isset ($ params ['body ' ])) {
@@ -66,6 +110,20 @@ public function create($username, $repository, $pullRequest, array $params)
66110 return $ this ->post ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/ ' .rawurlencode ($ pullRequest ).'/comments ' , $ params );
67111 }
68112
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+ */
69127 public function update ($ username , $ repository , $ comment , array $ params )
70128 {
71129 if (!isset ($ params ['body ' ])) {
@@ -75,6 +133,17 @@ public function update($username, $repository, $comment, array $params)
75133 return $ this ->patch ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments/ ' .rawurlencode ($ comment ), $ params );
76134 }
77135
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+ */
78147 public function remove ($ username , $ repository , $ comment )
79148 {
80149 return $ this ->delete ('/repos/ ' .rawurlencode ($ username ).'/ ' .rawurlencode ($ repository ).'/pulls/comments/ ' .rawurlencode ($ comment ));
0 commit comments