Skip to content

Commit ad28ca4

Browse files
committed
Use string constant like other previews
1 parent aebbe86 commit ad28ca4

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/main/java/org/kohsuke/github/GHPullRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import java.util.List;
3333
import javax.annotation.CheckForNull;
3434

35+
import static org.kohsuke.github.Previews.BLACK_CAT;
36+
3537
/**
3638
* A pull request.
3739
*
@@ -234,7 +236,7 @@ public PagedIterable<GHPullRequestReview> listReviews() {
234236
return new PagedIterable<GHPullRequestReview>() {
235237
public PagedIterator<GHPullRequestReview> _iterator(int pageSize) {
236238
return new PagedIterator<GHPullRequestReview>(root.retrieve()
237-
.withPreview("application/vnd.github.black-cat-preview+json")
239+
.withPreview(BLACK_CAT)
238240
.asIterator(String.format("%s/reviews", getApiRoute()),
239241
GHPullRequestReview[].class, pageSize)) {
240242
@Override
@@ -308,7 +310,7 @@ public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequest
308310
.with("body", body)
309311
//.with("event", event.name())
310312
._with("comments", draftComments)
311-
.withPreview("application/vnd.github.black-cat-preview+json")
313+
.withPreview(BLACK_CAT)
312314
.to(getApiRoute() + "/reviews", GHPullRequestReview.class).wrapUp(this);
313315
}
314316

src/main/java/org/kohsuke/github/GHPullRequestReview.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import java.io.IOException;
2727
import java.net.URL;
2828

29+
import static org.kohsuke.github.Previews.BLACK_CAT;
30+
2931
/**
3032
* Review to the pull request
3133
*
@@ -105,7 +107,7 @@ public void submit(String body, GHPullRequestReviewState event) throws IOExcepti
105107
@Deprecated
106108
public void delete() throws IOException {
107109
new Requester(owner.root).method("DELETE")
108-
.withPreview("application/vnd.github.black-cat-preview+json")
110+
.withPreview(BLACK_CAT)
109111
.to(getApiRoute());
110112
}
111113

@@ -117,7 +119,7 @@ public void delete() throws IOException {
117119
public void dismiss(String message) throws IOException {
118120
new Requester(owner.root).method("PUT")
119121
.with("message", message)
120-
.withPreview("application/vnd.github.black-cat-preview+json")
122+
.withPreview(BLACK_CAT)
121123
.to(getApiRoute()+"/dismissals");
122124
state = GHPullRequestReviewState.DISMISSED;
123125
}
@@ -132,7 +134,7 @@ public PagedIterable<GHPullRequestReviewComment> listReviewComments() throws IOE
132134
public PagedIterator<GHPullRequestReviewComment> _iterator(int pageSize) {
133135
return new PagedIterator<GHPullRequestReviewComment>(
134136
owner.root.retrieve()
135-
.withPreview("application/vnd.github.black-cat-preview+json")
137+
.withPreview(BLACK_CAT)
136138
.asIterator(getApiRoute() + "/comments",
137139
GHPullRequestReviewComment[].class, pageSize)) {
138140
protected void wrapUp(GHPullRequestReviewComment[] page) {

src/main/java/org/kohsuke/github/Previews.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
static final String DRAX = "application/vnd.github.drax-preview+json";
99
static final String SQUIRREL_GIRL = "application/vnd.github.squirrel-girl-preview";
1010
static final String CLOAK = "application/vnd.github.cloak-preview";
11+
static final String BLACK_CAT = "application/vnd.github.black-cat-preview+json";
1112
}

0 commit comments

Comments
 (0)