Further restoration of the compatibility

This commit is contained in:
Kohsuke Kawaguchi
2018-01-13 09:54:14 -08:00
parent d0a56dbb21
commit f41da19db5
2 changed files with 37 additions and 9 deletions

View File

@@ -23,10 +23,13 @@
*/
package org.kohsuke.github;
import javax.annotation.CheckForNull;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
* A pull request.
@@ -307,6 +310,28 @@ public class GHPullRequest extends GHIssue {
};
}
/**
* @deprecated
* Use {@link #createReview()}
*/
public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event,
GHPullRequestReviewComment... comments) throws IOException {
return createReview(body, event, Arrays.asList(comments));
}
/**
* @deprecated
* Use {@link #createReview()}
*/
public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event,
List<GHPullRequestReviewComment> comments) throws IOException {
GHPullRequestReviewBuilder b = createReview().body(body);
for (GHPullRequestReviewComment c : comments) {
b.comment(c.getBody(), c.getPath(), c.getPosition());
}
return b.create();
}
public GHPullRequestReviewBuilder createReview() {
return new GHPullRequestReviewBuilder(this);
}

View File

@@ -47,6 +47,10 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
private long in_reply_to_id = -1L;
/**
* @deprecated
* You should be using {@link GHPullRequestReviewBuilder#comment(String, String, int)}
*/
public static GHPullRequestReviewComment draft(String body, String path, int position) {
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
result.body = body;
@@ -86,18 +90,17 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
}
@CheckForNull
public Integer getPosition() {
return position == -1 ? null : position;
public int getPosition() {
return position;
}
public int getOriginalPosition() {
return original_position;
}
@CheckForNull
public Integer getOriginalPosition() {
return original_position == -1 ? null : original_position;
}
@CheckForNull
public Long getInReplyToId() {
return in_reply_to_id == -1 ? null : in_reply_to_id;
public long getInReplyToId() {
return in_reply_to_id;
}
@Override