diff --git a/src/main/java/org/kohsuke/github/AbuseLimitHandler.java b/src/main/java/org/kohsuke/github/AbuseLimitHandler.java
index 2c21cdaf9c..a30969da81 100644
--- a/src/main/java/org/kohsuke/github/AbuseLimitHandler.java
+++ b/src/main/java/org/kohsuke/github/AbuseLimitHandler.java
@@ -17,17 +17,18 @@ public abstract class AbuseLimitHandler {
* Called when the library encounters HTTP error indicating that the API abuse limit is reached.
*
*
- * Any exception thrown from this method will cause the request to fail, and the caller of github-api
- * will receive an exception. If this method returns normally, another request will be attempted.
- * For that to make sense, the implementation needs to wait for some time.
+ * Any exception thrown from this method will cause the request to fail, and the caller of github-api will receive
+ * an exception. If this method returns normally, another request will be attempted. For that to make sense, the
+ * implementation needs to wait for some time.
*
* @see API documentation from GitHub
* @param e
- * Exception from Java I/O layer. If you decide to fail the processing, you can throw
- * this exception (or wrap this exception into another exception and throw it).
+ * Exception from Java I/O layer. If you decide to fail the processing, you can throw this exception (or
+ * wrap this exception into another exception and throw it).
* @param uc
- * Connection that resulted in an error. Useful for accessing other response headers.
+ * Connection that resulted in an error. Useful for accessing other response headers.
* @throws IOException
+ * on failure
*/
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
@@ -40,15 +41,16 @@ public void onError(IOException e, HttpURLConnection uc) throws IOException {
try {
Thread.sleep(parseWaitTime(uc));
} catch (InterruptedException ex) {
- throw (InterruptedIOException)new InterruptedIOException().initCause(e);
+ throw (InterruptedIOException) new InterruptedIOException().initCause(e);
}
}
private long parseWaitTime(HttpURLConnection uc) {
String v = uc.getHeaderField("Retry-After");
- if (v==null) return 60 * 1000; // can't tell, return 1 min
+ if (v == null)
+ return 60 * 1000; // can't tell, return 1 min
- return Math.max(1000, Long.parseLong(v)*1000);
+ return Math.max(1000, Long.parseLong(v) * 1000);
}
};
@@ -58,7 +60,7 @@ private long parseWaitTime(HttpURLConnection uc) {
public static final AbuseLimitHandler FAIL = new AbuseLimitHandler() {
@Override
public void onError(IOException e, HttpURLConnection uc) throws IOException {
- throw (IOException)new IOException("Abuse limit reached").initCause(e);
+ throw (IOException) new IOException("Abuse limit reached").initCause(e);
}
};
}
diff --git a/src/main/java/org/kohsuke/github/DeleteToken.java b/src/main/java/org/kohsuke/github/DeleteToken.java
index d9d4724eb9..ebef1967f8 100644
--- a/src/main/java/org/kohsuke/github/DeleteToken.java
+++ b/src/main/java/org/kohsuke/github/DeleteToken.java
@@ -28,8 +28,7 @@
/**
* @author Kohsuke Kawaguchi
*/
-@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
- justification = "Being constructed by JSON deserialization")
+@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "Being constructed by JSON deserialization")
class DeleteToken {
public String delete_token;
}
diff --git a/src/main/java/org/kohsuke/github/GHApp.java b/src/main/java/org/kohsuke/github/GHApp.java
index d3a73354b2..e1386e72f4 100644
--- a/src/main/java/org/kohsuke/github/GHApp.java
+++ b/src/main/java/org/kohsuke/github/GHApp.java
@@ -25,14 +25,13 @@ public class GHApp extends GHObject {
private String description;
@JsonProperty("external_url")
private String externalUrl;
- private Map permissions;
+ private Map permissions;
private List events;
@JsonProperty("installations_count")
private long installationsCount;
@JsonProperty("html_url")
private String htmlUrl;
-
public GHUser getOwner() {
return owner;
}
@@ -93,80 +92,105 @@ public void setPermissions(Map permissions) {
this.permissions = permissions;
}
- /*package*/ GHApp wrapUp(GitHub root) {
+ GHApp wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Obtains all the installations associated with this app.
- *
+ *
* You must use a JWT to access this endpoint.
*
- * @see List installations
* @return a list of App installations
+ * @see List installations
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public PagedIterable listInstallations() {
- return root.retrieve().withPreview(MACHINE_MAN)
- .asPagedIterable(
- "/app/installations",
- GHAppInstallation[].class,
- item -> item.wrapUp(root) );
+ return root.retrieve().withPreview(MACHINE_MAN).asPagedIterable("/app/installations", GHAppInstallation[].class,
+ item -> item.wrapUp(root));
}
/**
- * Obtain an installation associated with this app
- * @param id - Installation Id
- *
+ * Obtain an installation associated with this app.
+ *
* You must use a JWT to access this endpoint.
*
+ * @param id
+ * Installation Id
+ * @return a GHAppInstallation
+ * @throws IOException
+ * on error
* @see Get an installation
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHAppInstallation getInstallationById(long id) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/app/installations/%d", id), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve().withPreview(MACHINE_MAN)
+ .to(String.format("/app/installations/%d", id), GHAppInstallation.class).wrapUp(root);
}
/**
- * Obtain an organization installation associated with this app
- * @param name - Organization name
- *
+ * Obtain an organization installation associated with this app.
+ *
* You must use a JWT to access this endpoint.
*
- * @see Get an organization installation
+ * @param name
+ * Organization name
+ * @return a GHAppInstallation
+ * @throws IOException
+ * on error
+ * @see Get an organization
+ * installation
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/orgs/%s/installation", name), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve().withPreview(MACHINE_MAN)
+ .to(String.format("/orgs/%s/installation", name), GHAppInstallation.class).wrapUp(root);
}
/**
- * Obtain an repository installation associated with this app
- * @param ownerName - Organization or user name
- * @param repositoryName - Repository name
- *
+ * Obtain an repository installation associated with this app.
+ *
* You must use a JWT to access this endpoint.
*
- * @see Get a repository installation
+ * @param ownerName
+ * Organization or user name
+ * @param repositoryName
+ * Repository name
+ * @return a GHAppInstallation
+ * @throws IOException
+ * on error
+ * @see Get a repository
+ * installation
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/repos/%s/%s/installation", ownerName, repositoryName), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve().withPreview(MACHINE_MAN)
+ .to(String.format("/repos/%s/%s/installation", ownerName, repositoryName), GHAppInstallation.class)
+ .wrapUp(root);
}
/**
- * Obtain a user installation associated with this app
- * @param name - user name
- *
+ * Obtain a user installation associated with this app.
+ *
* You must use a JWT to access this endpoint.
*
+ * @param name
+ * user name
+ * @return a GHAppInstallation
+ * @throws IOException
+ * on error
* @see Get a user installation
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHAppInstallation getInstallationByUser(String name) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/users/%s/installation", name), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve().withPreview(MACHINE_MAN)
+ .to(String.format("/users/%s/installation", name), GHAppInstallation.class).wrapUp(root);
}
}
-
diff --git a/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java b/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
index 807ebcf102..e677e634cb 100644
--- a/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
@@ -18,12 +18,13 @@ public class GHAppCreateTokenBuilder {
protected final Requester builder;
private final String apiUrlTail;
- @Preview @Deprecated
- /*package*/ GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map permissions) {
+ @Preview
+ @Deprecated
+ GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map permissions) {
this.root = root;
this.apiUrlTail = apiUrlTail;
this.builder = new Requester(root);
- this.builder.withPermissions("permissions",permissions);
+ this.builder.withPermissions("permissions", permissions);
}
/**
@@ -31,12 +32,15 @@ public class GHAppCreateTokenBuilder {
* the access to specific repositories, you can provide the repository_ids when creating the token. When you omit
* repository_ids, the response does not contain neither the repositories nor the permissions key.
*
- * @param repositoryIds - Array containing the repositories Ids
+ * @param repositoryIds
+ * Array containing the repositories Ids
*
+ * @return a GHAppCreateTokenBuilder
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHAppCreateTokenBuilder repositoryIds(List repositoryIds) {
- this.builder.with("repository_ids",repositoryIds);
+ this.builder.with("repository_ids", repositoryIds);
return this;
}
@@ -44,10 +48,16 @@ public GHAppCreateTokenBuilder repositoryIds(List repositoryIds) {
* Creates an app token with all the parameters.
*
* You must use a JWT to access this endpoint.
+ *
+ * @return a GHAppInstallationToken
+ * @throws IOException
+ * on error
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHAppInstallationToken create() throws IOException {
- return builder.method("POST").withPreview(MACHINE_MAN).to(apiUrlTail, GHAppInstallationToken.class).wrapUp(root);
+ return builder.method("POST").withPreview(MACHINE_MAN).to(apiUrlTail, GHAppInstallationToken.class)
+ .wrapUp(root);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHAppInstallation.java b/src/main/java/org/kohsuke/github/GHAppInstallation.java
index 3925742162..96e2633c08 100644
--- a/src/main/java/org/kohsuke/github/GHAppInstallation.java
+++ b/src/main/java/org/kohsuke/github/GHAppInstallation.java
@@ -135,7 +135,7 @@ public void setRepositorySelection(GHRepositorySelection repositorySelection) {
this.repositorySelection = repositorySelection;
}
- /*package*/ GHAppInstallation wrapUp(GitHub root) {
+ GHAppInstallation wrapUp(GitHub root) {
this.root = root;
return this;
}
@@ -145,23 +145,30 @@ public void setRepositorySelection(GHRepositorySelection repositorySelection) {
*
* You must use a JWT to access this endpoint.
*
+ * @throws IOException
+ * on error
* @see Delete an installation
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public void deleteInstallation() throws IOException {
root.retrieve().method("DELETE").withPreview(GAMBIT).to(String.format("/app/installations/%d", id));
}
-
/**
* Starts a builder that creates a new App Installation Token.
*
*
- * You use the returned builder to set various properties, then call {@link GHAppCreateTokenBuilder#create()}
- * to finally create an access token.
+ * You use the returned builder to set various properties, then call {@link GHAppCreateTokenBuilder#create()} to
+ * finally create an access token.
+ *
+ * @param permissions
+ * map of permissions for the created token
+ * @return a GHAppCreateTokenBuilder on error
*/
- @Preview @Deprecated
- public GHAppCreateTokenBuilder createToken(Map permissions){
- return new GHAppCreateTokenBuilder(root,String.format("/app/installations/%d/access_tokens", id), permissions);
+ @Preview
+ @Deprecated
+ public GHAppCreateTokenBuilder createToken(Map permissions) {
+ return new GHAppCreateTokenBuilder(root, String.format("/app/installations/%d/access_tokens", id), permissions);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHAppInstallationToken.java b/src/main/java/org/kohsuke/github/GHAppInstallationToken.java
index 2b6e78fdee..992e7ee349 100644
--- a/src/main/java/org/kohsuke/github/GHAppInstallationToken.java
+++ b/src/main/java/org/kohsuke/github/GHAppInstallationToken.java
@@ -68,9 +68,11 @@ public void setRepositorySelection(GHRepositorySelection repositorySelection) {
}
/**
- * When was this tokens expires?
+ * @return date when this token expires
+ * @throws IOException
+ * on error
*/
- @WithBridgeMethods(value=String.class, adapterMethod="expiresAtStr")
+ @WithBridgeMethods(value = String.class, adapterMethod = "expiresAtStr")
public Date getExpiresAt() throws IOException {
return GitHub.parseDate(expires_at);
}
@@ -80,7 +82,7 @@ private Object expiresAtStr(Date id, Class type) {
return expires_at;
}
- /*package*/ GHAppInstallationToken wrapUp(GitHub root) {
+ GHAppInstallationToken wrapUp(GitHub root) {
this.root = root;
return this;
}
diff --git a/src/main/java/org/kohsuke/github/GHAsset.java b/src/main/java/org/kohsuke/github/GHAsset.java
index 9f0be15863..877d85fbc0 100644
--- a/src/main/java/org/kohsuke/github/GHAsset.java
+++ b/src/main/java/org/kohsuke/github/GHAsset.java
@@ -81,7 +81,6 @@ public void delete() throws IOException {
new Requester(root).method("DELETE").to(getApiRoute());
}
-
private String getApiRoute() {
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + id;
}
diff --git a/src/main/java/org/kohsuke/github/GHAuthorization.java b/src/main/java/org/kohsuke/github/GHAuthorization.java
index bf7e24c7f2..033beda0a2 100644
--- a/src/main/java/org/kohsuke/github/GHAuthorization.java
+++ b/src/main/java/org/kohsuke/github/GHAuthorization.java
@@ -42,8 +42,8 @@ public class GHAuthorization extends GHObject {
private String note;
private String note_url;
private String fingerprint;
- //TODO add some user class for https://developer.github.com/v3/oauth_authorizations/#check-an-authorization ?
- //private GHUser user;
+ // TODO add some user class for https://developer.github.com/v3/oauth_authorizations/#check-an-authorization ?
+ // private GHUser user;
public GitHub getRoot() {
return root;
@@ -73,8 +73,7 @@ public String getAppName() {
return app.name;
}
- @SuppressFBWarnings(value = "NM_CONFUSING",
- justification = "It's a part of the library API, cannot be changed")
+ @SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library API, cannot be changed")
public URL getApiURL() {
return GitHub.parseURL(url);
}
@@ -99,13 +98,13 @@ public String getFingerprint() {
return fingerprint;
}
- /*package*/ GHAuthorization wrap(GitHub root) {
+ GHAuthorization wrap(GitHub root) {
this.root = root;
return this;
}
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD"},
- justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
+ "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
private static class App {
private String url;
private String name;
diff --git a/src/main/java/org/kohsuke/github/GHBlob.java b/src/main/java/org/kohsuke/github/GHBlob.java
index a38a18219c..d881fd8485 100644
--- a/src/main/java/org/kohsuke/github/GHBlob.java
+++ b/src/main/java/org/kohsuke/github/GHBlob.java
@@ -19,7 +19,7 @@ public class GHBlob {
private long size;
/**
- * API URL of this blob.
+ * @return API URL of this blob.
*/
public URL getUrl() {
return GitHub.parseURL(url);
@@ -30,7 +30,7 @@ public String getSha() {
}
/**
- * Number of bytes in this blob.
+ * @return Number of bytes in this blob.
*/
public long getSize() {
return size;
@@ -41,24 +41,24 @@ public String getEncoding() {
}
/**
- * Encoded content. You probably want {@link #read()}
+ * @return Encoded content. You probably want {@link #read()}
*/
public String getContent() {
return content;
}
/**
- * Retrieves the actual bytes of the blob.
+ * @return the actual bytes of the blob.
*/
public InputStream read() {
if (encoding.equals("base64")) {
try {
return new Base64InputStream(new ByteArrayInputStream(content.getBytes("US-ASCII")), false);
} catch (UnsupportedEncodingException e) {
- throw new AssertionError(e); // US-ASCII is mandatory
+ throw new AssertionError(e); // US-ASCII is mandatory
}
}
- throw new UnsupportedOperationException("Unrecognized encoding: "+encoding);
+ throw new UnsupportedOperationException("Unrecognized encoding: " + encoding);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHBlobBuilder.java b/src/main/java/org/kohsuke/github/GHBlobBuilder.java
index a6259e5b6d..9397fe89b8 100644
--- a/src/main/java/org/kohsuke/github/GHBlobBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHBlobBuilder.java
@@ -5,8 +5,7 @@
import java.io.IOException;
/**
- * Builder pattern for creating a new blob.
- * Based on https://developer.github.com/v3/git/blobs/#create-a-blob
+ * Builder pattern for creating a new blob. Based on https://developer.github.com/v3/git/blobs/#create-a-blob
*/
public class GHBlobBuilder {
private final GHRepository repo;
@@ -19,6 +18,10 @@ public class GHBlobBuilder {
/**
* Configures a blob with the specified text {@code content}.
+ *
+ * @param content
+ * string text of the blob
+ * @return a GHBlobBuilder
*/
public GHBlobBuilder textContent(String content) {
req.with("content", content);
@@ -28,6 +31,10 @@ public GHBlobBuilder textContent(String content) {
/**
* Configures a blob with the specified binary {@code content}.
+ *
+ * @param content
+ * byte array of the blob
+ * @return a GHBlobBuilder
*/
public GHBlobBuilder binaryContent(byte[] content) {
String base64Content = Base64.encodeBase64String(content);
@@ -42,6 +49,10 @@ private String getApiTail() {
/**
* Creates a blob based on the parameters specified thus far.
+ *
+ * @return a GHBlob
+ * @throws IOException
+ * if the blob cannot be created.
*/
public GHBlob create() throws IOException {
return req.method("POST").to(getApiTail(), GHBlob.class);
diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java
index e457fc243d..64c62c9d2a 100644
--- a/src/main/java/org/kohsuke/github/GHBranch.java
+++ b/src/main/java/org/kohsuke/github/GHBranch.java
@@ -14,8 +14,8 @@
*
* @author Yusuke Kokubo
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" }, justification = "JSON API")
public class GHBranch {
private GitHub root;
private GHRepository owner;
@@ -26,7 +26,6 @@ public class GHBranch {
private boolean protection;
private String protection_url;
-
public static class Commit {
String sha;
@@ -39,7 +38,7 @@ public GitHub getRoot() {
}
/**
- * Repository that this branch is in.
+ * @return the repository that this branch is in.
*/
public GHRepository getOwner() {
return owner;
@@ -50,17 +49,19 @@ public String getName() {
}
/**
- * Returns true if the push to this branch is restricted via branch protection.
+ * @return true if the push to this branch is restricted via branch protection.
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public boolean isProtected() {
return protection;
}
/**
- * Returns API URL that deals with the protection of this branch.
+ * @return API URL that deals with the protection of this branch.
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public URL getProtectionUrl() {
return GitHub.parseURL(protection_url);
}
@@ -70,7 +71,7 @@ public GHBranchProtection getProtection() throws IOException {
}
/**
- * The commit that this branch currently points to.
+ * @return The SHA1 of the commit that this branch currently points to.
*/
public String getSHA1() {
return commit.sha;
@@ -78,6 +79,9 @@ public String getSHA1() {
/**
* Disables branch protection and allows anyone with push access to push changes.
+ *
+ * @throws IOException
+ * if disabling protection fails
*/
public void disableProtection() throws IOException {
new Requester(root).method("DELETE").to(protection_url);
@@ -86,9 +90,11 @@ public void disableProtection() throws IOException {
/**
* Enables branch protection to control what commit statuses are required to push.
*
+ * @return GHBranchProtectionBuilder for enabling protection
* @see GHCommitStatus#getContext()
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHBranchProtectionBuilder enableProtection() {
return new GHBranchProtectionBuilder(this);
}
@@ -102,16 +108,13 @@ public void enableProtection(EnforcementLevel level, Collection contexts
break;
case NON_ADMINS:
case EVERYONE:
- enableProtection()
- .addRequiredChecks(contexts)
- .includeAdmins(level==EnforcementLevel.EVERYONE)
- .enable();
+ enableProtection().addRequiredChecks(contexts).includeAdmins(level == EnforcementLevel.EVERYONE).enable();
break;
}
}
String getApiRoute() {
- return owner.getApiTailUrl("/branches/"+name);
+ return owner.getApiTailUrl("/branches/" + name);
}
@Override
@@ -120,7 +123,7 @@ public String toString() {
return "Branch:" + name + " in " + url;
}
- /*package*/ GHBranch wrap(GHRepository repo) {
+ GHBranch wrap(GHRepository repo) {
this.owner = repo;
this.root = repo.root;
return this;
diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java
index 8420a531ad..41f5dda107 100644
--- a/src/main/java/org/kohsuke/github/GHBranchProtection.java
+++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java
@@ -8,8 +8,8 @@
import java.io.IOException;
import java.util.Collection;
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "URF_UNREAD_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" }, justification = "JSON API")
public class GHBranchProtection {
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";
@@ -30,16 +30,16 @@ public class GHBranchProtection {
@JsonProperty
private String url;
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public void enabledSignedCommits() throws IOException {
- requester().method("POST")
- .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class);
+ requester().method("POST").to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class);
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public void disableSignedCommits() throws IOException {
- requester().method("DELETE")
- .to(url + REQUIRE_SIGNATURES_URI);
+ requester().method("DELETE").to(url + REQUIRE_SIGNATURES_URI);
}
public EnforceAdmins getEnforceAdmins() {
@@ -50,10 +50,10 @@ public RequiredReviews getRequiredReviews() {
return requiredReviews;
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public boolean getRequiredSignatures() throws IOException {
- return requester().method("GET")
- .to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class).enabled;
+ return requester().method("GET").to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class).enabled;
}
public RequiredStatusChecks getRequiredStatusChecks() {
diff --git a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
index 822541a14d..fd819d59d1 100644
--- a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
@@ -37,7 +37,7 @@ public GHBranchProtectionBuilder addRequiredChecks(Collection checks) {
getStatusChecks().contexts.addAll(checks);
return this;
}
-
+
public GHBranchProtectionBuilder addRequiredChecks(String... checks) {
addRequiredChecks(Arrays.asList(checks));
return this;
@@ -53,13 +53,10 @@ public GHBranchProtectionBuilder dismissStaleReviews(boolean v) {
}
public GHBranchProtection enable() throws IOException {
- return requester().method("PUT")
- .withNullable("required_status_checks", statusChecks)
- .withNullable("required_pull_request_reviews", prReviews)
- .withNullable("restrictions", restrictions)
+ return requester().method("PUT").withNullable("required_status_checks", statusChecks)
+ .withNullable("required_pull_request_reviews", prReviews).withNullable("restrictions", restrictions)
.withNullable("enforce_admins", enforceAdmins)
- .to(branch.getProtectionUrl().toString(), GHBranchProtection.class)
- .wrap(branch);
+ .to(branch.getProtectionUrl().toString(), GHBranchProtection.class).wrap(branch);
}
public GHBranchProtectionBuilder includeAdmins() {
@@ -148,7 +145,7 @@ public GHBranchProtectionBuilder userPushAccess(Collection users) {
}
return this;
}
-
+
public GHBranchProtectionBuilder userPushAccess(GHUser... users) {
for (GHUser user : users) {
getRestrictions().users.add(user.getLogin());
@@ -173,7 +170,7 @@ public GHBranchProtectionBuilder userReviewDismissals(GHUser... users) {
private void addReviewRestriction(String restriction, boolean isTeam) {
restrictReviewDismissals();
Restrictions restrictions = (Restrictions) prReviews.get("dismissal_restrictions");
-
+
if (isTeam) {
restrictions.teams.add(restriction);
} else {
diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java
index 4891065ad5..f8d56d66e9 100644
--- a/src/main/java/org/kohsuke/github/GHCommit.java
+++ b/src/main/java/org/kohsuke/github/GHCommit.java
@@ -18,24 +18,23 @@
* @see GHRepository#getCommit(String)
* @see GHCommitComment#getCommit()
*/
-@SuppressFBWarnings(value = {"NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD"},
- justification = "JSON API")
+@SuppressFBWarnings(value = { "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHCommit {
private GHRepository owner;
-
+
private ShortInfo commit;
/**
* Short summary of this commit.
*/
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD"}, justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
public static class ShortInfo {
private GHAuthor author;
private GHAuthor committer;
-
+
private String message;
-
+
private int comment_count;
static class Tree {
@@ -63,7 +62,7 @@ public Date getCommitDate() {
}
/**
- * Commit message.
+ * @return Commit message.
*/
public String getMessage() {
return message;
@@ -82,89 +81,89 @@ public static class GHAuthor extends GitUser {
}
public static class Stats {
- int total,additions,deletions;
+ int total, additions, deletions;
}
/**
* A file that was modified.
*/
- @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD",
- justification = "It's being initilized by JSON deserialization")
+ @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "It's being initilized by JSON deserialization")
public static class File {
String status;
- int changes,additions,deletions;
+ int changes, additions, deletions;
String raw_url, blob_url, sha, patch;
String filename, previous_filename;
/**
- * Number of lines added + removed.
+ * @return Number of lines added + removed.
*/
public int getLinesChanged() {
return changes;
}
/**
- * Number of lines added.
+ * @return Number of lines added.
*/
public int getLinesAdded() {
return additions;
}
/**
- * Number of lines removed.
+ * @return Number of lines removed.
*/
public int getLinesDeleted() {
return deletions;
}
/**
- * "modified", "added", or "removed"
+ * @return "modified", "added", or "removed"
*/
public String getStatus() {
return status;
}
/**
- * Full path in the repository.
+ * @return Full path in the repository.
*/
- @SuppressFBWarnings(value = "NM_CONFUSING",
- justification = "It's a part of the library's API and cannot be renamed")
+ @SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library's API and cannot be renamed")
public String getFileName() {
return filename;
}
/**
- * Previous path, in case file has moved.
+ * @return Previous path, in case file has moved.
*/
public String getPreviousFilename() {
return previous_filename;
}
/**
- * The actual change.
+ * @return The actual change.
*/
public String getPatch() {
return patch;
}
/**
- * URL like 'https://raw.github.com/jenkinsci/jenkins/4eb17c197dfdcf8ef7ff87eb160f24f6a20b7f0e/core/pom.xml'
- * that resolves to the actual content of the file.
+ * @return URL like
+ * 'https://raw.github.com/jenkinsci/jenkins/4eb17c197dfdcf8ef7ff87eb160f24f6a20b7f0e/core/pom.xml' that
+ * resolves to the actual content of the file.
*/
public URL getRawUrl() {
return GitHub.parseURL(raw_url);
}
/**
- * URL like 'https://github.com/jenkinsci/jenkins/blob/1182e2ebb1734d0653142bd422ad33c21437f7cf/core/pom.xml'
- * that resolves to the HTML page that describes this file.
+ * @return URL like
+ * 'https://github.com/jenkinsci/jenkins/blob/1182e2ebb1734d0653142bd422ad33c21437f7cf/core/pom.xml'
+ * that resolves to the HTML page that describes this file.
*/
public URL getBlobUrl() {
return GitHub.parseURL(blob_url);
}
/**
- * [0-9a-f]{40} SHA1 checksum.
+ * @return [0-9a-f]{40} SHA1 checksum.
*/
public String getSha() {
return sha;
@@ -173,42 +172,43 @@ public String getSha() {
public static class Parent {
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
- String url;
+ String url;
String sha;
}
static class User {
// TODO: what if someone who doesn't have an account on GitHub makes a commit?
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
- String url,avatar_url,gravatar_id;
+ String url, avatar_url, gravatar_id;
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
int id;
-
+
String login;
}
- String url,html_url,sha;
+ String url, html_url, sha;
List files;
Stats stats;
List parents;
- User author,committer;
-
+ User author, committer;
public ShortInfo getCommitShortInfo() throws IOException {
- if (commit==null)
+ if (commit == null)
populate();
return commit;
}
/**
- * The repository that contains the commit.
+ * @return the repository that contains the commit.
*/
public GHRepository getOwner() {
return owner;
}
/**
- * Number of lines added + removed.
+ * @return the number of lines added + removed.
+ * @throws IOException
+ * if the field was not populated and refresh fails
*/
public int getLinesChanged() throws IOException {
populate();
@@ -216,7 +216,9 @@ public int getLinesChanged() throws IOException {
}
/**
- * Number of lines added.
+ * @return Number of lines added.
+ * @throws IOException
+ * if the field was not populated and refresh fails
*/
public int getLinesAdded() throws IOException {
populate();
@@ -224,7 +226,9 @@ public int getLinesAdded() throws IOException {
}
/**
- * Number of lines removed.
+ * @return Number of lines removed.
+ * @throws IOException
+ * if the field was not populated and refresh fails
*/
public int getLinesDeleted() throws IOException {
populate();
@@ -232,21 +236,26 @@ public int getLinesDeleted() throws IOException {
}
/**
- * Use this method to walk the tree
+ * Use this method to walk the tree.
+ *
+ * @return a GHTree to walk
+ * @throws IOException
+ * on error
*/
public GHTree getTree() throws IOException {
return owner.getTree(getCommitShortInfo().tree.sha);
}
/**
- * URL of this commit like "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
+ * @return URL of this commit like
+ * "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
}
/**
- * [0-9a-f]{40} SHA1 checksum.
+ * @return [0-9a-f]{40} SHA1 checksum.
*/
public String getSHA1() {
return sha;
@@ -255,19 +264,21 @@ public String getSHA1() {
/**
* List of files changed/added/removed in this commit.
*
- * @return
- * Can be empty but never null.
+ * @return Can be empty but never null.
+ * @throws IOException
+ * on error
*/
public List getFiles() throws IOException {
populate();
- return files!=null ? Collections.unmodifiableList(files) : Collections.emptyList();
+ return files != null ? Collections.unmodifiableList(files) : Collections. emptyList();
}
/**
- * Returns the SHA1 of parent commit objects.
+ * @return SHA1 of parent commit objects.
*/
public List getParentSHA1s() {
- if (parents==null) return Collections.emptyList();
+ if (parents == null)
+ return Collections.emptyList();
return new AbstractList() {
@Override
public String get(int index) {
@@ -283,6 +294,10 @@ public int size() {
/**
* Resolves the parent commit objects and return them.
+ *
+ * @return parent commit objects
+ * @throws IOException
+ * on error
*/
public List getParents() throws IOException {
List r = new ArrayList();
@@ -297,8 +312,10 @@ public GHUser getAuthor() throws IOException {
/**
* Gets the date the change was authored on.
+ *
* @return the date the change was authored on.
- * @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
+ * @throws IOException
+ * if the information was not already fetched and an attempt at fetching the information failed.
*/
public Date getAuthoredDate() throws IOException {
return getCommitShortInfo().getAuthoredDate();
@@ -312,40 +329,51 @@ public GHUser getCommitter() throws IOException {
* Gets the date the change was committed on.
*
* @return the date the change was committed on.
- * @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
+ * @throws IOException
+ * if the information was not already fetched and an attempt at fetching the information failed.
*/
public Date getCommitDate() throws IOException {
return getCommitShortInfo().getCommitDate();
}
private GHUser resolveUser(User author) throws IOException {
- if (author==null || author.login==null) return null;
+ if (author == null || author.login == null)
+ return null;
return owner.root.getUser(author.login);
}
/**
- * Lists up all the commit comments in this repository.
+ * @return {@link PagedIterable} with all the commit comments in this repository.
*/
public PagedIterable listComments() {
- return owner.root.retrieve()
- .asPagedIterable(
+ return owner.root.retrieve().asPagedIterable(
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
- GHCommitComment[].class,
- item -> item.wrap(owner) );
+ GHCommitComment[].class, item -> item.wrap(owner));
}
/**
* Creates a commit comment.
*
* I'm not sure how path/line/position parameters interact with each other.
+ *
+ * @param body
+ * body of the comment
+ * @param path
+ * path of file being commented on
+ * @param line
+ * target line for comment
+ * @param position
+ * position on line
+ *
+ * @return created GHCommitComment
+ * @throws IOException
+ * if comment is not created
*/
public GHCommitComment createComment(String body, String path, Integer line, Integer position) throws IOException {
- GHCommitComment r = new Requester(owner.root)
- .with("body",body)
- .with("path",path)
- .with("line",line)
- .with("position",position)
- .to(String.format("/repos/%s/%s/commits/%s/comments",owner.getOwnerName(),owner.getName(),sha),GHCommitComment.class);
+ GHCommitComment r = new Requester(owner.root).with("body", body).with("path", path).with("line", line)
+ .with("position", position)
+ .to(String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
+ GHCommitComment.class);
return r.wrap(owner);
}
@@ -354,14 +382,18 @@ public GHCommitComment createComment(String body) throws IOException {
}
/**
- * Gets the status of this commit, newer ones first.
+ * @return status of this commit, newer ones first.
+ * @throws IOException
+ * if statuses cannot be read
*/
public PagedIterable listStatuses() throws IOException {
return owner.listCommitStatuses(sha);
}
/**
- * Gets the last status of this commit, which is what gets shown in the UI.
+ * @return the last status of this commit, which is what gets shown in the UI.
+ * @throws IOException
+ * on error
*/
public GHCommitStatus getLastStatus() throws IOException {
return owner.getLastCommitStatus(sha);
@@ -369,9 +401,12 @@ public GHCommitStatus getLastStatus() throws IOException {
/**
* Some of the fields are not always filled in when this object is retrieved as a part of another API call.
+ *
+ * @throws IOException
+ * on error
*/
void populate() throws IOException {
- if (files==null && stats==null)
+ if (files == null && stats == null)
owner.root.retrieve().to(owner.getApiTailUrl("commits/" + sha), this);
}
diff --git a/src/main/java/org/kohsuke/github/GHCommitBuilder.java b/src/main/java/org/kohsuke/github/GHCommitBuilder.java
index 76e846a7d7..01a35fa16a 100644
--- a/src/main/java/org/kohsuke/github/GHCommitBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHCommitBuilder.java
@@ -9,8 +9,7 @@
import java.util.TimeZone;
/**
- * Builder pattern for creating a new commit.
- * Based on https://developer.github.com/v3/git/commits/#create-a-commit
+ * Builder pattern for creating a new commit. Based on https://developer.github.com/v3/git/commits/#create-a-commit
*/
public class GHCommitBuilder {
private final GHRepository repo;
@@ -39,7 +38,8 @@ private UserInfo(String name, String email, Date date) {
}
/**
- * @param message the commit message
+ * @param message
+ * the commit message
*/
public GHCommitBuilder message(String message) {
req.with("message", message);
@@ -47,7 +47,8 @@ public GHCommitBuilder message(String message) {
}
/**
- * @param tree the SHA of the tree object this commit points to
+ * @param tree
+ * the SHA of the tree object this commit points to
*/
public GHCommitBuilder tree(String tree) {
req.with("tree", tree);
@@ -55,7 +56,8 @@ public GHCommitBuilder tree(String tree) {
}
/**
- * @param parent the SHA of a parent commit.
+ * @param parent
+ * the SHA of a parent commit.
*/
public GHCommitBuilder parent(String parent) {
parents.add(parent);
diff --git a/src/main/java/org/kohsuke/github/GHCommitComment.java b/src/main/java/org/kohsuke/github/GHCommitComment.java
index a0047c3d15..56eb9a93b1 100644
--- a/src/main/java/org/kohsuke/github/GHCommitComment.java
+++ b/src/main/java/org/kohsuke/github/GHCommitComment.java
@@ -15,22 +15,23 @@
* @see GHCommit#listComments()
* @see GHCommit#createComment(String, String, Integer, Integer)
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHCommitComment extends GHObject implements Reactable {
private GHRepository owner;
String body, html_url, commit_id;
Integer line;
String path;
- GHUser user; // not fully populated. beware.
+ GHUser user; // not fully populated. beware.
public GHRepository getOwner() {
return owner;
}
/**
- * URL like 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
+ * URL like
+ * 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
* show this commit comment in a browser.
*/
public URL getHtmlUrl() {
@@ -49,19 +50,19 @@ public String getBody() {
}
/**
- * A commit comment can be on a specific line of a specific file, if so, this field points to a file.
- * Otherwise null.
+ * A commit comment can be on a specific line of a specific file, if so, this field points to a file. Otherwise
+ * null.
*/
public String getPath() {
return path;
}
/**
- * A commit comment can be on a specific line of a specific file, if so, this field points to the line number in the file.
- * Otherwise -1.
+ * A commit comment can be on a specific line of a specific file, if so, this field points to the line number in the
+ * file. Otherwise -1.
*/
public int getLine() {
- return line!=null ? line : -1;
+ return line != null ? line : -1;
}
/**
@@ -82,27 +83,22 @@ public GHCommit getCommit() throws IOException {
* Updates the body of the commit message.
*/
public void update(String body) throws IOException {
- new Requester(owner.root)
- .with("body", body)
- .method("PATCH").to(getApiTail(), GHCommitComment.class);
+ new Requester(owner.root).with("body", body).method("PATCH").to(getApiTail(), GHCommitComment.class);
this.body = body;
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root)
- .withPreview(SQUIRREL_GIRL)
- .with("content", content.getContent())
- .to(getApiTail()+"/reactions", GHReaction.class).wrap(owner.root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
+ .to(getApiTail() + "/reactions", GHReaction.class).wrap(owner.root);
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve().withPreview(SQUIRREL_GIRL)
- .asPagedIterable(
- getApiTail()+"/reactions",
- GHReaction[].class,
- item -> item.wrap(owner.root) );
+ return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiTail() + "/reactions",
+ GHReaction[].class, item -> item.wrap(owner.root));
}
/**
@@ -113,10 +109,9 @@ public void delete() throws IOException {
}
private String getApiTail() {
- return String.format("/repos/%s/%s/comments/%s",owner.getOwnerName(),owner.getName(),id);
+ return String.format("/repos/%s/%s/comments/%s", owner.getOwnerName(), owner.getName(), id);
}
-
GHCommitComment wrap(GHRepository owner) {
this.owner = owner;
if (owner.root.isOffline()) {
diff --git a/src/main/java/org/kohsuke/github/GHCommitPointer.java b/src/main/java/org/kohsuke/github/GHCommitPointer.java
index b6c347864e..3f0fb3cc3d 100644
--- a/src/main/java/org/kohsuke/github/GHCommitPointer.java
+++ b/src/main/java/org/kohsuke/github/GHCommitPointer.java
@@ -36,11 +36,11 @@ public class GHCommitPointer {
private GHRepository repo;
/**
- * This points to the user who owns
- * the {@link #getRepository()}.
+ * This points to the user who owns the {@link #getRepository()}.
*/
public GHUser getUser() throws IOException {
- if (user != null) return user.root.intern(user);
+ if (user != null)
+ return user.root.intern(user);
return user;
}
@@ -80,7 +80,9 @@ public GHCommit getCommit() throws IOException {
}
void wrapUp(GitHub root) {
- if (user!=null) user.root = root;
- if (repo!=null) repo.wrap(root);
+ if (user != null)
+ user.root = root;
+ if (repo != null)
+ repo.wrap(root);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHCommitQueryBuilder.java b/src/main/java/org/kohsuke/github/GHCommitQueryBuilder.java
index 64b3a0e935..32d1d964a8 100644
--- a/src/main/java/org/kohsuke/github/GHCommitQueryBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHCommitQueryBuilder.java
@@ -17,21 +17,21 @@
*
* @author Kohsuke Kawaguchi
* @see GHRepository#queryCommits()
-*/
+ */
public class GHCommitQueryBuilder {
private final Requester req;
private final GHRepository repo;
- /*package*/ GHCommitQueryBuilder(GHRepository repo) {
+ GHCommitQueryBuilder(GHRepository repo) {
this.repo = repo;
- this.req = repo.root.retrieve(); // requester to build up
+ this.req = repo.root.retrieve(); // requester to build up
}
/**
* GItHub login or email address by which to filter by commit author.
*/
public GHCommitQueryBuilder author(String author) {
- req.with("author",author);
+ req.with("author", author);
return this;
}
@@ -39,7 +39,7 @@ public GHCommitQueryBuilder author(String author) {
* Only commits containing this file path will be returned.
*/
public GHCommitQueryBuilder path(String path) {
- req.with("path",path);
+ req.with("path", path);
return this;
}
@@ -48,12 +48,12 @@ public GHCommitQueryBuilder path(String path) {
*
*/
public GHCommitQueryBuilder from(String ref) {
- req.with("sha",ref);
+ req.with("sha", ref);
return this;
}
public GHCommitQueryBuilder pageSize(int pageSize) {
- req.with("per_page",pageSize);
+ req.with("per_page", pageSize);
return this;
}
@@ -61,7 +61,7 @@ public GHCommitQueryBuilder pageSize(int pageSize) {
* Only commits after this date will be returned
*/
public GHCommitQueryBuilder since(Date dt) {
- req.with("since",GitHub.printDate(dt));
+ req.with("since", GitHub.printDate(dt));
return this;
}
@@ -76,7 +76,7 @@ public GHCommitQueryBuilder since(long timestamp) {
* Only commits before this date will be returned
*/
public GHCommitQueryBuilder until(Date dt) {
- req.with("until",GitHub.printDate(dt));
+ req.with("until", GitHub.printDate(dt));
return this;
}
@@ -91,10 +91,6 @@ public GHCommitQueryBuilder until(long timestamp) {
* Lists up the commits with the criteria built so far.
*/
public PagedIterable list() {
- return req
- .asPagedIterable(
- repo.getApiTailUrl("commits"),
- GHCommit[].class,
- item -> item.wrapUp(repo) );
+ return req.asPagedIterable(repo.getApiTailUrl("commits"), GHCommit[].class, item -> item.wrapUp(repo));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHCommitSearchBuilder.java b/src/main/java/org/kohsuke/github/GHCommitSearchBuilder.java
index 3d29aa80fd..5d75afbb3c 100644
--- a/src/main/java/org/kohsuke/github/GHCommitSearchBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHCommitSearchBuilder.java
@@ -10,10 +10,11 @@
* @author Marc de Verdelhan
* @see GitHub#searchCommits()
*/
-@Preview @Deprecated
+@Preview
+@Deprecated
public class GHCommitSearchBuilder extends GHSearchBuilder {
- /*package*/ GHCommitSearchBuilder(GitHub root) {
- super(root,CommitSearchResult.class);
+ GHCommitSearchBuilder(GitHub root) {
+ super(root, CommitSearchResult.class);
req.withPreview(Previews.CLOAK);
}
@@ -26,99 +27,103 @@ public GHCommitSearchBuilder q(String term) {
}
public GHCommitSearchBuilder author(String v) {
- return q("author:"+v);
+ return q("author:" + v);
}
public GHCommitSearchBuilder committer(String v) {
- return q("committer:"+v);
+ return q("committer:" + v);
}
public GHCommitSearchBuilder authorName(String v) {
- return q("author-name:"+v);
+ return q("author-name:" + v);
}
public GHCommitSearchBuilder committerName(String v) {
- return q("committer-name:"+v);
+ return q("committer-name:" + v);
}
public GHCommitSearchBuilder authorEmail(String v) {
- return q("author-email:"+v);
+ return q("author-email:" + v);
}
public GHCommitSearchBuilder committerEmail(String v) {
- return q("committer-email:"+v);
+ return q("committer-email:" + v);
}
public GHCommitSearchBuilder authorDate(String v) {
- return q("author-date:"+v);
+ return q("author-date:" + v);
}
public GHCommitSearchBuilder committerDate(String v) {
- return q("committer-date:"+v);
+ return q("committer-date:" + v);
}
public GHCommitSearchBuilder merge(boolean merge) {
- return q("merge:"+Boolean.valueOf(merge).toString().toLowerCase());
+ return q("merge:" + Boolean.valueOf(merge).toString().toLowerCase());
}
public GHCommitSearchBuilder hash(String v) {
- return q("hash:"+v);
+ return q("hash:" + v);
}
public GHCommitSearchBuilder parent(String v) {
- return q("parent:"+v);
+ return q("parent:" + v);
}
public GHCommitSearchBuilder tree(String v) {
- return q("tree:"+v);
+ return q("tree:" + v);
}
public GHCommitSearchBuilder is(String v) {
- return q("is:"+v);
+ return q("is:" + v);
}
public GHCommitSearchBuilder user(String v) {
- return q("user:"+v);
+ return q("user:" + v);
}
public GHCommitSearchBuilder org(String v) {
- return q("org:"+v);
+ return q("org:" + v);
}
public GHCommitSearchBuilder repo(String v) {
- return q("repo:"+v);
+ return q("repo:" + v);
}
public GHCommitSearchBuilder order(GHDirection v) {
- req.with("order",v);
+ req.with("order", v);
return this;
}
public GHCommitSearchBuilder sort(Sort sort) {
- req.with("sort",sort);
+ req.with("sort", sort);
return this;
}
- public enum Sort { AUTHOR_DATE, COMMITTER_DATE }
+ public enum Sort {
+ AUTHOR_DATE, COMMITTER_DATE
+ }
private static class CommitSearchResult extends SearchResult {
private GHCommit[] items;
@Override
- /*package*/ GHCommit[] getItems(GitHub root) {
+ GHCommit[] getItems(GitHub root) {
for (GHCommit commit : items) {
String repoName = getRepoName(commit.url);
try {
GHRepository repo = root.getRepository(repoName);
commit.wrapUp(repo);
- } catch (IOException ioe) {}
+ } catch (IOException ioe) {
+ }
}
return items;
}
}
-
+
/**
- * @param commitUrl a commit URL
+ * @param commitUrl
+ * a commit URL
* @return the repo name ("username/reponame")
*/
private static String getRepoName(String commitUrl) {
diff --git a/src/main/java/org/kohsuke/github/GHCommitStatus.java b/src/main/java/org/kohsuke/github/GHCommitStatus.java
index 63a62ae8d0..148a2a17bc 100644
--- a/src/main/java/org/kohsuke/github/GHCommitStatus.java
+++ b/src/main/java/org/kohsuke/github/GHCommitStatus.java
@@ -13,14 +13,15 @@
*/
public class GHCommitStatus extends GHObject {
String state;
- String target_url,description;
+ String target_url, description;
String context;
GHUser creator;
private GitHub root;
- /*package*/ GHCommitStatus wrapUp(GitHub root) {
- if (creator!=null) creator.wrapUp(root);
+ GHCommitStatus wrapUp(GitHub root) {
+ if (creator != null)
+ creator.wrapUp(root);
this.root = root;
return this;
}
@@ -30,7 +31,7 @@ public GHCommitState getState() {
if (s.name().equalsIgnoreCase(state))
return s;
}
- throw new IllegalStateException("Unexpected state: "+state);
+ throw new IllegalStateException("Unexpected state: " + state);
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHCompare.java b/src/main/java/org/kohsuke/github/GHCompare.java
index 100753db01..bfcc9423e7 100644
--- a/src/main/java/org/kohsuke/github/GHCompare.java
+++ b/src/main/java/org/kohsuke/github/GHCompare.java
@@ -67,6 +67,7 @@ public Commit getMergeBaseCommit() {
/**
* Gets an array of commits.
+ *
* @return A copy of the array being stored in the class.
*/
public Commit[] getCommits() {
@@ -74,9 +75,10 @@ public Commit[] getCommits() {
System.arraycopy(commits, 0, newValue, 0, commits.length);
return newValue;
}
-
+
/**
* Gets an array of commits.
+ *
* @return A copy of the array being stored in the class.
*/
public GHCommit.File[] getFiles() {
@@ -96,11 +98,11 @@ public GHCompare wrap(GHRepository owner) {
}
/**
- * Compare commits had a child commit element with additional details we want to capture.
- * This extenstion of GHCommit provides that.
+ * Compare commits had a child commit element with additional details we want to capture. This extenstion of
+ * GHCommit provides that.
*/
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD"},
- justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
+ "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
public static class Commit extends GHCommit {
private InnerCommit commit;
@@ -110,7 +112,6 @@ public InnerCommit getCommit() {
}
}
-
public static class InnerCommit {
private String url, sha, message;
private User author, committer;
@@ -128,12 +129,12 @@ public String getMessage() {
return message;
}
- @WithBridgeMethods(value=User.class,castRequired=true)
+ @WithBridgeMethods(value = User.class, castRequired = true)
public GitUser getAuthor() {
return author;
}
- @WithBridgeMethods(value=User.class,castRequired=true)
+ @WithBridgeMethods(value = User.class, castRequired = true)
public GitUser getCommitter() {
return committer;
}
diff --git a/src/main/java/org/kohsuke/github/GHContent.java b/src/main/java/org/kohsuke/github/GHContent.java
index 9b9f787a67..2be7016fd3 100644
--- a/src/main/java/org/kohsuke/github/GHContent.java
+++ b/src/main/java/org/kohsuke/github/GHContent.java
@@ -15,11 +15,11 @@
* @author Alexandre COLLIGNON
* @see GHRepository#getFileContent(String)
*/
-@SuppressWarnings({"UnusedDeclaration"})
+@SuppressWarnings({ "UnusedDeclaration" })
public class GHContent implements Refreshable {
/*
- In normal use of this class, repository field is set via wrap(),
- but in the code search API, there's a nested 'repository' field that gets populated from JSON.
+ * In normal use of this class, repository field is set via wrap(), but in the code search API, there's a nested
+ * 'repository' field that gets populated from JSON.
*/
private GHRepository repository;
@@ -33,8 +33,8 @@ In normal use of this class, repository field is set via wrap(),
private String path;
private String content;
private String url; // this is the API url
- private String git_url; // this is the Blob url
- private String html_url; // this is the UI
+ private String git_url; // this is the Blob url
+ private String html_url; // this is the UI
private String download_url;
public GHRepository getOwner() {
@@ -69,12 +69,10 @@ public String getPath() {
* Retrieve the decoded content that is stored at this location.
*
*
- * Due to the nature of GitHub's API, you're not guaranteed that
- * the content will already be populated, so this may trigger
- * network activity, and can throw an IOException.
+ * Due to the nature of GitHub's API, you're not guaranteed that the content will already be populated, so this may
+ * trigger network activity, and can throw an IOException.
*
- * @deprecated
- * Use {@link #read()}
+ * @deprecated Use {@link #read()}
*/
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
public String getContent() throws IOException {
@@ -85,12 +83,10 @@ public String getContent() throws IOException {
* Retrieve the base64-encoded content that is stored at this location.
*
*
- * Due to the nature of GitHub's API, you're not guaranteed that
- * the content will already be populated, so this may trigger
- * network activity, and can throw an IOException.
+ * Due to the nature of GitHub's API, you're not guaranteed that the content will already be populated, so this may
+ * trigger network activity, and can throw an IOException.
*
- * @deprecated
- * Use {@link #read()}
+ * @deprecated Use {@link #read()}
*/
public String getEncodedContent() throws IOException {
refresh(content);
@@ -121,11 +117,11 @@ public InputStream read() throws IOException {
try {
return new Base64InputStream(new ByteArrayInputStream(content.getBytes("US-ASCII")), false);
} catch (UnsupportedEncodingException e) {
- throw new AssertionError(e); // US-ASCII is mandatory
+ throw new AssertionError(e); // US-ASCII is mandatory
}
}
- throw new UnsupportedOperationException("Unrecognized encoding: "+encoding);
+ throw new UnsupportedOperationException("Unrecognized encoding: " + encoding);
}
/**
@@ -158,13 +154,9 @@ protected synchronized void populate() throws IOException {
*/
public PagedIterable listDirectoryContent() throws IOException {
if (!isDirectory())
- throw new IllegalStateException(path+" is not a directory");
+ throw new IllegalStateException(path + " is not a directory");
- return root.retrieve()
- .asPagedIterable(
- url,
- GHContent[].class,
- item -> item.wrap(repository) );
+ return root.retrieve().asPagedIterable(url, GHContent[].class, item -> item.wrap(repository));
}
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
@@ -181,15 +173,12 @@ public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessa
return update(newContentBytes, commitMessage, null);
}
- public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch) throws IOException {
+ public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch)
+ throws IOException {
String encodedContent = Base64.encodeBase64String(newContentBytes);
- Requester requester = new Requester(root)
- .with("path", path)
- .with("message", commitMessage)
- .with("sha", sha)
- .with("content", encodedContent)
- .method("PUT");
+ Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
+ .with("content", encodedContent).method("PUT");
if (branch != null) {
requester.with("branch", branch);
@@ -209,11 +198,8 @@ public GHContentUpdateResponse delete(String message) throws IOException {
}
public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException {
- Requester requester = new Requester(root)
- .with("path", path)
- .with("message", commitMessage)
- .with("sha", sha)
- .method("DELETE");
+ Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
+ .method("DELETE");
if (branch != null) {
requester.with("branch", branch);
@@ -234,14 +220,14 @@ GHContent wrap(GHRepository owner) {
this.root = owner.root;
return this;
}
+
GHContent wrap(GitHub root) {
this.root = root;
- if (repository!=null)
+ if (repository != null)
repository.wrap(root);
return this;
}
-
public static GHContent[] wrap(GHContent[] contents, GHRepository repository) {
for (GHContent unwrappedContent : contents) {
unwrappedContent.wrap(repository);
diff --git a/src/main/java/org/kohsuke/github/GHContentBuilder.java b/src/main/java/org/kohsuke/github/GHContentBuilder.java
index cdc019f6d1..d31a73d831 100644
--- a/src/main/java/org/kohsuke/github/GHContentBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHContentBuilder.java
@@ -26,7 +26,7 @@ public final class GHContentBuilder {
public GHContentBuilder path(String path) {
this.path = path;
- req.with("path",path);
+ req.with("path", path);
return this;
}
@@ -36,8 +36,7 @@ public GHContentBuilder branch(String branch) {
}
/**
- * Used when updating (but not creating a new content) to specify
- * Thetblob SHA of the file being replaced.
+ * Used when updating (but not creating a new content) to specify Thetblob SHA of the file being replaced.
*/
public GHContentBuilder sha(String sha) {
req.with("sha", sha);
@@ -66,7 +65,8 @@ public GHContentBuilder message(String commitMessage) {
* Commits a new content.
*/
public GHContentUpdateResponse commit() throws IOException {
- GHContentUpdateResponse response = req.to(repo.getApiTailUrl("contents/" + path), GHContentUpdateResponse.class);
+ GHContentUpdateResponse response = req.to(repo.getApiTailUrl("contents/" + path),
+ GHContentUpdateResponse.class);
response.getContent().wrap(repo);
response.getCommit().wrapUp(repo);
diff --git a/src/main/java/org/kohsuke/github/GHContentSearchBuilder.java b/src/main/java/org/kohsuke/github/GHContentSearchBuilder.java
index 47e5a46f52..f7438d2bbf 100644
--- a/src/main/java/org/kohsuke/github/GHContentSearchBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHContentSearchBuilder.java
@@ -7,8 +7,8 @@
* @see GitHub#searchContent()
*/
public class GHContentSearchBuilder extends GHSearchBuilder {
- /*package*/ GHContentSearchBuilder(GitHub root) {
- super(root,ContentSearchResult.class);
+ GHContentSearchBuilder(GitHub root) {
+ super(root, ContentSearchResult.class);
}
/**
@@ -20,47 +20,46 @@ public GHContentSearchBuilder q(String term) {
}
public GHContentSearchBuilder in(String v) {
- return q("in:"+v);
+ return q("in:" + v);
}
public GHContentSearchBuilder language(String v) {
- return q("language:"+v);
+ return q("language:" + v);
}
public GHContentSearchBuilder fork(String v) {
- return q("fork:"+v);
+ return q("fork:" + v);
}
public GHContentSearchBuilder size(String v) {
- return q("size:"+v);
+ return q("size:" + v);
}
public GHContentSearchBuilder path(String v) {
- return q("path:"+v);
+ return q("path:" + v);
}
public GHContentSearchBuilder filename(String v) {
- return q("filename:"+v);
+ return q("filename:" + v);
}
public GHContentSearchBuilder extension(String v) {
- return q("extension:"+v);
+ return q("extension:" + v);
}
public GHContentSearchBuilder user(String v) {
- return q("user:"+v);
+ return q("user:" + v);
}
-
public GHContentSearchBuilder repo(String v) {
- return q("repo:"+v);
+ return q("repo:" + v);
}
private static class ContentSearchResult extends SearchResult {
private GHContent[] items;
@Override
- /*package*/ GHContent[] getItems(GitHub root) {
+ GHContent[] getItems(GitHub root) {
for (GHContent item : items)
item.wrap(root);
return items;
diff --git a/src/main/java/org/kohsuke/github/GHContentUpdateResponse.java b/src/main/java/org/kohsuke/github/GHContentUpdateResponse.java
index 07f10d710c..cd66091e6b 100644
--- a/src/main/java/org/kohsuke/github/GHContentUpdateResponse.java
+++ b/src/main/java/org/kohsuke/github/GHContentUpdateResponse.java
@@ -1,9 +1,8 @@
package org.kohsuke.github;
/**
- * The response that is returned when updating
- * repository content.
-**/
+ * The response that is returned when updating repository content.
+ **/
public class GHContentUpdateResponse {
private GHContent content;
private GHCommit commit;
diff --git a/src/main/java/org/kohsuke/github/GHContentWithLicense.java b/src/main/java/org/kohsuke/github/GHContentWithLicense.java
index c067d5a037..c5e6e37753 100644
--- a/src/main/java/org/kohsuke/github/GHContentWithLicense.java
+++ b/src/main/java/org/kohsuke/github/GHContentWithLicense.java
@@ -13,7 +13,7 @@ class GHContentWithLicense extends GHContent {
@Override
GHContentWithLicense wrap(GHRepository owner) {
super.wrap(owner);
- if (license!=null)
+ if (license != null)
license.wrap(owner.root);
return this;
}
diff --git a/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java b/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java
index a11fc4493f..8c33e9efbe 100644
--- a/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java
@@ -13,123 +13,193 @@ public class GHCreateRepositoryBuilder {
protected final Requester builder;
private final String apiUrlTail;
- /*package*/ GHCreateRepositoryBuilder(GitHub root, String apiUrlTail, String name) {
+ GHCreateRepositoryBuilder(GitHub root, String apiUrlTail, String name) {
this.root = root;
this.apiUrlTail = apiUrlTail;
this.builder = new Requester(root);
- this.builder.with("name",name);
+ this.builder.with("name", name);
}
+ /**
+ * Description for repository
+ *
+ * @param description
+ * description of repository
+ *
+ * @return a builder to continue with building
+ */
public GHCreateRepositoryBuilder description(String description) {
- this.builder.with("description",description);
+ this.builder.with("description", description);
return this;
}
+ /**
+ * Homepage for repository
+ *
+ * @param homepage
+ * homepage of repository
+ *
+ * @return a builder to continue with building
+ */
public GHCreateRepositoryBuilder homepage(URL homepage) {
return homepage(homepage.toExternalForm());
}
+ /**
+ * Homepage for repository
+ *
+ * @param homepage
+ * homepage of repository
+ *
+ * @return a builder to continue with building
+ */
public GHCreateRepositoryBuilder homepage(String homepage) {
- this.builder.with("homepage",homepage);
+ this.builder.with("homepage", homepage);
return this;
}
/**
* Creates a private repository
+ *
+ * @param enabled
+ * private if true
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder private_(boolean b) {
- this.builder.with("private",b);
+ public GHCreateRepositoryBuilder private_(boolean enabled) {
+ this.builder.with("private", enabled);
return this;
}
/**
* Enables issue tracker
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder issues(boolean b) {
- this.builder.with("has_issues",b);
+ public GHCreateRepositoryBuilder issues(boolean enabled) {
+ this.builder.with("has_issues", enabled);
return this;
}
/**
* Enables wiki
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder wiki(boolean b) {
- this.builder.with("has_wiki",b);
+ public GHCreateRepositoryBuilder wiki(boolean enabled) {
+ this.builder.with("has_wiki", enabled);
return this;
}
/**
* Enables downloads
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder downloads(boolean b) {
- this.builder.with("has_downloads",b);
+ public GHCreateRepositoryBuilder downloads(boolean enabled) {
+ this.builder.with("has_downloads", enabled);
return this;
}
/**
* If true, create an initial commit with empty README.
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder autoInit(boolean b) {
- this.builder.with("auto_init",b);
+ public GHCreateRepositoryBuilder autoInit(boolean enabled) {
+ this.builder.with("auto_init", enabled);
return this;
}
/**
* Allow or disallow squash-merging pull requests.
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder allowSquashMerge(boolean b) {
- this.builder.with("allow_squash_merge",b);
+ public GHCreateRepositoryBuilder allowSquashMerge(boolean enabled) {
+ this.builder.with("allow_squash_merge", enabled);
return this;
}
/**
* Allow or disallow merging pull requests with a merge commit.
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder allowMergeCommit(boolean b) {
- this.builder.with("allow_merge_commit",b);
+ public GHCreateRepositoryBuilder allowMergeCommit(boolean enabled) {
+ this.builder.with("allow_merge_commit", enabled);
return this;
}
/**
* Allow or disallow rebase-merging pull requests.
+ *
+ * @param enabled
+ * true if enabled
+ * @return a builder to continue with building
*/
- public GHCreateRepositoryBuilder allowRebaseMerge(boolean b) {
- this.builder.with("allow_rebase_merge",b);
+ public GHCreateRepositoryBuilder allowRebaseMerge(boolean enabled) {
+ this.builder.with("allow_rebase_merge", enabled);
return this;
}
/**
* Creates a default .gitignore
+ *
+ * @param language
+ * template to base the ignore file on
+ * @return a builder to continue with building
*
- * See https://developer.github.com/v3/repos/#create
+ * See https://developer.github.com/v3/repos/#create
*/
public GHCreateRepositoryBuilder gitignoreTemplate(String language) {
- this.builder.with("gitignore_template",language);
+ this.builder.with("gitignore_template", language);
return this;
}
/**
* Desired license template to apply
+ *
+ * @param license
+ * template to base the license file on
+ * @return a builder to continue with building
*
- * See https://developer.github.com/v3/repos/#create
+ * See https://developer.github.com/v3/repos/#create
*/
public GHCreateRepositoryBuilder licenseTemplate(String license) {
- this.builder.with("license_template",license);
+ this.builder.with("license_template", license);
return this;
}
/**
- * The team that gets granted access to this repository. Only valid for creating a repository in
- * an organization.
+ * The team that gets granted access to this repository. Only valid for creating a repository in an organization.
+ *
+ * @param team
+ * team to grant access to
+ * @return a builder to continue with building
*/
public GHCreateRepositoryBuilder team(GHTeam team) {
- if (team!=null)
- this.builder.with("team_id",team.getId());
+ if (team != null)
+ this.builder.with("team_id", team.getId());
return this;
}
/**
* Creates a repository with all the parameters.
+ *
+ * @throws IOException
+ * if repsitory cannot be created
*/
public GHRepository create() throws IOException {
return builder.method("POST").to(apiUrlTail, GHRepository.class).wrap(root);
diff --git a/src/main/java/org/kohsuke/github/GHDeployKey.java b/src/main/java/org/kohsuke/github/GHDeployKey.java
index f5d0f9de6d..4b74875604 100644
--- a/src/main/java/org/kohsuke/github/GHDeployKey.java
+++ b/src/main/java/org/kohsuke/github/GHDeployKey.java
@@ -37,10 +37,11 @@ public GHDeployKey wrap(GHRepository repo) {
}
public String toString() {
- return new ToStringBuilder(this).append("title",title).append("id",id).append("key",key).toString();
+ return new ToStringBuilder(this).append("title", title).append("id", id).append("key", key).toString();
}
-
+
public void delete() throws IOException {
- new Requester(owner.root).method("DELETE").to(String.format("/repos/%s/%s/keys/%d", owner.getOwnerName(), owner.getName(), id));
+ new Requester(owner.root).method("DELETE")
+ .to(String.format("/repos/%s/%s/keys/%d", owner.getOwnerName(), owner.getName(), id));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHDeployment.java b/src/main/java/org/kohsuke/github/GHDeployment.java
index 7a7febf6ce..ddff6158d6 100644
--- a/src/main/java/org/kohsuke/github/GHDeployment.java
+++ b/src/main/java/org/kohsuke/github/GHDeployment.java
@@ -23,11 +23,11 @@ public class GHDeployment extends GHObject {
protected String repository_url;
protected GHUser creator;
-
GHDeployment wrap(GHRepository owner) {
this.owner = owner;
this.root = owner.root;
- if(creator != null) creator.wrapUp(root);
+ if (creator != null)
+ creator.wrapUp(root);
return this;
}
@@ -42,19 +42,24 @@ public URL getRepositoryUrl() {
public String getTask() {
return task;
}
+
public String getPayload() {
return (String) payload;
}
+
public String getEnvironment() {
return environment;
}
+
public GHUser getCreator() throws IOException {
return root.intern(creator);
}
+
public String getRef() {
return ref;
}
- public String getSha(){
+
+ public String getSha() {
return sha;
}
@@ -67,15 +72,11 @@ public URL getHtmlUrl() {
}
public GHDeploymentStatusBuilder createStatus(GHDeploymentState state) {
- return new GHDeploymentStatusBuilder(owner,id,state);
+ return new GHDeploymentStatusBuilder(owner, id, state);
}
public PagedIterable listStatuses() {
- return root.retrieve()
- .asPagedIterable(
- statuses_url,
- GHDeploymentStatus[].class,
- item -> item.wrap(owner) );
+ return root.retrieve().asPagedIterable(statuses_url, GHDeploymentStatus[].class, item -> item.wrap(owner));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHDeploymentBuilder.java b/src/main/java/org/kohsuke/github/GHDeploymentBuilder.java
index 00d10fad1b..ed13e14241 100644
--- a/src/main/java/org/kohsuke/github/GHDeploymentBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHDeploymentBuilder.java
@@ -19,37 +19,41 @@ public GHDeploymentBuilder(GHRepository repo, String ref) {
}
public GHDeploymentBuilder ref(String branch) {
- builder.with("ref",branch);
+ builder.with("ref", branch);
return this;
}
+
public GHDeploymentBuilder task(String task) {
- builder.with("task",task);
+ builder.with("task", task);
return this;
}
+
public GHDeploymentBuilder autoMerge(boolean autoMerge) {
- builder.with("auto_merge",autoMerge);
+ builder.with("auto_merge", autoMerge);
return this;
}
public GHDeploymentBuilder requiredContexts(List requiredContexts) {
- builder.with("required_contexts",requiredContexts);
+ builder.with("required_contexts", requiredContexts);
return this;
}
+
public GHDeploymentBuilder payload(String payload) {
- builder.with("payload",payload);
+ builder.with("payload", payload);
return this;
}
public GHDeploymentBuilder environment(String environment) {
- builder.with("environment",environment);
+ builder.with("environment", environment);
return this;
}
+
public GHDeploymentBuilder description(String description) {
- builder.with("description",description);
+ builder.with("description", description);
return this;
}
public GHDeployment create() throws IOException {
- return builder.to(repo.getApiTailUrl("deployments"),GHDeployment.class).wrap(repo);
+ return builder.to(repo.getApiTailUrl("deployments"), GHDeployment.class).wrap(repo);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHDeploymentStatus.java b/src/main/java/org/kohsuke/github/GHDeploymentStatus.java
index a058b8a447..b8c751bbc3 100644
--- a/src/main/java/org/kohsuke/github/GHDeploymentStatus.java
+++ b/src/main/java/org/kohsuke/github/GHDeploymentStatus.java
@@ -12,12 +12,15 @@ public class GHDeploymentStatus extends GHObject {
protected String target_url;
protected String deployment_url;
protected String repository_url;
+
public GHDeploymentStatus wrap(GHRepository owner) {
this.owner = owner;
this.root = owner.root;
- if(creator != null) creator.wrapUp(root);
+ if (creator != null)
+ creator.wrapUp(root);
return this;
}
+
public URL getTargetUrl() {
return GitHub.parseURL(target_url);
}
@@ -29,7 +32,7 @@ public URL getDeploymentUrl() {
public URL getRepositoryUrl() {
return GitHub.parseURL(repository_url);
}
-
+
public GHDeploymentState getState() {
return GHDeploymentState.valueOf(state.toUpperCase(Locale.ENGLISH));
}
diff --git a/src/main/java/org/kohsuke/github/GHDeploymentStatusBuilder.java b/src/main/java/org/kohsuke/github/GHDeploymentStatusBuilder.java
index 821a3e744e..c842c8ddd1 100644
--- a/src/main/java/org/kohsuke/github/GHDeploymentStatusBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHDeploymentStatusBuilder.java
@@ -5,8 +5,7 @@
/**
* Creates a new deployment status.
*
- * @see
- * GHDeployment#createStatus(GHDeploymentState)
+ * @see GHDeployment#createStatus(GHDeploymentState)
*/
public class GHDeploymentStatusBuilder {
private final Requester builder;
@@ -14,31 +13,31 @@ public class GHDeploymentStatusBuilder {
private long deploymentId;
/**
- * @deprecated
- * Use {@link GHDeployment#createStatus(GHDeploymentState)}
+ * @deprecated Use {@link GHDeployment#createStatus(GHDeploymentState)}
*/
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) {
- this(repo,(long)deploymentId,state);
+ this(repo, (long) deploymentId, state);
}
- /*package*/ GHDeploymentStatusBuilder(GHRepository repo, long deploymentId, GHDeploymentState state) {
+ GHDeploymentStatusBuilder(GHRepository repo, long deploymentId, GHDeploymentState state) {
this.repo = repo;
this.deploymentId = deploymentId;
this.builder = new Requester(repo.root);
- this.builder.with("state",state);
+ this.builder.with("state", state);
}
public GHDeploymentStatusBuilder description(String description) {
- this.builder.with("description",description);
- return this;
+ this.builder.with("description", description);
+ return this;
}
public GHDeploymentStatusBuilder targetUrl(String targetUrl) {
- this.builder.with("target_url",targetUrl);
+ this.builder.with("target_url", targetUrl);
return this;
}
public GHDeploymentStatus create() throws IOException {
- return builder.to(repo.getApiTailUrl("deployments/"+deploymentId+"/statuses"),GHDeploymentStatus.class).wrap(repo);
+ return builder.to(repo.getApiTailUrl("deployments/" + deploymentId + "/statuses"), GHDeploymentStatus.class)
+ .wrap(repo);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHEmail.java b/src/main/java/org/kohsuke/github/GHEmail.java
index 9eeac04336..76246dab75 100644
--- a/src/main/java/org/kohsuke/github/GHEmail.java
+++ b/src/main/java/org/kohsuke/github/GHEmail.java
@@ -25,14 +25,13 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* Represents an email of GitHub.
*
* @author Kelly Campbell
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" }, justification = "JSON API")
public class GHEmail {
protected String email;
@@ -51,10 +50,9 @@ public boolean isVerified() {
return verified;
}
-
@Override
public String toString() {
- return "Email:"+email;
+ return "Email:" + email;
}
@Override
diff --git a/src/main/java/org/kohsuke/github/GHEvent.java b/src/main/java/org/kohsuke/github/GHEvent.java
index 8ad6368fe5..7d92543449 100644
--- a/src/main/java/org/kohsuke/github/GHEvent.java
+++ b/src/main/java/org/kohsuke/github/GHEvent.java
@@ -10,57 +10,23 @@
* @see Event type reference
*/
public enum GHEvent {
- COMMIT_COMMENT,
- CREATE,
- DELETE,
- DEPLOYMENT,
- DEPLOYMENT_STATUS,
- DOWNLOAD,
- FOLLOW,
- FORK,
- FORK_APPLY,
- GIST,
- GOLLUM,
- INSTALLATION,
- INSTALLATION_REPOSITORIES,
- INTEGRATION_INSTALLATION_REPOSITORIES,
- CHECK_SUITE,
- ISSUE_COMMENT,
- ISSUES,
- LABEL,
- MARKETPLACE_PURCHASE,
- MEMBER,
- MEMBERSHIP,
- MILESTONE,
- ORGANIZATION,
- ORG_BLOCK,
- PAGE_BUILD,
- PROJECT_CARD,
- PROJECT_COLUMN,
- PROJECT,
- PUBLIC,
- PULL_REQUEST,
- PULL_REQUEST_REVIEW,
- PULL_REQUEST_REVIEW_COMMENT,
- PUSH,
- RELEASE,
- REPOSITORY, // only valid for org hooks
- STATUS,
- TEAM,
- TEAM_ADD,
- WATCH,
- PING,
+ COMMIT_COMMENT, CREATE, DELETE, DEPLOYMENT, DEPLOYMENT_STATUS, DOWNLOAD, FOLLOW, FORK, FORK_APPLY, GIST, GOLLUM, INSTALLATION, INSTALLATION_REPOSITORIES, INTEGRATION_INSTALLATION_REPOSITORIES, CHECK_SUITE, ISSUE_COMMENT, ISSUES, LABEL, MARKETPLACE_PURCHASE, MEMBER, MEMBERSHIP, MILESTONE, ORGANIZATION, ORG_BLOCK, PAGE_BUILD, PROJECT_CARD, PROJECT_COLUMN, PROJECT, PUBLIC, PULL_REQUEST, PULL_REQUEST_REVIEW, PULL_REQUEST_REVIEW_COMMENT, PUSH, RELEASE, REPOSITORY, // only
+ // valid
+ // for
+ // org
+ // hooks
+ STATUS, TEAM, TEAM_ADD, WATCH, PING,
/**
* Special event type that means "every possible event"
*/
ALL;
-
/**
* Returns GitHub's internal representation of this event.
*/
String symbol() {
- if (this==ALL) return "*";
+ if (this == ALL)
+ return "*";
return name().toLowerCase(Locale.ENGLISH);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHEventInfo.java b/src/main/java/org/kohsuke/github/GHEventInfo.java
index ca7e3d4f04..4e139c94d0 100644
--- a/src/main/java/org/kohsuke/github/GHEventInfo.java
+++ b/src/main/java/org/kohsuke/github/GHEventInfo.java
@@ -30,27 +30,28 @@ public class GHEventInfo {
/**
* Inside the event JSON model, GitHub uses a slightly different format.
*/
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "JSON API")
public static class GHEventRepository {
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
private long id;
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
- private String url; // repository API URL
- private String name; // owner/repo
+ private String url; // repository API URL
+ private String name; // owner/repo
}
public GHEvent getType() {
String t = type;
- if (t.endsWith("Event")) t=t.substring(0,t.length()-5);
+ if (t.endsWith("Event"))
+ t = t.substring(0, t.length() - 5);
for (GHEvent e : GHEvent.values()) {
- if (e.name().replace("_","").equalsIgnoreCase(t))
+ if (e.name().replace("_", "").equalsIgnoreCase(t))
return e;
}
- return null; // unknown event type
+ return null; // unknown event type
}
- /*package*/ GHEventInfo wrapUp(GitHub root) {
+ GHEventInfo wrapUp(GitHub root) {
this.root = root;
return this;
}
@@ -64,39 +65,52 @@ public Date getCreatedAt() {
}
/**
- * Repository where the change was made.
+ * @return Repository where the change was made.
+ * @throws IOException
+ * on error
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
- justification = "The field comes from JSON deserialization")
+ @SuppressFBWarnings(value = {
+ "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "The field comes from JSON deserialization")
public GHRepository getRepository() throws IOException {
return root.getRepository(repo.name);
}
-
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
- justification = "The field comes from JSON deserialization")
+
+ /**
+ * @return the {@link GHUser} actor for this event.
+ * @throws IOException
+ * on error
+ */
+ @SuppressFBWarnings(value = {
+ "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "The field comes from JSON deserialization")
public GHUser getActor() throws IOException {
return root.getUser(actor.getLogin());
}
/**
- * Quick way to just get the actor of the login.
+ * @return the login of the actor.
+ * @throws IOException
+ * on error
*/
public String getActorLogin() throws IOException {
return actor.getLogin();
}
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
- justification = "The field comes from JSON deserialization")
+ @SuppressFBWarnings(value = {
+ "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "The field comes from JSON deserialization")
public GHOrganization getOrganization() throws IOException {
- return (org==null || org.getLogin()==null) ? null : root.getOrganization(org.getLogin());
+ return (org == null || org.getLogin() == null) ? null : root.getOrganization(org.getLogin());
}
/**
* Retrieves the payload.
- *
+ *
* @param type
- * Specify one of the {@link GHEventPayload} subtype that defines a type-safe access to the payload.
- * This must match the {@linkplain #getType() event type}.
+ * Specify one of the {@link GHEventPayload} subtype that defines a type-safe access to the payload. This
+ * must match the {@linkplain #getType() event type}.
+ *
+ * @return parsed event payload
+ * @throws IOException
+ * if payload cannot be parsed
*/
public T getPayload(Class type) throws IOException {
T v = GitHub.MAPPER.readValue(payload.traverse(), type);
diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java
index acdf5c74e9..01b29c88e8 100644
--- a/src/main/java/org/kohsuke/github/GHEventPayload.java
+++ b/src/main/java/org/kohsuke/github/GHEventPayload.java
@@ -9,7 +9,7 @@
/**
* Base type for types used in databinding of the event payload.
- *
+ *
* @see GitHub#parseEventPayload(Reader, Class)
* @see GHEventInfo#getPayload(Class)
*/
@@ -19,11 +19,12 @@ public abstract class GHEventPayload {
private GHUser sender;
- /*package*/ GHEventPayload() {
+ GHEventPayload() {
}
/**
* Gets the sender or {@code null} if accessed via the events API.
+ *
* @return the sender or {@code null} if accessed via the events API.
*/
public GHUser getSender() {
@@ -34,7 +35,7 @@ public void setSender(GHUser sender) {
this.sender = sender;
}
- /*package*/ void wrapUp(GitHub root) {
+ void wrapUp(GitHub root) {
this.root = root;
if (sender != null) {
sender.wrapUp(root);
@@ -46,8 +47,8 @@ public void setSender(GHUser sender) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public static class PullRequest extends GHEventPayload {
private String action;
private int number;
@@ -74,9 +75,10 @@ public GHRepository getRepository() {
@Override
void wrapUp(GitHub root) {
super.wrapUp(root);
- if (pull_request==null)
- throw new IllegalStateException("Expected pull_request payload, but got something else. Maybe we've got another type of event?");
- if (repository!=null) {
+ if (pull_request == null)
+ throw new IllegalStateException(
+ "Expected pull_request payload, but got something else. Maybe we've got another type of event?");
+ if (repository != null) {
repository.wrap(root);
pull_request.wrapUp(repository);
} else {
@@ -85,11 +87,11 @@ void wrapUp(GitHub root) {
}
}
-
/**
* A review was added to a pull request
*
- * @see authoritative source
+ * @see authoritative
+ * source
*/
public static class PullRequestReview extends GHEventPayload {
private String action;
@@ -100,7 +102,7 @@ public static class PullRequestReview extends GHEventPayload {
public String getAction() {
return action;
}
-
+
public GHPullRequestReview getReview() {
return review;
}
@@ -116,12 +118,13 @@ public GHRepository getRepository() {
@Override
void wrapUp(GitHub root) {
super.wrapUp(root);
- if (review==null)
- throw new IllegalStateException("Expected pull_request_review payload, but got something else. Maybe we've got another type of event?");
-
+ if (review == null)
+ throw new IllegalStateException(
+ "Expected pull_request_review payload, but got something else. Maybe we've got another type of event?");
+
review.wrapUp(pull_request);
-
- if (repository!=null) {
+
+ if (repository != null) {
repository.wrap(root);
pull_request.wrapUp(repository);
} else {
@@ -129,11 +132,12 @@ void wrapUp(GitHub root) {
}
}
}
-
+
/**
* A review comment was added to a pull request
*
- * @see authoritative source
+ * @see authoritative
+ * source
*/
public static class PullRequestReviewComment extends GHEventPayload {
private String action;
@@ -144,7 +148,7 @@ public static class PullRequestReviewComment extends GHEventPayload {
public String getAction() {
return action;
}
-
+
public GHPullRequestReviewComment getComment() {
return comment;
}
@@ -160,12 +164,13 @@ public GHRepository getRepository() {
@Override
void wrapUp(GitHub root) {
super.wrapUp(root);
- if (comment==null)
- throw new IllegalStateException("Expected pull_request_review_comment payload, but got something else. Maybe we've got another type of event?");
-
+ if (comment == null)
+ throw new IllegalStateException(
+ "Expected pull_request_review_comment payload, but got something else. Maybe we've got another type of event?");
+
comment.wrapUp(pull_request);
-
- if (repository!=null) {
+
+ if (repository != null) {
repository.wrap(root);
pull_request.wrapUp(repository);
} else {
@@ -175,12 +180,13 @@ void wrapUp(GitHub root) {
}
/**
- * A Issue has been assigned, unassigned, labeled, unlabeled, opened, edited, milestoned, demilestoned, closed, or reopened.
+ * A Issue has been assigned, unassigned, labeled, unlabeled, opened, edited, milestoned, demilestoned, closed, or
+ * reopened.
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Issue extends GHEventPayload {
private String action;
private GHIssue issue;
@@ -224,8 +230,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class IssueComment extends GHEventPayload {
private String action;
private GHIssueComment comment;
@@ -279,8 +285,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class CommitComment extends GHEventPayload {
private String action;
private GHCommitComment comment;
@@ -322,8 +328,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Create extends GHEventPayload {
private String ref;
@JsonProperty("ref_type")
@@ -375,8 +381,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Delete extends GHEventPayload {
private String ref;
@JsonProperty("ref_type")
@@ -415,8 +421,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Deployment extends GHEventPayload {
private GHDeployment deployment;
private GHRepository repository;
@@ -450,10 +456,11 @@ void wrapUp(GitHub root) {
/**
* A deployment
*
- * @see authoritative source
+ * @see authoritative
+ * source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class DeploymentStatus extends GHEventPayload {
@JsonProperty("deployment_status")
private GHDeploymentStatus deploymentStatus;
@@ -500,13 +507,12 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Fork extends GHEventPayload {
private GHRepository forkee;
private GHRepository repository;
-
public GHRepository getForkee() {
return forkee;
}
@@ -559,7 +565,7 @@ public void setOrganization(GHOrganization organization) {
@Override
void wrapUp(GitHub root) {
super.wrapUp(root);
- if (repository!=null)
+ if (repository != null)
repository.wrap(root);
if (organization != null) {
organization.wrapUp(root);
@@ -587,7 +593,7 @@ public GHRepository getRepository() {
@Override
void wrapUp(GitHub root) {
super.wrapUp(root);
- if (repository!=null)
+ if (repository != null)
repository.wrap(root);
}
@@ -598,8 +604,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD", "UUF_UNUSED_FIELD"},
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD",
+ "UUF_UNUSED_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Push extends GHEventPayload {
private String head, before;
private boolean created, deleted, forced;
@@ -617,8 +623,8 @@ public String getHead() {
}
/**
- * This is undocumented, but it looks like this captures the commit that the ref was pointing to
- * before the push.
+ * This is undocumented, but it looks like this captures the commit that the ref was pointing to before the
+ * push.
*/
public String getBefore() {
return before;
@@ -637,8 +643,7 @@ public String getRef() {
}
/**
- * The number of commits in the push.
- * Is this always the same as {@code getCommits().size()}?
+ * The number of commits in the push. Is this always the same as {@code getCommits().size()}?
*/
public int getSize() {
return size;
@@ -678,7 +683,7 @@ public void setPusher(Pusher pusher) {
@Override
void wrapUp(GitHub root) {
super.wrapUp(root);
- if (repository!=null)
+ if (repository != null)
repository.wrap(root);
}
@@ -766,8 +771,8 @@ public List getModified() {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
+ "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Release extends GHEventPayload {
private String action;
private GHRelease release;
@@ -808,8 +813,8 @@ void wrapUp(GitHub root) {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD"},
- justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD",
+ "UWF_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
public static class Repository extends GHEventPayload {
private String action;
private GHRepository repository;
diff --git a/src/main/java/org/kohsuke/github/GHFileNotFoundException.java b/src/main/java/org/kohsuke/github/GHFileNotFoundException.java
index 9f4b37c560..b8ebadddf8 100644
--- a/src/main/java/org/kohsuke/github/GHFileNotFoundException.java
+++ b/src/main/java/org/kohsuke/github/GHFileNotFoundException.java
@@ -7,8 +7,7 @@
import java.util.Map;
/**
- * Request/responce contains useful metadata.
- * Custom exception allows store info for next diagnostics.
+ * Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
*
* @author Kanstantsin Shautsou
*/
diff --git a/src/main/java/org/kohsuke/github/GHGist.java b/src/main/java/org/kohsuke/github/GHGist.java
index 19a2b626f2..c8681f5c0f 100644
--- a/src/main/java/org/kohsuke/github/GHGist.java
+++ b/src/main/java/org/kohsuke/github/GHGist.java
@@ -20,8 +20,8 @@
* @see documentation
*/
public class GHGist extends GHObject {
- /*package almost final*/ GHUser owner;
- /*package almost final*/ GitHub root;
+ /* package almost final */ GHUser owner;
+ /* package almost final */ GitHub root;
private String forks_url, commits_url, id, git_pull_url, git_push_url, html_url;
@@ -34,10 +34,10 @@ public class GHGist extends GHObject {
private String comments_url;
- private Map files = new HashMap();
+ private Map files = new HashMap();
/**
- * User that owns this Gist.
+ * @return User that owns this Gist.
*/
public GHUser getOwner() throws IOException {
return root.intern(owner);
@@ -52,7 +52,7 @@ public String getCommitsUrl() {
}
/**
- * URL like https://gist.github.com/gists/12345.git
+ * @return URL like https://gist.github.com/gists/12345.git
*/
public String getGitPullUrl() {
return git_pull_url;
@@ -79,7 +79,7 @@ public int getCommentCount() {
}
/**
- * API URL of listing comments.
+ * @return API URL of listing comments.
*/
public String getCommentsUrl() {
return comments_url;
@@ -89,11 +89,11 @@ public GHGistFile getFile(String name) {
return files.get(name);
}
- public Map getFiles() {
+ public Map getFiles() {
return Collections.unmodifiableMap(files);
}
- /*package*/ GHGist wrapUp(GHUser owner) {
+ GHGist wrapUp(GHUser owner) {
this.owner = owner;
this.root = owner.root;
wrapUp();
@@ -101,10 +101,10 @@ public Map getFiles() {
}
/**
- * Used when caller obtains {@link GHGist} without knowing its owner.
- * A partially constructed owner object is interned.
+ * Used when caller obtains {@link GHGist} without knowing its owner. A partially constructed owner object is
+ * interned.
*/
- /*package*/ GHGist wrapUp(GitHub root) {
+ GHGist wrapUp(GitHub root) {
this.owner = root.getUser(owner);
this.root = root;
wrapUp();
@@ -134,22 +134,18 @@ public void unstar() throws IOException {
}
public boolean isStarred() throws IOException {
- return root.retrieve().asHttpStatusCode(getApiTailUrl("star"))/100==2;
+ return root.retrieve().asHttpStatusCode(getApiTailUrl("star")) / 100 == 2;
}
/**
* Forks this gist into your own.
*/
public GHGist fork() throws IOException {
- return new Requester(root).to(getApiTailUrl("forks"),GHGist.class).wrapUp(root);
+ return new Requester(root).to(getApiTailUrl("forks"), GHGist.class).wrapUp(root);
}
public PagedIterable listForks() {
- return root.retrieve()
- .asPagedIterable(
- getApiTailUrl("forks"),
- GHGist[].class,
- item -> item.wrapUp(root) );
+ return root.retrieve().asPagedIterable(getApiTailUrl("forks"), GHGist[].class, item -> item.wrapUp(root));
}
/**
@@ -168,8 +164,10 @@ public GHGistUpdater update() throws IOException {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
GHGist ghGist = (GHGist) o;
return id.equals(ghGist.id);
diff --git a/src/main/java/org/kohsuke/github/GHGistBuilder.java b/src/main/java/org/kohsuke/github/GHGistBuilder.java
index 57fd255031..c8742ad61d 100644
--- a/src/main/java/org/kohsuke/github/GHGistBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHGistBuilder.java
@@ -13,7 +13,7 @@
public class GHGistBuilder {
private final GitHub root;
private final Requester req;
- private final LinkedHashMap files = new LinkedHashMap();
+ private final LinkedHashMap files = new LinkedHashMap();
public GHGistBuilder(GitHub root) {
this.root = root;
@@ -21,17 +21,17 @@ public GHGistBuilder(GitHub root) {
}
public GHGistBuilder description(String desc) {
- req.with("description",desc);
+ req.with("description", desc);
return this;
}
public GHGistBuilder public_(boolean v) {
- req.with("public",v);
+ req.with("public", v);
return this;
}
/**
- * Adds a new file.
+ * @return Adds a new file.
*/
public GHGistBuilder file(String fileName, String content) {
files.put(fileName, Collections.singletonMap("content", content));
@@ -40,9 +40,13 @@ public GHGistBuilder file(String fileName, String content) {
/**
* Creates a Gist based on the parameters specified thus far.
+ *
+ * @return created Gist
+ * @throws IOException
+ * if Gist cannot be created.
*/
public GHGist create() throws IOException {
- req._with("files",files);
- return req.to("/gists",GHGist.class).wrapUp(root);
+ req._with("files", files);
+ return req.to("/gists", GHGist.class).wrapUp(root);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHGistFile.java b/src/main/java/org/kohsuke/github/GHGistFile.java
index 605afc993a..4f8084de1b 100644
--- a/src/main/java/org/kohsuke/github/GHGistFile.java
+++ b/src/main/java/org/kohsuke/github/GHGistFile.java
@@ -8,13 +8,12 @@
* @see GHGist#getFiles()
*/
public class GHGistFile {
- /*package almost final*/ String fileName;
+ /* package almost final */ String fileName;
private int size;
private String raw_url, type, language, content;
private boolean truncated;
-
public String getFileName() {
return fileName;
}
diff --git a/src/main/java/org/kohsuke/github/GHGistUpdater.java b/src/main/java/org/kohsuke/github/GHGistUpdater.java
index 71bff34e22..40c37bded6 100644
--- a/src/main/java/org/kohsuke/github/GHGistUpdater.java
+++ b/src/main/java/org/kohsuke/github/GHGistUpdater.java
@@ -12,7 +12,7 @@
public class GHGistUpdater {
private final GHGist base;
private final Requester builder;
- LinkedHashMap files;
+ LinkedHashMap files;
GHGistUpdater(GHGist base) {
this.base = base;
@@ -26,14 +26,13 @@ public GHGistUpdater addFile(String fileName, String content) throws IOException
return this;
}
-// // This method does not work.
-// public GHGistUpdater deleteFile(String fileName) throws IOException {
-// files.put(fileName, Collections.singletonMap("filename", null));
-// return this;
-// }
+ // // This method does not work.
+ // public GHGistUpdater deleteFile(String fileName) throws IOException {
+ // files.put(fileName, Collections.singletonMap("filename", null));
+ // return this;
+ // }
- public GHGistUpdater renameFile(String fileName, String newFileName) throws IOException
- {
+ public GHGistUpdater renameFile(String fileName, String newFileName) throws IOException {
files.put(fileName, Collections.singletonMap("filename", newFileName));
return this;
}
@@ -44,7 +43,7 @@ public GHGistUpdater updateFile(String fileName, String content) throws IOExcept
}
public GHGistUpdater description(String desc) {
- builder.with("description",desc);
+ builder.with("description", desc);
return this;
}
@@ -53,8 +52,6 @@ public GHGistUpdater description(String desc) {
*/
public GHGist update() throws IOException {
builder._with("files", files);
- return builder
- .method("PATCH")
- .to(base.getApiTailUrl(""), GHGist.class).wrap(base.owner);
+ return builder.method("PATCH").to(base.getApiTailUrl(""), GHGist.class).wrap(base.owner);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHHook.java b/src/main/java/org/kohsuke/github/GHHook.java
index b7f450307a..4ede438bb5 100644
--- a/src/main/java/org/kohsuke/github/GHHook.java
+++ b/src/main/java/org/kohsuke/github/GHHook.java
@@ -13,13 +13,13 @@
/**
* @author Kohsuke Kawaguchi
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public abstract class GHHook extends GHObject {
String name;
List events;
boolean active;
- Map config;
+ Map config;
public String getName() {
return name;
@@ -28,8 +28,10 @@ public String getName() {
public EnumSet getEvents() {
EnumSet s = EnumSet.noneOf(GHEvent.class);
for (String e : events) {
- if (e.equals("*")) s.add(GHEvent.ALL);
- else s.add(Enum.valueOf(GHEvent.class, e.toUpperCase(Locale.ENGLISH)));
+ if (e.equals("*"))
+ s.add(GHEvent.ALL);
+ else
+ s.add(Enum.valueOf(GHEvent.class, e.toUpperCase(Locale.ENGLISH)));
}
return s;
}
diff --git a/src/main/java/org/kohsuke/github/GHHooks.java b/src/main/java/org/kohsuke/github/GHHooks.java
index 6ecbb04b6e..5b994b141b 100644
--- a/src/main/java/org/kohsuke/github/GHHooks.java
+++ b/src/main/java/org/kohsuke/github/GHHooks.java
@@ -16,15 +16,16 @@ static abstract class Context {
private final GitHub root;
private Context(GitHub root) {
- this.root = root;
+ this.root = root;
}
public List getHooks() throws IOException {
-
- GHHook [] hookArray = root.retrieve().to(collection(),collectionClass()); // jdk/eclipse bug requires this to be on separate line
+
+ GHHook[] hookArray = root.retrieve().to(collection(), collectionClass()); // jdk/eclipse bug requires this
+ // to be on separate line
List list = new ArrayList(Arrays.asList(hookArray));
for (GHHook h : list)
- wrap(h);
+ wrap(h);
return list;
}
@@ -33,20 +34,17 @@ public GHHook getHook(int id) throws IOException {
return wrap(hook);
}
- public GHHook createHook(String name, Map config, Collection events, boolean active) throws IOException {
+ public GHHook createHook(String name, Map config, Collection events, boolean active)
+ throws IOException {
List ea = null;
- if (events!=null) {
- ea = new ArrayList();
- for (GHEvent e : events)
- ea.add(e.symbol());
+ if (events != null) {
+ ea = new ArrayList();
+ for (GHEvent e : events)
+ ea.add(e.symbol());
}
- GHHook hook = new Requester(root)
- .with("name", name)
- .with("active", active)
- ._with("config", config)
- ._with("events", ea)
- .to(collection(), clazz());
+ GHHook hook = new Requester(root).with("name", name).with("active", active)._with("config", config)
+ ._with("events", ea).to(collection(), clazz());
return wrap(hook);
}
@@ -87,7 +85,7 @@ Class extends GHHook> clazz() {
@Override
GHHook wrap(GHHook hook) {
- return ((GHRepoHook)hook).wrap(repository);
+ return ((GHRepoHook) hook).wrap(repository);
}
}
@@ -116,15 +114,15 @@ Class extends GHHook> clazz() {
@Override
GHHook wrap(GHHook hook) {
- return ((GHOrgHook)hook).wrap(organization);
+ return ((GHOrgHook) hook).wrap(organization);
}
}
- static Context repoContext(GHRepository repository, GHUser owner) {
- return new RepoContext(repository, owner);
- }
+ static Context repoContext(GHRepository repository, GHUser owner) {
+ return new RepoContext(repository, owner);
+ }
- static Context orgContext(GHOrganization organization) {
- return new OrgContext(organization);
- }
+ static Context orgContext(GHOrganization organization) {
+ return new OrgContext(organization);
+ }
}
diff --git a/src/main/java/org/kohsuke/github/GHIOException.java b/src/main/java/org/kohsuke/github/GHIOException.java
index b07144bcb7..45dc3404ed 100644
--- a/src/main/java/org/kohsuke/github/GHIOException.java
+++ b/src/main/java/org/kohsuke/github/GHIOException.java
@@ -7,8 +7,7 @@
import java.util.Map;
/**
- * Request/responce contains useful metadata.
- * Custom exception allows store info for next diagnostics.
+ * Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
*
* @author Kanstantsin Shautsou
*/
diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java
index 74619ad6e0..5db4eb4282 100644
--- a/src/main/java/org/kohsuke/github/GHInvitation.java
+++ b/src/main/java/org/kohsuke/github/GHInvitation.java
@@ -9,10 +9,10 @@
* @see GitHub#getMyInvitations()
* @see GHRepository#listInvitations()
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "UUF_UNUSED_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "UUF_UNUSED_FIELD" }, justification = "JSON API")
public class GHInvitation extends GHObject {
- /*package almost final*/ GitHub root;
+ /* package almost final */ GitHub root;
private int id;
private GHRepository repository;
@@ -20,7 +20,7 @@ public class GHInvitation extends GHObject {
private String permissions;
private String html_url;
- /*package*/ GHInvitation wrapUp(GitHub root) {
+ GHInvitation wrapUp(GitHub root) {
this.root = root;
return this;
}
diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java
index 20343266b7..dfd8102372 100644
--- a/src/main/java/org/kohsuke/github/GHIssue.java
+++ b/src/main/java/org/kohsuke/github/GHIssue.java
@@ -49,14 +49,14 @@
* @see GitHub#searchIssues()
* @see GHIssueSearchBuilder
*/
-public class GHIssue extends GHObject implements Reactable{
+public class GHIssue extends GHObject implements Reactable {
private static final String ASSIGNEES = "assignees";
GitHub root;
GHRepository owner;
-
+
// API v3
- protected GHUser assignee; // not sure what this field is now that 'assignees' exist
+ protected GHUser assignee; // not sure what this field is now that 'assignees' exist
protected GHUser[] assignees;
protected String state;
protected int number;
@@ -78,23 +78,28 @@ public class GHIssue extends GHObject implements Reactable{
*/
public static class Label extends GHLabel {
}
-
- /*package*/ GHIssue wrap(GHRepository owner) {
+
+ GHIssue wrap(GHRepository owner) {
this.owner = owner;
- if(milestone != null) milestone.wrap(owner);
+ if (milestone != null)
+ milestone.wrap(owner);
return wrap(owner.root);
}
- /*package*/ GHIssue wrap(GitHub root) {
+ GHIssue wrap(GitHub root) {
this.root = root;
- if(assignee != null) assignee.wrapUp(root);
- if(assignees!=null) GHUser.wrap(assignees,root);
- if(user != null) user.wrapUp(root);
- if(closed_by != null) closed_by.wrapUp(root);
+ if (assignee != null)
+ assignee.wrapUp(root);
+ if (assignees != null)
+ GHUser.wrap(assignees, root);
+ if (user != null)
+ user.wrapUp(root);
+ if (closed_by != null)
+ closed_by.wrapUp(root);
return this;
}
- /*package*/ static GHIssue[] wrap(GHIssue[] issues, GHRepository owner) {
+ static GHIssue[] wrap(GHIssue[] issues, GHRepository owner) {
for (GHIssue i : issues)
i.wrap(owner);
return issues;
@@ -122,8 +127,7 @@ public int getNumber() {
}
/**
- * The HTML page of this issue,
- * like https://github.com/jenkinsci/jenkins/issues/100
+ * The HTML page of this issue, like https://github.com/jenkinsci/jenkins/issues/100
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
@@ -142,37 +146,37 @@ public GHIssueState getState() {
}
public Collection getLabels() throws IOException {
- if(labels == null){
+ if (labels == null) {
return Collections.emptyList();
}
- return Collections.unmodifiableList(labels);
+ return Collections. unmodifiableList(labels);
}
public Date getClosedAt() {
return GitHub.parseDate(closed_at);
}
- public URL getApiURL(){
+ public URL getApiURL() {
return GitHub.parseURL(url);
}
public void lock() throws IOException {
- new Requester(root).method("PUT").to(getApiRoute()+"/lock");
+ new Requester(root).method("PUT").to(getApiRoute() + "/lock");
}
public void unlock() throws IOException {
- new Requester(root).method("PUT").to(getApiRoute()+"/lock");
+ new Requester(root).method("PUT").to(getApiRoute() + "/lock");
}
/**
* Updates the issue by adding a comment.
*
- * @return
- * Newly posted comment.
+ * @return Newly posted comment.
*/
@WithBridgeMethods(void.class)
public GHIssueComment comment(String message) throws IOException {
- GHIssueComment r = new Requester(root).with("body",message).to(getIssuesApiRoute() + "/comments", GHIssueComment.class);
+ GHIssueComment r = new Requester(root).with("body", message).to(getIssuesApiRoute() + "/comments",
+ GHIssueComment.class);
return r.wrapUp(this);
}
@@ -199,15 +203,15 @@ public void reopen() throws IOException {
}
public void setTitle(String title) throws IOException {
- edit("title",title);
+ edit("title", title);
}
public void setBody(String body) throws IOException {
- edit("body",body);
+ edit("body", body);
}
public void setMilestone(GHMilestone milestone) throws IOException {
- edit("milestone",milestone.getNumber());
+ edit("milestone", milestone.getNumber());
}
public void assignTo(GHUser user) throws IOException {
@@ -215,13 +219,14 @@ public void assignTo(GHUser user) throws IOException {
}
public void setLabels(String... labels) throws IOException {
- editIssue("labels",labels);
+ editIssue("labels", labels);
}
/**
* Adds labels to the issue.
*
- * @param names Names of the label
+ * @param names
+ * Names of the label
*/
public void addLabels(String... names) throws IOException {
_addLabels(Arrays.asList(names));
@@ -281,39 +286,33 @@ private void _removeLabels(Collection names) throws IOException {
/**
* Obtains all the comments associated with this issue.
- *
- * @see #listComments()
+ *
+ * @see #listComments()
*/
public List getComments() throws IOException {
return listComments().asList();
}
-
+
/**
* Obtains all the comments associated with this issue.
*/
public PagedIterable listComments() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- getIssuesApiRoute() + "/comments",
- GHIssueComment[].class,
- item -> item.wrapUp(GHIssue.this) );
+ return root.retrieve().asPagedIterable(getIssuesApiRoute() + "/comments", GHIssueComment[].class,
+ item -> item.wrapUp(GHIssue.this));
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root)
- .withPreview(SQUIRREL_GIRL)
- .with("content", content.getContent())
- .to(getApiRoute()+"/reactions", GHReaction.class).wrap(root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
+ .to(getApiRoute() + "/reactions", GHReaction.class).wrap(root);
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve().withPreview(SQUIRREL_GIRL)
- .asPagedIterable(
- getApiRoute()+"/reactions",
- GHReaction[].class,
- item -> item.wrap(owner.root) );
+ return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
+ GHReaction[].class, item -> item.wrap(owner.root));
}
public void addAssignees(GHUser... assignees) throws IOException {
@@ -321,7 +320,7 @@ public void addAssignees(GHUser... assignees) throws IOException {
}
public void addAssignees(Collection assignees) throws IOException {
- root.retrieve().method("POST").withLogins(ASSIGNEES,assignees).to(getIssuesApiRoute()+"/assignees",this);
+ root.retrieve().method("POST").withLogins(ASSIGNEES, assignees).to(getIssuesApiRoute() + "/assignees", this);
}
public void setAssignees(GHUser... assignees) throws IOException {
@@ -337,7 +336,8 @@ public void removeAssignees(GHUser... assignees) throws IOException {
}
public void removeAssignees(Collection assignees) throws IOException {
- root.retrieve().method("DELETE").withLogins(ASSIGNEES,assignees).inBody().to(getIssuesApiRoute()+"/assignees",this);
+ root.retrieve().method("DELETE").withLogins(ASSIGNEES, assignees).inBody()
+ .to(getIssuesApiRoute() + "/assignees", this);
}
protected String getApiRoute() {
@@ -345,7 +345,7 @@ protected String getApiRoute() {
}
protected String getIssuesApiRoute() {
- return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/issues/"+number;
+ return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/issues/" + number;
}
public GHUser getAssignee() throws IOException {
@@ -367,23 +367,21 @@ public GHUser getUser() throws IOException {
* Reports who has closed the issue.
*
*
- * Note that GitHub doesn't always seem to report this information
- * even for an issue that's already closed. See
+ * Note that GitHub doesn't always seem to report this information even for an issue that's already closed. See
* https://github.com/kohsuke/github-api/issues/60.
*/
public GHUser getClosedBy() throws IOException {
- if(!"closed".equals(state)) return null;
+ if (!"closed".equals(state))
+ return null;
- //TODO
+ // TODO
/*
- if (closed_by==null) {
- closed_by = owner.getIssue(number).getClosed_by();
- }
- */
+ * if (closed_by==null) { closed_by = owner.getIssue(number).getClosed_by(); }
+ */
return root.intern(closed_by);
}
-
- public int getCommentsCount(){
+
+ public int getCommentsCount() {
return comments;
}
@@ -395,39 +393,36 @@ public PullRequest getPullRequest() {
}
public boolean isPullRequest() {
- return pull_request!=null;
+ return pull_request != null;
}
public GHMilestone getMilestone() {
return milestone;
}
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD"},
- justification = "JSON API")
- public static class PullRequest{
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
+ "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
+ public static class PullRequest {
private String diff_url, patch_url, html_url;
-
+
public URL getDiffUrl() {
return GitHub.parseURL(diff_url);
}
-
+
public URL getPatchUrl() {
return GitHub.parseURL(patch_url);
}
-
+
public URL getUrl() {
return GitHub.parseURL(html_url);
}
}
/**
- * Lists events for this issue.
- * See https://developer.github.com/v3/issues/events/
+ * Lists events for this issue. See https://developer.github.com/v3/issues/events/
*/
public PagedIterable listEvents() throws IOException {
- return root.retrieve().asPagedIterable(
- owner.getApiTailUrl(String.format("/issues/%s/events", number)),
- GHIssueEvent[].class,
- item -> item.wrapUp(GHIssue.this) );
+ return root.retrieve().asPagedIterable(owner.getApiTailUrl(String.format("/issues/%s/events", number)),
+ GHIssueEvent[].class, item -> item.wrapUp(GHIssue.this));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHIssueBuilder.java b/src/main/java/org/kohsuke/github/GHIssueBuilder.java
index 3a5a532308..e1dbba012e 100644
--- a/src/main/java/org/kohsuke/github/GHIssueBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHIssueBuilder.java
@@ -16,37 +16,37 @@ public class GHIssueBuilder {
GHIssueBuilder(GHRepository repo, String title) {
this.repo = repo;
this.builder = new Requester(repo.root);
- builder.with("title",title);
+ builder.with("title", title);
}
/**
* Sets the main text of an issue, which is arbitrary multi-line text.
*/
public GHIssueBuilder body(String str) {
- builder.with("body",str);
+ builder.with("body", str);
return this;
}
public GHIssueBuilder assignee(GHUser user) {
- if (user!=null)
+ if (user != null)
assignees.add(user.getLogin());
return this;
}
public GHIssueBuilder assignee(String user) {
- if (user!=null)
+ if (user != null)
assignees.add(user);
return this;
}
public GHIssueBuilder milestone(GHMilestone milestone) {
- if (milestone!=null)
- builder.with("milestone",milestone.getNumber());
+ if (milestone != null)
+ builder.with("milestone", milestone.getNumber());
return this;
}
public GHIssueBuilder label(String label) {
- if (label!=null)
+ if (label != null)
labels.add(label);
return this;
}
@@ -55,6 +55,7 @@ public GHIssueBuilder label(String label) {
* Creates a new issue.
*/
public GHIssue create() throws IOException {
- return builder.with("labels",labels).with("assignees",assignees).to(repo.getApiTailUrl("issues"),GHIssue.class).wrap(repo);
+ return builder.with("labels", labels).with("assignees", assignees)
+ .to(repo.getApiTailUrl("issues"), GHIssue.class).wrap(repo);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHIssueComment.java b/src/main/java/org/kohsuke/github/GHIssueComment.java
index 258718312c..cddc2e02f5 100644
--- a/src/main/java/org/kohsuke/github/GHIssueComment.java
+++ b/src/main/java/org/kohsuke/github/GHIssueComment.java
@@ -41,7 +41,7 @@ public class GHIssueComment extends GHObject implements Reactable {
private String body, gravatar_id, html_url, author_association;
private GHUser user; // not fully populated. beware.
- /*package*/ GHIssueComment wrapUp(GHIssue owner) {
+ GHIssueComment wrapUp(GHIssue owner) {
this.owner = owner;
return this;
}
@@ -74,7 +74,7 @@ public String getUserName() {
public GHUser getUser() throws IOException {
return owner == null || owner.root.isOffline() ? user : owner.root.getUser(user.getLogin());
}
-
+
@Override
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
@@ -83,7 +83,7 @@ public URL getHtmlUrl() {
public GHCommentAuthorAssociation getAuthorAssociation() {
return GHCommentAuthorAssociation.valueOf(author_association);
}
-
+
/**
* Updates the body of the issue comment.
*/
@@ -99,25 +99,22 @@ public void delete() throws IOException {
new Requester(owner.root).method("DELETE").to(getApiRoute());
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root)
- .withPreview(SQUIRREL_GIRL)
- .with("content", content.getContent())
- .to(getApiRoute()+"/reactions", GHReaction.class).wrap(owner.root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
+ .to(getApiRoute() + "/reactions", GHReaction.class).wrap(owner.root);
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve()
- .withPreview(SQUIRREL_GIRL)
- .asPagedIterable(
- getApiRoute()+"/reactions",
- GHReaction[].class,
- item -> item.wrap(owner.root) );
+ return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
+ GHReaction[].class, item -> item.wrap(owner.root));
}
private String getApiRoute() {
- return "/repos/"+owner.getRepository().getOwnerName()+"/"+owner.getRepository().getName()+"/issues/comments/" + id;
+ return "/repos/" + owner.getRepository().getOwnerName() + "/" + owner.getRepository().getName()
+ + "/issues/comments/" + id;
}
}
diff --git a/src/main/java/org/kohsuke/github/GHIssueEvent.java b/src/main/java/org/kohsuke/github/GHIssueEvent.java
index 089e87a831..3f618414ca 100644
--- a/src/main/java/org/kohsuke/github/GHIssueEvent.java
+++ b/src/main/java/org/kohsuke/github/GHIssueEvent.java
@@ -72,10 +72,7 @@ GHIssueEvent wrapUp(GHIssue parent) {
@Override
public String toString() {
- return String.format("Issue %d was %s by %s on %s",
- getIssue().getNumber(),
- getEvent(),
- getActor().getLogin(),
+ return String.format("Issue %d was %s by %s on %s", getIssue().getNumber(), getEvent(), getActor().getLogin(),
getCreatedAt().toString());
}
}
diff --git a/src/main/java/org/kohsuke/github/GHIssueSearchBuilder.java b/src/main/java/org/kohsuke/github/GHIssueSearchBuilder.java
index 6cefc01678..49c58aff3a 100644
--- a/src/main/java/org/kohsuke/github/GHIssueSearchBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHIssueSearchBuilder.java
@@ -7,8 +7,8 @@
* @see GitHub#searchIssues()
*/
public class GHIssueSearchBuilder extends GHSearchBuilder {
- /*package*/ GHIssueSearchBuilder(GitHub root) {
- super(root,IssueSearchResult.class);
+ GHIssueSearchBuilder(GitHub root) {
+ super(root, IssueSearchResult.class);
}
/**
@@ -24,7 +24,7 @@ public GHIssueSearchBuilder mentions(GHUser u) {
}
public GHIssueSearchBuilder mentions(String login) {
- return q("mentions:"+login);
+ return q("mentions:" + login);
}
public GHIssueSearchBuilder isOpen() {
@@ -40,22 +40,24 @@ public GHIssueSearchBuilder isMerged() {
}
public GHIssueSearchBuilder order(GHDirection v) {
- req.with("order",v);
+ req.with("order", v);
return this;
}
public GHIssueSearchBuilder sort(Sort sort) {
- req.with("sort",sort);
+ req.with("sort", sort);
return this;
}
- public enum Sort { COMMENTS, CREATED, UPDATED }
+ public enum Sort {
+ COMMENTS, CREATED, UPDATED
+ }
private static class IssueSearchResult extends SearchResult {
private GHIssue[] items;
@Override
- /*package*/ GHIssue[] getItems(GitHub root) {
+ GHIssue[] getItems(GitHub root) {
for (GHIssue i : items)
i.wrap(root);
return items;
diff --git a/src/main/java/org/kohsuke/github/GHIssueState.java b/src/main/java/org/kohsuke/github/GHIssueState.java
index ec3cf10d24..4377ea596c 100644
--- a/src/main/java/org/kohsuke/github/GHIssueState.java
+++ b/src/main/java/org/kohsuke/github/GHIssueState.java
@@ -28,7 +28,5 @@
* @see GHPullRequestQueryBuilder#state(GHIssueState)
*/
public enum GHIssueState {
- OPEN,
- CLOSED,
- ALL
+ OPEN, CLOSED, ALL
}
\ No newline at end of file
diff --git a/src/main/java/org/kohsuke/github/GHKey.java b/src/main/java/org/kohsuke/github/GHKey.java
index d4c8197dbf..8d46b34f68 100644
--- a/src/main/java/org/kohsuke/github/GHKey.java
+++ b/src/main/java/org/kohsuke/github/GHKey.java
@@ -10,7 +10,7 @@
*/
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
public class GHKey {
- /*package almost final*/ GitHub root;
+ /* package almost final */ GitHub root;
protected String url, key, title;
protected boolean verified;
@@ -38,17 +38,17 @@ public String getUrl() {
public GitHub getRoot() {
return root;
}
-
+
public boolean isVerified() {
return verified;
}
- /*package*/ GHKey wrap(GitHub root) {
+ GHKey wrap(GitHub root) {
this.root = root;
return this;
}
public String toString() {
- return new ToStringBuilder(this).append("title",title).append("id",id).append("key",key).toString();
+ return new ToStringBuilder(this).append("title", title).append("id", id).append("key", key).toString();
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 29ab891473..fd737e3d8a 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -7,6 +7,7 @@
import java.util.Objects;
import static org.kohsuke.github.Previews.SYMMETRA;
+
/**
* @author Kohsuke Kawaguchi
* @see GHIssue#getLabels()
@@ -34,12 +35,13 @@ public String getColor() {
/**
* Purpose of Label
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public String getDescription() {
return description;
}
- /*package*/ GHLabel wrapUp(GHRepository repo) {
+ GHLabel wrapUp(GHRepository repo) {
this.repo = repo;
return this;
}
@@ -50,32 +52,25 @@ public void delete() throws IOException {
/**
* @param newColor
- * 6-letter hex color code, like "f29513"
+ * 6-letter hex color code, like "f29513"
*/
public void setColor(String newColor) throws IOException {
- repo.root.retrieve().method("PATCH")
- .withPreview(SYMMETRA)
- .with("name", name)
- .with("color", newColor)
- .with("description", description)
- .to(url);
+ repo.root.retrieve().method("PATCH").withPreview(SYMMETRA).with("name", name).with("color", newColor)
+ .with("description", description).to(url);
}
/**
* @param newDescription
- * Description of label
+ * Description of label
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public void setDescription(String newDescription) throws IOException {
- repo.root.retrieve().method("PATCH")
- .withPreview(SYMMETRA)
- .with("name", name)
- .with("color", color)
- .with("description", newDescription)
- .to(url);
+ repo.root.retrieve().method("PATCH").withPreview(SYMMETRA).with("name", name).with("color", color)
+ .with("description", newDescription).to(url);
}
- /*package*/ static Collection toNames(Collection labels) {
+ static Collection toNames(Collection labels) {
List r = new ArrayList();
for (GHLabel l : labels) {
r.add(l.getName());
@@ -85,13 +80,13 @@ public void setDescription(String newDescription) throws IOException {
@Override
public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
final GHLabel ghLabel = (GHLabel) o;
- return Objects.equals(url, ghLabel.url) &&
- Objects.equals(name, ghLabel.name) &&
- Objects.equals(color, ghLabel.color) &&
- Objects.equals(repo, ghLabel.repo);
+ return Objects.equals(url, ghLabel.url) && Objects.equals(name, ghLabel.name)
+ && Objects.equals(color, ghLabel.color) && Objects.equals(repo, ghLabel.repo);
}
@Override
diff --git a/src/main/java/org/kohsuke/github/GHLicense.java b/src/main/java/org/kohsuke/github/GHLicense.java
index b18e7e9338..1cfba97fea 100644
--- a/src/main/java/org/kohsuke/github/GHLicense.java
+++ b/src/main/java/org/kohsuke/github/GHLicense.java
@@ -34,19 +34,19 @@
/**
* The GitHub Preview API's license information
- *
*
* @author Duncan Dickinson
* @see GitHub#getLicense(String)
* @see GHRepository#getLicense()
* @see https://developer.github.com/v3/licenses/
*/
-@SuppressWarnings({"UnusedDeclaration"})
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+@SuppressWarnings({ "UnusedDeclaration" })
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHLicense extends GHObject {
- @SuppressFBWarnings("IS2_INCONSISTENT_SYNC") // root is set before the object is returned to the app
- /*package almost final*/ GitHub root;
+ @SuppressFBWarnings("IS2_INCONSISTENT_SYNC")
+ // root is set before the object is returned to the app
+ /* package almost final */ GitHub root;
// these fields are always present, even in the short form
protected String key, name;
@@ -138,15 +138,18 @@ public String getBody() throws IOException {
* Depending on the original API call where this object is created, it may not contain everything.
*/
protected synchronized void populate() throws IOException {
- if (description!=null) return; // already populated
+ if (description != null)
+ return; // already populated
root.retrieve().to(url, this);
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof GHLicense)) return false;
+ if (this == o)
+ return true;
+ if (!(o instanceof GHLicense))
+ return false;
GHLicense that = (GHLicense) o;
return this.url.equals(that.url);
@@ -157,7 +160,7 @@ public int hashCode() {
return url.hashCode();
}
- /*package*/ GHLicense wrap(GitHub root) {
+ GHLicense wrap(GitHub root) {
this.root = root;
return this;
}
diff --git a/src/main/java/org/kohsuke/github/GHMembership.java b/src/main/java/org/kohsuke/github/GHMembership.java
index 2847e1891c..d5e29ea016 100644
--- a/src/main/java/org/kohsuke/github/GHMembership.java
+++ b/src/main/java/org/kohsuke/github/GHMembership.java
@@ -45,17 +45,19 @@ public GHOrganization getOrganization() {
* @see GHMyself#getMembership(GHOrganization)
*/
public void activate() throws IOException {
- root.retrieve().method("PATCH").with("state",State.ACTIVE).to(url,this);
+ root.retrieve().method("PATCH").with("state", State.ACTIVE).to(url, this);
}
- /*package*/ GHMembership wrap(GitHub root) {
+ GHMembership wrap(GitHub root) {
this.root = root;
- if (user!=null) user = root.getUser(user.wrapUp(root));
- if (organization!=null) organization.wrapUp(root);
+ if (user != null)
+ user = root.getUser(user.wrapUp(root));
+ if (organization != null)
+ organization.wrapUp(root);
return this;
}
- /*package*/ static void wrap(GHMembership[] page, GitHub root) {
+ static void wrap(GHMembership[] page, GitHub root) {
for (GHMembership m : page)
m.wrap(root);
}
@@ -78,7 +80,6 @@ public enum Role {
* Whether a role is currently active or waiting for acceptance (pending)
*/
public enum State {
- ACTIVE,
- PENDING;
+ ACTIVE, PENDING;
}
}
diff --git a/src/main/java/org/kohsuke/github/GHMilestone.java b/src/main/java/org/kohsuke/github/GHMilestone.java
index 3ed54636c7..40d5a1eea5 100644
--- a/src/main/java/org/kohsuke/github/GHMilestone.java
+++ b/src/main/java/org/kohsuke/github/GHMilestone.java
@@ -6,7 +6,7 @@
import java.util.Locale;
/**
- *
+ *
* @author Yusuke Kokubo
*
*/
@@ -22,17 +22,18 @@ public class GHMilestone extends GHObject {
public GitHub getRoot() {
return root;
}
-
+
public GHRepository getOwner() {
return owner;
}
-
+
public GHUser getCreator() throws IOException {
return root.intern(creator);
}
-
+
public Date getDueOn() {
- if (due_on == null) return null;
+ if (due_on == null)
+ return null;
return GitHub.parseDate(due_on);
}
@@ -46,19 +47,19 @@ public Date getClosedAt() throws IOException {
public String getTitle() {
return title;
}
-
+
public String getDescription() {
return description;
}
-
+
public int getClosedIssues() {
return closed_issues;
}
-
+
public int getOpenIssues() {
return open_issues;
}
-
+
public int getNumber() {
return number;
}
@@ -66,7 +67,7 @@ public int getNumber() {
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
}
-
+
public GHMilestoneState getState() {
return Enum.valueOf(GHMilestoneState.class, state.toUpperCase(Locale.ENGLISH));
}
@@ -109,7 +110,7 @@ public void setDueOn(Date dueOn) throws IOException {
}
protected String getApiRoute() {
- return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/milestones/"+number;
+ return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/milestones/" + number;
}
public GHMilestone wrap(GHRepository repo) {
diff --git a/src/main/java/org/kohsuke/github/GHMilestoneState.java b/src/main/java/org/kohsuke/github/GHMilestoneState.java
index 92194546cb..ce45048186 100644
--- a/src/main/java/org/kohsuke/github/GHMilestoneState.java
+++ b/src/main/java/org/kohsuke/github/GHMilestoneState.java
@@ -1,11 +1,10 @@
package org.kohsuke.github;
/**
- *
+ *
* @author Yusuke Kokubo
*
*/
public enum GHMilestoneState {
- OPEN,
- CLOSED
+ OPEN, CLOSED
}
\ No newline at end of file
diff --git a/src/main/java/org/kohsuke/github/GHMyself.java b/src/main/java/org/kohsuke/github/GHMyself.java
index e059f58226..f370aa7c1b 100644
--- a/src/main/java/org/kohsuke/github/GHMyself.java
+++ b/src/main/java/org/kohsuke/github/GHMyself.java
@@ -44,8 +44,7 @@ public enum RepositoryListFilter {
}
/**
- * @deprecated
- * Use {@link #getEmails2()}
+ * @deprecated Use {@link #getEmails2()}
*/
public List getEmails() throws IOException {
List src = getEmails2();
@@ -59,12 +58,10 @@ public List getEmails() throws IOException {
/**
* Returns the read-only list of e-mail addresses configured for you.
*
- * This corresponds to the stuff you configure in https://github.com/settings/emails,
- * and not to be confused with {@link #getEmail()} that shows your public e-mail address
- * set in https://github.com/settings/profile
+ * This corresponds to the stuff you configure in https://github.com/settings/emails, and not to be confused with
+ * {@link #getEmail()} that shows your public e-mail address set in https://github.com/settings/profile
*
- * @return
- * Always non-null.
+ * @return Always non-null.
*/
public List getEmails2() throws IOException {
GHEmail[] addresses = root.retrieve().to("/user/emails", GHEmail[].class);
@@ -74,11 +71,10 @@ public List getEmails2() throws IOException {
/**
* Returns the read-only list of all the pulic keys of the current user.
*
- * NOTE: When using OAuth authenticaiton, the READ/WRITE User scope is
- * required by the GitHub APIs, otherwise you will get a 404 NOT FOUND.
+ * NOTE: When using OAuth authenticaiton, the READ/WRITE User scope is required by the GitHub APIs, otherwise you
+ * will get a 404 NOT FOUND.
*
- * @return
- * Always non-null.
+ * @return Always non-null.
*/
public List getPublicKeys() throws IOException {
return Collections.unmodifiableList(Arrays.asList(root.retrieve().to("/user/keys", GHKey[].class)));
@@ -87,17 +83,15 @@ public List getPublicKeys() throws IOException {
/**
* Returns the read-only list of all the public verified keys of the current user.
*
- * Differently from the getPublicKeys() method, the retrieval of the user's
- * verified public keys does not require any READ/WRITE OAuth Scope to the
- * user's profile.
+ * Differently from the getPublicKeys() method, the retrieval of the user's verified public keys does not require
+ * any READ/WRITE OAuth Scope to the user's profile.
*
- * @return
- * Always non-null.
+ * @return Always non-null.
*/
- public List getPublicVerifiedKeys() throws IOException {
- return Collections.unmodifiableList(Arrays.asList(root.retrieve().to(
- "/users/" + getLogin() + "/keys", GHVerifiedKey[].class)));
- }
+ public List getPublicVerifiedKeys() throws IOException {
+ return Collections.unmodifiableList(
+ Arrays.asList(root.retrieve().to("/users/" + getLogin() + "/keys", GHVerifiedKey[].class)));
+ }
/**
* Gets the organization that this user belongs to.
@@ -106,7 +100,7 @@ public GHPersonSet getAllOrganizations() throws IOException {
GHPersonSet orgs = new GHPersonSet();
Set names = new HashSet();
for (GHOrganization o : root.retrieve().to("/user/orgs", GHOrganization[].class)) {
- if (names.add(o.getLogin())) // in case of rumoured duplicates in the data
+ if (names.add(o.getLogin())) // in case of rumoured duplicates in the data
orgs.add(root.getOrganization(o.getLogin()));
}
return orgs;
@@ -115,10 +109,10 @@ public GHPersonSet getAllOrganizations() throws IOException {
/**
* Gets the all repositories this user owns (public and private).
*/
- public synchronized Map getAllRepositories() throws IOException {
- Map repositories = new TreeMap();
+ public synchronized Map getAllRepositories() throws IOException {
+ Map repositories = new TreeMap();
for (GHRepository r : listAllRepositories()) {
- repositories.put(r.getName(),r);
+ repositories.put(r.getName(), r);
}
return Collections.unmodifiableMap(repositories);
}
@@ -126,48 +120,47 @@ public synchronized Map getAllRepositories() throws IOExcep
/**
* Lists up all repositories this user owns (public and private).
*
- * Unlike {@link #getAllRepositories()}, this does not wait until all the repositories are returned.
- * Repositories are returned by GitHub API with a 30 items per page.
+ * Unlike {@link #getAllRepositories()}, this does not wait until all the repositories are returned. Repositories
+ * are returned by GitHub API with a 30 items per page.
*/
@Override
public PagedIterable listRepositories() {
- return listRepositories(30);
+ return listRepositories(30);
}
/**
- * List repositories that are accessible to the authenticated user (public and private) using the specified page size.
+ * List repositories that are accessible to the authenticated user (public and private) using the specified page
+ * size.
*
- * This includes repositories owned by the authenticated user, repositories that belong to other users
- * where the authenticated user is a collaborator, and other organizations' repositories that the authenticated
- * user has access to through an organization membership.
+ * This includes repositories owned by the authenticated user, repositories that belong to other users where the
+ * authenticated user is a collaborator, and other organizations' repositories that the authenticated user has
+ * access to through an organization membership.
*
- * @param pageSize size for each page of items returned by GitHub. Maximum page size is 100.
+ * @param pageSize
+ * size for each page of items returned by GitHub. Maximum page size is 100.
*
- * Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
+ * Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
*/
public PagedIterable listRepositories(final int pageSize) {
return listRepositories(pageSize, RepositoryListFilter.ALL);
}
/**
- * List repositories of a certain type that are accessible by current authenticated user using the specified page size.
+ * List repositories of a certain type that are accessible by current authenticated user using the specified page
+ * size.
*
- * @param pageSize size for each page of items returned by GitHub. Maximum page size is 100.
- * @param repoType type of repository returned in the listing
+ * @param pageSize
+ * size for each page of items returned by GitHub. Maximum page size is 100.
+ * @param repoType
+ * type of repository returned in the listing
*/
public PagedIterable listRepositories(final int pageSize, final RepositoryListFilter repoType) {
- return root.retrieve()
- .with("type",repoType)
- .asPagedIterable(
- "/user/repos",
- GHRepository[].class,
- item -> item.wrap(root)
- ).withPageSize(pageSize);
+ return root.retrieve().with("type", repoType)
+ .asPagedIterable("/user/repos", GHRepository[].class, item -> item.wrap(root)).withPageSize(pageSize);
}
/**
- * @deprecated
- * Use {@link #listRepositories()}
+ * @deprecated Use {@link #listRepositories()}
*/
public PagedIterable listAllRepositories() {
return listRepositories();
@@ -184,26 +177,22 @@ public PagedIterable listOrgMemberships() {
* List your organization memberships
*
* @param state
- * Filter by a specific state
+ * Filter by a specific state
*/
public PagedIterable listOrgMemberships(final GHMembership.State state) {
- return root.retrieve()
- .with("state",state)
- .asPagedIterable(
- "/user/memberships/orgs",
- GHMembership[].class,
- item -> item.wrap(root) );
+ return root.retrieve().with("state", state).asPagedIterable("/user/memberships/orgs", GHMembership[].class,
+ item -> item.wrap(root));
}
/**
* Gets your membership in a specific organization.
*/
public GHMembership getMembership(GHOrganization o) throws IOException {
- return root.retrieve().to("/user/memberships/orgs/"+o.getLogin(),GHMembership.class).wrap(root);
+ return root.retrieve().to("/user/memberships/orgs/" + o.getLogin(), GHMembership.class).wrap(root);
}
-// public void addEmails(Collection emails) throws IOException {
-//// new Requester(root,ApiVersion.V3).withCredential().to("/user/emails");
-// root.retrieveWithAuth3()
-// }
+ // public void addEmails(Collection emails) throws IOException {
+ //// new Requester(root,ApiVersion.V3).withCredential().to("/user/emails");
+ // root.retrieveWithAuth3()
+ // }
}
diff --git a/src/main/java/org/kohsuke/github/GHNotificationStream.java b/src/main/java/org/kohsuke/github/GHNotificationStream.java
index b8f8d7c296..4a8e733193 100644
--- a/src/main/java/org/kohsuke/github/GHNotificationStream.java
+++ b/src/main/java/org/kohsuke/github/GHNotificationStream.java
@@ -9,19 +9,15 @@
* Listens to GitHub notification stream.
*
*
- * This class supports two modes of retrieving notifications that can
- * be controlled via {@link #nonBlocking(boolean)}.
+ * This class supports two modes of retrieving notifications that can be controlled via {@link #nonBlocking(boolean)}.
*
*
- * In the blocking mode, which is the default, iterator will be infinite.
- * The call to {@link Iterator#next()} will block until a new notification
- * arrives. This is useful for application that runs perpetually and reacts
- * to notifications.
+ * In the blocking mode, which is the default, iterator will be infinite. The call to {@link Iterator#next()} will block
+ * until a new notification arrives. This is useful for application that runs perpetually and reacts to notifications.
*
*
- * In the non-blocking mode, the iterator will only report the set of
- * notifications initially retrieved from GitHub, then quit. This is useful
- * for a batch application to process the current set of notifications.
+ * In the non-blocking mode, the iterator will only report the set of notifications initially retrieved from GitHub,
+ * then quit. This is useful for a batch application to process the current set of notifications.
*
* @author Kohsuke Kawaguchi
* @see GitHub#listNotifications()
@@ -35,7 +31,7 @@ public class GHNotificationStream implements Iterable {
private String apiUrl;
private boolean nonBlocking = false;
- /*package*/ GHNotificationStream(GitHub root, String apiUrl) {
+ GHNotificationStream(GitHub root, String apiUrl) {
this.root = root;
this.apiUrl = apiUrl;
}
@@ -49,8 +45,7 @@ public GHNotificationStream read(boolean v) {
}
/**
- * Should the stream be restricted to notifications in which the user
- * is directly participating or mentioned?
+ * Should the stream be restricted to notifications in which the user is directly participating or mentioned?
*/
public GHNotificationStream participating(boolean v) {
participating = v;
@@ -67,8 +62,8 @@ public GHNotificationStream since(Date dt) {
}
/**
- * If set to true, {@link #iterator()} will stop iterating instead of blocking and
- * waiting for the updates to arrive.
+ * If set to true, {@link #iterator()} will stop iterating instead of blocking and waiting for the updates to
+ * arrive.
*/
public GHNotificationStream nonBlocking(boolean v) {
this.nonBlocking = v;
@@ -76,25 +71,23 @@ public GHNotificationStream nonBlocking(boolean v) {
}
/**
- * Returns an infinite blocking {@link Iterator} that returns
- * {@link GHThread} as notifications arrive.
+ * Returns an infinite blocking {@link Iterator} that returns {@link GHThread} as notifications arrive.
*/
public Iterator iterator() {
// capture the configuration setting here
- final Requester req = new Requester(root).method("GET")
- .with("all", all).with("participating", participating).with("since", since);
+ final Requester req = new Requester(root).method("GET").with("all", all).with("participating", participating)
+ .with("since", since);
return new Iterator() {
/**
- * Stuff we've fetched but haven't returned to the caller.
- * Newer ones first.
+ * Stuff we've fetched but haven't returned to the caller. Newer ones first.
*/
private GHThread[] threads = EMPTY_ARRAY;
/**
* Next element in {@link #threads} to return. This counts down.
*/
- private int idx=-1;
+ private int idx = -1;
/**
* threads whose updated_at is older than this should be ignored.
@@ -114,9 +107,9 @@ public Iterator iterator() {
private GHThread next;
public GHThread next() {
- if (next==null) {
+ if (next == null) {
next = fetch();
- if (next==null)
+ if (next == null)
throw new NoSuchElementException();
}
@@ -126,9 +119,9 @@ public GHThread next() {
}
public boolean hasNext() {
- if (next==null)
+ if (next == null)
next = fetch();
- return next!=null;
+ return next != null;
}
GHThread fetch() {
@@ -136,7 +129,7 @@ GHThread fetch() {
while (true) {// loop until we get new threads to return
// if we have fetched un-returned threads, use them first
- while (idx>=0) {
+ while (idx >= 0) {
GHThread n = threads[idx--];
long nt = n.getUpdatedAt().getTime();
if (nt >= lastUpdated) {
@@ -145,13 +138,14 @@ GHThread fetch() {
}
}
- if (nonBlocking && nextCheckTime>=0)
- return null; // nothing more to report, and we aren't blocking
+ if (nonBlocking && nextCheckTime >= 0)
+ return null; // nothing more to report, and we aren't blocking
// observe the polling interval before making the call
while (true) {
long now = System.currentTimeMillis();
- if (nextCheckTime < now) break;
+ if (nextCheckTime < now)
+ break;
long waitTime = Math.min(Math.max(nextCheckTime - now, 1000), 60 * 1000);
Thread.sleep(waitTime);
}
@@ -159,13 +153,13 @@ GHThread fetch() {
req.setHeader("If-Modified-Since", lastModified);
threads = req.to(apiUrl, GHThread[].class);
- if (threads==null) {
- threads = EMPTY_ARRAY; // if unmodified, we get empty array
+ if (threads == null) {
+ threads = EMPTY_ARRAY; // if unmodified, we get empty array
} else {
// we get a new batch, but we want to ignore the ones that we've seen
lastUpdated++;
}
- idx = threads.length-1;
+ idx = threads.length - 1;
nextCheckTime = calcNextCheckTime();
lastModified = req.getResponseHeader("Last-Modified");
@@ -179,9 +173,10 @@ GHThread fetch() {
private long calcNextCheckTime() {
String v = req.getResponseHeader("X-Poll-Interval");
- if (v==null) v="60";
+ if (v == null)
+ v = "60";
long seconds = Integer.parseInt(v);
- return System.currentTimeMillis() + seconds*1000;
+ return System.currentTimeMillis() + seconds * 1000;
}
public void remove() {
@@ -199,7 +194,7 @@ public void markAsRead() throws IOException {
*/
public void markAsRead(long timestamp) throws IOException {
final Requester req = new Requester(root).method("PUT");
- if (timestamp>=0)
+ if (timestamp >= 0)
req.with("last_read_at", GitHub.printDate(new Date(timestamp)));
req.asHttpStatusCode(apiUrl);
}
diff --git a/src/main/java/org/kohsuke/github/GHOTPRequiredException.java b/src/main/java/org/kohsuke/github/GHOTPRequiredException.java
index f7d935bd54..3bfd2e1150 100644
--- a/src/main/java/org/kohsuke/github/GHOTPRequiredException.java
+++ b/src/main/java/org/kohsuke/github/GHOTPRequiredException.java
@@ -1,10 +1,11 @@
-package org.kohsuke.github;
-/**
- * This exception is thrown when GitHub is requesting an OTP from the user
- *
- * @author Kevin Harrington mad.hephaestus@gmail.com
- *
- */
-public class GHOTPRequiredException extends GHIOException {
-//...
-}
+package org.kohsuke.github;
+
+/**
+ * This exception is thrown when GitHub is requesting an OTP from the user
+ *
+ * @author Kevin Harrington mad.hephaestus@gmail.com
+ *
+ */
+public class GHOTPRequiredException extends GHIOException {
+ // ...
+}
diff --git a/src/main/java/org/kohsuke/github/GHObject.java b/src/main/java/org/kohsuke/github/GHObject.java
index 2bad0891bc..4251162253 100644
--- a/src/main/java/org/kohsuke/github/GHObject.java
+++ b/src/main/java/org/kohsuke/github/GHObject.java
@@ -16,8 +16,8 @@
/**
* Most (all?) domain objects in GitHub seems to have these 4 properties.
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public abstract class GHObject {
/**
* Capture response HTTP headers on the state object.
@@ -29,28 +29,35 @@ public abstract class GHObject {
protected String created_at;
protected String updated_at;
- /*package*/ GHObject() {
+ GHObject() {
}
/**
* Returns the HTTP response headers given along with the state of this object.
*
*
- * Some of the HTTP headers have nothing to do with the object, for example "Cache-Control"
- * and others are different depending on how this object was retrieved.
+ * Some of the HTTP headers have nothing to do with the object, for example "Cache-Control" and others are different
+ * depending on how this object was retrieved.
*
- * This method was added as a kind of hack to allow the caller to retrieve OAuth scopes and such.
- * Use with caution. The method might be removed in the future.
+ * This method was added as a kind of hack to allow the caller to retrieve OAuth scopes and such. Use with caution.
+ * The method might be removed in the future.
+ *
+ * @return a map of header names to value lists
*/
- @CheckForNull @Deprecated
+ @CheckForNull
+ @Deprecated
public Map> getResponseHeaderFields() {
return responseHeaderFields;
}
/**
* When was this resource created?
+ *
+ * @return date created
+ * @throws IOException
+ * on error
*/
- @WithBridgeMethods(value=String.class, adapterMethod="createdAtStr")
+ @WithBridgeMethods(value = String.class, adapterMethod = "createdAtStr")
public Date getCreatedAt() throws IOException {
return GitHub.parseDate(created_at);
}
@@ -61,51 +68,57 @@ private Object createdAtStr(Date id, Class type) {
}
/**
- * API URL of this object.
+ * @return API URL of this object.
*/
- @WithBridgeMethods(value=String.class, adapterMethod="urlToString")
+ @WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
public URL getUrl() {
return GitHub.parseURL(url);
}
/**
- * URL of this object for humans, which renders some HTML.
+ * @return URL of this object for humans, which renders some HTML.
+ * @throws IOException
+ * on error
*/
- @WithBridgeMethods(value=String.class, adapterMethod="urlToString")
+ @WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
public abstract URL getHtmlUrl() throws IOException;
/**
* When was this resource last updated?
+ *
+ * @return updated date
+ * @throws IOException
+ * on error
*/
public Date getUpdatedAt() throws IOException {
return GitHub.parseDate(updated_at);
}
/**
- * Unique ID number of this resource.
+ * @return Unique ID number of this resource.
*/
- @WithBridgeMethods(value={String.class,int.class}, adapterMethod="longToStringOrInt")
+ @WithBridgeMethods(value = { String.class, int.class }, adapterMethod = "longToStringOrInt")
public long getId() {
return id;
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getId")
private Object longToStringOrInt(long id, Class type) {
- if (type==String.class)
+ if (type == String.class)
return String.valueOf(id);
- if (type==int.class)
- return (int)id;
- throw new AssertionError("Unexpected type: "+type);
+ if (type == int.class)
+ return (int) id;
+ throw new AssertionError("Unexpected type: " + type);
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getHtmlUrl")
private Object urlToString(URL url, Class type) {
- return url==null ? null : url.toString();
+ return url == null ? null : url.toString();
}
/**
- * String representation to assist debugging and inspection. The output format of this string
- * is not a committed part of the API and is subject to change.
+ * String representation to assist debugging and inspection. The output format of this string is not a committed
+ * part of the API and is subject to change.
*/
@Override
public String toString() {
@@ -134,7 +147,7 @@ public void append(StringBuffer buffer, String fieldName, Object value, Boolean
if (value instanceof GitHub)
return;
- super.append(buffer,fieldName,value,fullDetail);
+ super.append(buffer, fieldName, value, fullDetail);
}
};
}
diff --git a/src/main/java/org/kohsuke/github/GHOrgHook.java b/src/main/java/org/kohsuke/github/GHOrgHook.java
index 58404019bf..d13f766401 100644
--- a/src/main/java/org/kohsuke/github/GHOrgHook.java
+++ b/src/main/java/org/kohsuke/github/GHOrgHook.java
@@ -8,9 +8,9 @@ class GHOrgHook extends GHHook {
/**
* Organization that the hook belongs to.
*/
- /*package*/ transient GHOrganization organization;
+ transient GHOrganization organization;
- /*package*/ GHOrgHook wrap(GHOrganization owner) {
+ GHOrgHook wrap(GHOrganization owner) {
this.organization = owner;
return this;
}
diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java
index 2b56d02f07..a2366136d2 100644
--- a/src/main/java/org/kohsuke/github/GHOrganization.java
+++ b/src/main/java/org/kohsuke/github/GHOrganization.java
@@ -15,53 +15,53 @@
* @author Kohsuke Kawaguchi
*/
public class GHOrganization extends GHPerson {
- /*package*/ GHOrganization wrapUp(GitHub root) {
- return (GHOrganization)super.wrapUp(root);
+ GHOrganization wrapUp(GitHub root) {
+ return (GHOrganization) super.wrapUp(root);
}
/**
* Creates a new repository.
*
- * @return
- * Newly created repository.
- * @deprecated
- * Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
+ * @return Newly created repository.
+ * @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
*/
- public GHRepository createRepository(String name, String description, String homepage, String team, boolean isPublic) throws IOException {
+ public GHRepository createRepository(String name, String description, String homepage, String team,
+ boolean isPublic) throws IOException {
GHTeam t = getTeams().get(team);
- if (t==null)
- throw new IllegalArgumentException("No such team: "+team);
+ if (t == null)
+ throw new IllegalArgumentException("No such team: " + team);
return createRepository(name, description, homepage, t, isPublic);
}
/**
- * @deprecated
- * Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
+ * @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
*/
- public GHRepository createRepository(String name, String description, String homepage, GHTeam team, boolean isPublic) throws IOException {
- if (team==null)
+ public GHRepository createRepository(String name, String description, String homepage, GHTeam team,
+ boolean isPublic) throws IOException {
+ if (team == null)
throw new IllegalArgumentException("Invalid team");
- return createRepository(name).description(description).homepage(homepage).private_(!isPublic).team(team).create();
+ return createRepository(name).description(description).homepage(homepage).private_(!isPublic).team(team)
+ .create();
}
/**
* Starts a builder that creates a new repository.
*
*
- * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()}
- * to finally createa repository.
+ * You use the returned builder to set various properties, then call {@link GHCreateRepositoryBuilder#create()} to
+ * finally createa repository.
*/
public GHCreateRepositoryBuilder createRepository(String name) {
- return new GHCreateRepositoryBuilder(root,"/orgs/"+login+"/repos",name);
+ return new GHCreateRepositoryBuilder(root, "/orgs/" + login + "/repos", name);
}
/**
* Teams by their names.
*/
- public Map getTeams() throws IOException {
- Map r = new TreeMap();
+ public Map getTeams() throws IOException {
+ Map r = new TreeMap();
for (GHTeam t : listTeams()) {
- r.put(t.getName(),t);
+ r.put(t.getName(), t);
}
return r;
}
@@ -70,11 +70,8 @@ public Map getTeams() throws IOException {
* List up all the teams.
*/
public PagedIterable listTeams() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- String.format("/orgs/%s/teams", login),
- GHTeam[].class,
- item -> item.wrapUp(GHOrganization.this) );
+ return root.retrieve().asPagedIterable(String.format("/orgs/%s/teams", login), GHTeam[].class,
+ item -> item.wrapUp(GHOrganization.this));
}
/**
@@ -82,7 +79,7 @@ public PagedIterable listTeams() throws IOException {
*/
public GHTeam getTeamByName(String name) throws IOException {
for (GHTeam t : listTeams()) {
- if(t.getName().equals(name))
+ if (t.getName().equals(name))
return t;
}
return null;
@@ -93,7 +90,7 @@ public GHTeam getTeamByName(String name) throws IOException {
*/
public GHTeam getTeamBySlug(String slug) throws IOException {
for (GHTeam t : listTeams()) {
- if(t.getSlug().equals(slug))
+ if (t.getSlug().equals(slug))
return t;
}
return null;
@@ -101,17 +98,19 @@ public GHTeam getTeamBySlug(String slug) throws IOException {
/** Member's role in an organization */
public enum Role {
- ADMIN, /** The user is an owner of the organization. */
+ ADMIN,
+ /** The user is an owner of the organization. */
MEMBER /** The user is a non-owner member of the organization. */
}
/**
* Adds (invites) a user to the organization.
- * @see documentation
+ *
+ * @see documentation
*/
public void add(GHUser user, Role role) throws IOException {
- root.retrieve().method("PUT")
- .with("role", role.name().toLowerCase())
+ root.retrieve().method("PUT").with("role", role.name().toLowerCase())
.to("/orgs/" + login + "/memberships/" + user.getLogin());
}
@@ -120,7 +119,7 @@ public void add(GHUser user, Role role) throws IOException {
*/
public boolean hasMember(GHUser user) {
try {
- root.retrieve().to("/orgs/" + login + "/members/" + user.getLogin());
+ root.retrieve().to("/orgs/" + login + "/members/" + user.getLogin());
return true;
} catch (IOException ignore) {
return false;
@@ -128,11 +127,11 @@ public boolean hasMember(GHUser user) {
}
/**
- * Remove a member of the organisation - which will remove them from
- * all teams, and remove their access to the organization’s repositories.
+ * Remove a member of the organisation - which will remove them from all teams, and remove their access to the
+ * organization’s repositories.
*/
public void remove(GHUser user) throws IOException {
- root.retrieve().method("DELETE").to("/orgs/" + login + "/members/" + user.getLogin());
+ root.retrieve().method("DELETE").to("/orgs/" + login + "/members/" + user.getLogin());
}
/**
@@ -185,11 +184,8 @@ public PagedIterable listMembersWithFilter(String filter) throws IOExcep
private PagedIterable listMembers(final String suffix, final String filter) throws IOException {
String filterParams = (filter == null) ? "" : ("?filter=" + filter);
- return root.retrieve()
- .asPagedIterable(
- String.format("/orgs/%s/%s%s", login, suffix, filterParams),
- GHUser[].class,
- item -> item.wrapUp(root) );
+ return root.retrieve().asPagedIterable(String.format("/orgs/%s/%s%s", login, suffix, filterParams),
+ GHUser[].class, item -> item.wrapUp(root));
}
/**
@@ -201,15 +197,13 @@ public void conceal(GHUser u) throws IOException {
/**
* Returns the projects for this organization.
- * @param status The status filter (all, open or closed).
+ *
+ * @param status
+ * The status filter (all, open or closed).
*/
public PagedIterable listProjects(final GHProject.ProjectStateFilter status) throws IOException {
- return root.retrieve().withPreview(INERTIA)
- .with("state", status)
- .asPagedIterable(
- String.format("/orgs/%s/projects", login),
- GHProject[].class,
- item -> item.wrap(root) );
+ return root.retrieve().withPreview(INERTIA).with("state", status)
+ .asPagedIterable(String.format("/orgs/%s/projects", login), GHProject[].class, item -> item.wrap(root));
}
/**
@@ -223,14 +217,13 @@ public PagedIterable listProjects() throws IOException {
* Creates a project for the organization.
*/
public GHProject createProject(String name, String body) throws IOException {
- return root.retrieve().method("POST")
- .withPreview(INERTIA)
- .with("name", name)
- .with("body", body)
+ return root.retrieve().method("POST").withPreview(INERTIA).with("name", name).with("body", body)
.to(String.format("/orgs/%s/projects", login), GHProject.class).wrap(root);
}
- public enum Permission { ADMIN, PUSH, PULL }
+ public enum Permission {
+ ADMIN, PUSH, PULL
+ }
/**
* Creates a new team and assigns the repositories.
@@ -241,7 +234,7 @@ public GHTeam createTeam(String name, Permission p, Collection rep
for (GHRepository r : repositories) {
repo_names.add(login + "/" + r.getName());
}
- post.with("repo_names",repo_names);
+ post.with("repo_names", repo_names);
return post.method("POST").to("/orgs/" + login + "/teams", GHTeam.class).wrapUp(this);
}
@@ -252,8 +245,8 @@ public GHTeam createTeam(String name, Permission p, GHRepository... repositories
/**
* List up repositories that has some open pull requests.
*
- * This used to be an efficient method that didn't involve traversing every repository, but now
- * it doesn't do any optimization.
+ * This used to be an efficient method that didn't involve traversing every repository, but now it doesn't do any
+ * optimization.
*/
public List getRepositoriesWithOpenPullRequests() throws IOException {
List r = new ArrayList();
@@ -282,28 +275,23 @@ public List getPullRequests() throws IOException {
* Lists events performed by a user (this includes private events if the caller is authenticated.
*/
public PagedIterable listEvents() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- String.format("/orgs/%s/events", login),
- GHEventInfo[].class,
- item -> item.wrapUp(root) );
+ return root.retrieve().asPagedIterable(String.format("/orgs/%s/events", login), GHEventInfo[].class,
+ item -> item.wrapUp(root));
}
/**
* Lists up all the repositories using the specified page size.
*
- * @param pageSize size for each page of items returned by GitHub. Maximum page size is 100.
+ * @param pageSize
+ * size for each page of items returned by GitHub. Maximum page size is 100.
*
- * Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
+ * Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
*/
@Override
public PagedIterable listRepositories(final int pageSize) {
return root.retrieve()
- .asPagedIterable(
- "/orgs/" + login + "/repos",
- GHRepository[].class,
- item -> item.wrap(root)
- ).withPageSize(pageSize);
+ .asPagedIterable("/orgs/" + login + "/repos", GHRepository[].class, item -> item.wrap(root))
+ .withPageSize(pageSize);
}
/**
@@ -319,22 +307,23 @@ public GHHook getHook(int id) throws IOException {
/**
*
- * See https://api.github.com/hooks for possible names and their configuration scheme.
- * TODO: produce type-safe binding
+ * See https://api.github.com/hooks for possible names and their configuration scheme. TODO: produce type-safe
+ * binding
*
* @param name
- * Type of the hook to be created. See https://api.github.com/hooks for possible names.
+ * Type of the hook to be created. See https://api.github.com/hooks for possible names.
* @param config
- * The configuration hash.
+ * The configuration hash.
* @param events
- * Can be null. Types of events to hook into.
+ * Can be null. Types of events to hook into.
*/
- public GHHook createHook(String name, Map config, Collection events, boolean active) throws IOException {
+ public GHHook createHook(String name, Map config, Collection events, boolean active)
+ throws IOException {
return GHHooks.orgContext(this).createHook(name, config, events, active);
}
public GHHook createWebHook(URL url, Collection events) throws IOException {
- return createHook("web", Collections.singletonMap("url", url.toExternalForm()),events,true);
+ return createHook("web", Collections.singletonMap("url", url.toExternalForm()), events, true);
}
public GHHook createWebHook(URL url) throws IOException {
diff --git a/src/main/java/org/kohsuke/github/GHPermission.java b/src/main/java/org/kohsuke/github/GHPermission.java
index 51a808dfc0..2f97576e6e 100644
--- a/src/main/java/org/kohsuke/github/GHPermission.java
+++ b/src/main/java/org/kohsuke/github/GHPermission.java
@@ -28,9 +28,10 @@
/**
* Permission for a user in a repository.
+ *
* @see API
*/
-/*package*/ class GHPermission {
+class GHPermission {
private String permission;
private GHUser user;
diff --git a/src/main/java/org/kohsuke/github/GHPermissionType.java b/src/main/java/org/kohsuke/github/GHPermissionType.java
index d3e2bd0909..b3f4664f33 100644
--- a/src/main/java/org/kohsuke/github/GHPermissionType.java
+++ b/src/main/java/org/kohsuke/github/GHPermissionType.java
@@ -4,8 +4,5 @@
* @author Kohsuke Kawaguchi
*/
public enum GHPermissionType {
- ADMIN,
- WRITE,
- READ,
- NONE
+ ADMIN, WRITE, READ, NONE
}
diff --git a/src/main/java/org/kohsuke/github/GHPerson.java b/src/main/java/org/kohsuke/github/GHPerson.java
index 137dd5b368..d93d6f9f49 100644
--- a/src/main/java/org/kohsuke/github/GHPerson.java
+++ b/src/main/java/org/kohsuke/github/GHPerson.java
@@ -13,21 +13,21 @@
/**
* Common part of {@link GHUser} and {@link GHOrganization}.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public abstract class GHPerson extends GHObject {
- /*package almost final*/ GitHub root;
+ /* package almost final */ GitHub root;
// core data fields that exist even for "small" user data (such as the user info in pull request)
protected String login, avatar_url, gravatar_id;
// other fields (that only show up in full data)
- protected String location,blog,email,name,company;
+ protected String location, blog, email, name, company;
protected String html_url;
- protected int followers,following,public_repos,public_gists;
+ protected int followers, following, public_repos, public_gists;
- /*package*/ GHPerson wrapUp(GitHub root) {
+ GHPerson wrapUp(GitHub root) {
this.root = root;
return this;
}
@@ -38,7 +38,7 @@ public abstract class GHPerson extends GHObject {
* Depending on the original API call where this object is created, it may not contain everything.
*/
protected synchronized void populate() throws IOException {
- if (created_at!=null) {
+ if (created_at != null) {
return; // already populated
}
if (root == null || root.isOffline()) {
@@ -51,13 +51,12 @@ protected synchronized void populate() throws IOException {
* Gets the public repositories this user owns.
*
*
- * To list your own repositories, including private repositories,
- * use {@link GHMyself#listRepositories()}
+ * To list your own repositories, including private repositories, use {@link GHMyself#listRepositories()}
*/
- public synchronized Map getRepositories() throws IOException {
- Map repositories = new TreeMap();
+ public synchronized Map getRepositories() throws IOException {
+ Map repositories = new TreeMap();
for (GHRepository r : listRepositories(100)) {
- repositories.put(r.getName(),r);
+ repositories.put(r.getName(), r);
}
return Collections.unmodifiableMap(repositories);
}
@@ -68,43 +67,41 @@ public synchronized Map getRepositories() throws IOExceptio
* Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
*/
public PagedIterable listRepositories() {
- return listRepositories(30);
+ return listRepositories(30);
}
/**
* Lists up all the repositories using the specified page size.
*
- * @param pageSize size for each page of items returned by GitHub. Maximum page size is 100.
+ * @param pageSize
+ * size for each page of items returned by GitHub. Maximum page size is 100.
*
- * Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
+ * Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
*/
public PagedIterable listRepositories(final int pageSize) {
return root.retrieve()
- .asPagedIterable(
- "/users/" + login + "/repos",
- GHRepository[].class,
- item -> item.wrap(root)
- ).withPageSize(pageSize);
+ .asPagedIterable("/users/" + login + "/repos", GHRepository[].class, item -> item.wrap(root))
+ .withPageSize(pageSize);
}
/**
* Loads repository list in a paginated fashion.
*
*
- * For a person with a lot of repositories, GitHub returns the list of repositories in a paginated fashion.
- * Unlike {@link #getRepositories()}, this method allows the caller to start processing data as it arrives.
+ * For a person with a lot of repositories, GitHub returns the list of repositories in a paginated fashion. Unlike
+ * {@link #getRepositories()}, this method allows the caller to start processing data as it arrives.
*
- * Every {@link Iterator#next()} call results in I/O. Exceptions that occur during the processing is wrapped
- * into {@link Error}.
+ * Every {@link Iterator#next()} call results in I/O. Exceptions that occur during the processing is wrapped into
+ * {@link Error}.
*
- * @deprecated
- * Use {@link #listRepositories()}
+ * @deprecated Use {@link #listRepositories()}
*/
@Deprecated
public synchronized Iterable> iterateRepositories(final int pageSize) {
return new Iterable>() {
public Iterator> iterator() {
- final Iterator pager = root.retrieve().asIterator("/users/" + login + "/repos",GHRepository[].class, pageSize);
+ final Iterator pager = root.retrieve().asIterator("/users/" + login + "/repos",
+ GHRepository[].class, pageSize);
return new Iterator>() {
public boolean hasNext() {
@@ -128,8 +125,7 @@ public void remove() {
/**
*
- * @return
- * null if the repository was not found
+ * @return null if the repository was not found
*/
public GHRepository getRepository(String name) throws IOException {
try {
@@ -147,22 +143,21 @@ public GHRepository getRepository(String name) throws IOException {
/**
* Gravatar ID of this user, like 0cb9832a01c22c083390f3c5dcb64105
*
- * @deprecated
- * No longer available in the v3 API.
+ * @deprecated No longer available in the v3 API.
*/
public String getGravatarId() {
return gravatar_id;
}
/**
- * Returns a string like 'https://secure.gravatar.com/avatar/0cb9832a01c22c083390f3c5dcb64105'
- * that indicates the avatar image URL.
+ * Returns a string like 'https://secure.gravatar.com/avatar/0cb9832a01c22c083390f3c5dcb64105' that indicates the
+ * avatar image URL.
*/
public String getAvatarUrl() {
- if (avatar_url!=null)
+ if (avatar_url != null)
return avatar_url;
- if (gravatar_id!=null)
- return "https://secure.gravatar.com/avatar/"+gravatar_id;
+ if (gravatar_id != null)
+ return "https://secure.gravatar.com/avatar/" + gravatar_id;
return null;
}
diff --git a/src/main/java/org/kohsuke/github/GHPersonSet.java b/src/main/java/org/kohsuke/github/GHPersonSet.java
index eb35b1bf7a..2a68a3ff57 100644
--- a/src/main/java/org/kohsuke/github/GHPersonSet.java
+++ b/src/main/java/org/kohsuke/github/GHPersonSet.java
@@ -6,12 +6,12 @@
/**
* Set of {@link GHPerson} with helper lookup methods.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class GHPersonSet extends HashSet {
private static final long serialVersionUID = 1L;
-
+
public GHPersonSet() {
}
@@ -39,5 +39,5 @@ public T byLogin(String login) {
if (t.getLogin().equals(login))
return t;
return null;
- }
+ }
}
diff --git a/src/main/java/org/kohsuke/github/GHProject.java b/src/main/java/org/kohsuke/github/GHProject.java
index 66e347cbc3..35198666e4 100644
--- a/src/main/java/org/kohsuke/github/GHProject.java
+++ b/src/main/java/org/kohsuke/github/GHProject.java
@@ -32,6 +32,7 @@
/**
* A GitHub project.
+ *
* @see Projects
* @author Martin van Zijl
*/
@@ -58,13 +59,13 @@ public GitHub getRoot() {
}
public GHObject getOwner() throws IOException {
- if(owner == null) {
+ if (owner == null) {
try {
- if(owner_url.contains("/orgs/")) {
+ if (owner_url.contains("/orgs/")) {
owner = root.retrieve().to(getOwnerUrl().getPath(), GHOrganization.class).wrapUp(root);
- } else if(owner_url.contains("/users/")) {
+ } else if (owner_url.contains("/users/")) {
owner = root.retrieve().to(getOwnerUrl().getPath(), GHUser.class).wrapUp(root);
- } else if(owner_url.contains("/repos/")) {
+ } else if (owner_url.contains("/repos/")) {
owner = root.retrieve().to(getOwnerUrl().getPath(), GHRepository.class).wrap(root);
}
} catch (FileNotFoundException e) {
@@ -130,8 +131,7 @@ public void setBody(String body) throws IOException {
}
public enum ProjectState {
- OPEN,
- CLOSED
+ OPEN, CLOSED
}
public void setState(ProjectState state) throws IOException {
@@ -139,22 +139,19 @@ public void setState(ProjectState state) throws IOException {
}
public static enum ProjectStateFilter {
- ALL,
- OPEN,
- CLOSED
+ ALL, OPEN, CLOSED
}
/**
- * Set the permission level that all members of the project's organization will have on this project.
- * Only applicable for organization-owned projects.
+ * Set the permission level that all members of the project's organization will have on this project. Only
+ * applicable for organization-owned projects.
*/
public void setOrganizationPermission(GHPermissionType permission) throws IOException {
edit("organization_permission", permission.toString().toLowerCase());
}
/**
- * Sets visibility of the project within the organization.
- * Only applicable for organization-owned projects.
+ * Sets visibility of the project within the organization. Only applicable for organization-owned projects.
*/
public void setPublic(boolean isPublic) throws IOException {
edit("public", isPublic);
@@ -166,18 +163,12 @@ public void delete() throws IOException {
public PagedIterable listColumns() throws IOException {
final GHProject project = this;
- return root.retrieve()
- .withPreview(INERTIA)
- .asPagedIterable(
- String.format("/projects/%d/columns", id),
- GHProjectColumn[].class,
- item -> item.wrap(project) );
+ return root.retrieve().withPreview(INERTIA).asPagedIterable(String.format("/projects/%d/columns", id),
+ GHProjectColumn[].class, item -> item.wrap(project));
}
public GHProjectColumn createColumn(String name) throws IOException {
- return root.retrieve().method("POST")
- .withPreview(INERTIA)
- .with("name", name)
+ return root.retrieve().method("POST").withPreview(INERTIA).with("name", name)
.to(String.format("/projects/%d/columns", id), GHProjectColumn.class).wrap(this);
}
}
\ No newline at end of file
diff --git a/src/main/java/org/kohsuke/github/GHProjectCard.java b/src/main/java/org/kohsuke/github/GHProjectCard.java
index d6fb97cd87..574c016420 100644
--- a/src/main/java/org/kohsuke/github/GHProjectCard.java
+++ b/src/main/java/org/kohsuke/github/GHProjectCard.java
@@ -12,112 +12,112 @@
* @author Gunnar Skjold
*/
public class GHProjectCard extends GHObject {
- private GitHub root;
- private GHProject project;
- private GHProjectColumn column;
-
- private String note;
- private GHUser creator;
- private String content_url, project_url, column_url;
- private boolean archived;
-
- public URL getHtmlUrl() throws IOException {
- return null;
- }
-
- public GHProjectCard wrap(GitHub root) {
- this.root = root;
- return this;
- }
-
- public GHProjectCard wrap(GHProjectColumn column) {
- this.column = column;
- this.project = column.project;
- this.root = column.root;
- return this;
- }
-
- public GitHub getRoot() {
- return root;
- }
-
- public GHProject getProject() throws IOException {
- if(project == null) {
- try {
- project = root.retrieve().to(getProjectUrl().getPath(), GHProject.class).wrap(root);
- } catch (FileNotFoundException e) {
- return null;
- }
- }
- return project;
- }
-
- public GHProjectColumn getColumn() throws IOException {
- if(column == null) {
- try {
- column = root.retrieve().to(getColumnUrl().getPath(), GHProjectColumn.class).wrap(root);
- } catch (FileNotFoundException e) {
- return null;
- }
- }
- return column;
- }
-
- public GHIssue getContent() throws IOException {
- if(StringUtils.isEmpty(content_url))
- return null;
- try {
- if(content_url.contains("/pulls")) {
- return root.retrieve().to(getContentUrl().getPath(), GHPullRequest.class).wrap(root);
- } else {
- return root.retrieve().to(getContentUrl().getPath(), GHIssue.class).wrap(root);
- }
- } catch (FileNotFoundException e) {
- return null;
- }
- }
-
- public String getNote() {
- return note;
- }
-
- public GHUser getCreator() {
- return creator;
- }
-
- public URL getContentUrl() {
- return GitHub.parseURL(content_url);
- }
-
- public URL getProjectUrl() {
- return GitHub.parseURL(project_url);
- }
-
- public URL getColumnUrl() {
- return GitHub.parseURL(column_url);
- }
-
- public boolean isArchived() {
- return archived;
- }
-
- public void setNote(String note) throws IOException {
- edit("note", note);
- }
-
- public void setArchived(boolean archived) throws IOException {
- edit("archived", archived);
- }
-
- private void edit(String key, Object value) throws IOException {
- new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
- }
-
- protected String getApiRoute() {
- return String.format("/projects/columns/cards/%d", id);
- }
-
- public void delete() throws IOException {
- new Requester(root).withPreview(INERTIA).method("DELETE").to(getApiRoute());
- }
+ private GitHub root;
+ private GHProject project;
+ private GHProjectColumn column;
+
+ private String note;
+ private GHUser creator;
+ private String content_url, project_url, column_url;
+ private boolean archived;
+
+ public URL getHtmlUrl() throws IOException {
+ return null;
+ }
+
+ public GHProjectCard wrap(GitHub root) {
+ this.root = root;
+ return this;
+ }
+
+ public GHProjectCard wrap(GHProjectColumn column) {
+ this.column = column;
+ this.project = column.project;
+ this.root = column.root;
+ return this;
+ }
+
+ public GitHub getRoot() {
+ return root;
+ }
+
+ public GHProject getProject() throws IOException {
+ if (project == null) {
+ try {
+ project = root.retrieve().to(getProjectUrl().getPath(), GHProject.class).wrap(root);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+ return project;
+ }
+
+ public GHProjectColumn getColumn() throws IOException {
+ if (column == null) {
+ try {
+ column = root.retrieve().to(getColumnUrl().getPath(), GHProjectColumn.class).wrap(root);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+ return column;
+ }
+
+ public GHIssue getContent() throws IOException {
+ if (StringUtils.isEmpty(content_url))
+ return null;
+ try {
+ if (content_url.contains("/pulls")) {
+ return root.retrieve().to(getContentUrl().getPath(), GHPullRequest.class).wrap(root);
+ } else {
+ return root.retrieve().to(getContentUrl().getPath(), GHIssue.class).wrap(root);
+ }
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public GHUser getCreator() {
+ return creator;
+ }
+
+ public URL getContentUrl() {
+ return GitHub.parseURL(content_url);
+ }
+
+ public URL getProjectUrl() {
+ return GitHub.parseURL(project_url);
+ }
+
+ public URL getColumnUrl() {
+ return GitHub.parseURL(column_url);
+ }
+
+ public boolean isArchived() {
+ return archived;
+ }
+
+ public void setNote(String note) throws IOException {
+ edit("note", note);
+ }
+
+ public void setArchived(boolean archived) throws IOException {
+ edit("archived", archived);
+ }
+
+ private void edit(String key, Object value) throws IOException {
+ new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
+ }
+
+ protected String getApiRoute() {
+ return String.format("/projects/columns/cards/%d", id);
+ }
+
+ public void delete() throws IOException {
+ new Requester(root).withPreview(INERTIA).method("DELETE").to(getApiRoute());
+ }
}
diff --git a/src/main/java/org/kohsuke/github/GHProjectColumn.java b/src/main/java/org/kohsuke/github/GHProjectColumn.java
index 3b853962ff..3846e402d0 100644
--- a/src/main/java/org/kohsuke/github/GHProjectColumn.java
+++ b/src/main/java/org/kohsuke/github/GHProjectColumn.java
@@ -10,89 +10,82 @@
* @author Gunnar Skjold
*/
public class GHProjectColumn extends GHObject {
- protected GitHub root;
- protected GHProject project;
-
- private String name;
- private String project_url;
-
- @Override
- public URL getHtmlUrl() throws IOException {
- return null;
- }
-
- public GHProjectColumn wrap(GitHub root) {
- this.root = root;
- return this;
- }
-
- public GHProjectColumn wrap(GHProject project) {
- this.project = project;
- this.root = project.root;
- return this;
- }
-
- public GitHub getRoot() {
- return root;
- }
-
- public GHProject getProject() throws IOException {
- if(project == null) {
- try {
- project = root.retrieve().to(getProjectUrl().getPath(), GHProject.class).wrap(root);
- } catch (FileNotFoundException e) {
- return null;
- }
- }
- return project;
- }
-
- public String getName() {
- return name;
- }
-
- public URL getProjectUrl() {
- return GitHub.parseURL(project_url);
- }
-
- public void setName(String name) throws IOException {
- edit("name", name);
- }
-
- private void edit(String key, Object value) throws IOException {
- new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
- }
-
- protected String getApiRoute() {
- return String.format("/projects/columns/%d", id);
- }
-
- public void delete() throws IOException {
- new Requester(root).withPreview(INERTIA).method("DELETE").to(getApiRoute());
- }
-
- public PagedIterable listCards() throws IOException {
- final GHProjectColumn column = this;
- return root.retrieve()
- .withPreview(INERTIA)
- .asPagedIterable(
- String.format("/projects/columns/%d/cards", id),
- GHProjectCard[].class,
- item -> item.wrap(column) );
- }
-
- public GHProjectCard createCard(String note) throws IOException {
- return root.retrieve().method("POST")
- .withPreview(INERTIA)
- .with("note", note)
- .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class).wrap(this);
- }
-
- public GHProjectCard createCard(GHIssue issue) throws IOException {
- return root.retrieve().method("POST")
- .withPreview(INERTIA)
- .with("content_type", issue instanceof GHPullRequest ? "PullRequest" : "Issue")
- .with("content_id", issue.getId())
- .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class).wrap(this);
- }
+ protected GitHub root;
+ protected GHProject project;
+
+ private String name;
+ private String project_url;
+
+ @Override
+ public URL getHtmlUrl() throws IOException {
+ return null;
+ }
+
+ public GHProjectColumn wrap(GitHub root) {
+ this.root = root;
+ return this;
+ }
+
+ public GHProjectColumn wrap(GHProject project) {
+ this.project = project;
+ this.root = project.root;
+ return this;
+ }
+
+ public GitHub getRoot() {
+ return root;
+ }
+
+ public GHProject getProject() throws IOException {
+ if (project == null) {
+ try {
+ project = root.retrieve().to(getProjectUrl().getPath(), GHProject.class).wrap(root);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+ return project;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public URL getProjectUrl() {
+ return GitHub.parseURL(project_url);
+ }
+
+ public void setName(String name) throws IOException {
+ edit("name", name);
+ }
+
+ private void edit(String key, Object value) throws IOException {
+ new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
+ }
+
+ protected String getApiRoute() {
+ return String.format("/projects/columns/%d", id);
+ }
+
+ public void delete() throws IOException {
+ new Requester(root).withPreview(INERTIA).method("DELETE").to(getApiRoute());
+ }
+
+ public PagedIterable listCards() throws IOException {
+ final GHProjectColumn column = this;
+ return root.retrieve().withPreview(INERTIA).asPagedIterable(String.format("/projects/columns/%d/cards", id),
+ GHProjectCard[].class, item -> item.wrap(column));
+ }
+
+ public GHProjectCard createCard(String note) throws IOException {
+ return root.retrieve().method("POST").withPreview(INERTIA).with("note", note)
+ .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class).wrap(this);
+ }
+
+ public GHProjectCard createCard(GHIssue issue) throws IOException {
+ return root.retrieve().method("POST").withPreview(INERTIA)
+ .with("content_type", issue instanceof GHPullRequest ? "PullRequest" : "Issue")
+ .with("content_id", issue.getId())
+ .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class).wrap(this);
+ }
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequest.java b/src/main/java/org/kohsuke/github/GHPullRequest.java
index b4c3ee1645..3b7e3e120d 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequest.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequest.java
@@ -41,7 +41,7 @@
* @author Kohsuke Kawaguchi
* @see GHRepository#getPullRequest(int)
*/
-@SuppressWarnings({"UnusedDeclaration"})
+@SuppressWarnings({ "UnusedDeclaration" })
public class GHPullRequest extends GHIssue implements Refreshable {
private static final String COMMENTS_ACTION = "/comments";
@@ -69,52 +69,54 @@ public class GHPullRequest extends GHIssue implements Refreshable {
private GHTeam[] requested_teams;
/**
- * GitHub doesn't return some properties of {@link GHIssue} when requesting the GET on the 'pulls' API
- * route as opposed to 'issues' API route. This flag remembers whether we made the GET call on the 'issues' route
- * on this object to fill in those missing details
+ * GitHub doesn't return some properties of {@link GHIssue} when requesting the GET on the 'pulls' API route as
+ * opposed to 'issues' API route. This flag remembers whether we made the GET call on the 'issues' route on this
+ * object to fill in those missing details
*/
private transient boolean fetchedIssueDetails;
-
GHPullRequest wrapUp(GHRepository owner) {
this.wrap(owner);
return wrapUp(owner.root);
}
GHPullRequest wrapUp(GitHub root) {
- if (owner != null) owner.wrap(root);
- if (base != null) base.wrapUp(root);
- if (head != null) head.wrapUp(root);
- if (merged_by != null) merged_by.wrapUp(root);
- if (requested_reviewers != null) GHUser.wrap(requested_reviewers, root);
- if (requested_teams != null) GHTeam.wrapUp(requested_teams, this);
+ if (owner != null)
+ owner.wrap(root);
+ if (base != null)
+ base.wrapUp(root);
+ if (head != null)
+ head.wrapUp(root);
+ if (merged_by != null)
+ merged_by.wrapUp(root);
+ if (requested_reviewers != null)
+ GHUser.wrap(requested_reviewers, root);
+ if (requested_teams != null)
+ GHTeam.wrapUp(requested_teams, this);
return this;
}
@Override
protected String getApiRoute() {
- return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/pulls/"+number;
+ return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/pulls/" + number;
}
/**
- * The URL of the patch file.
- * like https://github.com/jenkinsci/jenkins/pull/100.patch
+ * The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch
*/
public URL getPatchUrl() {
return GitHub.parseURL(patch_url);
}
/**
- * The URL of the patch file.
- * like https://github.com/jenkinsci/jenkins/pull/100.patch
+ * The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch
*/
public URL getIssueUrl() {
return GitHub.parseURL(issue_url);
}
/**
- * This points to where the change should be pulled into,
- * but I'm not really sure what exactly it means.
+ * This points to where the change should be pulled into, but I'm not really sure what exactly it means.
*/
public GHCommitPointer getBase() {
return base;
@@ -133,8 +135,7 @@ public Date getIssueUpdatedAt() throws IOException {
}
/**
- * The diff file,
- * like https://github.com/jenkinsci/jenkins/pull/100.diff
+ * The diff file, like https://github.com/jenkinsci/jenkins/pull/100.diff
*/
public URL getDiffUrl() {
return GitHub.parseURL(diff_url);
@@ -202,10 +203,9 @@ public boolean isDraft() throws IOException {
/**
* Is this PR mergeable?
*
- * @return
- * null if the state has not been determined yet, for example when a PR is newly created.
- * If this method is called on an instance whose mergeable state is not yet known,
- * API call is made to retrieve the latest state.
+ * @return null if the state has not been determined yet, for example when a PR is newly created. If this method is
+ * called on an instance whose mergeable state is not yet known, API call is made to retrieve the latest
+ * state.
*/
public Boolean getMergeable() throws IOException {
refresh(mergeable);
@@ -220,7 +220,6 @@ Boolean getMergeableNoRefresh() throws IOException {
return mergeable;
}
-
public int getDeletions() throws IOException {
populate();
return deletions;
@@ -260,7 +259,8 @@ public List getRequestedTeams() throws IOException {
* Depending on the original API call where this object is created, it may not contain everything.
*/
private void populate() throws IOException {
- if (mergeable_state!=null) return; // already populated
+ if (mergeable_state != null)
+ return; // already populated
refresh();
}
@@ -271,30 +271,22 @@ public void refresh() throws IOException {
if (root.isOffline()) {
return; // cannot populate, will have to live with what we have
}
- root.retrieve()
- .withPreview(SHADOW_CAT)
- .to(url, this).wrapUp(owner);
+ root.retrieve().withPreview(SHADOW_CAT).to(url, this).wrapUp(owner);
}
/**
* Retrieves all the files associated to this pull request.
*/
public PagedIterable listFiles() {
- return root.retrieve()
- .asPagedIterable(
- String.format("%s/files", getApiRoute()),
- GHPullRequestFileDetail[].class,
- null);
+ return root.retrieve().asPagedIterable(String.format("%s/files", getApiRoute()),
+ GHPullRequestFileDetail[].class, null);
}
/**
* Retrieves all the reviews associated to this pull request.
*/
public PagedIterable listReviews() {
- return root.retrieve()
- .asPagedIterable(
- String.format("%s/reviews", getApiRoute()),
- GHPullRequestReview[].class,
+ return root.retrieve().asPagedIterable(String.format("%s/reviews", getApiRoute()), GHPullRequestReview[].class,
item -> item.wrapUp(GHPullRequest.this));
}
@@ -302,39 +294,31 @@ public PagedIterable listReviews() {
* Obtains all the review comments associated with this pull request.
*/
public PagedIterable listReviewComments() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- getApiRoute() + COMMENTS_ACTION,
- GHPullRequestReviewComment[].class,
- item -> item.wrapUp(GHPullRequest.this) );
+ return root.retrieve().asPagedIterable(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment[].class,
+ item -> item.wrapUp(GHPullRequest.this));
}
/**
* Retrieves all the commits associated to this pull request.
*/
public PagedIterable listCommits() {
- return root.retrieve()
- .asPagedIterable(
- String.format("%s/commits", getApiRoute()),
- GHPullRequestCommitDetail[].class,
- item -> item.wrapUp(GHPullRequest.this) );
+ return root.retrieve().asPagedIterable(String.format("%s/commits", getApiRoute()),
+ GHPullRequestCommitDetail[].class, item -> item.wrapUp(GHPullRequest.this));
}
/**
- * @deprecated
- * Use {@link #createReview()}
+ * @deprecated Use {@link #createReview()}
*/
public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event,
- GHPullRequestReviewComment... comments) throws IOException {
+ GHPullRequestReviewComment... comments) throws IOException {
return createReview(body, event, Arrays.asList(comments));
}
/**
- * @deprecated
- * Use {@link #createReview()}
+ * @deprecated Use {@link #createReview()}
*/
public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event,
- List comments) throws IOException {
+ List comments) throws IOException {
GHPullRequestReviewBuilder b = createReview().body(body);
for (GHPullRequestReviewComment c : comments) {
b.comment(c.getBody(), c.getPath(), c.getPosition());
@@ -346,29 +330,23 @@ public GHPullRequestReviewBuilder createReview() {
return new GHPullRequestReviewBuilder(this);
}
- public GHPullRequestReviewComment createReviewComment(String body, String sha, String path, int position) throws IOException {
- return new Requester(root).method("POST")
- .with("body", body)
- .with("commit_id", sha)
- .with("path", path)
- .with("position", position)
- .to(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment.class).wrapUp(this);
+ public GHPullRequestReviewComment createReviewComment(String body, String sha, String path, int position)
+ throws IOException {
+ return new Requester(root).method("POST").with("body", body).with("commit_id", sha).with("path", path)
+ .with("position", position).to(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment.class)
+ .wrapUp(this);
}
public void requestReviewers(List reviewers) throws IOException {
- new Requester(root).method("POST")
- .withLogins("reviewers", reviewers)
- .to(getApiRoute() + REQUEST_REVIEWERS);
+ new Requester(root).method("POST").withLogins("reviewers", reviewers).to(getApiRoute() + REQUEST_REVIEWERS);
}
public void requestTeamReviewers(List teams) throws IOException {
List teamReviewers = new ArrayList(teams.size());
for (GHTeam team : teams) {
- teamReviewers.add(team.getSlug());
+ teamReviewers.add(team.getSlug());
}
- new Requester(root).method("POST")
- .with("team_reviewers", teamReviewers)
- .to(getApiRoute() + REQUEST_REVIEWERS);
+ new Requester(root).method("POST").with("team_reviewers", teamReviewers).to(getApiRoute() + REQUEST_REVIEWERS);
}
/**
@@ -377,10 +355,10 @@ public void requestTeamReviewers(List teams) throws IOException {
* The equivalent of the big green "Merge pull request" button.
*
* @param msg
- * Commit message. If null, the default one will be used.
+ * Commit message. If null, the default one will be used.
*/
public void merge(String msg) throws IOException {
- merge(msg,null);
+ merge(msg, null);
}
/**
@@ -389,9 +367,9 @@ public void merge(String msg) throws IOException {
* The equivalent of the big green "Merge pull request" button.
*
* @param msg
- * Commit message. If null, the default one will be used.
+ * Commit message. If null, the default one will be used.
* @param sha
- * SHA that pull request head must match to allow merge.
+ * SHA that pull request head must match to allow merge.
*/
public void merge(String msg, String sha) throws IOException {
merge(msg, sha, null);
@@ -403,19 +381,18 @@ public void merge(String msg, String sha) throws IOException {
* The equivalent of the big green "Merge pull request" button.
*
* @param msg
- * Commit message. If null, the default one will be used.
+ * Commit message. If null, the default one will be used.
* @param method
- * SHA that pull request head must match to allow merge.
+ * SHA that pull request head must match to allow merge.
*/
public void merge(String msg, String sha, MergeMethod method) throws IOException {
- new Requester(root).method("PUT")
- .with("commit_message", msg)
- .with("sha", sha)
- .with("merge_method", method)
+ new Requester(root).method("PUT").with("commit_message", msg).with("sha", sha).with("merge_method", method)
.to(getApiRoute() + "/merge");
}
- public enum MergeMethod{ MERGE, SQUASH, REBASE }
+ public enum MergeMethod {
+ MERGE, SQUASH, REBASE
+ }
private void fetchIssue() throws IOException {
if (!fetchedIssueDetails) {
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
index e6c558b9e1..cc2311e1d1 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2013, Luca Milanesio
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -30,16 +30,16 @@
/**
* Commit detail inside a {@link GHPullRequest}.
- *
+ *
* @author Luca Milanesio
* @see GHPullRequest#listCommits()
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" }, justification = "JSON API")
public class GHPullRequestCommitDetail {
private GHPullRequest owner;
- /*package*/ void wrapUp(GHPullRequest owner) {
+ void wrapUp(GHPullRequest owner) {
this.owner = owner;
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestFileDetail.java b/src/main/java/org/kohsuke/github/GHPullRequestFileDetail.java
index 35bb86c444..d0129e282c 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestFileDetail.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestFileDetail.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2015, Julien Henry
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -27,7 +27,7 @@
/**
* File detail inside a {@link GHPullRequest}.
- *
+ *
* @author Julien Henry
* @see GHPullRequest#listFiles()
*/
@@ -85,8 +85,7 @@ public String getPatch() {
return patch;
}
- public String getPreviousFilename()
- {
+ public String getPreviousFilename() {
return previous_filename;
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java b/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java
index 50b5cbb3ae..10d1bc2761 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java
@@ -11,13 +11,13 @@
public class GHPullRequestQueryBuilder extends GHQueryBuilder {
private final GHRepository repo;
- /*package*/ GHPullRequestQueryBuilder(GHRepository repo) {
+ GHPullRequestQueryBuilder(GHRepository repo) {
super(repo.root);
this.repo = repo;
}
public GHPullRequestQueryBuilder state(GHIssueState state) {
- req.with("state",state);
+ req.with("state", state);
return this;
}
@@ -25,34 +25,32 @@ public GHPullRequestQueryBuilder head(String head) {
if (head != null && !head.contains(":")) {
head = repo.getOwnerName() + ":" + head;
}
- req.with("head",head);
+ req.with("head", head);
return this;
}
public GHPullRequestQueryBuilder base(String base) {
- req.with("base",base);
+ req.with("base", base);
return this;
}
public GHPullRequestQueryBuilder sort(Sort sort) {
- req.with("sort",sort);
+ req.with("sort", sort);
return this;
}
- public enum Sort { CREATED, UPDATED, POPULARITY, LONG_RUNNING }
+ public enum Sort {
+ CREATED, UPDATED, POPULARITY, LONG_RUNNING
+ }
public GHPullRequestQueryBuilder direction(GHDirection d) {
- req.with("direction",d);
+ req.with("direction", d);
return this;
}
@Override
public PagedIterable list() {
- return req
- .withPreview(SHADOW_CAT)
- .asPagedIterable(
- repo.getApiTailUrl("pulls"),
- GHPullRequest[].class,
- item -> item.wrapUp(repo) );
+ return req.withPreview(SHADOW_CAT).asPagedIterable(repo.getApiTailUrl("pulls"), GHPullRequest[].class,
+ item -> item.wrapUp(repo));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReview.java b/src/main/java/org/kohsuke/github/GHPullRequestReview.java
index b61a65ca05..9ea06dd2bb 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReview.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReview.java
@@ -36,7 +36,7 @@
* @see GHPullRequest#listReviews()
* @see GHPullRequestReviewBuilder
*/
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_FIELD"}, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHPullRequestReview extends GHObject {
GHPullRequest owner;
@@ -46,7 +46,7 @@ public class GHPullRequestReview extends GHObject {
private GHPullRequestReviewState state;
private String submitted_at;
- /*package*/ GHPullRequestReview wrapUp(GHPullRequest owner) {
+ GHPullRequestReview wrapUp(GHPullRequest owner) {
this.owner = owner;
return this;
}
@@ -87,7 +87,7 @@ public URL getHtmlUrl() {
}
protected String getApiRoute() {
- return owner.getApiRoute()+"/reviews/"+id;
+ return owner.getApiRoute() + "/reviews/" + id;
}
/**
@@ -106,22 +106,19 @@ public Date getCreatedAt() throws IOException {
}
/**
- * @deprecated
- * Former preview method that changed when it got public. Left here for backward compatibility.
- * Use {@link #submit(String, GHPullRequestReviewEvent)}
+ * @deprecated Former preview method that changed when it got public. Left here for backward compatibility. Use
+ * {@link #submit(String, GHPullRequestReviewEvent)}
*/
public void submit(String body, GHPullRequestReviewState state) throws IOException {
- submit(body,state.toEvent());
+ submit(body, state.toEvent());
}
/**
* Updates the comment.
*/
public void submit(String body, GHPullRequestReviewEvent event) throws IOException {
- new Requester(owner.root).method("POST")
- .with("body", body)
- .with("event", event.action())
- .to(getApiRoute()+"/events",this);
+ new Requester(owner.root).method("POST").with("body", body).with("event", event.action())
+ .to(getApiRoute() + "/events", this);
this.body = body;
this.state = event.toState();
}
@@ -130,17 +127,14 @@ public void submit(String body, GHPullRequestReviewEvent event) throws IOExcepti
* Deletes this review.
*/
public void delete() throws IOException {
- new Requester(owner.root).method("DELETE")
- .to(getApiRoute());
+ new Requester(owner.root).method("DELETE").to(getApiRoute());
}
/**
* Dismisses this review.
*/
public void dismiss(String message) throws IOException {
- new Requester(owner.root).method("PUT")
- .with("message", message)
- .to(getApiRoute()+"/dismissals");
+ new Requester(owner.root).method("PUT").with("message", message).to(getApiRoute() + "/dismissals");
state = GHPullRequestReviewState.DISMISSED;
}
@@ -148,10 +142,7 @@ public void dismiss(String message) throws IOException {
* Obtains all the review comments associated with this pull request review.
*/
public PagedIterable listReviewComments() throws IOException {
- return owner.root.retrieve()
- .asPagedIterable(
- getApiRoute() + "/comments",
- GHPullRequestReviewComment[].class,
- item -> item.wrapUp(owner) );
+ return owner.root.retrieve().asPagedIterable(getApiRoute() + "/comments", GHPullRequestReviewComment[].class,
+ item -> item.wrapUp(owner));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
index 318daf721f..4649d1f1f3 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
@@ -15,19 +15,21 @@ public class GHPullRequestReviewBuilder {
private final Requester builder;
private final List comments = new ArrayList();
- /*package*/ GHPullRequestReviewBuilder(GHPullRequest pr) {
+ GHPullRequestReviewBuilder(GHPullRequest pr) {
this.pr = pr;
this.builder = new Requester(pr.root);
}
- // public GHPullRequestReview createReview(@Nullable String commitId, String body, GHPullRequestReviewEvent event,
- // List comments) throws IOException
+ // public GHPullRequestReview createReview(@Nullable String commitId, String body, GHPullRequestReviewEvent event,
+ // List comments) throws IOException
/**
- * The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the position. Defaults to the most recent commit in the pull request when you do not specify a value.
+ * The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment
+ * outdated if a subsequent commit modifies the line you specify as the position. Defaults to the most recent commit
+ * in the pull request when you do not specify a value.
*/
public GHPullRequestReviewBuilder commitId(String commitId) {
- builder.with("commit_id",commitId);
+ builder.with("commit_id", commitId);
return this;
}
@@ -35,34 +37,38 @@ public GHPullRequestReviewBuilder commitId(String commitId) {
* Required when using REQUEST_CHANGES or COMMENT for the event parameter. The body text of the pull request review.
*/
public GHPullRequestReviewBuilder body(String body) {
- builder.with("body",body);
+ builder.with("body", body);
return this;
}
/**
- * The review action you want to perform. The review actions include: APPROVE, REQUEST_CHANGES, or COMMENT.
- * By leaving this blank, you set the review action state to PENDING,
- * which means you will need to {@linkplain GHPullRequestReview#submit(String, GHPullRequestReviewEvent) submit the pull request review} when you are ready.
+ * The review action you want to perform. The review actions include: APPROVE, REQUEST_CHANGES, or COMMENT. By
+ * leaving this blank, you set the review action state to PENDING, which means you will need to
+ * {@linkplain GHPullRequestReview#submit(String, GHPullRequestReviewEvent) submit the pull request review} when you
+ * are ready.
*/
public GHPullRequestReviewBuilder event(GHPullRequestReviewEvent event) {
- builder.with("event",event.action());
+ builder.with("event", event.action());
return this;
}
/**
- * @param body The relative path to the file that necessitates a review comment.
- * @param path The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below.
- * @param position Text of the review comment.
+ * @param body
+ * The relative path to the file that necessitates a review comment.
+ * @param path
+ * The position in the diff where you want to add a review comment. Note this value is not the same as
+ * the line number in the file. For help finding the position value, read the note below.
+ * @param position
+ * Text of the review comment.
*/
public GHPullRequestReviewBuilder comment(String body, String path, int position) {
- comments.add(new DraftReviewComment(body,path,position));
+ comments.add(new DraftReviewComment(body, path, position));
return this;
}
public GHPullRequestReview create() throws IOException {
- return builder.method("POST")._with("comments",comments)
- .to(pr.getApiRoute() + "/reviews", GHPullRequestReview.class)
- .wrapUp(pr);
+ return builder.method("POST")._with("comments", comments)
+ .to(pr.getApiRoute() + "/reviews", GHPullRequestReview.class).wrapUp(pr);
}
private static class DraftReviewComment {
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
index 8848c28282..1804d47e93 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
@@ -46,10 +46,8 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
private int original_position = -1;
private long in_reply_to_id = -1L;
-
/**
- * @deprecated
- * You should be using {@link GHPullRequestReviewBuilder#comment(String, String, int)}
+ * @deprecated You should be using {@link GHPullRequestReviewBuilder#comment(String, String, int)}
*/
public static GHPullRequestReviewComment draft(String body, String path, int position) {
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
@@ -59,7 +57,7 @@ public static GHPullRequestReviewComment draft(String body, String path, int pos
return result;
}
- /*package*/ GHPullRequestReviewComment wrapUp(GHPullRequest owner) {
+ GHPullRequestReviewComment wrapUp(GHPullRequest owner) {
this.owner = owner;
return this;
}
@@ -109,14 +107,14 @@ public URL getHtmlUrl() {
}
protected String getApiRoute() {
- return "/repos/"+owner.getRepository().getFullName()+"/pulls/comments/"+id;
+ return "/repos/" + owner.getRepository().getFullName() + "/pulls/comments/" + id;
}
/**
* Updates the comment.
*/
public void update(String body) throws IOException {
- new Requester(owner.root).method("PATCH").with("body", body).to(getApiRoute(),this);
+ new Requester(owner.root).method("PATCH").with("body", body).to(getApiRoute(), this);
this.body = body;
}
@@ -131,28 +129,21 @@ public void delete() throws IOException {
* Create a new comment that replies to this comment.
*/
public GHPullRequestReviewComment reply(String body) throws IOException {
- return new Requester(owner.root).method("POST")
- .with("body", body)
- .with("in_reply_to", getId())
- .to(getApiRoute() + "/comments", GHPullRequestReviewComment.class)
- .wrapUp(owner);
+ return new Requester(owner.root).method("POST").with("body", body).with("in_reply_to", getId())
+ .to(getApiRoute() + "/comments", GHPullRequestReviewComment.class).wrapUp(owner);
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root)
- .withPreview(SQUIRREL_GIRL)
- .with("content", content.getContent())
- .to(getApiRoute()+"/reactions", GHReaction.class).wrap(owner.root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
+ .to(getApiRoute() + "/reactions", GHReaction.class).wrap(owner.root);
}
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve()
- .withPreview(SQUIRREL_GIRL)
- .asPagedIterable(
- getApiRoute() + "/reactions",
- GHReaction[].class,
- item -> item.wrap(owner.root) );
+ return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
+ GHReaction[].class, item -> item.wrap(owner.root));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java
index e6537e0f09..3bcea3311f 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java
@@ -27,24 +27,25 @@
* Action to perform on {@link GHPullRequestReview}.
*/
public enum GHPullRequestReviewEvent {
- PENDING,
- APPROVE,
- REQUEST_CHANGES,
- COMMENT;
+ PENDING, APPROVE, REQUEST_CHANGES, COMMENT;
- /*package*/ String action() {
- return this==PENDING ? null : name();
+ String action() {
+ return this == PENDING ? null : name();
}
/**
* When a {@link GHPullRequestReview} is submitted with this event, it should transition to this state.
*/
- /*package*/ GHPullRequestReviewState toState() {
+ GHPullRequestReviewState toState() {
switch (this) {
- case PENDING: return GHPullRequestReviewState.PENDING;
- case APPROVE: return GHPullRequestReviewState.APPROVED;
- case REQUEST_CHANGES: return GHPullRequestReviewState.CHANGES_REQUESTED;
- case COMMENT: return GHPullRequestReviewState.COMMENTED;
+ case PENDING:
+ return GHPullRequestReviewState.PENDING;
+ case APPROVE:
+ return GHPullRequestReviewState.APPROVED;
+ case REQUEST_CHANGES:
+ return GHPullRequestReviewState.CHANGES_REQUESTED;
+ case COMMENT:
+ return GHPullRequestReviewState.COMMENTED;
}
throw new IllegalStateException();
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java
index a64a105994..5f1c0c06e3 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java
@@ -4,35 +4,33 @@
* Current state of {@link GHPullRequestReview}
*/
public enum GHPullRequestReviewState {
- PENDING,
- APPROVED,
- CHANGES_REQUESTED,
+ PENDING, APPROVED, CHANGES_REQUESTED,
/**
- * @deprecated
- * This was the thing when this API was in preview, but it changed when it became public.
- * Use {@link #CHANGES_REQUESTED}. Left here for compatibility.
+ * @deprecated This was the thing when this API was in preview, but it changed when it became public. Use
+ * {@link #CHANGES_REQUESTED}. Left here for compatibility.
*/
- REQUEST_CHANGES,
- COMMENTED,
- DISMISSED;
+ REQUEST_CHANGES, COMMENTED, DISMISSED;
/**
- * @deprecated
- * This was an internal method accidentally exposed.
- * Left here for compatibility.
+ * @deprecated This was an internal method accidentally exposed. Left here for compatibility.
*/
public String action() {
GHPullRequestReviewEvent e = toEvent();
- return e==null ? null : e.action();
+ return e == null ? null : e.action();
}
- /*package*/ GHPullRequestReviewEvent toEvent() {
+ GHPullRequestReviewEvent toEvent() {
switch (this) {
- case PENDING: return GHPullRequestReviewEvent.PENDING;
- case APPROVED: return GHPullRequestReviewEvent.APPROVE;
- case CHANGES_REQUESTED: return GHPullRequestReviewEvent.REQUEST_CHANGES;
- case REQUEST_CHANGES: return GHPullRequestReviewEvent.REQUEST_CHANGES;
- case COMMENTED: return GHPullRequestReviewEvent.COMMENT;
+ case PENDING:
+ return GHPullRequestReviewEvent.PENDING;
+ case APPROVED:
+ return GHPullRequestReviewEvent.APPROVE;
+ case CHANGES_REQUESTED:
+ return GHPullRequestReviewEvent.REQUEST_CHANGES;
+ case REQUEST_CHANGES:
+ return GHPullRequestReviewEvent.REQUEST_CHANGES;
+ case COMMENTED:
+ return GHPullRequestReviewEvent.COMMENT;
}
return null;
}
diff --git a/src/main/java/org/kohsuke/github/GHQueryBuilder.java b/src/main/java/org/kohsuke/github/GHQueryBuilder.java
index bb85fbbe95..bf26fa567e 100644
--- a/src/main/java/org/kohsuke/github/GHQueryBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHQueryBuilder.java
@@ -9,7 +9,7 @@ public abstract class GHQueryBuilder {
protected final GitHub root;
protected final Requester req;
- /*package*/ GHQueryBuilder(GitHub root) {
+ GHQueryBuilder(GitHub root) {
this.root = root;
this.req = root.retrieve();
}
diff --git a/src/main/java/org/kohsuke/github/GHRateLimit.java b/src/main/java/org/kohsuke/github/GHRateLimit.java
index c0b21da817..f99c848fab 100644
--- a/src/main/java/org/kohsuke/github/GHRateLimit.java
+++ b/src/main/java/org/kohsuke/github/GHRateLimit.java
@@ -34,21 +34,19 @@ public class GHRateLimit {
/**
* Allotted API call per hour.
*
- * @deprecated This value should never have been made public. Use {@link #getLimit()}
+ * @deprecated This value should never have been made public. Use {@link #getLimit()}
*/
@Deprecated
public int limit;
/**
- * The time at which the current rate limit window resets in UTC epoch seconds.
- * NOTE: that means to
+ * The time at which the current rate limit window resets in UTC epoch seconds. NOTE: that means to
*
* @deprecated This value should never have been made public. Use {@link #getResetDate()}
*/
@Deprecated
public Date reset;
-
@Nonnull
private final Record core;
@@ -62,7 +60,8 @@ public class GHRateLimit {
private final Record integrationManifest;
static GHRateLimit Unknown() {
- return new GHRateLimit(new UnknownLimitRecord(), new UnknownLimitRecord(), new UnknownLimitRecord(), new UnknownLimitRecord());
+ return new GHRateLimit(new UnknownLimitRecord(), new UnknownLimitRecord(), new UnknownLimitRecord(),
+ new UnknownLimitRecord());
}
static GHRateLimit fromHeaderRecord(Record header) {
@@ -70,10 +69,9 @@ static GHRateLimit fromHeaderRecord(Record header) {
}
@JsonCreator
- GHRateLimit(@Nonnull @JsonProperty("core") Record core,
- @Nonnull @JsonProperty("search") Record search,
- @Nonnull @JsonProperty("graphql") Record graphql,
- @Nonnull @JsonProperty("integration_manifest") Record integrationManifest) {
+ GHRateLimit(@Nonnull @JsonProperty("core") Record core, @Nonnull @JsonProperty("search") Record search,
+ @Nonnull @JsonProperty("graphql") Record graphql,
+ @Nonnull @JsonProperty("integration_manifest") Record integrationManifest) {
this.core = core;
this.search = search;
this.graphql = graphql;
@@ -85,7 +83,6 @@ static GHRateLimit fromHeaderRecord(Record header) {
this.reset = new Date(core.getResetEpochSeconds());
}
-
/**
* Returns the date at which the Core API rate limit will reset.
*
@@ -116,7 +113,6 @@ public int getLimit() {
return getCore().getLimit();
}
-
/**
* Gets the time in epoch seconds when the Core API rate limit will reset.
*
@@ -149,8 +145,8 @@ public Record getCore() {
}
/**
- * The search object provides your rate limit status for the Search API.
- * TODO: integrate with header limit updating. Issue #605.
+ * The search object provides your rate limit status for the Search API. TODO: integrate with header limit updating.
+ * Issue #605.
*
* @return a rate limit record
*/
@@ -160,8 +156,8 @@ Record getSearch() {
}
/**
- * The graphql object provides your rate limit status for the GraphQL API.
- * TODO: integrate with header limit updating. Issue #605.
+ * The graphql object provides your rate limit status for the GraphQL API. TODO: integrate with header limit
+ * updating. Issue #605.
*
* @return a rate limit record
*/
@@ -171,8 +167,8 @@ Record getGraphQL() {
}
/**
- * The integration_manifest object provides your rate limit status for the GitHub App Manifest code conversion endpoint.
- * TODO: integrate with header limit updating. Issue #605.
+ * The integration_manifest object provides your rate limit status for the GitHub App Manifest code conversion
+ * endpoint. TODO: integrate with header limit updating. Issue #605.
*
* @return a rate limit record
*/
@@ -183,12 +179,8 @@ Record getIntegrationManifest() {
@Override
public String toString() {
- return "GHRateLimit {" +
- "core " + getCore().toString() +
- "search " + getSearch().toString() +
- "graphql " + getGraphQL().toString() +
- "integrationManifest " + getIntegrationManifest().toString() +
- '}';
+ return "GHRateLimit {" + "core " + getCore().toString() + "search " + getSearch().toString() + "graphql "
+ + getGraphQL().toString() + "integrationManifest " + getIntegrationManifest().toString() + '}';
}
@Override
@@ -200,10 +192,9 @@ public boolean equals(Object o) {
return false;
}
GHRateLimit rateLimit = (GHRateLimit) o;
- return getCore().equals(rateLimit.getCore()) &&
- getSearch().equals(rateLimit.getSearch()) &&
- getGraphQL().equals(rateLimit.getGraphQL()) &&
- getIntegrationManifest().equals(rateLimit.getIntegrationManifest());
+ return getCore().equals(rateLimit.getCore()) && getSearch().equals(rateLimit.getSearch())
+ && getGraphQL().equals(rateLimit.getGraphQL())
+ && getIntegrationManifest().equals(rateLimit.getIntegrationManifest());
}
@Override
@@ -233,6 +224,7 @@ private UnknownLimitRecord() {
/**
* A rate limit record.
+ *
* @since 1.100
*/
public static class Record {
@@ -257,21 +249,19 @@ public static class Record {
private final long createdAtEpochSeconds = System.currentTimeMillis() / 1000;
/**
- * The calculated time at which the rate limit will reset.
- * Recalculated if {@link #recalculateResetDate} is called.
+ * The calculated time at which the rate limit will reset. Recalculated if {@link #recalculateResetDate} is
+ * called.
*/
@Nonnull
private Date resetDate;
@JsonCreator
- public Record(@JsonProperty("limit") int limit,
- @JsonProperty("remaining") int remaining,
- @JsonProperty("reset")long resetEpochSeconds) {
+ public Record(@JsonProperty("limit") int limit, @JsonProperty("remaining") int remaining,
+ @JsonProperty("reset") long resetEpochSeconds) {
this(limit, remaining, resetEpochSeconds, null);
}
- @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD",
- justification = "Deprecated")
+ @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "Deprecated")
public Record(int limit, int remaining, long resetEpochSeconds, String updatedAt) {
this.limit = limit;
this.remaining = remaining;
@@ -280,10 +270,11 @@ public Record(int limit, int remaining, long resetEpochSeconds, String updatedAt
}
/**
- * Recalculates the reset date using the server response date to calculate a time duration
- * and then add that to the local created time for this record.
+ * Recalculates the reset date using the server response date to calculate a time duration and then add that to
+ * the local created time for this record.
*
- * @param updatedAt a string date in RFC 1123
+ * @param updatedAt
+ * a string date in RFC 1123
* @return reset date based on the passed date
*/
Date recalculateResetDate(String updatedAt) {
@@ -291,7 +282,8 @@ Date recalculateResetDate(String updatedAt) {
if (!StringUtils.isBlank(updatedAt)) {
try {
// Get the server date and reset data, will always return a time in GMT
- updatedAtEpochSeconds = ZonedDateTime.parse(updatedAt, DateTimeFormatter.RFC_1123_DATE_TIME).toEpochSecond();
+ updatedAtEpochSeconds = ZonedDateTime.parse(updatedAt, DateTimeFormatter.RFC_1123_DATE_TIME)
+ .toEpochSecond();
} catch (DateTimeParseException e) {
if (LOGGER.isLoggable(FINEST)) {
LOGGER.log(FINEST, "Malformed Date header value " + updatedAt, e);
@@ -353,11 +345,8 @@ public Date getResetDate() {
@Override
public String toString() {
- return "{" +
- "remaining=" + getRemaining() +
- ", limit=" + getLimit() +
- ", resetDate=" + getResetDate() +
- '}';
+ return "{" + "remaining=" + getRemaining() + ", limit=" + getLimit() + ", resetDate=" + getResetDate()
+ + '}';
}
@Override
@@ -369,10 +358,9 @@ public boolean equals(Object o) {
return false;
}
Record record = (Record) o;
- return getRemaining() == record.getRemaining() &&
- getLimit() == record.getLimit() &&
- getResetEpochSeconds() == record.getResetEpochSeconds() &&
- getResetDate().equals(record.getResetDate());
+ return getRemaining() == record.getRemaining() && getLimit() == record.getLimit()
+ && getResetEpochSeconds() == record.getResetEpochSeconds()
+ && getResetDate().equals(record.getResetDate());
}
@Override
diff --git a/src/main/java/org/kohsuke/github/GHReaction.java b/src/main/java/org/kohsuke/github/GHReaction.java
index 6a00eb305c..e809516cac 100644
--- a/src/main/java/org/kohsuke/github/GHReaction.java
+++ b/src/main/java/org/kohsuke/github/GHReaction.java
@@ -11,14 +11,15 @@
* @author Kohsuke Kawaguchi
* @see Reactable
*/
-@Preview @Deprecated
+@Preview
+@Deprecated
public class GHReaction extends GHObject {
private GitHub root;
private GHUser user;
private ReactionContent content;
- /*package*/ GHReaction wrap(GitHub root) {
+ GHReaction wrap(GitHub root) {
this.root = root;
user.wrapUp(root);
return this;
@@ -50,6 +51,6 @@ public URL getHtmlUrl() {
* Removes this reaction.
*/
public void delete() throws IOException {
- new Requester(root).method("DELETE").withPreview(SQUIRREL_GIRL).to("/reactions/"+id);
+ new Requester(root).method("DELETE").withPreview(SQUIRREL_GIRL).to("/reactions/" + id);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHRef.java b/src/main/java/org/kohsuke/github/GHRef.java
index c8462d3fe6..f8ff997512 100644
--- a/src/main/java/org/kohsuke/github/GHRef.java
+++ b/src/main/java/org/kohsuke/github/GHRef.java
@@ -11,7 +11,7 @@
* @author Michael Clarke
*/
public class GHRef {
- /*package almost final*/ GitHub root;
+ /* package almost final */ GitHub root;
private String ref, url;
private GHObject object;
@@ -41,48 +41,47 @@ public GHObject getObject() {
* Updates this ref to the specified commit.
*
* @param sha
- * The SHA1 value to set this reference to
+ * The SHA1 value to set this reference to
*/
public void updateTo(String sha) throws IOException {
- updateTo(sha, false);
+ updateTo(sha, false);
}
/**
* Updates this ref to the specified commit.
*
* @param sha
- * The SHA1 value to set this reference to
+ * The SHA1 value to set this reference to
* @param force
- * Whether or not to force this ref update.
+ * Whether or not to force this ref update.
*/
public void updateTo(String sha, Boolean force) throws IOException {
- new Requester(root)
- .with("sha", sha).with("force", force).method("PATCH").to(url, GHRef.class).wrap(root);
+ new Requester(root).with("sha", sha).with("force", force).method("PATCH").to(url, GHRef.class).wrap(root);
}
/**
* Deletes this ref from the repository using the GitHub API.
*/
public void delete() throws IOException {
- new Requester(root).method("DELETE").to(url);
+ new Requester(root).method("DELETE").to(url);
}
- /*package*/ GHRef wrap(GitHub root) {
+ GHRef wrap(GitHub root) {
this.root = root;
return this;
}
- /*package*/ static GHRef[] wrap(GHRef[] in, GitHub root) {
+ static GHRef[] wrap(GHRef[] in, GitHub root) {
for (GHRef r : in) {
r.wrap(root);
}
return in;
}
- @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public static class GHObject {
- private String type, sha, url;
+ private String type, sha, url;
/**
* Type of the object, such as "commit"
@@ -99,7 +98,8 @@ public String getSha() {
}
/**
- * API URL to this Git data, such as https://api.github.com/repos/jenkinsci/jenkins/git/commits/b72322675eb0114363a9a86e9ad5a170d1d07ac0
+ * API URL to this Git data, such as
+ * https://api.github.com/repos/jenkinsci/jenkins/git/commits/b72322675eb0114363a9a86e9ad5a170d1d07ac0
*/
public URL getUrl() {
return GitHub.parseURL(url);
diff --git a/src/main/java/org/kohsuke/github/GHRelease.java b/src/main/java/org/kohsuke/github/GHRelease.java
index 0df6b415b0..f7e81e2180 100644
--- a/src/main/java/org/kohsuke/github/GHRelease.java
+++ b/src/main/java/org/kohsuke/github/GHRelease.java
@@ -47,8 +47,7 @@ public boolean isDraft() {
}
/**
- * @deprecated
- * Use {@link #update()}
+ * @deprecated Use {@link #update()}
*/
public GHRelease setDraft(boolean draft) throws IOException {
return update().draft(draft).update();
@@ -121,10 +120,10 @@ static GHRelease[] wrap(GHRelease[] releases, GHRepository owner) {
/**
* Because github relies on SNI (http://en.wikipedia.org/wiki/Server_Name_Indication) this method will only work on
- * Java 7 or greater. Options for fixing this for earlier JVMs can be found here
+ * Java 7 or greater. Options for fixing this for earlier JVMs can be found here
* http://stackoverflow.com/questions/12361090/server-name-indication-sni-on-java but involve more complicated
* handling of the HTTP requests to github's API.
- */
+ */
public GHAsset uploadAsset(File file, String contentType) throws IOException {
FileInputStream s = new FileInputStream(file);
try {
@@ -133,23 +132,19 @@ public GHAsset uploadAsset(File file, String contentType) throws IOException {
s.close();
}
}
-
+
public GHAsset uploadAsset(String filename, InputStream stream, String contentType) throws IOException {
Requester builder = new Requester(owner.root);
- String url = format("https://uploads.github.com%s/releases/%d/assets?name=%s",
- owner.getApiTailUrl(""), getId(), filename);
- return builder.contentType(contentType)
- .with(stream)
- .to(url, GHAsset.class).wrap(this);
+ String url = format("https://uploads.github.com%s/releases/%d/assets?name=%s", owner.getApiTailUrl(""), getId(),
+ filename);
+ return builder.contentType(contentType).with(stream).to(url, GHAsset.class).wrap(this);
}
public List getAssets() throws IOException {
Requester builder = new Requester(owner.root);
- GHAsset[] assets = builder
- .method("GET")
- .to(getApiTailUrl("assets"), GHAsset[].class);
+ GHAsset[] assets = builder.method("GET").to(getApiTailUrl("assets"), GHAsset[].class);
return Arrays.asList(GHAsset.wrap(assets, this));
}
@@ -157,7 +152,7 @@ public List getAssets() throws IOException {
* Deletes this release.
*/
public void delete() throws IOException {
- new Requester(root).method("DELETE").to(owner.getApiTailUrl("releases/"+id));
+ new Requester(root).method("DELETE").to(owner.getApiTailUrl("releases/" + id));
}
/**
@@ -168,6 +163,6 @@ public GHReleaseUpdater update() {
}
private String getApiTailUrl(String end) {
- return owner.getApiTailUrl(format("releases/%s/%s",id,end));
+ return owner.getApiTailUrl(format("releases/%s/%s", id, end));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHReleaseBuilder.java b/src/main/java/org/kohsuke/github/GHReleaseBuilder.java
index e427bdf8a5..d35943b570 100644
--- a/src/main/java/org/kohsuke/github/GHReleaseBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHReleaseBuilder.java
@@ -18,7 +18,8 @@ public GHReleaseBuilder(GHRepository ghRepository, String tag) {
}
/**
- * @param body The release notes body.
+ * @param body
+ * The release notes body.
*/
public GHReleaseBuilder body(String body) {
builder.with("body", body);
@@ -26,11 +27,10 @@ public GHReleaseBuilder body(String body) {
}
/**
- * Specifies the commitish value that determines where the Git tag is created from. Can be any branch or
- * commit SHA.
+ * Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA.
*
- * @param commitish Defaults to the repository’s default branch (usually "master"). Unused if the Git tag
- * already exists.
+ * @param commitish
+ * Defaults to the repository’s default branch (usually "master"). Unused if the Git tag already exists.
*/
public GHReleaseBuilder commitish(String commitish) {
builder.with("target_commitish", commitish);
@@ -40,8 +40,9 @@ public GHReleaseBuilder commitish(String commitish) {
/**
* Optional.
*
- * @param draft {@code true} to create a draft (unpublished) release, {@code false} to create a published one.
- * Default is {@code false}.
+ * @param draft
+ * {@code true} to create a draft (unpublished) release, {@code false} to create a published one. Default
+ * is {@code false}.
*/
public GHReleaseBuilder draft(boolean draft) {
builder.with("draft", draft);
@@ -49,7 +50,8 @@ public GHReleaseBuilder draft(boolean draft) {
}
/**
- * @param name the name of the release
+ * @param name
+ * the name of the release
*/
public GHReleaseBuilder name(String name) {
builder.with("name", name);
@@ -59,8 +61,9 @@ public GHReleaseBuilder name(String name) {
/**
* Optional
*
- * @param prerelease {@code true} to identify the release as a prerelease. {@code false} to identify the release
- * as a full release. Default is {@code false}.
+ * @param prerelease
+ * {@code true} to identify the release as a prerelease. {@code false} to identify the release as a full
+ * release. Default is {@code false}.
*/
public GHReleaseBuilder prerelease(boolean prerelease) {
builder.with("prerelease", prerelease);
diff --git a/src/main/java/org/kohsuke/github/GHReleaseUpdater.java b/src/main/java/org/kohsuke/github/GHReleaseUpdater.java
index a34a5b0bc2..e3905f03e3 100644
--- a/src/main/java/org/kohsuke/github/GHReleaseUpdater.java
+++ b/src/main/java/org/kohsuke/github/GHReleaseUpdater.java
@@ -18,12 +18,13 @@ public class GHReleaseUpdater {
}
public GHReleaseUpdater tag(String tag) {
- builder.with("tag_name",tag);
+ builder.with("tag_name", tag);
return this;
}
/**
- * @param body The release notes body.
+ * @param body
+ * The release notes body.
*/
public GHReleaseUpdater body(String body) {
builder.with("body", body);
@@ -31,11 +32,10 @@ public GHReleaseUpdater body(String body) {
}
/**
- * Specifies the commitish value that determines where the Git tag is created from. Can be any branch or
- * commit SHA.
+ * Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA.
*
- * @param commitish Defaults to the repository’s default branch (usually "master"). Unused if the Git tag
- * already exists.
+ * @param commitish
+ * Defaults to the repository’s default branch (usually "master"). Unused if the Git tag already exists.
*/
public GHReleaseUpdater commitish(String commitish) {
builder.with("target_commitish", commitish);
@@ -45,8 +45,9 @@ public GHReleaseUpdater commitish(String commitish) {
/**
* Optional.
*
- * @param draft {@code true} to create a draft (unpublished) release, {@code false} to create a published one.
- * Default is {@code false}.
+ * @param draft
+ * {@code true} to create a draft (unpublished) release, {@code false} to create a published one. Default
+ * is {@code false}.
*/
public GHReleaseUpdater draft(boolean draft) {
builder.with("draft", draft);
@@ -54,7 +55,8 @@ public GHReleaseUpdater draft(boolean draft) {
}
/**
- * @param name the name of the release
+ * @param name
+ * the name of the release
*/
public GHReleaseUpdater name(String name) {
builder.with("name", name);
@@ -64,8 +66,9 @@ public GHReleaseUpdater name(String name) {
/**
* Optional
*
- * @param prerelease {@code true} to identify the release as a prerelease. {@code false} to identify the release
- * as a full release. Default is {@code false}.
+ * @param prerelease
+ * {@code true} to identify the release as a prerelease. {@code false} to identify the release as a full
+ * release. Default is {@code false}.
*/
public GHReleaseUpdater prerelease(boolean prerelease) {
builder.with("prerelease", prerelease);
@@ -73,9 +76,8 @@ public GHReleaseUpdater prerelease(boolean prerelease) {
}
public GHRelease update() throws IOException {
- return builder
- .method("PATCH")
- .to(base.owner.getApiTailUrl("releases/"+base.id), GHRelease.class).wrap(base.owner);
+ return builder.method("PATCH").to(base.owner.getApiTailUrl("releases/" + base.id), GHRelease.class)
+ .wrap(base.owner);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHRepoHook.java b/src/main/java/org/kohsuke/github/GHRepoHook.java
index 948438eb96..d273168f42 100644
--- a/src/main/java/org/kohsuke/github/GHRepoHook.java
+++ b/src/main/java/org/kohsuke/github/GHRepoHook.java
@@ -4,9 +4,9 @@ class GHRepoHook extends GHHook {
/**
* Repository that the hook belongs to.
*/
- /*package*/ transient GHRepository repository;
+ transient GHRepository repository;
- /*package*/ GHRepoHook wrap(GHRepository owner) {
+ GHRepoHook wrap(GHRepository owner) {
this.repository = owner;
return this;
}
diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java
index 88a13b3be5..2565c30f85 100644
--- a/src/main/java/org/kohsuke/github/GHRepository.java
+++ b/src/main/java/org/kohsuke/github/GHRepository.java
@@ -66,14 +66,14 @@
*
* @author Kohsuke Kawaguchi
*/
-@SuppressWarnings({"UnusedDeclaration"})
-@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD"}, justification = "JSON API")
+@SuppressWarnings({ "UnusedDeclaration" })
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHRepository extends GHObject {
- /*package almost final*/ GitHub root;
+ /* package almost final */ GitHub root;
private String description, homepage, name, full_name;
- private String html_url; // this is the UI
+ private String html_url; // this is the UI
/*
* The license information makes use of the preview API.
*
@@ -82,21 +82,21 @@ public class GHRepository extends GHObject {
private GHLicense license;
private String git_url, ssh_url, clone_url, svn_url, mirror_url;
- private GHUser owner; // not fully populated. beware.
+ private GHUser owner; // not fully populated. beware.
private boolean has_issues, has_wiki, fork, has_downloads, has_pages, archived;
-
+
private boolean allow_squash_merge;
private boolean allow_merge_commit;
private boolean allow_rebase_merge;
-
+
@JsonProperty("private")
private boolean _private;
private int forks_count, stargazers_count, watchers_count, size, open_issues_count, subscribers_count;
private String pushed_at;
- private Map milestones = new WeakHashMap();
+ private Map milestones = new WeakHashMap();
- private String default_branch,language;
- private Map commits = new WeakHashMap();
+ private String default_branch, language;
+ private Map commits = new WeakHashMap();
@SkipFromToString
private GHRepoPermission permissions;
@@ -104,25 +104,22 @@ public class GHRepository extends GHObject {
private GHRepository source, parent;
public GHDeploymentBuilder createDeployment(String ref) {
- return new GHDeploymentBuilder(this,ref);
+ return new GHDeploymentBuilder(this, ref);
}
/**
- * @deprecated
- * Use {@code getDeployment(id).listStatuses()}
+ * @deprecated Use {@code getDeployment(id).listStatuses()}
*/
public PagedIterable getDeploymentStatuses(final int id) throws IOException {
return getDeployment(id).listStatuses();
}
- public PagedIterable listDeployments(String sha,String ref,String task,String environment){
- List params = Arrays.asList(getParam("sha", sha), getParam("ref", ref), getParam("task", task), getParam("environment", environment));
- final String deploymentsUrl = getApiTailUrl("deployments") + "?"+ join(params,"&");
- return root.retrieve()
- .asPagedIterable(
- deploymentsUrl,
- GHDeployment[].class,
- item -> item.wrap(GHRepository.this) );
+ public PagedIterable listDeployments(String sha, String ref, String task, String environment) {
+ List params = Arrays.asList(getParam("sha", sha), getParam("ref", ref), getParam("task", task),
+ getParam("environment", environment));
+ final String deploymentsUrl = getApiTailUrl("deployments") + "?" + join(params, "&");
+ return root.retrieve().asPagedIterable(deploymentsUrl, GHDeployment[].class,
+ item -> item.wrap(GHRepository.this));
}
/**
@@ -134,31 +131,30 @@ public GHDeployment getDeployment(long id) throws IOException {
private String join(List params, String joinStr) {
StringBuilder output = new StringBuilder();
- for(String param: params){
- if(param != null){
- output.append(param+joinStr);
+ for (String param : params) {
+ if (param != null) {
+ output.append(param + joinStr);
}
}
return output.toString();
}
private String getParam(String name, String value) {
- return StringUtils.trimToNull(value)== null? null: name+"="+value;
+ return StringUtils.trimToNull(value) == null ? null : name + "=" + value;
}
/**
- * @deprecated
- * Use {@code getDeployment(deploymentId).createStatus(ghDeploymentState)}
+ * @deprecated Use {@code getDeployment(deploymentId).createStatus(ghDeploymentState)}
*/
- public GHDeploymentStatusBuilder createDeployStatus(int deploymentId, GHDeploymentState ghDeploymentState) throws IOException {
+ public GHDeploymentStatusBuilder createDeployStatus(int deploymentId, GHDeploymentState ghDeploymentState)
+ throws IOException {
return getDeployment(deploymentId).createStatus(ghDeploymentState);
}
private static class GHRepoPermission {
- boolean pull,push,admin;
+ boolean pull, push, admin;
}
-
public String getDescription() {
return description;
}
@@ -168,24 +164,21 @@ public String getHomepage() {
}
/**
- * Gets the git:// URL to this repository, such as "git://github.com/kohsuke/jenkins.git"
- * This URL is read-only.
+ * Gets the git:// URL to this repository, such as "git://github.com/kohsuke/jenkins.git" This URL is read-only.
*/
public String getGitTransportUrl() {
return git_url;
}
/**
- * Gets the HTTPS URL to this repository, such as "https://github.com/kohsuke/jenkins.git"
- * This URL is read-only.
+ * Gets the HTTPS URL to this repository, such as "https://github.com/kohsuke/jenkins.git" This URL is read-only.
*/
public String getHttpTransportUrl() {
return clone_url;
}
/**
- * @deprecated
- * Typo of {@link #getHttpTransportUrl()}
+ * @deprecated Typo of {@link #getHttpTransportUrl()}
*/
public String gitHttpTransportUrl() {
return clone_url;
@@ -199,8 +192,8 @@ public String getSvnUrl() {
}
/**
- * Gets the Mirror URL to access this repository: https://github.com/apache/tomee
- * mirrored from git://git.apache.org/tomee.git
+ * Gets the Mirror URL to access this repository: https://github.com/apache/tomee mirrored from
+ * git://git.apache.org/tomee.git
*/
public String getMirrorUrl() {
return mirror_url;
@@ -225,22 +218,23 @@ public String getName() {
}
/**
- * Full repository name including the owner or organization. For example 'jenkinsci/jenkins' in case of http://github.com/jenkinsci/jenkins
+ * Full repository name including the owner or organization. For example 'jenkinsci/jenkins' in case of
+ * http://github.com/jenkinsci/jenkins
*/
public String getFullName() {
return full_name;
}
public boolean hasPullAccess() {
- return permissions!=null && permissions.pull;
+ return permissions != null && permissions.pull;
}
public boolean hasPushAccess() {
- return permissions!=null && permissions.push;
+ return permissions != null && permissions.push;
}
public boolean hasAdminAccess() {
- return permissions!=null && permissions.admin;
+ return permissions != null && permissions.admin;
}
/**
@@ -251,7 +245,7 @@ public String getLanguage() {
}
public GHUser getOwner() throws IOException {
- return root.isOffline() ? owner : root.getUser(getOwnerName()); // because 'owner' isn't fully populated
+ return root.isOffline() ? owner : root.getUser(getOwnerName()); // because 'owner' isn't fully populated
}
public GHIssue getIssue(int id) throws IOException {
@@ -259,7 +253,7 @@ public GHIssue getIssue(int id) throws IOException {
}
public GHIssueBuilder createIssue(String title) {
- return new GHIssueBuilder(this,title);
+ return new GHIssueBuilder(this, title);
}
public List getIssues(GHIssueState state) throws IOException {
@@ -267,45 +261,39 @@ public List getIssues(GHIssueState state) throws IOException {
}
public List getIssues(GHIssueState state, GHMilestone milestone) throws IOException {
- return Arrays.asList(GHIssue.wrap(root.retrieve()
- .with("state", state)
+ return Arrays.asList(GHIssue.wrap(root.retrieve().with("state", state)
.with("milestone", milestone == null ? "none" : "" + milestone.getNumber())
- .to(getApiTailUrl("issues"),
- GHIssue[].class), this));
+ .to(getApiTailUrl("issues"), GHIssue[].class), this));
}
/**
* Lists up all the issues in this repository.
*/
public PagedIterable listIssues(final GHIssueState state) {
- return root.retrieve().with("state",state)
- .asPagedIterable(
- getApiTailUrl("issues"),
- GHIssue[].class,
- item -> item.wrap(GHRepository.this) );
+ return root.retrieve().with("state", state).asPagedIterable(getApiTailUrl("issues"), GHIssue[].class,
+ item -> item.wrap(GHRepository.this));
}
public GHReleaseBuilder createRelease(String tag) {
- return new GHReleaseBuilder(this,tag);
+ return new GHReleaseBuilder(this, tag);
}
/**
* Creates a named ref, such as tag, branch, etc.
*
* @param name
- * The name of the fully qualified reference (ie: refs/heads/master).
- * If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
+ * The name of the fully qualified reference (ie: refs/heads/master). If it doesn't start with 'refs' and
+ * have at least two slashes, it will be rejected.
* @param sha
- * The SHA1 value to set this reference to
+ * The SHA1 value to set this reference to
*/
public GHRef createRef(String name, String sha) throws IOException {
- return new Requester(root)
- .with("ref", name).with("sha", sha).method("POST").to(getApiTailUrl("git/refs"), GHRef.class).wrap(root);
+ return new Requester(root).with("ref", name).with("sha", sha).method("POST")
+ .to(getApiTailUrl("git/refs"), GHRef.class).wrap(root);
}
/**
- * @deprecated
- * use {@link #listReleases()}
+ * @deprecated use {@link #listReleases()}
*/
public List getReleases() throws IOException {
return listReleases().asList();
@@ -326,7 +314,7 @@ public GHRelease getReleaseByTagName(String tag) throws IOException {
return null; // no release for this tag
}
}
-
+
public GHRelease getLatestRelease() throws IOException {
try {
return root.retrieve().to(getApiTailUrl("releases/latest"), GHRelease.class).wrap(this);
@@ -336,30 +324,20 @@ public GHRelease getLatestRelease() throws IOException {
}
public PagedIterable listReleases() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- getApiTailUrl("releases"),
- GHRelease[].class,
- item -> item.wrap(GHRepository.this) );
+ return root.retrieve().asPagedIterable(getApiTailUrl("releases"), GHRelease[].class,
+ item -> item.wrap(GHRepository.this));
}
public PagedIterable listTags() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- getApiTailUrl("tags"),
- GHTag[].class,
- item -> item.wrap(GHRepository.this) );
+ return root.retrieve().asPagedIterable(getApiTailUrl("tags"), GHTag[].class,
+ item -> item.wrap(GHRepository.this));
}
/**
- * List languages for the specified repository.
- * The value on the right of a language is the number of bytes of code written in that language.
- * {
- "C": 78769,
- "Python": 7769
- }
+ * List languages for the specified repository. The value on the right of a language is the number of bytes of code
+ * written in that language. { "C": 78769, "Python": 7769 }
*/
- public Map listLanguages() throws IOException {
+ public Map listLanguages() throws IOException {
return root.retrieve().to(getApiTailUrl("languages"), HashMap.class);
}
@@ -386,22 +364,22 @@ public boolean isFork() {
public boolean isArchived() {
return archived;
}
-
+
public boolean isAllowSquashMerge() {
- return allow_squash_merge;
+ return allow_squash_merge;
}
-
+
public boolean isAllowMergeCommit() {
- return allow_merge_commit;
+ return allow_merge_commit;
}
-
+
public boolean isAllowRebaseMerge() {
- return allow_rebase_merge;
+ return allow_rebase_merge;
}
/**
- * Returns the number of all forks of this repository.
- * This not only counts direct forks, but also forks of forks, and so on.
+ * Returns the number of all forks of this repository. This not only counts direct forks, but also forks of forks,
+ * and so on.
*/
public int getForks() {
return forks_count;
@@ -432,9 +410,7 @@ public int getOpenIssueCount() {
}
/**
- * @deprecated
- * This no longer exists in the official API documentation.
- * Use {@link #getForks()}
+ * @deprecated This no longer exists in the official API documentation. Use {@link #getForks()}
*/
public int getNetworkCount() {
return forks_count;
@@ -446,8 +422,7 @@ public int getSubscribersCount() {
/**
*
- * @return
- * null if the repository was never pushed at.
+ * @return null if the repository was never pushed at.
*/
public Date getPushedAt() {
return GitHub.parseDate(pushed_at);
@@ -456,16 +431,14 @@ public Date getPushedAt() {
/**
* Returns the primary branch you'll configure in the "Admin > Options" config page.
*
- * @return
- * This field is null until the user explicitly configures the master branch.
+ * @return This field is null until the user explicitly configures the master branch.
*/
public String getDefaultBranch() {
return default_branch;
}
/**
- * @deprecated
- * Renamed to {@link #getDefaultBranch()}
+ * @deprecated Renamed to {@link #getDefaultBranch()}
*/
public String getMasterBranch() {
return default_branch;
@@ -475,10 +448,8 @@ public int getSize() {
return size;
}
-
/**
- * Gets the collaborators on this repository.
- * This set always appear to include the owner.
+ * Gets the collaborators on this repository. This set always appear to include the owner.
*/
@WithBridgeMethods(Set.class)
public GHPersonSet getCollaborators() throws IOException {
@@ -495,8 +466,9 @@ public PagedIterable listCollaborators() throws IOException {
}
/**
- * Lists all the available assignees
- * to which issues may be assigned.
+ * Lists all
+ * the
+ * available assignees to which issues may be assigned.
*/
public PagedIterable listAssignees() throws IOException {
return listUsers("assignees");
@@ -506,36 +478,44 @@ public PagedIterable listAssignees() throws IOException {
* Checks if the given user is an assignee for this repository.
*/
public boolean hasAssignee(GHUser u) throws IOException {
- return root.retrieve().asHttpStatusCode(getApiTailUrl("assignees/" + u.getLogin()))/100==2;
+ return root.retrieve().asHttpStatusCode(getApiTailUrl("assignees/" + u.getLogin())) / 100 == 2;
}
/**
- * Gets the names of the collaborators on this repository.
- * This method deviates from the principle of this library but it works a lot faster than {@link #getCollaborators()}.
+ * Gets the names of the collaborators on this repository. This method deviates from the principle of this library
+ * but it works a lot faster than {@link #getCollaborators()}.
*/
public Set getCollaboratorNames() throws IOException {
Set r = new HashSet();
- for (GHUser u : GHUser.wrap(root.retrieve().to(getApiTailUrl("collaborators"), GHUser[].class),root))
+ for (GHUser u : GHUser.wrap(root.retrieve().to(getApiTailUrl("collaborators"), GHUser[].class), root))
r.add(u.login);
return r;
}
/**
* Obtain permission for a given user in this repository.
- * @param user a {@link GHUser#getLogin}
- * @throws FileNotFoundException under some conditions (e.g., private repo you can see but are not an admin of); treat as unknown
- * @throws HttpException with a 403 under other conditions (e.g., public repo you have no special rights to); treat as unknown
+ *
+ * @param user
+ * a {@link GHUser#getLogin}
+ * @throws FileNotFoundException
+ * under some conditions (e.g., private repo you can see but are not an admin of); treat as unknown
+ * @throws HttpException
+ * with a 403 under other conditions (e.g., public repo you have no special rights to); treat as unknown
*/
public GHPermissionType getPermission(String user) throws IOException {
- GHPermission perm = root.retrieve().to(getApiTailUrl("collaborators/" + user + "/permission"), GHPermission.class);
+ GHPermission perm = root.retrieve().to(getApiTailUrl("collaborators/" + user + "/permission"),
+ GHPermission.class);
perm.wrapUp(root);
return perm.getPermissionType();
}
/**
* Obtain permission for a given user in this repository.
- * @throws FileNotFoundException under some conditions (e.g., private repo you can see but are not an admin of); treat as unknown
- * @throws HttpException with a 403 under other conditions (e.g., public repo you have no special rights to); treat as unknown
+ *
+ * @throws FileNotFoundException
+ * under some conditions (e.g., private repo you can see but are not an admin of); treat as unknown
+ * @throws HttpException
+ * with a 403 under other conditions (e.g., public repo you have no special rights to); treat as unknown
*/
public GHPermissionType getPermission(GHUser u) throws IOException {
return getPermission(u.getLogin());
@@ -545,7 +525,8 @@ public GHPermissionType getPermission(GHUser u) throws IOException {
* If this repository belongs to an organization, return a set of teams.
*/
public Set getTeams() throws IOException {
- return Collections.unmodifiableSet(new HashSet(Arrays.asList(GHTeam.wrapUp(root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(getOwnerName())))));
+ return Collections.unmodifiableSet(new HashSet(Arrays.asList(GHTeam.wrapUp(
+ root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(getOwnerName())))));
}
public void addCollaborators(GHUser... users) throws IOException {
@@ -580,7 +561,7 @@ public void setEmailServiceHook(String address) throws IOException {
private void edit(String key, String value) throws IOException {
Requester requester = new Requester(root);
if (!key.equals("name"))
- requester.with("name", name); // even when we don't change the name, we need to send it in
+ requester.with("name", name); // even when we don't change the name, we need to send it in
requester.with(key, value).method("PATCH").to(getApiTailUrl(""));
}
@@ -599,22 +580,22 @@ public void enableWiki(boolean v) throws IOException {
}
public void enableDownloads(boolean v) throws IOException {
- edit("has_downloads",String.valueOf(v));
+ edit("has_downloads", String.valueOf(v));
}
/**
* Rename this repository.
*/
public void renameTo(String name) throws IOException {
- edit("name",name);
+ edit("name", name);
}
public void setDescription(String value) throws IOException {
- edit("description",value);
+ edit("description", value);
}
public void setHomepage(String value) throws IOException {
- edit("homepage",value);
+ edit("homepage", value);
}
public void setDefaultBranch(String value) throws IOException {
@@ -624,19 +605,19 @@ public void setDefaultBranch(String value) throws IOException {
public void setPrivate(boolean value) throws IOException {
edit("private", Boolean.toString(value));
}
-
+
public void allowSquashMerge(boolean value) throws IOException {
edit("allow_squash_merge", Boolean.toString(value));
}
-
+
public void allowMergeCommit(boolean value) throws IOException {
edit("allow_merge_commit", Boolean.toString(value));
}
-
+
public void allowRebaseMerge(boolean value) throws IOException {
edit("allow_rebase_merge", Boolean.toString(value));
}
-
+
/**
* Deletes this repository.
*/
@@ -644,16 +625,18 @@ public void delete() throws IOException {
try {
new Requester(root).method("DELETE").to(getApiTailUrl(""));
} catch (FileNotFoundException x) {
- throw (FileNotFoundException) new FileNotFoundException("Failed to delete " + getOwnerName() + "/" + name + "; might not exist, or you might need the delete_repo scope in your token: http://stackoverflow.com/a/19327004/12916").initCause(x);
+ throw (FileNotFoundException) new FileNotFoundException("Failed to delete " + getOwnerName() + "/" + name
+ + "; might not exist, or you might need the delete_repo scope in your token: http://stackoverflow.com/a/19327004/12916")
+ .initCause(x);
}
}
/**
- * Will archive and this repository as read-only. When a repository is archived, any operation
- * that can change its state is forbidden. This applies symmetrically if trying to unarchive it.
+ * Will archive and this repository as read-only. When a repository is archived, any operation that can change its
+ * state is forbidden. This applies symmetrically if trying to unarchive it.
*
- * When you try to do any operation that modifies a read-only repository, it returns the
- * response:
+ *
+ * When you try to do any operation that modifies a read-only repository, it returns the response:
*
*
* org.kohsuke.github.HttpException: {
@@ -662,7 +645,8 @@ public void delete() throws IOException {
* }
*
*
- * @throws IOException In case of any networking error or error from the server.
+ * @throws IOException
+ * In case of any networking error or error from the server.
*/
public void archive() throws IOException {
edit("archived", "true");
@@ -674,80 +658,80 @@ public void archive() throws IOException {
/**
* Sort orders for listing forks
*/
- public enum ForkSort { NEWEST, OLDEST, STARGAZERS }
+ public enum ForkSort {
+ NEWEST, OLDEST, STARGAZERS
+ }
/**
- * Lists all the direct forks of this repository, sorted by
- * github api default, currently {@link ForkSort#NEWEST ForkSort.NEWEST}.
+ * Lists all the direct forks of this repository, sorted by github api default, currently {@link ForkSort#NEWEST
+ * ForkSort.NEWEST}.
*/
public PagedIterable listForks() {
- return listForks(null);
+ return listForks(null);
}
/**
* Lists all the direct forks of this repository, sorted by the given sort order.
- * @param sort the sort order. If null, defaults to github api default,
- * currently {@link ForkSort#NEWEST ForkSort.NEWEST}.
+ *
+ * @param sort
+ * the sort order. If null, defaults to github api default, currently {@link ForkSort#NEWEST
+ * ForkSort.NEWEST}.
*/
public PagedIterable listForks(final ForkSort sort) {
- return root.retrieve().with("sort",sort)
- .asPagedIterable(
- getApiTailUrl("forks"),
- GHRepository[].class,
- item -> item.wrap(root) );
+ return root.retrieve().with("sort", sort).asPagedIterable(getApiTailUrl("forks"), GHRepository[].class,
+ item -> item.wrap(root));
}
/**
* Forks this repository as your repository.
*
- * @return
- * Newly forked repository that belong to you.
+ * @return Newly forked repository that belong to you.
*/
public GHRepository fork() throws IOException {
new Requester(root).method("POST").to(getApiTailUrl("forks"), null);
// this API is asynchronous. we need to wait for a bit
- for (int i=0; i<10; i++) {
+ for (int i = 0; i < 10; i++) {
GHRepository r = root.getMyself().getRepository(name);
- if (r!=null) return r;
+ if (r != null)
+ return r;
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
- throw (IOException)new InterruptedIOException().initCause(e);
+ throw (IOException) new InterruptedIOException().initCause(e);
}
}
- throw new IOException(this+" was forked but can't find the new repository");
+ throw new IOException(this + " was forked but can't find the new repository");
}
/**
* Forks this repository into an organization.
*
- * @return
- * Newly forked repository that belong to you.
+ * @return Newly forked repository that belong to you.
*/
public GHRepository forkTo(GHOrganization org) throws IOException {
- new Requester(root).to(getApiTailUrl("forks?org="+org.getLogin()));
+ new Requester(root).to(getApiTailUrl("forks?org=" + org.getLogin()));
// this API is asynchronous. we need to wait for a bit
- for (int i=0; i<10; i++) {
+ for (int i = 0; i < 10; i++) {
GHRepository r = org.getRepository(name);
- if (r!=null) return r;
+ if (r != null)
+ return r;
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
- throw (IOException)new InterruptedIOException().initCause(e);
+ throw (IOException) new InterruptedIOException().initCause(e);
}
}
- throw new IOException(this+" was forked into "+org.getLogin()+" but can't find the new repository");
+ throw new IOException(this + " was forked into " + org.getLogin() + " but can't find the new repository");
}
/**
* Retrieves a specified pull request.
*/
public GHPullRequest getPullRequest(int i) throws IOException {
- return root.retrieve()
- .withPreview(SHADOW_CAT)
- .to(getApiTailUrl("pulls/" + i), GHPullRequest.class).wrapUp(this);
+ return root.retrieve().withPreview(SHADOW_CAT).to(getApiTailUrl("pulls/" + i), GHPullRequest.class)
+ .wrapUp(this);
}
/**
@@ -762,8 +746,7 @@ public List getPullRequests(GHIssueState state) throws IOExceptio
/**
* Retrieves all the pull requests of a particular state.
*
- * @deprecated
- * Use {@link #queryPullRequests()}
+ * @deprecated Use {@link #queryPullRequests()}
*/
public PagedIterable listPullRequests(GHIssueState state) {
return queryPullRequests().state(state).list();
@@ -780,17 +763,15 @@ public GHPullRequestQueryBuilder queryPullRequests() {
* Creates a new pull request.
*
* @param title
- * Required. The title of the pull request.
+ * Required. The title of the pull request.
* @param head
- * Required. The name of the branch where your changes are implemented.
- * For cross-repository pull requests in the same network,
- * namespace head with a user like this: username:branch.
+ * Required. The name of the branch where your changes are implemented. For cross-repository pull
+ * requests in the same network, namespace head with a user like this: username:branch.
* @param base
- * Required. The name of the branch you want your changes pulled into.
- * This should be an existing branch on the current repository.
+ * Required. The name of the branch you want your changes pulled into. This should be an existing branch
+ * on the current repository.
* @param body
- * The contents of the pull request. This is the markdown description
- * of a pull request.
+ * The contents of the pull request. This is the markdown description of a pull request.
*/
public GHPullRequest createPullRequest(String title, String head, String base, String body) throws IOException {
return createPullRequest(title, head, base, body, true);
@@ -800,19 +781,17 @@ public GHPullRequest createPullRequest(String title, String head, String base, S
* Creates a new pull request. Maintainer's permissions aware.
*
* @param title
- * Required. The title of the pull request.
+ * Required. The title of the pull request.
* @param head
- * Required. The name of the branch where your changes are implemented.
- * For cross-repository pull requests in the same network,
- * namespace head with a user like this: username:branch.
+ * Required. The name of the branch where your changes are implemented. For cross-repository pull
+ * requests in the same network, namespace head with a user like this: username:branch.
* @param base
- * Required. The name of the branch you want your changes pulled into.
- * This should be an existing branch on the current repository.
+ * Required. The name of the branch you want your changes pulled into. This should be an existing branch
+ * on the current repository.
* @param body
- * The contents of the pull request. This is the markdown description
- * of a pull request.
+ * The contents of the pull request. This is the markdown description of a pull request.
* @param maintainerCanModify
- * Indicates whether maintainers can modify the pull request.
+ * Indicates whether maintainers can modify the pull request.
*/
public GHPullRequest createPullRequest(String title, String head, String base, String body,
boolean maintainerCanModify) throws IOException {
@@ -823,34 +802,25 @@ public GHPullRequest createPullRequest(String title, String head, String base, S
* Creates a new pull request. Maintainer's permissions and draft aware.
*
* @param title
- * Required. The title of the pull request.
+ * Required. The title of the pull request.
* @param head
- * Required. The name of the branch where your changes are implemented.
- * For cross-repository pull requests in the same network,
- * namespace head with a user like this: username:branch.
+ * Required. The name of the branch where your changes are implemented. For cross-repository pull
+ * requests in the same network, namespace head with a user like this: username:branch.
* @param base
- * Required. The name of the branch you want your changes pulled into.
- * This should be an existing branch on the current repository.
+ * Required. The name of the branch you want your changes pulled into. This should be an existing branch
+ * on the current repository.
* @param body
- * The contents of the pull request. This is the markdown description
- * of a pull request.
+ * The contents of the pull request. This is the markdown description of a pull request.
* @param maintainerCanModify
- * Indicates whether maintainers can modify the pull request.
+ * Indicates whether maintainers can modify the pull request.
* @param draft
- * Indicates whether to create a draft pull request or not.
+ * Indicates whether to create a draft pull request or not.
*/
public GHPullRequest createPullRequest(String title, String head, String base, String body,
- boolean maintainerCanModify, boolean draft) throws IOException {
- return new Requester(root)
- .withPreview(SHADOW_CAT)
- .with("title",title)
- .with("head",head)
- .with("base",base)
- .with("body",body)
- .with("maintainer_can_modify", maintainerCanModify)
- .with("draft", draft)
- .to(getApiTailUrl("pulls"),GHPullRequest.class)
- .wrapUp(this);
+ boolean maintainerCanModify, boolean draft) throws IOException {
+ return new Requester(root).withPreview(SHADOW_CAT).with("title", title).with("head", head).with("base", base)
+ .with("body", body).with("maintainer_can_modify", maintainerCanModify).with("draft", draft)
+ .to(getApiTailUrl("pulls"), GHPullRequest.class).wrapUp(this);
}
/**
@@ -865,15 +835,21 @@ public GHHook getHook(int id) throws IOException {
}
/**
- * Gets a comparison between 2 points in the repository. This would be similar
- * to calling git log id1...id2
against a local repository.
- * @param id1 an identifier for the first point to compare from, this can be a sha1 ID (for a commit, tag etc) or a direct tag name
- * @param id2 an identifier for the second point to compare to. Can be the same as the first point.
+ * Gets a comparison between 2 points in the repository. This would be similar to calling
+ * git log id1...id2
against a local repository.
+ *
+ * @param id1
+ * an identifier for the first point to compare from, this can be a sha1 ID (for a commit, tag etc) or a
+ * direct tag name
+ * @param id2
+ * an identifier for the second point to compare to. Can be the same as the first point.
* @return the comparison output
- * @throws IOException on failure communicating with GitHub
+ * @throws IOException
+ * on failure communicating with GitHub
*/
public GHCompare getCompare(String id1, String id2) throws IOException {
- GHCompare compare = root.retrieve().to(getApiTailUrl(String.format("compare/%s...%s", id1, id2)), GHCompare.class);
+ GHCompare compare = root.retrieve().to(getApiTailUrl(String.format("compare/%s...%s", id1, id2)),
+ GHCompare.class);
return compare.wrap(this);
}
@@ -887,7 +863,7 @@ public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException {
GHRepository owner2 = id2.getOwner();
// If the owner of the branches is different, we have a cross-fork compare.
- if (owner1!=null && owner2!=null) {
+ if (owner1 != null && owner2 != null) {
String ownerName1 = owner1.getOwnerName();
String ownerName2 = owner2.getOwnerName();
if (!StringUtils.equals(ownerName1, ownerName2)) {
@@ -903,53 +879,54 @@ public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException {
/**
* Retrieves all refs for the github repository.
+ *
* @return an array of GHRef elements coresponding with the refs in the remote repository.
- * @throws IOException on failure communicating with GitHub
+ * @throws IOException
+ * on failure communicating with GitHub
*/
public GHRef[] getRefs() throws IOException {
- return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class), root);
+ return GHRef.wrap(
+ root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class), root);
}
-
/**
* Retrieves all refs for the github repository.
*
* @return paged iterable of all refs
- * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested
+ * @throws IOException
+ * on failure communicating with GitHub, potentially due to an invalid ref type being requested
*/
public PagedIterable listRefs() throws IOException {
final String url = String.format("/repos/%s/%s/git/refs", getOwnerName(), name);
- return root.retrieve()
- .asPagedIterable(
- url,
- GHRef[].class,
- item -> item.wrap(root) );
+ return root.retrieve().asPagedIterable(url, GHRef[].class, item -> item.wrap(root));
}
/**
* Retrieves all refs of the given type for the current GitHub repository.
- * @param refType the type of reg to search for e.g. tags
or commits
+ *
+ * @param refType
+ * the type of reg to search for e.g. tags
or commits
* @return an array of all refs matching the request type
- * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested
+ * @throws IOException
+ * on failure communicating with GitHub, potentially due to an invalid ref type being requested
*/
public GHRef[] getRefs(String refType) throws IOException {
- return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType), GHRef[].class),root);
+ return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType),
+ GHRef[].class), root);
}
/**
* Retrieves all refs of the given type for the current GitHub repository.
*
- * @param refType the type of reg to search for e.g. tags
or commits
+ * @param refType
+ * the type of reg to search for e.g. tags
or commits
* @return paged iterable of all refs of the specified type
- * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested
+ * @throws IOException
+ * on failure communicating with GitHub, potentially due to an invalid ref type being requested
*/
public PagedIterable listRefs(String refType) throws IOException {
final String url = String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType);
- return root.retrieve()
- .asPagedIterable(
- url,
- GHRef[].class,
- item -> item.wrap(root));
+ return root.retrieve().asPagedIterable(url, GHRef[].class, item -> item.wrap(root));
}
/**
@@ -959,22 +936,24 @@ public PagedIterable listRefs(String refType) throws IOException {
* eg: heads/branch
* @return refs matching the request type
* @throws IOException
- * on failure communicating with GitHub, potentially due to an
- * invalid ref type being requested
+ * on failure communicating with GitHub, potentially due to an invalid ref type being requested
*/
public GHRef getRef(String refName) throws IOException {
// hashes in branch names must be replaced with the url encoded equivalent or this call will fail
- // FIXME: how about other URL unsafe characters, like space, @, : etc? do we need to be using URLEncoder.encode()?
+ // FIXME: how about other URL unsafe characters, like space, @, : etc? do we need to be using
+ // URLEncoder.encode()?
// OTOH, '/' need no escaping
refName = refName.replaceAll("#", "%23");
- return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.class).wrap(root);
+ return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.class)
+ .wrap(root);
}
/**
* Returns the annotated tag object. Only valid if the {@link GHRef#getObject()} has a
* {@link GHRef.GHObject#getType()} of {@code tag}.
*
- * @param sha the sha of the tag object
+ * @param sha
+ * the sha of the tag object
* @return the annotated tag object
*/
public GHTagObject getTagObject(String sha) throws IOException {
@@ -984,11 +963,11 @@ public GHTagObject getTagObject(String sha) throws IOException {
/**
* Retrive a tree of the given type for the current GitHub repository.
*
- * @param sha - sha number or branch name ex: "master"
+ * @param sha
+ * sha number or branch name ex: "master"
* @return refs matching the request type
* @throws IOException
- * on failure communicating with GitHub, potentially due to an
- * invalid tree type being requested
+ * on failure communicating with GitHub, potentially due to an invalid tree type being requested
*/
public GHTree getTree(String sha) throws IOException {
String url = String.format("/repos/%s/%s/git/trees/%s", getOwnerName(), name, sha);
@@ -1003,11 +982,12 @@ public GHTreeBuilder createTree() {
* Retrieves the tree for the current GitHub repository, recursively as described in here:
* https://developer.github.com/v3/git/trees/#get-a-tree-recursively
*
- * @param sha - sha number or branch name ex: "master"
- * @param recursive use 1
+ * @param sha
+ * sha number or branch name ex: "master"
+ * @param recursive
+ * use 1
* @throws IOException
- * on failure communicating with GitHub, potentially due to an
- * invalid tree type being requested
+ * on failure communicating with GitHub, potentially due to an invalid tree type being requested
*/
public GHTree getTreeRecursive(String sha, int recursive) throws IOException {
String url = String.format("/repos/%s/%s/git/trees/%s?recursive=%d", getOwnerName(), name, sha, recursive);
@@ -1040,7 +1020,7 @@ public GHBlobBuilder createBlob() {
*/
public InputStream readBlob(String blobSha) throws IOException {
String target = getApiTailUrl("git/blobs/" + blobSha);
- return root.retrieve().withHeader("Accept","application/vnd.github.VERSION.raw").asStream(target);
+ return root.retrieve().withHeader("Accept", "application/vnd.github.VERSION.raw").asStream(target);
}
/**
@@ -1048,9 +1028,10 @@ public InputStream readBlob(String blobSha) throws IOException {
*/
public GHCommit getCommit(String sha1) throws IOException {
GHCommit c = commits.get(sha1);
- if (c==null) {
- c = root.retrieve().to(String.format("/repos/%s/%s/commits/%s", getOwnerName(), name, sha1), GHCommit.class).wrapUp(this);
- commits.put(sha1,c);
+ if (c == null) {
+ c = root.retrieve().to(String.format("/repos/%s/%s/commits/%s", getOwnerName(), name, sha1), GHCommit.class)
+ .wrapUp(this);
+ commits.put(sha1, c);
}
return c;
}
@@ -1063,11 +1044,8 @@ public GHCommitBuilder createCommit() {
* Lists all the commits.
*/
public PagedIterable listCommits() {
- return root.retrieve()
- .asPagedIterable(
- String.format("/repos/%s/%s/commits", getOwnerName(), name),
- GHCommit[].class,
- item -> item.wrapUp(GHRepository.this) );
+ return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/commits", getOwnerName(), name),
+ GHCommit[].class, item -> item.wrapUp(GHRepository.this));
}
/**
@@ -1081,23 +1059,21 @@ public GHCommitQueryBuilder queryCommits() {
* Lists up all the commit comments in this repository.
*/
public PagedIterable listCommitComments() {
- return root.retrieve()
- .asPagedIterable(
- String.format("/repos/%s/%s/comments", getOwnerName(), name),
- GHCommitComment[].class,
- item -> item.wrap(GHRepository.this) );
+ return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/comments", getOwnerName(), name),
+ GHCommitComment[].class, item -> item.wrap(GHRepository.this));
}
/**
* Gets the basic license details for the repository.
*
*
- * @throws IOException as usual but also if you don't use the preview connector
+ * @throws IOException
+ * as usual but also if you don't use the preview connector
* @return null if there's no license.
*/
- public GHLicense getLicense() throws IOException{
+ public GHLicense getLicense() throws IOException {
GHContentWithLicense lic = getLicenseContent_();
- return lic!=null ? lic.license : null;
+ return lic != null ? lic.license : null;
}
/**
@@ -1105,7 +1081,8 @@ public GHLicense getLicense() throws IOException{
*
*
* @return details regarding the license contents, or null if there's no license.
- * @throws IOException as usual but also if you don't use the preview connector
+ * @throws IOException
+ * as usual but also if you don't use the preview connector
*/
public GHContent getLicenseContent() throws IOException {
return getLicenseContent_();
@@ -1113,24 +1090,19 @@ public GHContent getLicenseContent() throws IOException {
private GHContentWithLicense getLicenseContent_() throws IOException {
try {
- return root.retrieve()
- .to(getApiTailUrl("license"), GHContentWithLicense.class).wrap(this);
+ return root.retrieve().to(getApiTailUrl("license"), GHContentWithLicense.class).wrap(this);
} catch (FileNotFoundException e) {
return null;
}
}
/**
-
- /**
- * Lists all the commit statues attached to the given commit, newer ones first.
+ *
+ * /** Lists all the commit statues attached to the given commit, newer ones first.
*/
public PagedIterable listCommitStatuses(final String sha1) throws IOException {
- return root.retrieve()
- .asPagedIterable(
- String.format("/repos/%s/%s/statuses/%s", getOwnerName(), name, sha1),
- GHCommitStatus[].class,
- item -> item.wrapUp(root) );
+ return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/statuses/%s", getOwnerName(), name, sha1),
+ GHCommitStatus[].class, item -> item.wrapUp(root));
}
/**
@@ -1145,25 +1117,25 @@ public GHCommitStatus getLastCommitStatus(String sha1) throws IOException {
* Creates a commit status
*
* @param targetUrl
- * Optional parameter that points to the URL that has more details.
+ * Optional parameter that points to the URL that has more details.
* @param description
- * Optional short description.
- * @param context
- * Optinal commit status context.
- */
- public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description, String context) throws IOException {
- return new Requester(root)
- .with("state", state)
- .with("target_url", targetUrl)
- .with("description", description)
+ * Optional short description.
+ * @param context
+ * Optinal commit status context.
+ */
+ public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description,
+ String context) throws IOException {
+ return new Requester(root).with("state", state).with("target_url", targetUrl).with("description", description)
.with("context", context)
- .to(String.format("/repos/%s/%s/statuses/%s",getOwnerName(),this.name,sha1),GHCommitStatus.class).wrapUp(root);
+ .to(String.format("/repos/%s/%s/statuses/%s", getOwnerName(), this.name, sha1), GHCommitStatus.class)
+ .wrapUp(root);
}
/**
- * @see #createCommitStatus(String, GHCommitState,String,String,String)
+ * @see #createCommitStatus(String, GHCommitState,String,String,String)
*/
- public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description) throws IOException {
+ public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description)
+ throws IOException {
return createCommitStatus(sha1, state, targetUrl, description, null);
}
@@ -1171,11 +1143,8 @@ public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, Strin
* Lists repository events.
*/
public PagedIterable listEvents() throws IOException {
- return root.retrieve()
- .asPagedIterable(
- String.format("/repos/%s/%s/events", getOwnerName(), name),
- GHEventInfo[].class,
- item -> item.wrapUp(root) );
+ return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/events", getOwnerName(), name),
+ GHEventInfo[].class, item -> item.wrapUp(root));
}
/**
@@ -1184,19 +1153,12 @@ public PagedIterable listEvents() throws IOException {
* https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
*/
public PagedIterable listLabels() throws IOException {
- return root.retrieve()
- .withPreview(SYMMETRA)
- .asPagedIterable(
- getApiTailUrl("labels"),
- GHLabel[].class,
- item -> item.wrapUp(GHRepository.this) );
+ return root.retrieve().withPreview(SYMMETRA).asPagedIterable(getApiTailUrl("labels"), GHLabel[].class,
+ item -> item.wrapUp(GHRepository.this));
}
public GHLabel getLabel(String name) throws IOException {
- return root.retrieve()
- .withPreview(SYMMETRA)
- .to(getApiTailUrl("labels/"+name), GHLabel.class)
- .wrapUp(this);
+ return root.retrieve().withPreview(SYMMETRA).to(getApiTailUrl("labels/" + name), GHLabel.class).wrapUp(this);
}
public GHLabel createLabel(String name, String color) throws IOException {
@@ -1205,31 +1167,26 @@ public GHLabel createLabel(String name, String color) throws IOException {
/**
* Description is still in preview.
+ *
* @param name
* @param color
* @param description
* @return
* @throws IOException
*/
- @Preview @Deprecated
+ @Preview
+ @Deprecated
public GHLabel createLabel(String name, String color, String description) throws IOException {
- return root.retrieve().method("POST")
- .withPreview(SYMMETRA)
- .with("name",name)
- .with("color", color)
- .with("description", description)
- .to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this);
+ return root.retrieve().method("POST").withPreview(SYMMETRA).with("name", name).with("color", color)
+ .with("description", description).to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this);
}
/**
* Lists all the invitations.
*/
public PagedIterable