Skip to content

Commit 9042ff4

Browse files
committed
Clean up Previews
1 parent 468f4f9 commit 9042ff4

5 files changed

Lines changed: 32 additions & 20 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @see <a href="https://developer.github.com/v3/licenses/#get-a-repositorys-license">documentation</a>
88
* @see GHRepository#getLicense()
99
*/
10-
@Preview @Deprecated
1110
class GHContentWithLicense extends GHContent {
1211
GHLicense license;
1312

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,15 @@
3232
import java.util.ArrayList;
3333
import java.util.List;
3434

35-
import static org.kohsuke.github.Previews.*;
36-
3735
/**
3836
* The GitHub Preview API's license information
3937
* <p>
40-
* WARNING: This uses a PREVIEW API - subject to change.
4138
*
4239
* @author Duncan Dickinson
4340
* @see GitHub#getLicense(String)
4441
* @see GHRepository#getLicense()
4542
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
4643
*/
47-
@Preview @Deprecated
4844
@SuppressWarnings({"UnusedDeclaration"})
4945
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
5046
"NP_UNWRITTEN_FIELD"}, justification = "JSON API")
@@ -144,7 +140,7 @@ public String getBody() throws IOException {
144140
protected synchronized void populate() throws IOException {
145141
if (description!=null) return; // already populated
146142

147-
root.retrieve().withPreview(DRAX).to(url, this);
143+
root.retrieve().to(url, this);
148144
}
149145

150146
@Override

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,12 +1049,10 @@ protected void wrapUp(GHCommitComment[] page) {
10491049
/**
10501050
* Gets the basic license details for the repository.
10511051
* <p>
1052-
* This is a preview item and subject to change.
10531052
*
10541053
* @throws IOException as usual but also if you don't use the preview connector
10551054
* @return null if there's no license.
10561055
*/
1057-
@Preview @Deprecated
10581056
public GHLicense getLicense() throws IOException{
10591057
GHContentWithLicense lic = getLicenseContent_();
10601058
return lic!=null ? lic.license : null;
@@ -1063,21 +1061,17 @@ public GHLicense getLicense() throws IOException{
10631061
/**
10641062
* Retrieves the contents of the repository's license file - makes an additional API call
10651063
* <p>
1066-
* This is a preview item and subject to change.
10671064
*
10681065
* @return details regarding the license contents, or null if there's no license.
10691066
* @throws IOException as usual but also if you don't use the preview connector
10701067
*/
1071-
@Preview @Deprecated
10721068
public GHContent getLicenseContent() throws IOException {
10731069
return getLicenseContent_();
10741070
}
10751071

1076-
@Preview @Deprecated
10771072
private GHContentWithLicense getLicenseContent_() throws IOException {
10781073
try {
10791074
return root.retrieve()
1080-
.withPreview(DRAX)
10811075
.to(getApiTailUrl("license"), GHContentWithLicense.class).wrap(this);
10821076
} catch (FileNotFoundException e) {
10831077
return null;

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,10 @@ public GHRepository getRepositoryById(String id) throws IOException {
488488
*
489489
* @return a list of popular open source licenses
490490
*/
491-
@Preview @Deprecated
492491
public PagedIterable<GHLicense> listLicenses() throws IOException {
493492
return new PagedIterable<GHLicense>() {
494493
public PagedIterator<GHLicense> _iterator(int pageSize) {
495-
return new PagedIterator<GHLicense>(retrieve().withPreview(DRAX).asIterator("/licenses", GHLicense[].class, pageSize)) {
494+
return new PagedIterator<GHLicense>(retrieve().asIterator("/licenses", GHLicense[].class, pageSize)) {
496495
@Override
497496
protected void wrapUp(GHLicense[] page) {
498497
for (GHLicense c : page)
@@ -523,15 +522,12 @@ protected void wrapUp(GHUser[] page) {
523522
/**
524523
* Returns the full details for a license
525524
*
526-
* WARNING: This uses a PREVIEW API.
527-
*
528525
* @param key The license key provided from the API
529526
* @return The license details
530527
* @see GHLicense#getKey()
531528
*/
532-
@Preview @Deprecated
533529
public GHLicense getLicense(String key) throws IOException {
534-
return retrieve().withPreview(DRAX).to("/licenses/" + key, GHLicense.class);
530+
return retrieve().to("/licenses/" + key, GHLicense.class);
535531
}
536532

537533
/**
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,39 @@
11
package org.kohsuke.github;
22

33
/**
4+
* Provides the media type strings for GitHub API previews
5+
*
6+
* https://developer.github.com/v3/previews/
7+
*
48
* @author Kohsuke Kawaguchi
59
*/
610
/*package*/ class Previews {
11+
12+
/**
13+
* Require multiple approving reviews
14+
*
15+
* @see <a href="https://developer.github.com/v3/previews/#require-multiple-approving-reviews">GitHub API Previews</a>
16+
*/
717
static final String LUKE_CAGE = "application/vnd.github.luke-cage-preview+json";
8-
static final String DRAX = "application/vnd.github.drax-preview+json";
18+
19+
/**
20+
* Reactions
21+
*
22+
* @see <a href="https://developer.github.com/v3/previews/#reactions">GitHub API Previews</a>
23+
*/
924
static final String SQUIRREL_GIRL = "application/vnd.github.squirrel-girl-preview";
10-
static final String CLOAK = "application/vnd.github.cloak-preview";
25+
26+
/**
27+
* Commit Search
28+
*
29+
* @see <a href="https://developer.github.com/v3/previews/#commit-search">GitHub API Previews</a>
30+
*/
31+
static final String CLOAK = "application/vnd.github.cloak-preview+json";
32+
33+
/**
34+
* Require signed commits
35+
*
36+
* @see <a href="https://developer.github.com/v3/previews/#require-signed-commits">GitHub API Previews</a>
37+
*/
1138
static final String ZZZAX = "application/vnd.github.zzzax-preview+json";
1239
}

0 commit comments

Comments
 (0)