Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Previews #1827

Merged
merged 7 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
<annotationProcessorPath>
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
<version>1.12</version>
<version>1.17</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/org/kohsuke/github/BetaApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
import java.lang.annotation.RetentionPolicy;

/**
* Indicates that the method/class/etc marked is a beta implementation of an sdk feature.
* Indicates that the method/class/etc marked is a beta implementation of an SDK feature.
* <p>
* These APIs are subject to change and not a part of the backward compatibility commitment. Always used in conjunction
* with 'deprecated' to raise awareness to clients.
* </p>
*
* These APIs are subject to change and not a part of the backward compatibility commitment.
*/
@Retention(RetentionPolicy.RUNTIME)
@Documented
Expand Down
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 @@ -124,7 +122,6 @@ public Map<String, String> getPermissions() {
* @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 @@ -139,9 +136,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 @@ -160,10 +156,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 @@ -181,10 +175,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 @@ -204,10 +196,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 @@ -224,10 +214,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);
}

}
14 changes: 2 additions & 12 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 @@ -97,12 +94,10 @@ public String getRepositoriesUrl() {
* retrieve a {@link GHAuthenticatedAppInstallation} from {@link GitHub#getInstallation()}, then call
* {@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 @@ -209,13 +204,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
9 changes: 0 additions & 9 deletions src/main/java/org/kohsuke/github/GHAppInstallationToken.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.kohsuke.github;

import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.util.*;

Expand Down Expand Up @@ -65,13 +62,7 @@ public GHRepositorySelection getRepositorySelection() {
* @throws IOException
* on error
*/
@WithBridgeMethods(value = String.class, adapterMethod = "expiresAtStr")
public Date getExpiresAt() throws IOException {
return GitHubClient.parseDate(expires_at);
}

@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getExpiresAt")
private Object expiresAtStr(Date id, Class type) {
return expires_at;
}
}
13 changes: 0 additions & 13 deletions src/main/java/org/kohsuke/github/GHArtifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,6 @@ public GHRepository getRepository() {
return owner;
}

/**
* Gets the html url.
*
* @return the html url
* @throws IOException
* Signals that an I/O exception has occurred.
* @deprecated This object has no HTML URL.
*/
@Override
public URL getHtmlUrl() throws IOException {
return null;
}

/**
* Deletes the artifact.
*
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/kohsuke/github/GHAsset.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.net.URL;

// TODO: Auto-generated Javadoc
/**
Expand Down Expand Up @@ -113,17 +112,6 @@ public String getState() {
return state;
}

/**
* Gets the html url.
*
* @return the html url
* @deprecated This object has no HTML URL.
*/
@Override
public URL getHtmlUrl() {
return null;
}

/**
* Gets browser download url.
*
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
11 changes: 0 additions & 11 deletions src/main/java/org/kohsuke/github/GHAuthorization.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,6 @@ public String getAppName() {
return app.name;
}

/**
* Gets the html url.
*
* @return the html url
* @deprecated This object has no HTML URL.
*/
@Override
public URL getHtmlUrl() {
return null;
}

/**
* Gets note.
*
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 @@ -81,7 +80,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 @@ -91,7 +89,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 @@ -103,12 +100,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 @@ -136,7 +129,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 @@ -7,8 +7,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 @@ -64,7 +62,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 @@ -75,7 +72,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 @@ -168,7 +164,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 @@ -201,7 +196,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 @@ -12,8 +12,6 @@
import java.util.Map;
import java.util.Set;

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

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

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

private static class Restrictions {
Expand Down
Loading