@@ -100,11 +100,11 @@ public Issue browse(Repository argRepository, int argIssueNo) {
100100 * Note: so far only title and body are used from passed instance
101101 *
102102 * @param argRepository {@link Repository} instance used to open issue
103- * @param argIssue {@link Issue} instance containing title and body of the issue
103+ * @param argIssue {@link Issue} instance containing title and body of the issue
104104 * @return the {@link Issue} instance which was opened and contains assigned id
105105 * @throws IllegalArgumentException in case passed Issue doesn't contain a body or title
106106 * @throws NullPointerException in case passed repository or issue is null
107- * @throws HttpClientErrorException in case passed user, repository or issue doesn't exist
107+ * @throws HttpClientErrorException in case passed user or repository doesn't exist
108108 */
109109 public Issue open (Repository argRepository , Issue argIssue ) {
110110 RestTemplate template = initTemplate ();
@@ -114,7 +114,30 @@ public Issue open(Repository argRepository, Issue argIssue) {
114114
115115 OpenIssueRequest req = new OpenIssueRequest (username , apiToken , argIssue .getTitle (), argIssue .getBody ());
116116 IssueResponse resp = template .postForObject (OPEN_ISSUE_URL , req , IssueResponse .class , argRepository .getOwner (), argRepository .getName ());
117-
117+
118+ return resp .getIssue ();
119+ }
120+
121+ /**
122+ * Reopens the passed {@link Issue} in the passed {@link Repository}
123+ * Note: so far only title and body are used from passed instance
124+ *
125+ * @param argRepository {@link Repository} instance used to open issue
126+ * @param argIssue {@link Issue} instance containing title and body of the issue
127+ * @return the {@link Issue} instance which was opened and contains assigned id
128+ * @throws IllegalArgumentException in case passed Issue doesn't contain a body or title
129+ * @throws NullPointerException in case passed repository or issue is null
130+ * @throws HttpClientErrorException in case passed user, repository or issue doesn't exist
131+ */
132+ public Issue reopen (Repository argRepository , Issue argIssue ) {
133+ RestTemplate template = initTemplate ();
134+
135+ Assert .hasText (argIssue .getTitle ());
136+ Assert .hasText (argIssue .getBody ());
137+
138+ OpenIssueRequest req = new OpenIssueRequest (username , apiToken , argIssue .getTitle (), argIssue .getBody ());
139+ IssueResponse resp = template .postForObject (OPEN_ISSUE_URL , req , IssueResponse .class , argRepository .getOwner (), argRepository .getName ());
140+
118141 return resp .getIssue ();
119142 }
120143
0 commit comments