- * This value should be set using the existing constants defined in {@link Previews}
+ * This value must be set using the existing constants defined in {@link Previews}
*
* @return The API preview media type.
*/
- public String[] value() default {};
+ public Previews[] value() default {};
}
diff --git a/src/main/java/org/kohsuke/github/Previews.java b/src/main/java/org/kohsuke/github/Previews.java
index 3be4ee57b2..c669e7e612 100644
--- a/src/main/java/org/kohsuke/github/Previews.java
+++ b/src/main/java/org/kohsuke/github/Previews.java
@@ -7,20 +7,21 @@
*
* @author Kohsuke Kawaguchi
*/
-class Previews {
+enum Previews {
+
/**
* Check-runs and check-suites
*
* @see GitHub API Previews
*/
- static final String ANTIOPE = "application/vnd.github.antiope-preview+json";
+ ANTIOPE("application/vnd.github.antiope-preview+json"),
/**
* Enhanced Deployments
*
* @see GitHub API Previews
*/
- static final String ANT_MAN = "application/vnd.github.ant-man-preview+json";
+ ANT_MAN("application/vnd.github.ant-man-preview+json"),
/**
* Create repository from template repository
@@ -28,28 +29,28 @@ class Previews {
* @see GitHub API
* Previews
*/
- static final String BAPTISE = "application/vnd.github.baptiste-preview+json";
+ BAPTISTE("application/vnd.github.baptiste-preview+json"),
/**
* Commit Search
*
* @see GitHub API Previews
*/
- static final String CLOAK = "application/vnd.github.cloak-preview+json";
+ CLOAK("application/vnd.github.cloak-preview+json"),
/**
* New deployment statuses and support for updating deployment status environment
*
* @see GitHub API Previews
*/
- static final String FLASH = "application/vnd.github.flash-preview+json";
+ FLASH("application/vnd.github.flash-preview+json"),
/**
* Owners of GitHub Apps can now uninstall an app using the Apps API
*
* @see GitHub API Previews
*/
- static final String GAMBIT = "application/vnd.github.gambit-preview+json";
+ GAMBIT("application/vnd.github.gambit-preview+json"),
/**
* List branches or pull requests for a commit
@@ -57,21 +58,21 @@ class Previews {
* @see GitHub API
* Previews
*/
- static final String GROOT = "application/vnd.github.groot-preview+json";
+ GROOT("application/vnd.github.groot-preview+json"),
/**
* Manage projects
*
* @see GitHub API Previews
*/
- static final String INERTIA = "application/vnd.github.inertia-preview+json";
+ INERTIA("application/vnd.github.inertia-preview+json"),
/**
* Update a pull request branch
*
* @see GitHub API Previews
*/
- static final String LYDIAN = "application/vnd.github.lydian-preview+json";
+ LYDIAN("application/vnd.github.lydian-preview+json"),
/**
* Require multiple approving reviews
@@ -79,21 +80,21 @@ class Previews {
* @see GitHub API
* Previews
*/
- static final String LUKE_CAGE = "application/vnd.github.luke-cage-preview+json";
+ LUKE_CAGE("application/vnd.github.luke-cage-preview+json"),
/**
* Manage integrations through the API
*
* @see GitHub API Previews
*/
- static final String MACHINE_MAN = "application/vnd.github.machine-man-preview+json";
+ MACHINE_MAN("application/vnd.github.machine-man-preview+json"),
/**
* View a list of repository topics in calls that return repository results
*
* @see GitHub API Previews
*/
- static final String MERCY = "application/vnd.github.mercy-preview+json";
+ MERCY("application/vnd.github.mercy-preview+json"),
/**
* New visibility parameter for the Repositories API
@@ -101,27 +102,38 @@ class Previews {
* @see GitHub
* API Previews
*/
- static final String NEBULA = "application/vnd.github.nebula-preview+json";
+ NEBULA("application/vnd.github.nebula-preview+json"),
/**
* Draft pull requests
*
* @see GitHub API Previews
*/
- static final String SHADOW_CAT = "application/vnd.github.shadow-cat-preview+json";
+ SHADOW_CAT("application/vnd.github.shadow-cat-preview+json"),
/**
* Reactions
*
* @see GitHub API Previews
*/
- static final String SQUIRREL_GIRL = "application/vnd.github.squirrel-girl-preview+json";
+ SQUIRREL_GIRL("application/vnd.github.squirrel-girl-preview+json"),
/**
* Require signed commits
*
* @see GitHub API Previews
*/
- static final String ZZZAX = "application/vnd.github.zzzax-preview+json";
+ ZZZAX("application/vnd.github.zzzax-preview+json")
+
+ ;
+
+ private final String mediaType;
+
+ Previews(String mediaType) {
+ this.mediaType = mediaType;
+ }
+ public String mediaType() {
+ return mediaType;
+ }
}
diff --git a/src/main/java/org/kohsuke/github/Reactable.java b/src/main/java/org/kohsuke/github/Reactable.java
index 82908f28d6..777ef7a472 100644
--- a/src/main/java/org/kohsuke/github/Reactable.java
+++ b/src/main/java/org/kohsuke/github/Reactable.java
@@ -2,12 +2,14 @@
import java.io.IOException;
+import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
+
/**
* Those {@link GHObject}s that can have {@linkplain GHReaction reactions}.
*
* @author Kohsuke Kawaguchi
*/
-@Preview
+@Preview(SQUIRREL_GIRL)
@Deprecated
public interface Reactable {
/**
@@ -15,7 +17,7 @@ public interface Reactable {
*
* @return the paged iterable
*/
- @Preview
+ @Preview(SQUIRREL_GIRL)
@Deprecated
PagedIterable