Skip to content

Commit 4d63d8c

Browse files
authored
Merge pull request #1859 from bitwiseman/task/remove-previews
Remove preview and switch to latest accept headers
2 parents fcdf5c9 + 6d90891 commit 4d63d8c

File tree

2,879 files changed

+3771
-3590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,879 files changed

+3771
-3590
lines changed

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import java.util.Map;
1212
import java.util.stream.Collectors;
1313

14-
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
15-
1614
// TODO: Auto-generated Javadoc
1715
/**
1816
* A Github App.
@@ -208,7 +206,6 @@ public void setPermissions(Map<String, String> permissions) {
208206
* @return a list of App installations
209207
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
210208
*/
211-
@Preview(MACHINE_MAN)
212209
public PagedIterable<GHAppInstallation> listInstallations() {
213210
return listInstallations(null);
214211
}
@@ -223,9 +220,8 @@ public PagedIterable<GHAppInstallation> listInstallations() {
223220
* @return a list of App installations since a given time.
224221
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
225222
*/
226-
@Preview(MACHINE_MAN)
227223
public PagedIterable<GHAppInstallation> listInstallations(final Date since) {
228-
Requester requester = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/app/installations");
224+
Requester requester = root().createRequest().withUrlPath("/app/installations");
229225
if (since != null) {
230226
requester.with("since", GitHubClient.printDate(since));
231227
}
@@ -244,10 +240,8 @@ public PagedIterable<GHAppInstallation> listInstallations(final Date since) {
244240
* on error
245241
* @see <a href="https://developer.github.com/v3/apps/#get-an-installation">Get an installation</a>
246242
*/
247-
@Preview(MACHINE_MAN)
248243
public GHAppInstallation getInstallationById(long id) throws IOException {
249244
return root().createRequest()
250-
.withPreview(MACHINE_MAN)
251245
.withUrlPath(String.format("/app/installations/%d", id))
252246
.fetch(GHAppInstallation.class);
253247
}
@@ -265,10 +259,8 @@ public GHAppInstallation getInstallationById(long id) throws IOException {
265259
* @see <a href="https://developer.github.com/v3/apps/#get-an-organization-installation">Get an organization
266260
* installation</a>
267261
*/
268-
@Preview(MACHINE_MAN)
269262
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
270263
return root().createRequest()
271-
.withPreview(MACHINE_MAN)
272264
.withUrlPath(String.format("/orgs/%s/installation", name))
273265
.fetch(GHAppInstallation.class);
274266
}
@@ -288,10 +280,8 @@ public GHAppInstallation getInstallationByOrganization(String name) throws IOExc
288280
* @see <a href="https://developer.github.com/v3/apps/#get-a-repository-installation">Get a repository
289281
* installation</a>
290282
*/
291-
@Preview(MACHINE_MAN)
292283
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
293284
return root().createRequest()
294-
.withPreview(MACHINE_MAN)
295285
.withUrlPath(String.format("/repos/%s/%s/installation", ownerName, repositoryName))
296286
.fetch(GHAppInstallation.class);
297287
}
@@ -308,10 +298,8 @@ public GHAppInstallation getInstallationByRepository(String ownerName, String re
308298
* on error
309299
* @see <a href="https://developer.github.com/v3/apps/#get-a-user-installation">Get a user installation</a>
310300
*/
311-
@Preview(MACHINE_MAN)
312301
public GHAppInstallation getInstallationByUser(String name) throws IOException {
313302
return root().createRequest()
314-
.withPreview(MACHINE_MAN)
315303
.withUrlPath(String.format("/users/%s/installation", name))
316304
.fetch(GHAppInstallation.class);
317305
}

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.util.List;
66
import java.util.Map;
77

8-
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
9-
108
// TODO: Auto-generated Javadoc
119
/**
1210
* Creates a access token for a GitHub App Installation.
@@ -108,12 +106,8 @@ public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permiss
108106
* @throws IOException
109107
* on error
110108
*/
111-
@Preview(MACHINE_MAN)
112109
public GHAppInstallationToken create() throws IOException {
113-
return builder.method("POST")
114-
.withPreview(MACHINE_MAN)
115-
.withUrlPath(apiUrlTail)
116-
.fetch(GHAppInstallationToken.class);
110+
return builder.method("POST").withUrlPath(apiUrlTail).fetch(GHAppInstallationToken.class);
117111
}
118112

119113
}

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
import java.util.Map;
1313
import java.util.stream.Collectors;
1414

15-
import static org.kohsuke.github.internal.Previews.GAMBIT;
16-
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
17-
1815
// TODO: Auto-generated Javadoc
1916
/**
2017
* A Github App Installation.
@@ -135,11 +132,10 @@ public String getRepositoriesUrl() {
135132
* {@link GHAuthenticatedAppInstallation#listRepositories()}.
136133
*/
137134
@Deprecated
138-
@Preview(MACHINE_MAN)
139135
public PagedSearchIterable<GHRepository> listRepositories() {
140136
GitHubRequest request;
141137

142-
request = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
138+
request = root().createRequest().withUrlPath("/installation/repositories").build();
143139

144140
return new PagedSearchIterable<>(root(), request, GHAppInstallationRepositoryResult.class);
145141
}
@@ -342,13 +338,8 @@ public GHUser getSuspendedBy() {
342338
* on error
343339
* @see <a href="https://developer.github.com/v3/apps/#delete-an-installation">Delete an installation</a>
344340
*/
345-
@Preview(GAMBIT)
346341
public void deleteInstallation() throws IOException {
347-
root().createRequest()
348-
.method("DELETE")
349-
.withPreview(GAMBIT)
350-
.withUrlPath(String.format("/app/installations/%d", getId()))
351-
.send();
342+
root().createRequest().method("DELETE").withUrlPath(String.format("/app/installations/%d", getId())).send();
352343
}
353344

354345
/**

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import javax.annotation.Nonnull;
44

5-
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
6-
75
// TODO: Auto-generated Javadoc
86
/**
97
* The Github App Installation corresponding to the installation token used in a client.
@@ -27,11 +25,10 @@ protected GHAuthenticatedAppInstallation(@Nonnull GitHub root) {
2725
*
2826
* @return the paged iterable
2927
*/
30-
@Preview(MACHINE_MAN)
3128
public PagedSearchIterable<GHRepository> listRepositories() {
3229
GitHubRequest request;
3330

34-
request = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
31+
request = root().createRequest().withUrlPath("/installation/repositories").build();
3532

3633
return new PagedSearchIterable<>(root(), request, GHAuthenticatedAppInstallationRepositoryResult.class);
3734
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.fasterxml.jackson.annotation.JsonCreator;
44
import com.fasterxml.jackson.annotation.JsonProperty;
55
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
6-
import org.kohsuke.github.internal.Previews;
76

87
import java.io.IOException;
98
import java.net.URL;
@@ -82,7 +81,6 @@ public String getName() {
8281
*
8382
* @return true if the push to this branch is restricted via branch protection.
8483
*/
85-
@Preview(Previews.LUKE_CAGE)
8684
public boolean isProtected() {
8785
return protection;
8886
}
@@ -92,7 +90,6 @@ public boolean isProtected() {
9290
*
9391
* @return API URL that deals with the protection of this branch.
9492
*/
95-
@Preview(Previews.LUKE_CAGE)
9693
public URL getProtectionUrl() {
9794
return GitHubClient.parseURL(protection_url);
9895
}
@@ -104,12 +101,8 @@ public URL getProtectionUrl() {
104101
* @throws IOException
105102
* the io exception
106103
*/
107-
@Preview(Previews.LUKE_CAGE)
108104
public GHBranchProtection getProtection() throws IOException {
109-
return root().createRequest()
110-
.withPreview(Previews.LUKE_CAGE)
111-
.setRawUrlPath(protection_url)
112-
.fetch(GHBranchProtection.class);
105+
return root().createRequest().setRawUrlPath(protection_url).fetch(GHBranchProtection.class);
113106
}
114107

115108
/**
@@ -137,7 +130,6 @@ public void disableProtection() throws IOException {
137130
* @return GHBranchProtectionBuilder for enabling protection
138131
* @see GHCommitStatus#getContext() GHCommitStatus#getContext()
139132
*/
140-
@Preview(Previews.LUKE_CAGE)
141133
public GHBranchProtectionBuilder enableProtection() {
142134
return new GHBranchProtectionBuilder(this);
143135
}

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.Collection;
99
import java.util.Collections;
1010

11-
import static org.kohsuke.github.internal.Previews.ZZZAX;
12-
1311
// TODO: Auto-generated Javadoc
1412
/**
1513
* The type GHBranchProtection.
@@ -65,7 +63,6 @@ public class GHBranchProtection extends GitHubInteractiveObject {
6563
* @throws IOException
6664
* the io exception
6765
*/
68-
@Preview(ZZZAX)
6966
public void enabledSignedCommits() throws IOException {
7067
requester().method("POST").withUrlPath(url + REQUIRE_SIGNATURES_URI).fetch(RequiredSignatures.class);
7168
}
@@ -76,7 +73,6 @@ public void enabledSignedCommits() throws IOException {
7673
* @throws IOException
7774
* the io exception
7875
*/
79-
@Preview(ZZZAX)
8076
public void disableSignedCommits() throws IOException {
8177
requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).send();
8278
}
@@ -169,7 +165,6 @@ public RequiredReviews getRequiredReviews() {
169165
* @throws IOException
170166
* the io exception
171167
*/
172-
@Preview(ZZZAX)
173168
public boolean getRequiredSignatures() throws IOException {
174169
return requester().withUrlPath(url + REQUIRE_SIGNATURES_URI).fetch(RequiredSignatures.class).enabled;
175170
}
@@ -202,7 +197,7 @@ public String getUrl() {
202197
}
203198

204199
private Requester requester() {
205-
return root().createRequest().withPreview(ZZZAX);
200+
return root().createRequest();
206201
}
207202

208203
/**

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import java.util.Set;
1414
import java.util.stream.Collectors;
1515

16-
import static org.kohsuke.github.internal.Previews.LUKE_CAGE;
17-
1816
// TODO: Auto-generated Javadoc
1917
/**
2018
* Builder to configure the branch protection settings.
@@ -567,7 +565,7 @@ private StatusChecks getStatusChecks() {
567565
}
568566

569567
private Requester requester() {
570-
return branch.root().createRequest().withPreview(LUKE_CAGE);
568+
return branch.root().createRequest();
571569
}
572570

573571
private static class Restrictions {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import edu.umd.cs.findbugs.annotations.NonNull;
66
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
77
import org.kohsuke.github.internal.EnumUtils;
8-
import org.kohsuke.github.internal.Previews;
98

109
import java.io.IOException;
1110
import java.net.URL;
@@ -397,7 +396,6 @@ public static enum AnnotationLevel {
397396
*
398397
* @return a builder which you should customize, then call {@link GHCheckRunBuilder#create}
399398
*/
400-
@Preview(Previews.ANTIOPE)
401399
public @NonNull GHCheckRunBuilder update() {
402400
return new GHCheckRunBuilder(owner, getId());
403401
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import edu.umd.cs.findbugs.annotations.CheckForNull;
2929
import edu.umd.cs.findbugs.annotations.NonNull;
3030
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
31-
import org.kohsuke.github.internal.Previews;
3231

3332
import java.io.IOException;
3433
import java.util.Collections;
@@ -48,7 +47,6 @@
4847
* @see <a href="https://developer.github.com/v3/checks/runs/#update-a-check-run">documentation</a>
4948
*/
5049
@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Jackson serializes these even without a getter")
51-
@Preview(Previews.ANTIOPE)
5250
public final class GHCheckRunBuilder {
5351

5452
/** The repo. */
@@ -78,7 +76,6 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) {
7876
this(repo,
7977
repo.root()
8078
.createRequest()
81-
.withPreview(Previews.ANTIOPE)
8279
.method("POST")
8380
.with("name", name)
8481
.with("head_sha", headSHA)
@@ -95,11 +92,7 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) {
9592
*/
9693
GHCheckRunBuilder(GHRepository repo, long checkId) {
9794
this(repo,
98-
repo.root()
99-
.createRequest()
100-
.withPreview(Previews.ANTIOPE)
101-
.method("PATCH")
102-
.withUrlPath(repo.getApiTailUrl("check-runs/" + checkId)));
95+
repo.root().createRequest().method("PATCH").withUrlPath(repo.getApiTailUrl("check-runs/" + checkId)));
10396
}
10497

10598
/**
@@ -254,7 +247,6 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) {
254247
extraAnnotations = extraAnnotations.subList(i, extraAnnotations.size());
255248
run = repo.root()
256249
.createRequest()
257-
.withPreview(Previews.ANTIOPE)
258250
.method("PATCH")
259251
.with("output", output2)
260252
.withUrlPath(repo.getApiTailUrl("check-runs/" + run.getId()))

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
import java.util.Date;
1111
import java.util.List;
1212

13-
import static org.kohsuke.github.internal.Previews.ANTIOPE;
14-
import static org.kohsuke.github.internal.Previews.GROOT;
15-
1613
// TODO: Auto-generated Javadoc
1714
/**
1815
* A commit in a repository.
@@ -533,11 +530,9 @@ private GHUser resolveUser(User author) throws IOException {
533530
*
534531
* @return {@link PagedIterable} with the pull requests which contain this commit
535532
*/
536-
@Preview(GROOT)
537533
public PagedIterable<GHPullRequest> listPullRequests() {
538534
return owner.root()
539535
.createRequest()
540-
.withPreview(GROOT)
541536
.withUrlPath(String.format("/repos/%s/%s/commits/%s/pulls", owner.getOwnerName(), owner.getName(), sha))
542537
.toIterable(GHPullRequest[].class, item -> item.wrapUp(owner));
543538
}
@@ -549,11 +544,9 @@ public PagedIterable<GHPullRequest> listPullRequests() {
549544
* @throws IOException
550545
* the io exception
551546
*/
552-
@Preview(GROOT)
553547
public PagedIterable<GHBranch> listBranchesWhereHead() throws IOException {
554548
return owner.root()
555549
.createRequest()
556-
.withPreview(GROOT)
557550
.withUrlPath(String.format("/repos/%s/%s/commits/%s/branches-where-head",
558551
owner.getOwnerName(),
559552
owner.getName(),
@@ -643,7 +636,6 @@ public GHCommitStatus getLastStatus() throws IOException {
643636
* @throws IOException
644637
* on error
645638
*/
646-
@Preview(ANTIOPE)
647639
public PagedIterable<GHCheckRun> getCheckRuns() throws IOException {
648640
return owner.getCheckRuns(sha);
649641
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.io.IOException;
66
import java.net.URL;
77

8-
import static org.kohsuke.github.internal.Previews.SQUIRREL_GIRL;
9-
108
// TODO: Auto-generated Javadoc
119
/**
1210
* A comment attached to a commit (or a specific line in a specific file of a commit.)
@@ -142,12 +140,10 @@ public void update(String body) throws IOException {
142140
* @throws IOException
143141
* Signals that an I/O exception has occurred.
144142
*/
145-
@Preview(SQUIRREL_GIRL)
146143
public GHReaction createReaction(ReactionContent content) throws IOException {
147144
return owner.root()
148145
.createRequest()
149146
.method("POST")
150-
.withPreview(SQUIRREL_GIRL)
151147
.with("content", content.getContent())
152148
.withUrlPath(getApiTail() + "/reactions")
153149
.fetch(GHReaction.class);
@@ -174,11 +170,9 @@ public void deleteReaction(GHReaction reaction) throws IOException {
174170
*
175171
* @return the paged iterable
176172
*/
177-
@Preview(SQUIRREL_GIRL)
178173
public PagedIterable<GHReaction> listReactions() {
179174
return owner.root()
180175
.createRequest()
181-
.withPreview(SQUIRREL_GIRL)
182176
.withUrlPath(getApiTail() + "/reactions")
183177
.toIterable(GHReaction[].class, item -> owner.root());
184178
}

0 commit comments

Comments
 (0)