Skip to content

Commit 0c4c5c5

Browse files
Add reopenIssue api in IssuesApi (gitlab4j#1043)
1 parent 4841ece commit 0c4c5c5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

+21
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,27 @@ public Issue closeIssue(Object projectIdOrPath, Long issueIid) throws GitLabApiE
488488
return (response.readEntity(Issue.class));
489489
}
490490

491+
/**
492+
* Reopens an existing project issue.
493+
*
494+
* <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre>
495+
*
496+
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
497+
* @param issueIid the issue IID to update, required
498+
* @return an instance of the updated Issue
499+
* @throws GitLabApiException if any exception occurs
500+
*/
501+
public Issue reopenIssue(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
502+
503+
if (issueIid == null) {
504+
throw new RuntimeException("issue IID cannot be null");
505+
}
506+
507+
GitLabApiForm formData = new GitLabApiForm().withParam("state_event", StateEvent.REOPEN);
508+
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid);
509+
return (response.readEntity(Issue.class));
510+
}
511+
491512
/**
492513
* Updates an existing project issue. This call can also be used to mark an issue as closed.
493514
*

0 commit comments

Comments
 (0)