From 0c4c5c5d1beede0e805b7627b49181fc2276de34 Mon Sep 17 00:00:00 2001 From: Neil Wang Date: Mon, 6 Nov 2023 19:26:53 +0800 Subject: [PATCH] Add reopenIssue api in IssuesApi (#1043) --- src/main/java/org/gitlab4j/api/IssuesApi.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/IssuesApi.java b/src/main/java/org/gitlab4j/api/IssuesApi.java index 1324954fd..6a67c6f41 100644 --- a/src/main/java/org/gitlab4j/api/IssuesApi.java +++ b/src/main/java/org/gitlab4j/api/IssuesApi.java @@ -488,6 +488,27 @@ public Issue closeIssue(Object projectIdOrPath, Long issueIid) throws GitLabApiE return (response.readEntity(Issue.class)); } + /** + * Reopens an existing project issue. + * + *
GitLab Endpoint: PUT /projects/:id/issues/:issue_iid
+ * + * @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. *