@@ -1572,4 +1572,47 @@ private String sanitizeProjectId(Serializable projectId) {
15721572 throw new RuntimeException ((e ));
15731573 }
15741574 }
1575+
1576+ /**
1577+ * Post comment to commit
1578+ *
1579+ * @param projectId (required) - The ID of a project
1580+ * @param sha (required) - The name of a repository branch or tag or if not given the default branch
1581+ * @param note (required) - Text of comment
1582+ * @param path (optional) - The file path
1583+ * @param line (optional) - The line number
1584+ * @param line_type (optional) - The line type (new or old)
1585+ * @return A CommitComment
1586+ * @throws IOException on gitlab api call error
1587+ * @see <a href="http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit">http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit</a>
1588+ */
1589+ public CommitComment createCommitComment (Integer projectId , String sha , String note ,
1590+ String path , String line , String line_type ) throws IOException {
1591+
1592+ Query query = new Query ()
1593+ .append ("id" , projectId .toString ())
1594+ .appendIf ("sha" , sha )
1595+ .appendIf ("note" , note )
1596+ .appendIf ("path" , path )
1597+ .appendIf ("line" , line );
1598+ String tailUrl = GitlabProject .URL + "/" + sanitizeProjectId (projectId ) + "/repository/commits/" + sha + CommitComment .URL + query .toString ();
1599+
1600+ return dispatch ().to (tailUrl , CommitComment .class );
1601+ }
1602+
1603+ /**
1604+ * Get the comments of a commit
1605+ *
1606+ * @param projectId (required) - The ID of a project
1607+ * @param sha (required) - The name of a repository branch or tag or if not given the default branch
1608+ * @return A CommitComment
1609+ * @throws IOException on gitlab api call error
1610+ * @see <a href="http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit">http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit</a>
1611+ */
1612+ public List <CommitComment > getCommitComments (Integer projectId , String sha ) throws IOException {
1613+
1614+ String tailUrl = GitlabProject .URL + "/" + sanitizeProjectId (projectId ) + "/repository/commits/" + sha + CommitComment .URL ;
1615+
1616+ return Arrays .asList (retrieve ().to (tailUrl , CommitComment [].class ));
1617+ }
15751618}
0 commit comments