Skip to content

Commit

Permalink
Add reopenIssue api in IssuesApi (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilwangweili authored Nov 6, 2023
1 parent 4841ece commit 0c4c5c5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/org/gitlab4j/api/IssuesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,27 @@ public Issue closeIssue(Object projectIdOrPath, Long issueIid) throws GitLabApiE
return (response.readEntity(Issue.class));
}

/**
* Reopens an existing project issue.
*
* <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
* @param issueIid the issue IID to update, required
* @return an instance of the updated Issue
* @throws GitLabApiException if any exception occurs
*/
public Issue reopenIssue(Object projectIdOrPath, Long issueIid) throws GitLabApiException {

if (issueIid == null) {
throw new RuntimeException("issue IID cannot be null");
}

GitLabApiForm formData = new GitLabApiForm().withParam("state_event", StateEvent.REOPEN);
Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid);
return (response.readEntity(Issue.class));
}

/**
* Updates an existing project issue. This call can also be used to mark an issue as closed.
*
Expand Down

0 comments on commit 0c4c5c5

Please sign in to comment.