Commit a6176bde authored by Wayne Nugent's avatar Wayne Nugent

Add delete notes functionality

parent 4d93aa57
...@@ -1231,6 +1231,19 @@ public class GitlabAPI { ...@@ -1231,6 +1231,19 @@ public class GitlabAPI {
return dispatch().with("body", body).to(tailUrl, GitlabNote.class); return dispatch().with("body", body).to(tailUrl, GitlabNote.class);
} }
/**
* Delete a Merge Request Note
*
* @param mergeRequest The merge request
* @param noteToDelete The note to delete
* @throws IOException on gitlab api call error
*/
public void deleteNote(GitlabMergeRequest mergeRequest, GitlabNote noteToDelete) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/"
+ mergeRequest.getId() + GitlabNote.URL + "/" + noteToDelete.getId();
retrieve().method("DELETE").to(tailUrl, GitlabNote.class);
}
public List<GitlabBranch> getBranches(Serializable projectId) throws IOException { public List<GitlabBranch> getBranches(Serializable projectId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL; String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabBranch.URL;
GitlabBranch[] branches = retrieve().to(tailUrl, GitlabBranch[].class); GitlabBranch[] branches = retrieve().to(tailUrl, GitlabBranch[].class);
...@@ -1420,6 +1433,31 @@ public class GitlabAPI { ...@@ -1420,6 +1433,31 @@ public class GitlabAPI {
return createNote(String.valueOf(issue.getProjectId()), issue.getId(), message); return createNote(String.valueOf(issue.getProjectId()), issue.getId(), message);
} }
/**
* Delete an Issue Note
*
* @param projectId The project id
* @param issueId The issue id
* @param noteToDelete The note to delete
* @throws IOException on gitlab api call error
*/
public void deleteNote(Serializable projectId, Integer issueId, GitlabNote noteToDelete) throws IOException {
String tailUrl = GitlabProject.URL + "/" + projectId + GitlabIssue.URL + "/"
+ issueId + GitlabNote.URL + "/" + noteToDelete.getId();
retrieve().method("DELETE").to(tailUrl, GitlabNote.class);
}
/**
* Delete an Issue Note
*
* @param issue The issue
* @param noteToDelete The note to delete
* @throws IOException on gitlab api call error
*/
public void deleteNote(GitlabIssue issue, GitlabNote noteToDelete) throws IOException {
deleteNote(String.valueOf(issue.getProjectId()), issue.getId(), noteToDelete);
}
/** /**
* Gets labels associated with a project. * Gets labels associated with a project.
* @param projectId The ID of the project. * @param projectId The ID of the project.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment