Use string constant like other previews

This commit is contained in:
Kohsuke Kawaguchi
2017-09-09 07:59:31 -07:00
parent aebbe86cfc
commit ad28ca4a90
3 changed files with 10 additions and 5 deletions

View File

@@ -32,6 +32,8 @@ import java.util.Date;
import java.util.List;
import javax.annotation.CheckForNull;
import static org.kohsuke.github.Previews.BLACK_CAT;
/**
* A pull request.
*
@@ -234,7 +236,7 @@ public class GHPullRequest extends GHIssue {
return new PagedIterable<GHPullRequestReview>() {
public PagedIterator<GHPullRequestReview> _iterator(int pageSize) {
return new PagedIterator<GHPullRequestReview>(root.retrieve()
.withPreview("application/vnd.github.black-cat-preview+json")
.withPreview(BLACK_CAT)
.asIterator(String.format("%s/reviews", getApiRoute()),
GHPullRequestReview[].class, pageSize)) {
@Override
@@ -308,7 +310,7 @@ public class GHPullRequest extends GHIssue {
.with("body", body)
//.with("event", event.name())
._with("comments", draftComments)
.withPreview("application/vnd.github.black-cat-preview+json")
.withPreview(BLACK_CAT)
.to(getApiRoute() + "/reviews", GHPullRequestReview.class).wrapUp(this);
}

View File

@@ -26,6 +26,8 @@ package org.kohsuke.github;
import java.io.IOException;
import java.net.URL;
import static org.kohsuke.github.Previews.BLACK_CAT;
/**
* Review to the pull request
*
@@ -105,7 +107,7 @@ public class GHPullRequestReview extends GHObject {
@Deprecated
public void delete() throws IOException {
new Requester(owner.root).method("DELETE")
.withPreview("application/vnd.github.black-cat-preview+json")
.withPreview(BLACK_CAT)
.to(getApiRoute());
}
@@ -117,7 +119,7 @@ public class GHPullRequestReview extends GHObject {
public void dismiss(String message) throws IOException {
new Requester(owner.root).method("PUT")
.with("message", message)
.withPreview("application/vnd.github.black-cat-preview+json")
.withPreview(BLACK_CAT)
.to(getApiRoute()+"/dismissals");
state = GHPullRequestReviewState.DISMISSED;
}
@@ -132,7 +134,7 @@ public class GHPullRequestReview extends GHObject {
public PagedIterator<GHPullRequestReviewComment> _iterator(int pageSize) {
return new PagedIterator<GHPullRequestReviewComment>(
owner.root.retrieve()
.withPreview("application/vnd.github.black-cat-preview+json")
.withPreview(BLACK_CAT)
.asIterator(getApiRoute() + "/comments",
GHPullRequestReviewComment[].class, pageSize)) {
protected void wrapUp(GHPullRequestReviewComment[] page) {

View File

@@ -8,4 +8,5 @@ package org.kohsuke.github;
static final String DRAX = "application/vnd.github.drax-preview+json";
static final String SQUIRREL_GIRL = "application/vnd.github.squirrel-girl-preview";
static final String CLOAK = "application/vnd.github.cloak-preview";
static final String BLACK_CAT = "application/vnd.github.black-cat-preview+json";
}