Skip to content

Commit

Permalink
Merge pull request #1859 from bitwiseman/task/remove-previews
Browse files Browse the repository at this point in the history
Remove preview and switch to latest accept headers
  • Loading branch information
bitwiseman authored Jun 20, 2024
2 parents fcdf5c9 + 6d90891 commit 4d63d8c
Show file tree
Hide file tree
Showing 2,879 changed files with 3,771 additions and 3,590 deletions.
14 changes: 1 addition & 13 deletions src/main/java/org/kohsuke/github/GHApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import java.util.Map;
import java.util.stream.Collectors;

import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* A Github App.
Expand Down Expand Up @@ -208,7 +206,6 @@ public void setPermissions(Map<String, String> permissions) {
* @return a list of App installations
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
*/
@Preview(MACHINE_MAN)
public PagedIterable<GHAppInstallation> listInstallations() {
return listInstallations(null);
}
Expand All @@ -223,9 +220,8 @@ public PagedIterable<GHAppInstallation> listInstallations() {
* @return a list of App installations since a given time.
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
*/
@Preview(MACHINE_MAN)
public PagedIterable<GHAppInstallation> listInstallations(final Date since) {
Requester requester = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/app/installations");
Requester requester = root().createRequest().withUrlPath("/app/installations");
if (since != null) {
requester.with("since", GitHubClient.printDate(since));
}
Expand All @@ -244,10 +240,8 @@ public PagedIterable<GHAppInstallation> listInstallations(final Date since) {
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-an-installation">Get an installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationById(long id) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/app/installations/%d", id))
.fetch(GHAppInstallation.class);
}
Expand All @@ -265,10 +259,8 @@ public GHAppInstallation getInstallationById(long id) throws IOException {
* @see <a href="https://developer.github.com/v3/apps/#get-an-organization-installation">Get an organization
* installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/orgs/%s/installation", name))
.fetch(GHAppInstallation.class);
}
Expand All @@ -288,10 +280,8 @@ public GHAppInstallation getInstallationByOrganization(String name) throws IOExc
* @see <a href="https://developer.github.com/v3/apps/#get-a-repository-installation">Get a repository
* installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/repos/%s/%s/installation", ownerName, repositoryName))
.fetch(GHAppInstallation.class);
}
Expand All @@ -308,10 +298,8 @@ public GHAppInstallation getInstallationByRepository(String ownerName, String re
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-a-user-installation">Get a user installation</a>
*/
@Preview(MACHINE_MAN)
public GHAppInstallation getInstallationByUser(String name) throws IOException {
return root().createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/users/%s/installation", name))
.fetch(GHAppInstallation.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.util.List;
import java.util.Map;

import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* Creates a access token for a GitHub App Installation.
Expand Down Expand Up @@ -108,12 +106,8 @@ public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permiss
* @throws IOException
* on error
*/
@Preview(MACHINE_MAN)
public GHAppInstallationToken create() throws IOException {
return builder.method("POST")
.withPreview(MACHINE_MAN)
.withUrlPath(apiUrlTail)
.fetch(GHAppInstallationToken.class);
return builder.method("POST").withUrlPath(apiUrlTail).fetch(GHAppInstallationToken.class);
}

}
13 changes: 2 additions & 11 deletions src/main/java/org/kohsuke/github/GHAppInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import java.util.Map;
import java.util.stream.Collectors;

import static org.kohsuke.github.internal.Previews.GAMBIT;
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* A Github App Installation.
Expand Down Expand Up @@ -135,11 +132,10 @@ public String getRepositoriesUrl() {
* {@link GHAuthenticatedAppInstallation#listRepositories()}.
*/
@Deprecated
@Preview(MACHINE_MAN)
public PagedSearchIterable<GHRepository> listRepositories() {
GitHubRequest request;

request = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
request = root().createRequest().withUrlPath("/installation/repositories").build();

return new PagedSearchIterable<>(root(), request, GHAppInstallationRepositoryResult.class);
}
Expand Down Expand Up @@ -342,13 +338,8 @@ public GHUser getSuspendedBy() {
* on error
* @see <a href="https://developer.github.com/v3/apps/#delete-an-installation">Delete an installation</a>
*/
@Preview(GAMBIT)
public void deleteInstallation() throws IOException {
root().createRequest()
.method("DELETE")
.withPreview(GAMBIT)
.withUrlPath(String.format("/app/installations/%d", getId()))
.send();
root().createRequest().method("DELETE").withUrlPath(String.format("/app/installations/%d", getId())).send();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import javax.annotation.Nonnull;

import static org.kohsuke.github.internal.Previews.MACHINE_MAN;

// TODO: Auto-generated Javadoc
/**
* The Github App Installation corresponding to the installation token used in a client.
Expand All @@ -27,11 +25,10 @@ protected GHAuthenticatedAppInstallation(@Nonnull GitHub root) {
*
* @return the paged iterable
*/
@Preview(MACHINE_MAN)
public PagedSearchIterable<GHRepository> listRepositories() {
GitHubRequest request;

request = root().createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
request = root().createRequest().withUrlPath("/installation/repositories").build();

return new PagedSearchIterable<>(root(), request, GHAuthenticatedAppInstallationRepositoryResult.class);
}
Expand Down
10 changes: 1 addition & 9 deletions src/main/java/org/kohsuke/github/GHBranch.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.Previews;

import java.io.IOException;
import java.net.URL;
Expand Down Expand Up @@ -82,7 +81,6 @@ public String getName() {
*
* @return true if the push to this branch is restricted via branch protection.
*/
@Preview(Previews.LUKE_CAGE)
public boolean isProtected() {
return protection;
}
Expand All @@ -92,7 +90,6 @@ public boolean isProtected() {
*
* @return API URL that deals with the protection of this branch.
*/
@Preview(Previews.LUKE_CAGE)
public URL getProtectionUrl() {
return GitHubClient.parseURL(protection_url);
}
Expand All @@ -104,12 +101,8 @@ public URL getProtectionUrl() {
* @throws IOException
* the io exception
*/
@Preview(Previews.LUKE_CAGE)
public GHBranchProtection getProtection() throws IOException {
return root().createRequest()
.withPreview(Previews.LUKE_CAGE)
.setRawUrlPath(protection_url)
.fetch(GHBranchProtection.class);
return root().createRequest().setRawUrlPath(protection_url).fetch(GHBranchProtection.class);
}

/**
Expand Down Expand Up @@ -137,7 +130,6 @@ public void disableProtection() throws IOException {
* @return GHBranchProtectionBuilder for enabling protection
* @see GHCommitStatus#getContext() GHCommitStatus#getContext()
*/
@Preview(Previews.LUKE_CAGE)
public GHBranchProtectionBuilder enableProtection() {
return new GHBranchProtectionBuilder(this);
}
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/kohsuke/github/GHBranchProtection.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.util.Collection;
import java.util.Collections;

import static org.kohsuke.github.internal.Previews.ZZZAX;

// TODO: Auto-generated Javadoc
/**
* The type GHBranchProtection.
Expand Down Expand Up @@ -65,7 +63,6 @@ public class GHBranchProtection extends GitHubInteractiveObject {
* @throws IOException
* the io exception
*/
@Preview(ZZZAX)
public void enabledSignedCommits() throws IOException {
requester().method("POST").withUrlPath(url + REQUIRE_SIGNATURES_URI).fetch(RequiredSignatures.class);
}
Expand All @@ -76,7 +73,6 @@ public void enabledSignedCommits() throws IOException {
* @throws IOException
* the io exception
*/
@Preview(ZZZAX)
public void disableSignedCommits() throws IOException {
requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).send();
}
Expand Down Expand Up @@ -169,7 +165,6 @@ public RequiredReviews getRequiredReviews() {
* @throws IOException
* the io exception
*/
@Preview(ZZZAX)
public boolean getRequiredSignatures() throws IOException {
return requester().withUrlPath(url + REQUIRE_SIGNATURES_URI).fetch(RequiredSignatures.class).enabled;
}
Expand Down Expand Up @@ -202,7 +197,7 @@ public String getUrl() {
}

private Requester requester() {
return root().createRequest().withPreview(ZZZAX);
return root().createRequest();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.util.Set;
import java.util.stream.Collectors;

import static org.kohsuke.github.internal.Previews.LUKE_CAGE;

// TODO: Auto-generated Javadoc
/**
* Builder to configure the branch protection settings.
Expand Down Expand Up @@ -567,7 +565,7 @@ private StatusChecks getStatusChecks() {
}

private Requester requester() {
return branch.root().createRequest().withPreview(LUKE_CAGE);
return branch.root().createRequest();
}

private static class Restrictions {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/kohsuke/github/GHCheckRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.EnumUtils;
import org.kohsuke.github.internal.Previews;

import java.io.IOException;
import java.net.URL;
Expand Down Expand Up @@ -397,7 +396,6 @@ public static enum AnnotationLevel {
*
* @return a builder which you should customize, then call {@link GHCheckRunBuilder#create}
*/
@Preview(Previews.ANTIOPE)
public @NonNull GHCheckRunBuilder update() {
return new GHCheckRunBuilder(owner, getId());
}
Expand Down
10 changes: 1 addition & 9 deletions src/main/java/org/kohsuke/github/GHCheckRunBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.Previews;

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

/** The repo. */
Expand Down Expand Up @@ -78,7 +76,6 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) {
this(repo,
repo.root()
.createRequest()
.withPreview(Previews.ANTIOPE)
.method("POST")
.with("name", name)
.with("head_sha", headSHA)
Expand All @@ -95,11 +92,7 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) {
*/
GHCheckRunBuilder(GHRepository repo, long checkId) {
this(repo,
repo.root()
.createRequest()
.withPreview(Previews.ANTIOPE)
.method("PATCH")
.withUrlPath(repo.getApiTailUrl("check-runs/" + checkId)));
repo.root().createRequest().method("PATCH").withUrlPath(repo.getApiTailUrl("check-runs/" + checkId)));
}

/**
Expand Down Expand Up @@ -254,7 +247,6 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) {
extraAnnotations = extraAnnotations.subList(i, extraAnnotations.size());
run = repo.root()
.createRequest()
.withPreview(Previews.ANTIOPE)
.method("PATCH")
.with("output", output2)
.withUrlPath(repo.getApiTailUrl("check-runs/" + run.getId()))
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/kohsuke/github/GHCommit.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import java.util.Date;
import java.util.List;

import static org.kohsuke.github.internal.Previews.ANTIOPE;
import static org.kohsuke.github.internal.Previews.GROOT;

// TODO: Auto-generated Javadoc
/**
* A commit in a repository.
Expand Down Expand Up @@ -533,11 +530,9 @@ private GHUser resolveUser(User author) throws IOException {
*
* @return {@link PagedIterable} with the pull requests which contain this commit
*/
@Preview(GROOT)
public PagedIterable<GHPullRequest> listPullRequests() {
return owner.root()
.createRequest()
.withPreview(GROOT)
.withUrlPath(String.format("/repos/%s/%s/commits/%s/pulls", owner.getOwnerName(), owner.getName(), sha))
.toIterable(GHPullRequest[].class, item -> item.wrapUp(owner));
}
Expand All @@ -549,11 +544,9 @@ public PagedIterable<GHPullRequest> listPullRequests() {
* @throws IOException
* the io exception
*/
@Preview(GROOT)
public PagedIterable<GHBranch> listBranchesWhereHead() throws IOException {
return owner.root()
.createRequest()
.withPreview(GROOT)
.withUrlPath(String.format("/repos/%s/%s/commits/%s/branches-where-head",
owner.getOwnerName(),
owner.getName(),
Expand Down Expand Up @@ -643,7 +636,6 @@ public GHCommitStatus getLastStatus() throws IOException {
* @throws IOException
* on error
*/
@Preview(ANTIOPE)
public PagedIterable<GHCheckRun> getCheckRuns() throws IOException {
return owner.getCheckRuns(sha);
}
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/kohsuke/github/GHCommitComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.io.IOException;
import java.net.URL;

import static org.kohsuke.github.internal.Previews.SQUIRREL_GIRL;

// TODO: Auto-generated Javadoc
/**
* A comment attached to a commit (or a specific line in a specific file of a commit.)
Expand Down Expand Up @@ -142,12 +140,10 @@ public void update(String body) throws IOException {
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Preview(SQUIRREL_GIRL)
public GHReaction createReaction(ReactionContent content) throws IOException {
return owner.root()
.createRequest()
.method("POST")
.withPreview(SQUIRREL_GIRL)
.with("content", content.getContent())
.withUrlPath(getApiTail() + "/reactions")
.fetch(GHReaction.class);
Expand All @@ -174,11 +170,9 @@ public void deleteReaction(GHReaction reaction) throws IOException {
*
* @return the paged iterable
*/
@Preview(SQUIRREL_GIRL)
public PagedIterable<GHReaction> listReactions() {
return owner.root()
.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiTail() + "/reactions")
.toIterable(GHReaction[].class, item -> owner.root());
}
Expand Down
Loading

0 comments on commit 4d63d8c

Please sign in to comment.