Skip to content

Commit 133e6e1

Browse files
committed
Added methods to get and delete a single project issue.
1 parent 67043cc commit 133e6e1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/main/java/org/gitlab4j/api/ProjectApi.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,4 +1236,33 @@ public List<Issue> getIssues(Integer projectId, int page, int perPage) throws Gi
12361236
public Pager<Issue> getIssues(Integer projectId, int itemsPerPage) throws GitLabApiException {
12371237
return (new Pager<Issue>(this, Issue.class, itemsPerPage, null, "projects", projectId, "issues"));
12381238
}
1239+
1240+
/**
1241+
* Get a single project issues.
1242+
*
1243+
* GET /projects/:id/issues/:issue_iid
1244+
*
1245+
* @param projectId the project ID to get the issue for
1246+
* @param issueId the internal ID of a project's issue
1247+
* @return the specified Issue instance
1248+
* @throws GitLabApiException if any exception occurs
1249+
*/
1250+
public Issue getIssue(Integer projectId, Integer issueId) throws GitLabApiException {
1251+
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", projectId, "issues", issueId);
1252+
return (response.readEntity(Issue.class));
1253+
}
1254+
1255+
/**
1256+
* Delete a project issue.
1257+
*
1258+
* DELETE /projects/:id/issues/:issue_iid
1259+
*
1260+
* @param projectId the project ID to delete the issue from
1261+
* @param issueId the internal ID of a project's issue
1262+
* @throws GitLabApiException if any exception occurs
1263+
*/
1264+
public void deleteIssue(Integer projectId, Integer issueId) throws GitLabApiException {
1265+
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
1266+
delete(expectedStatus, getDefaultPerPageParam(), "projects", projectId, "issues", issueId);
1267+
}
12391268
}

0 commit comments

Comments
 (0)