mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-24 15:50:35 +00:00
Merge remote-tracking branch 'github-api/master' into BranchMissing
This commit is contained in:
3
pom.xml
3
pom.xml
@@ -175,6 +175,9 @@
|
||||
<goals>
|
||||
<goal>${formatter-maven-plugin.goal}</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<configFile>src/main/resources/eclipse/formatter.xml</configFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
@@ -183,8 +183,9 @@ public class GHApp extends GHObject {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public PagedIterable<GHAppInstallation> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,8 +203,10 @@ public class GHApp extends GHObject {
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,8 +225,10 @@ public class GHApp extends GHObject {
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +249,8 @@ public class GHApp extends GHObject {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
|
||||
return root.retrieve().withPreview(MACHINE_MAN)
|
||||
return root.retrieve()
|
||||
.withPreview(MACHINE_MAN)
|
||||
.to(String.format("/repos/%s/%s/installation", ownerName, repositoryName), GHAppInstallation.class)
|
||||
.wrapUp(root);
|
||||
}
|
||||
@@ -264,8 +270,10 @@ public class GHApp extends GHObject {
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class GHAppCreateTokenBuilder {
|
||||
this.root = root;
|
||||
this.apiUrlTail = apiUrlTail;
|
||||
this.builder = new Requester(root);
|
||||
this.builder.withPermissions("permissions", permissions);
|
||||
withPermissions(builder, permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,4 +59,12 @@ public class GHAppCreateTokenBuilder {
|
||||
.wrapUp(root);
|
||||
}
|
||||
|
||||
private static Requester withPermissions(Requester builder, Map<String, GHPermissionType> value) {
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
for (Map.Entry<String, GHPermissionType> entry : value.entrySet()) {
|
||||
retMap.put(entry.getKey(), Requester.transformEnum(entry.getValue()));
|
||||
}
|
||||
return builder.with("permissions", retMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class GHAsset extends GHObject {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -158,8 +158,8 @@ public class GHAuthorization extends GHObject {
|
||||
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;
|
||||
|
||||
@@ -16,8 +16,10 @@ import static org.kohsuke.github.Previews.*;
|
||||
*
|
||||
* @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;
|
||||
@@ -149,13 +151,15 @@ public class GHBranch {
|
||||
@Deprecated
|
||||
public void enableProtection(EnforcementLevel level, Collection<String> contexts) throws IOException {
|
||||
switch (level) {
|
||||
case OFF:
|
||||
disableProtection();
|
||||
break;
|
||||
case NON_ADMINS:
|
||||
case EVERYONE:
|
||||
enableProtection().addRequiredChecks(contexts).includeAdmins(level == EnforcementLevel.EVERYONE).enable();
|
||||
break;
|
||||
case OFF :
|
||||
disableProtection();
|
||||
break;
|
||||
case NON_ADMINS :
|
||||
case EVERYONE :
|
||||
enableProtection().addRequiredChecks(contexts)
|
||||
.includeAdmins(level == EnforcementLevel.EVERYONE)
|
||||
.enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ import java.util.Collection;
|
||||
/**
|
||||
* The type GHBranchProtection.
|
||||
*/
|
||||
@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";
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@ import static org.kohsuke.github.Previews.*;
|
||||
*
|
||||
* @see GHBranch#enableProtection() GHBranch#enableProtection()
|
||||
*/
|
||||
@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 GHBranchProtectionBuilder {
|
||||
private final GHBranch branch;
|
||||
|
||||
@@ -86,10 +88,13 @@ public class GHBranchProtectionBuilder {
|
||||
* the io exception
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,10 @@ public class GHCommit {
|
||||
/**
|
||||
* 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;
|
||||
@@ -167,7 +169,8 @@ public class GHCommit {
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -344,7 +347,7 @@ public class GHCommit {
|
||||
*/
|
||||
public List<File> getFiles() throws IOException {
|
||||
populate();
|
||||
return files != null ? Collections.unmodifiableList(files) : Collections.<File> emptyList();
|
||||
return files != null ? Collections.unmodifiableList(files) : Collections.<File>emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -438,9 +441,11 @@ public class GHCommit {
|
||||
* @return {@link PagedIterable} with all the commit comments in this repository.
|
||||
*/
|
||||
public PagedIterable<GHCommitComment> listComments() {
|
||||
return owner.root.retrieve().asPagedIterable(
|
||||
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
|
||||
GHCommitComment[].class, item -> item.wrap(owner));
|
||||
return owner.root.retrieve()
|
||||
.asPagedIterable(
|
||||
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
|
||||
GHCommitComment[].class,
|
||||
item -> item.wrap(owner));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,7 +466,9 @@ public class GHCommit {
|
||||
* 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)
|
||||
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);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class GHCommitBuilder {
|
||||
* @return the gh commit builder
|
||||
*/
|
||||
public GHCommitBuilder author(String name, String email, Date date) {
|
||||
req._with("author", new UserInfo(name, email, date));
|
||||
req.with("author", new UserInfo(name, email, date));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class GHCommitBuilder {
|
||||
* @return the gh commit builder
|
||||
*/
|
||||
public GHCommitBuilder committer(String name, String email, Date date) {
|
||||
req._with("committer", new UserInfo(name, email, date));
|
||||
req.with("committer", new UserInfo(name, email, date));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class GHCommitBuilder {
|
||||
* the io exception
|
||||
*/
|
||||
public GHCommit create() throws IOException {
|
||||
req._with("parents", parents);
|
||||
req.with("parents", parents);
|
||||
return req.method("POST").to(getApiTail(), GHCommit.class).wrapUp(repo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ import static org.kohsuke.github.Previews.*;
|
||||
* @see GHCommit#createComment(String, String, Integer, Integer) 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;
|
||||
|
||||
@@ -120,15 +120,18 @@ public class GHCommitComment extends GHObject implements Reactable {
|
||||
@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
|
||||
public PagedIterable<GHReaction> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,8 +163,8 @@ public class GHCompare {
|
||||
* 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;
|
||||
|
||||
@@ -306,8 +306,11 @@ public class GHContent implements Refreshable {
|
||||
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);
|
||||
@@ -347,7 +350,9 @@ public class GHContent implements Refreshable {
|
||||
* the io exception
|
||||
*/
|
||||
public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException {
|
||||
Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
|
||||
Requester requester = new Requester(root).with("path", path)
|
||||
.with("message", commitMessage)
|
||||
.with("sha", sha)
|
||||
.method("DELETE");
|
||||
|
||||
if (branch != null) {
|
||||
|
||||
@@ -30,8 +30,10 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
*
|
||||
* @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;
|
||||
|
||||
@@ -30,8 +30,10 @@ 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;
|
||||
@@ -86,8 +88,8 @@ public class GHEventInfo {
|
||||
* @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);
|
||||
}
|
||||
@@ -99,8 +101,8 @@ public class GHEventInfo {
|
||||
* @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 GHUser getActor() throws IOException {
|
||||
return root.getUser(actor.getLogin());
|
||||
}
|
||||
@@ -123,8 +125,8 @@ public class GHEventInfo {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
@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());
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#pullrequestevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -251,8 +252,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#issueevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -323,8 +324,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#issuecommentevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -416,8 +417,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#commitcommentevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -486,8 +487,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#createevent">authoritative source</a>
|
||||
*/
|
||||
@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")
|
||||
@@ -570,8 +571,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#deleteevent">authoritative source</a>
|
||||
*/
|
||||
@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")
|
||||
@@ -631,8 +632,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#deploymentevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -691,8 +692,8 @@ public abstract class GHEventPayload {
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#deploymentstatusevent">authoritative
|
||||
* source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -772,8 +773,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#forkevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -924,8 +925,9 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#pushevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -1196,8 +1198,8 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#releaseevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
@@ -1265,8 +1267,9 @@ public abstract class GHEventPayload {
|
||||
*
|
||||
* @see <a href="http://developer.github.com/v3/activity/events/types/#repositoryevent">authoritative source</a>
|
||||
*/
|
||||
@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;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class GHGistBuilder {
|
||||
* if Gist cannot be created.
|
||||
*/
|
||||
public GHGist create() throws IOException {
|
||||
req._with("files", files);
|
||||
req.with("files", files);
|
||||
return req.to("/gists", GHGist.class).wrapUp(root);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class GHGistUpdater {
|
||||
* the io exception
|
||||
*/
|
||||
public GHGist update() throws IOException {
|
||||
builder._with("files", files);
|
||||
builder.with("files", files);
|
||||
return builder.method("PATCH").to(base.getApiTailUrl(""), GHGist.class).wrap(base.owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.Map;
|
||||
*
|
||||
* @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<String> events;
|
||||
|
||||
@@ -74,8 +74,11 @@ class GHHooks {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ import java.net.URL;
|
||||
* @see GitHub#getMyInvitations() GitHub#getMyInvitations()
|
||||
* @see GHRepository#listInvitations() 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;
|
||||
|
||||
|
||||
@@ -237,11 +237,11 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
private void editIssue(String key, Object value) throws IOException {
|
||||
new Requester(root)._with(key, value).method("PATCH").to(getIssuesApiRoute());
|
||||
new Requester(root).with(key, value).method("PATCH").to(getIssuesApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,7 +482,8 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void addAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
root.retrieve().method("POST").withLogins(ASSIGNEES, assignees).to(getIssuesApiRoute() + "/assignees", this);
|
||||
root.retrieve().method("POST").with(ASSIGNEES, getLogins(assignees)).to(getIssuesApiRoute() + "/assignees",
|
||||
this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,7 +507,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void setAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
new Requester(root).withLogins(ASSIGNEES, assignees).method("PATCH").to(getIssuesApiRoute());
|
||||
new Requester(root).with(ASSIGNEES, getLogins(assignees)).method("PATCH").to(getIssuesApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -530,7 +531,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void removeAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
root.retrieve().method("DELETE").withLogins(ASSIGNEES, assignees).inBody()
|
||||
root.retrieve().method("DELETE").with(ASSIGNEES, getLogins(assignees)).inBody()
|
||||
.to(getIssuesApiRoute() + "/assignees", this);
|
||||
}
|
||||
|
||||
@@ -677,6 +678,14 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
}
|
||||
}
|
||||
|
||||
protected static List<String> getLogins(Collection<GHUser> users) {
|
||||
List<String> names = new ArrayList<String>(users.size());
|
||||
for (GHUser a : users) {
|
||||
names.add(a.getLogin());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists events for this issue. See https://developer.github.com/v3/issues/events/
|
||||
*
|
||||
|
||||
@@ -93,7 +93,9 @@ public class GHIssueBuilder {
|
||||
* the io exception
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,15 +125,18 @@ public class GHIssueComment extends GHObject implements Reactable {
|
||||
@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
|
||||
public PagedIterable<GHReaction> 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() {
|
||||
|
||||
@@ -124,7 +124,10 @@ public class GHIssueEvent {
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,13 @@ public class GHLabel {
|
||||
* the io exception
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,8 +101,13 @@ public class GHLabel {
|
||||
@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);
|
||||
}
|
||||
|
||||
static Collection<String> toNames(Collection<GHLabel> labels) {
|
||||
|
||||
@@ -41,8 +41,8 @@ import java.util.List;
|
||||
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
|
||||
*/
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
@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 GHLicense extends GHObject {
|
||||
@SuppressFBWarnings("IS2_INCONSISTENT_SYNC")
|
||||
// root is set before the object is returned to the app
|
||||
|
||||
@@ -159,7 +159,7 @@ public class GHMilestone extends GHObject {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -175,8 +175,10 @@ public class GHMyself extends GHUser {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHRepository> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,8 +208,9 @@ public class GHMyself extends GHUser {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHMembership> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,9 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
||||
*/
|
||||
public Iterator<GHThread> iterator() {
|
||||
// capture the configuration setting here
|
||||
final Requester req = new Requester(root).method("GET").with("all", all).with("participating", participating)
|
||||
final Requester req = new Requester(root).method("GET")
|
||||
.with("all", all)
|
||||
.with("participating", participating)
|
||||
.with("since", since);
|
||||
|
||||
return new Iterator<GHThread>() {
|
||||
|
||||
@@ -16,8 +16,8 @@ import java.util.Map;
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -39,7 +39,10 @@ public class GHOrganization extends GHPerson {
|
||||
* the io exception
|
||||
* @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,
|
||||
public GHRepository createRepository(String name,
|
||||
String description,
|
||||
String homepage,
|
||||
String team,
|
||||
boolean isPublic) throws IOException {
|
||||
GHTeam t = getTeams().get(team);
|
||||
if (t == null)
|
||||
@@ -65,11 +68,17 @@ public class GHOrganization extends GHPerson {
|
||||
* the io exception
|
||||
* @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,
|
||||
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)
|
||||
return createRepository(name).description(description)
|
||||
.homepage(homepage)
|
||||
.private_(!isPublic)
|
||||
.team(team)
|
||||
.create();
|
||||
}
|
||||
|
||||
@@ -111,8 +120,10 @@ public class GHOrganization extends GHPerson {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHTeam> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +182,9 @@ public class GHOrganization extends GHPerson {
|
||||
* "https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership">documentation</a>
|
||||
*/
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -285,8 +298,10 @@ public class GHOrganization extends GHPerson {
|
||||
|
||||
private PagedIterable<GHUser> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,7 +326,9 @@ public class GHOrganization extends GHPerson {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHProject> listProjects(final GHProject.ProjectStateFilter status) throws IOException {
|
||||
return root.retrieve().withPreview(INERTIA).with("state", status)
|
||||
return root.retrieve()
|
||||
.withPreview(INERTIA)
|
||||
.with("state", status)
|
||||
.asPagedIterable(String.format("/orgs/%s/projects", login), GHProject[].class, item -> item.wrap(root));
|
||||
}
|
||||
|
||||
@@ -338,8 +355,13 @@ public class GHOrganization extends GHPerson {
|
||||
* the io exception
|
||||
*/
|
||||
public GHProject createProject(String name, String body) throws IOException {
|
||||
return root.retrieve().method("POST").withPreview(INERTIA).with("name", name).with("body", body)
|
||||
.to(String.format("/orgs/%s/projects", login), GHProject.class).wrap(root);
|
||||
return root.retrieve()
|
||||
.method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("name", name)
|
||||
.with("body", body)
|
||||
.to(String.format("/orgs/%s/projects", login), GHProject.class)
|
||||
.wrap(root);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,8 +452,10 @@ public class GHOrganization extends GHPerson {
|
||||
* Lists events performed by a user (this includes private events if the caller is authenticated.
|
||||
*/
|
||||
public PagedIterable<GHEventInfo> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,8 +112,8 @@ public abstract class GHPerson extends GHObject {
|
||||
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
|
||||
return new Iterable<List<GHRepository>>() {
|
||||
public Iterator<List<GHRepository>> iterator() {
|
||||
final Iterator<GHRepository[]> pager = root.retrieve().asIterator("/users/" + login + "/repos",
|
||||
GHRepository[].class, pageSize);
|
||||
final Iterator<GHRepository[]> pager = root.retrieve()
|
||||
.asIterator("/users/" + login + "/repos", GHRepository[].class, pageSize);
|
||||
|
||||
return new Iterator<List<GHRepository>>() {
|
||||
public boolean hasNext() {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class GHProject extends GHObject {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).withPreview(INERTIA).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,8 +282,11 @@ public class GHProject extends GHObject {
|
||||
*/
|
||||
public PagedIterable<GHProjectColumn> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -296,7 +299,11 @@ public class GHProject extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHProjectColumn createColumn(String name) throws IOException {
|
||||
return root.retrieve().method("POST").withPreview(INERTIA).with("name", name)
|
||||
.to(String.format("/projects/%d/columns", id), GHProjectColumn.class).wrap(this);
|
||||
return root.retrieve()
|
||||
.method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("name", name)
|
||||
.to(String.format("/projects/%d/columns", id), GHProjectColumn.class)
|
||||
.wrap(this);
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public class GHProjectCard extends GHObject {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).withPreview(INERTIA).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ public class GHProjectColumn extends GHObject {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).withPreview(INERTIA).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,8 +137,11 @@ public class GHProjectColumn extends GHObject {
|
||||
*/
|
||||
public PagedIterable<GHProjectCard> 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));
|
||||
return root.retrieve()
|
||||
.withPreview(INERTIA)
|
||||
.asPagedIterable(String.format("/projects/columns/%d/cards", id),
|
||||
GHProjectCard[].class,
|
||||
item -> item.wrap(column));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,8 +154,12 @@ public class GHProjectColumn extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
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);
|
||||
return root.retrieve()
|
||||
.method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("note", note)
|
||||
.to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class)
|
||||
.wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,9 +172,12 @@ public class GHProjectColumn extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHProjectCard createCard(GHIssue issue) throws IOException {
|
||||
return root.retrieve().method("POST").withPreview(INERTIA)
|
||||
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);
|
||||
.to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class)
|
||||
.wrap(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +510,8 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* the io exception
|
||||
*/
|
||||
public void requestReviewers(List<GHUser> reviewers) throws IOException {
|
||||
new Requester(root).method("POST").withLogins("reviewers", reviewers).to(getApiRoute() + REQUEST_REVIEWERS);
|
||||
new Requester(root).method("POST").with("reviewers", getLogins(reviewers))
|
||||
.to(getApiRoute() + REQUEST_REVIEWERS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,8 +34,10 @@ import java.net.URL;
|
||||
* @author Luca Milanesio
|
||||
* @see GHPullRequest#listCommits() 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;
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GHPullRequestQueryBuilder extends GHQueryBuilder<GHPullRequest> {
|
||||
|
||||
@Override
|
||||
public PagedIterable<GHPullRequest> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,9 @@ public class GHPullRequestReview extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public void submit(String body, GHPullRequestReviewEvent event) throws IOException {
|
||||
new Requester(owner.root).method("POST").with("body", body).with("event", event.action())
|
||||
new Requester(owner.root).method("POST")
|
||||
.with("body", body)
|
||||
.with("event", event.action())
|
||||
.to(getApiRoute() + "/events", this);
|
||||
this.body = body;
|
||||
this.state = event.toState();
|
||||
@@ -196,7 +198,9 @@ public class GHPullRequestReview extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHPullRequestReviewComment> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +89,10 @@ public class GHPullRequestReviewBuilder {
|
||||
* the io exception
|
||||
*/
|
||||
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 {
|
||||
|
||||
@@ -186,21 +186,27 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
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
|
||||
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
|
||||
public PagedIterable<GHReaction> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ public enum GHPullRequestReviewEvent {
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ package org.kohsuke.github;
|
||||
* 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.
|
||||
*/
|
||||
REQUEST_CHANGES, COMMENTED, DISMISSED;
|
||||
REQUEST_CHANGES,
|
||||
COMMENTED,
|
||||
DISMISSED;
|
||||
|
||||
/**
|
||||
* Action string.
|
||||
@@ -24,16 +28,16 @@ public enum GHPullRequestReviewState {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@ public class GHRateLimit {
|
||||
private final Record integrationManifest;
|
||||
|
||||
static GHRateLimit Unknown() {
|
||||
return new GHRateLimit(new UnknownLimitRecord(), new UnknownLimitRecord(), new UnknownLimitRecord(),
|
||||
return new GHRateLimit(new UnknownLimitRecord(),
|
||||
new UnknownLimitRecord(),
|
||||
new UnknownLimitRecord(),
|
||||
new UnknownLimitRecord());
|
||||
}
|
||||
|
||||
@@ -69,7 +71,8 @@ public class GHRateLimit {
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
GHRateLimit(@Nonnull @JsonProperty("core") Record core, @Nonnull @JsonProperty("search") Record search,
|
||||
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;
|
||||
@@ -266,7 +269,8 @@ public class GHRateLimit {
|
||||
* the reset epoch seconds
|
||||
*/
|
||||
@JsonCreator
|
||||
public Record(@JsonProperty("limit") int limit, @JsonProperty("remaining") int remaining,
|
||||
public Record(@JsonProperty("limit") int limit,
|
||||
@JsonProperty("remaining") int remaining,
|
||||
@JsonProperty("reset") long resetEpochSeconds) {
|
||||
this(limit, remaining, resetEpochSeconds, null);
|
||||
}
|
||||
|
||||
@@ -94,8 +94,9 @@ public class GHRef {
|
||||
/**
|
||||
* The type GHObject.
|
||||
*/
|
||||
@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;
|
||||
|
||||
|
||||
@@ -241,7 +241,9 @@ public class GHRelease extends GHObject {
|
||||
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(),
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,8 @@ public class GHReleaseUpdater {
|
||||
* the io exception
|
||||
*/
|
||||
public GHRelease update() throws IOException {
|
||||
return builder.method("PATCH").to(base.owner.getApiTailUrl("releases/" + base.id), GHRelease.class)
|
||||
return builder.method("PATCH")
|
||||
.to(base.owner.getApiTailUrl("releases/" + base.id), GHRelease.class)
|
||||
.wrap(base.owner);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ import static org.kohsuke.github.Previews.*;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
@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 GHRepository extends GHObject {
|
||||
/* package almost final */ GitHub root;
|
||||
|
||||
@@ -142,11 +142,13 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHDeployment> listDeployments(String sha, String ref, String task, String environment) {
|
||||
List<String> params = Arrays.asList(getParam("sha", sha), getParam("ref", ref), getParam("task", task),
|
||||
List<String> 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));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(deploymentsUrl, GHDeployment[].class, item -> item.wrap(GHRepository.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,7 +392,8 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public List<GHIssue> 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));
|
||||
}
|
||||
@@ -403,8 +406,9 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHIssue> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,8 +435,11 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,8 +511,8 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHRelease> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -516,8 +523,8 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHTag> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -802,8 +809,8 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
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();
|
||||
}
|
||||
@@ -829,8 +836,9 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public Set<GHTeam> getTeams() throws IOException {
|
||||
return Collections.unmodifiableSet(new HashSet<GHTeam>(Arrays.asList(GHTeam.wrapUp(
|
||||
root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(getOwnerName())))));
|
||||
return Collections.unmodifiableSet(new HashSet<GHTeam>(
|
||||
Arrays.asList(GHTeam.wrapUp(root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class),
|
||||
root.getOrganization(getOwnerName())))));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -898,7 +906,10 @@ public class GHRepository extends GHObject {
|
||||
public void setEmailServiceHook(String address) throws IOException {
|
||||
Map<String, String> config = new HashMap<String, String>();
|
||||
config.put("address", address);
|
||||
new Requester(root).method("POST").with("name", "email").with("config", config).with("active", true)
|
||||
new Requester(root).method("POST")
|
||||
.with("name", "email")
|
||||
.with("config", config)
|
||||
.with("active", true)
|
||||
.to(getApiTailUrl("hooks"));
|
||||
}
|
||||
|
||||
@@ -1107,8 +1118,9 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHRepository> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1171,7 +1183,9 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHPullRequest getPullRequest(int i) throws IOException {
|
||||
return root.retrieve().withPreview(SHADOW_CAT).to(getApiTailUrl("pulls/" + i), GHPullRequest.class)
|
||||
return root.retrieve()
|
||||
.withPreview(SHADOW_CAT)
|
||||
.to(getApiTailUrl("pulls/" + i), GHPullRequest.class)
|
||||
.wrapUp(this);
|
||||
}
|
||||
|
||||
@@ -1250,7 +1264,10 @@ public class GHRepository extends GHObject {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHPullRequest createPullRequest(String title, String head, String base, String body,
|
||||
public GHPullRequest createPullRequest(String title,
|
||||
String head,
|
||||
String base,
|
||||
String body,
|
||||
boolean maintainerCanModify) throws IOException {
|
||||
return createPullRequest(title, head, base, body, maintainerCanModify, false);
|
||||
}
|
||||
@@ -1276,11 +1293,21 @@ public class GHRepository extends GHObject {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1321,8 +1348,8 @@ public class GHRepository extends GHObject {
|
||||
* 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);
|
||||
}
|
||||
|
||||
@@ -1381,7 +1408,8 @@ public class GHRepository extends GHObject {
|
||||
*/
|
||||
public GHRef[] getRefs() throws IOException {
|
||||
return GHRef.wrap(
|
||||
root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class), root);
|
||||
root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class),
|
||||
root);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1406,8 +1434,10 @@ public class GHRepository extends GHObject {
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1439,7 +1469,8 @@ public class GHRepository extends GHObject {
|
||||
// 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)
|
||||
return root.retrieve()
|
||||
.to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.class)
|
||||
.wrap(root);
|
||||
}
|
||||
|
||||
@@ -1553,7 +1584,8 @@ public class GHRepository extends GHObject {
|
||||
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)
|
||||
c = root.retrieve()
|
||||
.to(String.format("/repos/%s/%s/commits/%s", getOwnerName(), name, sha1), GHCommit.class)
|
||||
.wrapUp(this);
|
||||
commits.put(sha1, c);
|
||||
}
|
||||
@@ -1575,8 +1607,10 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHCommit> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1594,8 +1628,10 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHCommitComment> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1641,8 +1677,10 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHCommitStatus> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1676,9 +1714,14 @@ public class GHRepository extends GHObject {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description,
|
||||
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)
|
||||
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);
|
||||
@@ -1714,8 +1757,10 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHEventInfo> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1728,8 +1773,9 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHLabel> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1776,8 +1822,14 @@ public class GHRepository extends GHObject {
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1786,8 +1838,10 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHInvitation> listInvitations() {
|
||||
return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/invitations", getOwnerName(), name),
|
||||
GHInvitation[].class, item -> item.wrapUp(root));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(String.format("/repos/%s/%s/invitations", getOwnerName(), name),
|
||||
GHInvitation[].class,
|
||||
item -> item.wrapUp(root));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1818,8 +1872,11 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHStargazer> listStargazers2() {
|
||||
return root.retrieve().withPreview("application/vnd.github.v3.star+json").asPagedIterable(
|
||||
getApiTailUrl("stargazers"), GHStargazer[].class, item -> item.wrapUp(GHRepository.this));
|
||||
return root.retrieve()
|
||||
.withPreview("application/vnd.github.v3.star+json")
|
||||
.asPagedIterable(getApiTailUrl("stargazers"),
|
||||
GHStargazer[].class,
|
||||
item -> item.wrapUp(GHRepository.this));
|
||||
}
|
||||
|
||||
private PagedIterable<GHUser> listUsers(final String suffix) {
|
||||
@@ -1890,7 +1947,8 @@ public class GHRepository extends GHObject {
|
||||
* @return the post commit hooks
|
||||
* @deprecated Use {@link #getHooks()} and {@link #createHook(String, Map, Collection, boolean)}
|
||||
*/
|
||||
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "It causes a performance degradation, but we have already exposed it to the API")
|
||||
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
|
||||
justification = "It causes a performance degradation, but we have already exposed it to the API")
|
||||
public Set<URL> getPostCommitHooks() {
|
||||
return postCommitHooks;
|
||||
}
|
||||
@@ -1898,7 +1956,8 @@ public class GHRepository extends GHObject {
|
||||
/**
|
||||
* Live set view of the post-commit hook.
|
||||
*/
|
||||
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "It causes a performance degradation, but we have already exposed it to the API")
|
||||
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
|
||||
justification = "It causes a performance degradation, but we have already exposed it to the API")
|
||||
@SkipFromToString
|
||||
private final Set<URL> postCommitHooks = new AbstractSet<URL>() {
|
||||
private List<URL> getPostCommitHooks() {
|
||||
@@ -2032,8 +2091,11 @@ public class GHRepository extends GHObject {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHMilestone> listMilestones(final GHIssueState state) {
|
||||
return root.retrieve().with("state", state).asPagedIterable(getApiTailUrl("milestones"), GHMilestone[].class,
|
||||
item -> item.wrap(GHRepository.this));
|
||||
return root.retrieve()
|
||||
.with("state", state)
|
||||
.asPagedIterable(getApiTailUrl("milestones"),
|
||||
GHMilestone[].class,
|
||||
item -> item.wrap(GHRepository.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2237,8 +2299,11 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHMilestone createMilestone(String title, String description) throws IOException {
|
||||
return new Requester(root).with("title", title).with("description", description).method("POST")
|
||||
.to(getApiTailUrl("milestones"), GHMilestone.class).wrap(this);
|
||||
return new Requester(root).with("title", title)
|
||||
.with("description", description)
|
||||
.method("POST")
|
||||
.to(getApiTailUrl("milestones"), GHMilestone.class)
|
||||
.wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2253,8 +2318,11 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHDeployKey addDeployKey(String title, String key) throws IOException {
|
||||
return new Requester(root).with("title", title).with("key", key).method("POST")
|
||||
.to(getApiTailUrl("keys"), GHDeployKey.class).wrap(this);
|
||||
return new Requester(root).with("title", title)
|
||||
.with("key", key)
|
||||
.method("POST")
|
||||
.to(getApiTailUrl("keys"), GHDeployKey.class)
|
||||
.wrap(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -2320,8 +2388,11 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException {
|
||||
return new Requester(root).with("subscribed", subscribed).with("ignored", ignored).method("PUT")
|
||||
.to(getApiTailUrl("subscription"), GHSubscription.class).wrapUp(this);
|
||||
return new Requester(root).with("subscribed", subscribed)
|
||||
.with("ignored", ignored)
|
||||
.method("PUT")
|
||||
.to(getApiTailUrl("subscription"), GHSubscription.class)
|
||||
.wrapUp(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2347,8 +2418,8 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<Contributor> listContributors() throws IOException {
|
||||
return root.retrieve().asPagedIterable(getApiTailUrl("contributors"), Contributor[].class,
|
||||
item -> item.wrapUp(root));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(getApiTailUrl("contributors"), Contributor[].class, item -> item.wrapUp(root));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2402,8 +2473,13 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHProject createProject(String name, String body) throws IOException {
|
||||
return root.retrieve().method("POST").withPreview(INERTIA).with("name", name).with("body", body)
|
||||
.to(getApiTailUrl("projects"), GHProject.class).wrap(this);
|
||||
return root.retrieve()
|
||||
.method("POST")
|
||||
.withPreview(INERTIA)
|
||||
.with("name", name)
|
||||
.with("body", body)
|
||||
.to(getApiTailUrl("projects"), GHProject.class)
|
||||
.wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2416,8 +2492,10 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHProject> listProjects(final GHProject.ProjectStateFilter status) throws IOException {
|
||||
return root.retrieve().withPreview(INERTIA).with("state", status).asPagedIterable(getApiTailUrl("projects"),
|
||||
GHProject[].class, item -> item.wrap(GHRepository.this));
|
||||
return root.retrieve()
|
||||
.withPreview(INERTIA)
|
||||
.with("state", status)
|
||||
.asPagedIterable(getApiTailUrl("projects"), GHProject[].class, item -> item.wrap(GHRepository.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2446,10 +2524,10 @@ public class GHRepository extends GHObject {
|
||||
* @see GitHub#renderMarkdown(String) GitHub#renderMarkdown(String)
|
||||
*/
|
||||
public Reader renderMarkdown(String text, MarkdownMode mode) throws IOException {
|
||||
return new InputStreamReader(
|
||||
new Requester(root).with("text", text).with("mode", mode == null ? null : mode.toString())
|
||||
.with("context", getFullName()).asStream("/markdown"),
|
||||
"UTF-8");
|
||||
return new InputStreamReader(new Requester(root).with("text", text)
|
||||
.with("mode", mode == null ? null : mode.toString())
|
||||
.with("context", getFullName())
|
||||
.asStream("/markdown"), "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2514,8 +2592,8 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHIssueEvent> listIssueEvents() throws IOException {
|
||||
return root.retrieve().asPagedIterable(getApiTailUrl("issues/events"), GHIssueEvent[].class,
|
||||
item -> item.wrapUp(root));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(getApiTailUrl("issues/events"), GHIssueEvent[].class, item -> item.wrapUp(root));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,15 +86,17 @@ public class GHRepositoryStatistics {
|
||||
* This gets the actual statistics from the server. Returns null if they are still being cached.
|
||||
*/
|
||||
private PagedIterable<ContributorStats> getContributorStatsImpl() throws IOException {
|
||||
return root.retrieve().asPagedIterable(getApiTailUrl("contributors"), ContributorStats[].class,
|
||||
item -> item.wrapUp(root));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(getApiTailUrl("contributors"), ContributorStats[].class, item -> item.wrapUp(root));
|
||||
}
|
||||
|
||||
/**
|
||||
* The type ContributorStats.
|
||||
*/
|
||||
@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 static class ContributorStats extends GHObject {
|
||||
/* package almost final */ private GitHub root;
|
||||
private GHUser author;
|
||||
@@ -172,8 +174,10 @@ public class GHRepositoryStatistics {
|
||||
/**
|
||||
* The type Week.
|
||||
*/
|
||||
@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 static class Week {
|
||||
|
||||
private long w;
|
||||
@@ -238,15 +242,16 @@ public class GHRepositoryStatistics {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<CommitActivity> getCommitActivity() throws IOException {
|
||||
return root.retrieve().asPagedIterable(getApiTailUrl("commit_activity"), CommitActivity[].class,
|
||||
item -> item.wrapUp(root));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(getApiTailUrl("commit_activity"), CommitActivity[].class, item -> item.wrapUp(root));
|
||||
}
|
||||
|
||||
/**
|
||||
* The type CommitActivity.
|
||||
*/
|
||||
@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 CommitActivity extends GHObject {
|
||||
/* package almost final */ private GitHub root;
|
||||
private List<Integer> days;
|
||||
|
||||
@@ -7,8 +7,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
*
|
||||
* @see GHRepository#listTags() GHRepository#listTags()
|
||||
*/
|
||||
@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 GHTag {
|
||||
private GHRepository owner;
|
||||
private GitHub root;
|
||||
|
||||
@@ -7,8 +7,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
*
|
||||
* @see GHRepository#getTagObject(String) GHRepository#getTagObject(String)
|
||||
*/
|
||||
@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 GHTagObject {
|
||||
private GHRepository owner;
|
||||
private GitHub root;
|
||||
|
||||
@@ -243,7 +243,9 @@ public class GHTeam implements Refreshable {
|
||||
* the io exception
|
||||
*/
|
||||
public void add(GHRepository r, GHOrganization.Permission permission) throws IOException {
|
||||
root.retrieve().method("PUT").with("permission", permission)
|
||||
root.retrieve()
|
||||
.method("PUT")
|
||||
.with("permission", permission)
|
||||
.to(api("/repos/" + r.getOwnerName() + '/' + r.getName()), null);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import java.util.Date;
|
||||
* @see <a href="https://developer.github.com/v3/activity/notifications/">documentation</a>
|
||||
* @see GHNotificationStream
|
||||
*/
|
||||
@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 GHThread extends GHObject {
|
||||
private GitHub root;
|
||||
private GHRepository repository;
|
||||
@@ -176,8 +176,11 @@ public class GHThread extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException {
|
||||
return new Requester(root).with("subscribed", subscribed).with("ignored", ignored).method("PUT")
|
||||
.to(subscription_url, GHSubscription.class).wrapUp(root);
|
||||
return new Requester(root).with("subscribed", subscribed)
|
||||
.with("ignored", ignored)
|
||||
.method("PUT")
|
||||
.to(subscription_url, GHSubscription.class)
|
||||
.wrapUp(root);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -120,7 +120,7 @@ public class GHTreeBuilder {
|
||||
* the io exception
|
||||
*/
|
||||
public GHTree create() throws IOException {
|
||||
req._with("tree", treeEntries);
|
||||
req.with("tree", treeEntries);
|
||||
return req.method("POST").to(getApiTail(), GHTree.class).wrap(repo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,8 +197,10 @@ public class GHUser extends GHPerson {
|
||||
* Lists events performed by a user (this includes private events if the caller is authenticated.
|
||||
*/
|
||||
public PagedIterable<GHEventInfo> listEvents() throws IOException {
|
||||
return root.retrieve().asPagedIterable(String.format("/users/%s/events", login), GHEventInfo[].class,
|
||||
item -> item.wrapUp(root));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(String.format("/users/%s/events", login),
|
||||
GHEventInfo[].class,
|
||||
item -> item.wrapUp(root));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,8 +211,10 @@ public class GHUser extends GHPerson {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHGist> listGists() throws IOException {
|
||||
return root.retrieve().asPagedIterable(String.format("/users/%s/gists", login), GHGist[].class,
|
||||
item -> item.wrapUp(GHUser.this));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(String.format("/users/%s/gists", login),
|
||||
GHGist[].class,
|
||||
item -> item.wrapUp(GHUser.this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -128,9 +128,14 @@ public class GitHub {
|
||||
* @param connector
|
||||
* HttpConnector to use. Pass null to use default connector.
|
||||
*/
|
||||
GitHub(String apiUrl, String login, String oauthAccessToken, String jwtToken, String password,
|
||||
HttpConnector connector, RateLimitHandler rateLimitHandler, AbuseLimitHandler abuseLimitHandler)
|
||||
throws IOException {
|
||||
GitHub(String apiUrl,
|
||||
String login,
|
||||
String oauthAccessToken,
|
||||
String jwtToken,
|
||||
String password,
|
||||
HttpConnector connector,
|
||||
RateLimitHandler rateLimitHandler,
|
||||
AbuseLimitHandler abuseLimitHandler) throws IOException {
|
||||
if (apiUrl.endsWith("/"))
|
||||
apiUrl = apiUrl.substring(0, apiUrl.length() - 1); // normalize
|
||||
this.apiUrl = apiUrl;
|
||||
@@ -345,7 +350,8 @@ public class GitHub {
|
||||
*/
|
||||
public static GitHub offline() {
|
||||
try {
|
||||
return new GitHubBuilder().withEndpoint("https://api.github.invalid").withConnector(HttpConnector.OFFLINE)
|
||||
return new GitHubBuilder().withEndpoint("https://api.github.invalid")
|
||||
.withConnector(HttpConnector.OFFLINE)
|
||||
.build();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException("The offline implementation constructor should not connect", e);
|
||||
@@ -624,8 +630,8 @@ public class GitHub {
|
||||
* @see <a href="https://developer.github.com/v3/orgs/#parameters">List All Orgs - Parameters</a>
|
||||
*/
|
||||
public PagedIterable<GHOrganization> listOrganizations(final String since) {
|
||||
return retrieve().with("since", since).asPagedIterable("/organizations", GHOrganization[].class,
|
||||
item -> item.wrapUp(GitHub.this));
|
||||
return retrieve().with("since", since)
|
||||
.asPagedIterable("/organizations", GHOrganization[].class, item -> item.wrapUp(GitHub.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -949,8 +955,9 @@ public class GitHub {
|
||||
return createToken(scope, note, noteUrl);
|
||||
} catch (GHOTPRequiredException ex) {
|
||||
String OTPstring = OTP.get();
|
||||
Requester requester = new Requester(this).with("scopes", scope).with("note", note).with("note_url",
|
||||
noteUrl);
|
||||
Requester requester = new Requester(this).with("scopes", scope)
|
||||
.with("note", note)
|
||||
.with("note_url", noteUrl);
|
||||
// Add the OTP from the user
|
||||
requester.setHeader("x-github-otp", OTPstring);
|
||||
return requester.method("POST").to("/authorizations", GHAuthorization.class).wrap(this);
|
||||
@@ -976,10 +983,15 @@ public class GitHub {
|
||||
* @see <a href=
|
||||
* "https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app">docs</a>
|
||||
*/
|
||||
public GHAuthorization createOrGetAuth(String clientId, String clientSecret, List<String> scopes, String note,
|
||||
public GHAuthorization createOrGetAuth(String clientId,
|
||||
String clientSecret,
|
||||
List<String> scopes,
|
||||
String note,
|
||||
String note_url) throws IOException {
|
||||
Requester requester = new Requester(this).with("client_secret", clientSecret).with("scopes", scopes)
|
||||
.with("note", note).with("note_url", note_url);
|
||||
Requester requester = new Requester(this).with("client_secret", clientSecret)
|
||||
.with("scopes", scopes)
|
||||
.with("note", note)
|
||||
.with("note_url", note_url);
|
||||
|
||||
return requester.method("PUT").to("/authorizations/clients/" + clientId, GHAuthorization.class);
|
||||
}
|
||||
@@ -1029,8 +1041,8 @@ public class GitHub {
|
||||
* authorization</a>
|
||||
*/
|
||||
public GHAuthorization resetAuth(@Nonnull String clientId, @Nonnull String accessToken) throws IOException {
|
||||
return retrieve().method("POST").to("/applications/" + clientId + "/tokens/" + accessToken,
|
||||
GHAuthorization.class);
|
||||
return retrieve().method("POST")
|
||||
.to("/applications/" + clientId + "/tokens/" + accessToken, GHAuthorization.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1306,8 +1318,8 @@ public class GitHub {
|
||||
* @see <a href="https://developer.github.com/v3/repos/#list-all-public-repositories">documentation</a>
|
||||
*/
|
||||
public PagedIterable<GHRepository> listAllPublicRepositories(final String since) {
|
||||
return retrieve().with("since", since).asPagedIterable("/repositories", GHRepository[].class,
|
||||
item -> item.wrap(GitHub.this));
|
||||
return retrieve().with("since", since)
|
||||
.asPagedIterable("/repositories", GHRepository[].class, item -> item.wrap(GitHub.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1326,7 +1338,8 @@ public class GitHub {
|
||||
*/
|
||||
public Reader renderMarkdown(String text) throws IOException {
|
||||
return new InputStreamReader(new Requester(this).with(new ByteArrayInputStream(text.getBytes("UTF-8")))
|
||||
.contentType("text/plain;charset=UTF-8").asStream("/markdown/raw"), "UTF-8");
|
||||
.contentType("text/plain;charset=UTF-8")
|
||||
.asStream("/markdown/raw"), "UTF-8");
|
||||
}
|
||||
|
||||
static URL parseURL(String s) {
|
||||
|
||||
@@ -90,7 +90,8 @@ public class GitHubBuilder implements Cloneable {
|
||||
* @deprecated Use {@link #fromEnvironment()} to pick up standard set of environment variables, so that different
|
||||
* clients of this library will all recognize one consistent set of coordinates.
|
||||
*/
|
||||
public static GitHubBuilder fromEnvironment(String loginVariableName, String passwordVariableName,
|
||||
public static GitHubBuilder fromEnvironment(String loginVariableName,
|
||||
String passwordVariableName,
|
||||
String oauthVariableName) throws IOException {
|
||||
return fromEnvironment(loginVariableName, passwordVariableName, oauthVariableName, "");
|
||||
}
|
||||
@@ -118,8 +119,10 @@ public class GitHubBuilder implements Cloneable {
|
||||
* @deprecated Use {@link #fromEnvironment()} to pick up standard set of environment variables, so that different
|
||||
* clients of this library will all recognize one consistent set of coordinates.
|
||||
*/
|
||||
public static GitHubBuilder fromEnvironment(String loginVariableName, String passwordVariableName,
|
||||
String oauthVariableName, String endpointVariableName) throws IOException {
|
||||
public static GitHubBuilder fromEnvironment(String loginVariableName,
|
||||
String passwordVariableName,
|
||||
String oauthVariableName,
|
||||
String endpointVariableName) throws IOException {
|
||||
Properties env = new Properties();
|
||||
loadIfSet(loginVariableName, env, "login");
|
||||
loadIfSet(passwordVariableName, env, "password");
|
||||
@@ -355,7 +358,13 @@ public class GitHubBuilder implements Cloneable {
|
||||
* the io exception
|
||||
*/
|
||||
public GitHub build() throws IOException {
|
||||
return new GitHub(endpoint, user, oauthToken, jwtToken, password, connector, rateLimitHandler,
|
||||
return new GitHub(endpoint,
|
||||
user,
|
||||
oauthToken,
|
||||
jwtToken,
|
||||
password,
|
||||
connector,
|
||||
rateLimitHandler,
|
||||
abuseLimitHandler);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import java.util.Date;
|
||||
*
|
||||
* @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 class GitUser {
|
||||
private String name, email, date;
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ import java.util.Iterator;
|
||||
* the type parameter
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
|
||||
"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "Constructed by JSON API")
|
||||
@SuppressFBWarnings(
|
||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
|
||||
"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
|
||||
justification = "Constructed by JSON API")
|
||||
public abstract class PagedSearchIterable<T> extends PagedIterable<T> {
|
||||
private final GitHub root;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -60,9 +61,7 @@ import java.util.regex.Pattern;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.logging.Level.FINE;
|
||||
import static java.util.logging.Level.FINEST;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.*;
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.kohsuke.github.GitHub.MAPPER;
|
||||
|
||||
@@ -131,22 +130,10 @@ class Requester {
|
||||
return this;
|
||||
}
|
||||
|
||||
Requester withPreview(String name) {
|
||||
public Requester withPreview(String name) {
|
||||
return withHeader("Accept", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request with authentication credential.
|
||||
*
|
||||
* @return the requester
|
||||
*/
|
||||
@Deprecated
|
||||
public Requester withCredential() {
|
||||
// keeping it inline with retrieveWithAuth not to enforce the check
|
||||
// root.requireCredential();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* With requester.
|
||||
*
|
||||
@@ -157,7 +144,7 @@ class Requester {
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, int value) {
|
||||
return _with(key, value);
|
||||
return with(key, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,22 +157,7 @@ class Requester {
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, long value) {
|
||||
return _with(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* With requester.
|
||||
*
|
||||
* @param key
|
||||
* the key
|
||||
* @param value
|
||||
* the value
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, Integer value) {
|
||||
if (value != null)
|
||||
_with(key, value);
|
||||
return this;
|
||||
return with(key, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,20 +170,7 @@ class Requester {
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, boolean value) {
|
||||
return _with(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* With requester.
|
||||
*
|
||||
* @param key
|
||||
* the key
|
||||
* @param value
|
||||
* the value
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, Boolean value) {
|
||||
return _with(key, value);
|
||||
return with(key, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +184,7 @@ class Requester {
|
||||
*/
|
||||
public Requester with(String key, Enum e) {
|
||||
if (e == null)
|
||||
return _with(key, null);
|
||||
return with(key, (Object) null);
|
||||
return with(key, transformEnum(e));
|
||||
}
|
||||
|
||||
@@ -239,7 +198,7 @@ class Requester {
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, String value) {
|
||||
return _with(key, value);
|
||||
return with(key, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,24 +211,7 @@ class Requester {
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, Collection<?> value) {
|
||||
return _with(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* With logins requester.
|
||||
*
|
||||
* @param key
|
||||
* the key
|
||||
* @param users
|
||||
* the users
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester withLogins(String key, Collection<GHUser> users) {
|
||||
List<String> names = new ArrayList<String>(users.size());
|
||||
for (GHUser a : users) {
|
||||
names.add(a.getLogin());
|
||||
}
|
||||
return with(key, names);
|
||||
return with(key, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,24 +224,7 @@ class Requester {
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester with(String key, Map<String, String> value) {
|
||||
return _with(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* With permissions requester.
|
||||
*
|
||||
* @param key
|
||||
* the key
|
||||
* @param value
|
||||
* the value
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester withPermissions(String key, Map<String, GHPermissionType> value) {
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
for (Map.Entry<String, GHPermissionType> entry : value.entrySet()) {
|
||||
retMap.put(entry.getKey(), transformEnum(entry.getValue()));
|
||||
}
|
||||
return _with(key, retMap);
|
||||
return with(key, (Object) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,7 +262,7 @@ class Requester {
|
||||
* the value
|
||||
* @return the requester
|
||||
*/
|
||||
public Requester _with(String key, Object value) {
|
||||
public Requester with(String key, Object value) {
|
||||
if (value != null) {
|
||||
args.add(new Entry(key, value));
|
||||
}
|
||||
@@ -360,7 +285,7 @@ class Requester {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
return _with(key, value);
|
||||
return with(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -392,7 +317,7 @@ class Requester {
|
||||
* Normally whether parameters go as query parameters or a body depends on the HTTP verb in use, but this method
|
||||
* forces the parameters to be sent as a body.
|
||||
*/
|
||||
Requester inBody() {
|
||||
public Requester inBody() {
|
||||
forceBody = true;
|
||||
return this;
|
||||
}
|
||||
@@ -406,7 +331,7 @@ class Requester {
|
||||
* the io exception
|
||||
*/
|
||||
public void to(String tailApiUrl) throws IOException {
|
||||
to(tailApiUrl, null);
|
||||
_to(tailApiUrl, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,26 +368,6 @@ class Requester {
|
||||
return _to(tailApiUrl, null, existingInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Short for {@code method(method).to(tailApiUrl,type)}
|
||||
*
|
||||
* @param <T>
|
||||
* the type parameter
|
||||
* @param tailApiUrl
|
||||
* the tail api url
|
||||
* @param type
|
||||
* the type
|
||||
* @param method
|
||||
* the method
|
||||
* @return the t
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
@Deprecated
|
||||
public <T> T to(String tailApiUrl, Class<T> type, String method) throws IOException {
|
||||
return method(method).to(tailApiUrl, type);
|
||||
}
|
||||
|
||||
@SuppressFBWarnings("SBSC_USE_STRINGBUFFER_CONCATENATION")
|
||||
private <T> T _to(String tailApiUrl, Class<T> type, T instance) throws IOException {
|
||||
if (!isMethodWithBody() && !args.isEmpty()) {
|
||||
@@ -1017,7 +922,7 @@ class Requester {
|
||||
* Enum to be transformed
|
||||
* @return a String containing the value of a Github constant
|
||||
*/
|
||||
private String transformEnum(Enum en) {
|
||||
static String transformEnum(Enum en) {
|
||||
// by convention Java constant names are upper cases, but github uses
|
||||
// lower-case constants. GitHub also uses '-', which in Java we always
|
||||
// replace by '_'
|
||||
|
||||
@@ -263,7 +263,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
if (networkResponse == null) {
|
||||
return response.cacheResponse() == null ? "NONE" : "CACHE " + response.code();
|
||||
} else {
|
||||
return response.cacheResponse() == null ? "NETWORK " + response.code()
|
||||
return response.cacheResponse() == null
|
||||
? "NETWORK " + response.code()
|
||||
: "CONDITIONAL_CACHE " + networkResponse.code();
|
||||
}
|
||||
}
|
||||
@@ -414,8 +415,10 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
if (responseHeaders == null) {
|
||||
Response response = getResponse(true);
|
||||
Headers headers = response.headers();
|
||||
responseHeaders = headers.newBuilder().add(SELECTED_PROTOCOL, response.protocol().toString())
|
||||
.add(RESPONSE_SOURCE, responseSourceHeader(response)).build();
|
||||
responseHeaders = headers.newBuilder()
|
||||
.add(SELECTED_PROTOCOL, response.protocol().toString())
|
||||
.add(RESPONSE_SOURCE, responseSourceHeader(response))
|
||||
.build();
|
||||
}
|
||||
return responseHeaders;
|
||||
}
|
||||
@@ -471,7 +474,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
return toMultimap(requestHeaders.build(), null);
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Good request will have body")
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
|
||||
justification = "Good request will have body")
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
if (!doInput) {
|
||||
@@ -503,7 +507,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
return requestBody.outputStream;
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "usingProxy() handles this")
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
|
||||
justification = "usingProxy() handles this")
|
||||
@Override
|
||||
public Permission getPermission() {
|
||||
URL url = getURL();
|
||||
@@ -604,7 +609,9 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
throw malformedUrl;
|
||||
}
|
||||
|
||||
Request request = new Request.Builder().url(url).headers(requestHeaders.build()).method(method, requestBody)
|
||||
Request request = new Request.Builder().url(url)
|
||||
.headers(requestHeaders.build())
|
||||
.method(method, requestBody)
|
||||
.build();
|
||||
|
||||
OkHttpClient.Builder clientBuilder = client.newBuilder();
|
||||
@@ -787,7 +794,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "If we get here there is a connection and request.body() is checked")
|
||||
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
|
||||
justification = "If we get here there is a connection and request.body() is checked")
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
@@ -843,7 +851,7 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
write(new byte[] { (byte) b }, 0, 1);
|
||||
write(new byte[]{ (byte) b }, 0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -929,8 +937,10 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
|
||||
|
||||
outputStream.close();
|
||||
contentLength = buffer.size();
|
||||
return request.newBuilder().removeHeader("Transfer-Encoding")
|
||||
.header("Content-Length", Long.toString(buffer.size())).build();
|
||||
return request.newBuilder()
|
||||
.removeHeader("Transfer-Encoding")
|
||||
.header("Content-Length", Long.toString(buffer.size()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
383
src/main/resources/eclipse/formatter.xml
Normal file
383
src/main/resources/eclipse/formatter.xml
Normal file
@@ -0,0 +1,383 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="17">
|
||||
<profile kind="CodeFormatterProfile" name="Java Conventions - GitHub-api" version="17">
|
||||
<!-- Make various elements turn to colums when they wrap -->
|
||||
<!-- Basically the only way to create this is by downloading eclipse and working in their UI -->
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
</profile>
|
||||
<!-- Keeping the "default" exported values for reference -->
|
||||
<!--
|
||||
<profile kind="CodeFormatterProfile" name="Eclipse [built-in]-Default" version="17">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
-->
|
||||
</profiles>
|
||||
@@ -165,9 +165,12 @@ public abstract class AbstractGitHubWireMockTest extends Assert {
|
||||
if (mockGitHub.isUseProxy()) {
|
||||
cleanupRepository(fullName);
|
||||
|
||||
GHRepository repository = gitHubBeforeAfter.getOrganization(GITHUB_API_TEST_ORG).createRepository(name)
|
||||
GHRepository repository = gitHubBeforeAfter.getOrganization(GITHUB_API_TEST_ORG)
|
||||
.createRepository(name)
|
||||
.description("A test repository for testing the github-api project: " + name)
|
||||
.homepage("http://github-api.kohsuke.org/").autoInit(true).create();
|
||||
.homepage("http://github-api.kohsuke.org/")
|
||||
.autoInit(true)
|
||||
.create();
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
@@ -34,8 +34,10 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
cleanupUserRepository("github-api-test-rename");
|
||||
cleanupUserRepository(targetName);
|
||||
|
||||
GHRepository r = gitHub.createRepository("github-api-test-rename", "a test repository",
|
||||
"http://github-api.kohsuke.org/", true);
|
||||
GHRepository r = gitHub.createRepository("github-api-test-rename",
|
||||
"a test repository",
|
||||
"http://github-api.kohsuke.org/",
|
||||
true);
|
||||
assertThat(r.hasIssues(), is(true));
|
||||
|
||||
r.enableIssueTracker(false);
|
||||
@@ -49,8 +51,11 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
public void testRepositoryWithAutoInitializationCRUD() throws Exception {
|
||||
String name = "github-api-test-autoinit";
|
||||
cleanupUserRepository(name);
|
||||
GHRepository r = gitHub.createRepository(name).description("a test repository for auto init")
|
||||
.homepage("http://github-api.kohsuke.org/").autoInit(true).create();
|
||||
GHRepository r = gitHub.createRepository(name)
|
||||
.description("a test repository for auto init")
|
||||
.homepage("http://github-api.kohsuke.org/")
|
||||
.autoInit(true)
|
||||
.create();
|
||||
r.enableIssueTracker(false);
|
||||
r.enableDownloads(false);
|
||||
r.enableWiki(false);
|
||||
@@ -91,8 +96,13 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
GHUser u = getUser();
|
||||
GHRepository repository = getTestRepository();
|
||||
GHMilestone milestone = repository.createMilestone("Test Milestone Title3", "Test Milestone");
|
||||
GHIssue o = repository.createIssue("testing").body("this is body").assignee(u).label("bug").label("question")
|
||||
.milestone(milestone).create();
|
||||
GHIssue o = repository.createIssue("testing")
|
||||
.body("this is body")
|
||||
.assignee(u)
|
||||
.label("bug")
|
||||
.label("question")
|
||||
.milestone(milestone)
|
||||
.create();
|
||||
assertNotNull(o);
|
||||
o.close();
|
||||
}
|
||||
@@ -101,7 +111,9 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
public void testCreateAndListDeployments() throws IOException {
|
||||
GHRepository repository = getTestRepository();
|
||||
GHDeployment deployment = repository.createDeployment("master")
|
||||
.payload("{\"user\":\"atmos\",\"room_id\":123456}").description("question").environment("unittest")
|
||||
.payload("{\"user\":\"atmos\",\"room_id\":123456}")
|
||||
.description("question")
|
||||
.environment("unittest")
|
||||
.create();
|
||||
assertNotNull(deployment.getCreator());
|
||||
assertNotNull(deployment.getId());
|
||||
@@ -117,10 +129,14 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
@Test
|
||||
public void testGetDeploymentStatuses() throws IOException {
|
||||
GHRepository repository = getTestRepository();
|
||||
GHDeployment deployment = repository.createDeployment("master").description("question")
|
||||
.payload("{\"user\":\"atmos\",\"room_id\":123456}").create();
|
||||
GHDeployment deployment = repository.createDeployment("master")
|
||||
.description("question")
|
||||
.payload("{\"user\":\"atmos\",\"room_id\":123456}")
|
||||
.create();
|
||||
GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.SUCCESS)
|
||||
.description("success").targetUrl("http://www.github.com").create();
|
||||
.description("success")
|
||||
.targetUrl("http://www.github.com")
|
||||
.create();
|
||||
Iterable<GHDeploymentStatus> deploymentStatuses = deployment.listStatuses();
|
||||
assertNotNull(deploymentStatuses);
|
||||
assertEquals(1, Iterables.size(deploymentStatuses));
|
||||
@@ -129,7 +145,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testGetIssues() throws Exception {
|
||||
List<GHIssue> closedIssues = gitHub.getOrganization("github-api").getRepository("github-api")
|
||||
List<GHIssue> closedIssues = gitHub.getOrganization("github-api")
|
||||
.getRepository("github-api")
|
||||
.getIssues(GHIssueState.CLOSED);
|
||||
// prior to using PagedIterable GHRepository.getIssues(GHIssueState) would only retrieve 30 issues
|
||||
assertTrue(closedIssues.size() > 150);
|
||||
@@ -150,11 +167,20 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
GHIssue unhomed = null;
|
||||
GHIssue homed = null;
|
||||
try {
|
||||
unhomed = repository.createIssue("testing").body("this is body").assignee(u).label("bug").label("question")
|
||||
unhomed = repository.createIssue("testing")
|
||||
.body("this is body")
|
||||
.assignee(u)
|
||||
.label("bug")
|
||||
.label("question")
|
||||
.create();
|
||||
assertEquals(unhomed.getNumber(), repository.getIssues(GHIssueState.OPEN, null).get(0).getNumber());
|
||||
homed = repository.createIssue("testing").body("this is body").assignee(u).label("bug").label("question")
|
||||
.milestone(milestone).create();
|
||||
homed = repository.createIssue("testing")
|
||||
.body("this is body")
|
||||
.assignee(u)
|
||||
.label("bug")
|
||||
.label("question")
|
||||
.milestone(milestone)
|
||||
.create();
|
||||
assertEquals(homed.getNumber(), repository.getIssues(GHIssueState.OPEN, milestone).get(0).getNumber());
|
||||
} finally {
|
||||
if (unhomed != null) {
|
||||
@@ -306,7 +332,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testMembership() throws Exception {
|
||||
Set<String> members = gitHub.getOrganization(GITHUB_API_TEST_ORG).getRepository("jenkins")
|
||||
Set<String> members = gitHub.getOrganization(GITHUB_API_TEST_ORG)
|
||||
.getRepository("jenkins")
|
||||
.getCollaboratorNames();
|
||||
// System.out.println(members.contains("kohsuke"));
|
||||
}
|
||||
@@ -344,7 +371,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testCommit() throws Exception {
|
||||
GHCommit commit = gitHub.getUser("jenkinsci").getRepository("jenkins")
|
||||
GHCommit commit = gitHub.getUser("jenkinsci")
|
||||
.getRepository("jenkins")
|
||||
.getCommit("08c1c9970af4d609ae754fbe803e06186e3206f7");
|
||||
assertEquals(1, commit.getParents().size());
|
||||
assertEquals(1, commit.getFiles().size());
|
||||
@@ -374,8 +402,13 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
public void testQueryCommits() throws Exception {
|
||||
List<String> sha1 = new ArrayList<String>();
|
||||
for (GHCommit c : gitHub.getUser("jenkinsci").getRepository("jenkins").queryCommits()
|
||||
.since(new Date(1199174400000L)).until(1201852800000L).path("pom.xml").list()) {
|
||||
for (GHCommit c : gitHub.getUser("jenkinsci")
|
||||
.getRepository("jenkins")
|
||||
.queryCommits()
|
||||
.since(new Date(1199174400000L))
|
||||
.until(1201852800000L)
|
||||
.path("pom.xml")
|
||||
.list()) {
|
||||
// System.out.println(c.getSHA1());
|
||||
sha1.add(c.getSHA1());
|
||||
}
|
||||
@@ -403,7 +436,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void testCreateCommitComment() throws Exception {
|
||||
GHCommit commit = gitHub.getUser("kohsuke").getRepository("sandbox-ant")
|
||||
GHCommit commit = gitHub.getUser("kohsuke")
|
||||
.getRepository("sandbox-ant")
|
||||
.getCommit("8ae38db0ea5837313ab5f39d43a6f73de3bd9000");
|
||||
GHCommitComment c = commit.createComment("[testing](http://kohsuse.org/)");
|
||||
// System.out.println(c);
|
||||
@@ -679,8 +713,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
public void testCommitStatusContext() throws IOException {
|
||||
GHRepository myRepository = getTestRepository();
|
||||
GHRef masterRef = myRepository.getRef("heads/master");
|
||||
GHCommitStatus commitStatus = myRepository.createCommitStatus(masterRef.getObject().getSha(),
|
||||
GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
|
||||
GHCommitStatus commitStatus = myRepository.createCommitStatus(masterRef.getObject()
|
||||
.getSha(), GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
|
||||
assertEquals("test/context", commitStatus.getContext());
|
||||
|
||||
}
|
||||
|
||||
@@ -336,15 +336,18 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
rateLimit = gitHub.rateLimit();
|
||||
|
||||
assertThat(rateLimit, notNullValue());
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server", rateLimit,
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server",
|
||||
rateLimit,
|
||||
sameInstance(headerRateLimit));
|
||||
|
||||
// Nothing changes still valid
|
||||
Thread.sleep(1000);
|
||||
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.rateLimit(),
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server",
|
||||
gitHub.rateLimit(),
|
||||
sameInstance(headerRateLimit));
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.lastRateLimit(),
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server",
|
||||
gitHub.lastRateLimit(),
|
||||
sameInstance(headerRateLimit));
|
||||
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(1));
|
||||
@@ -355,12 +358,15 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
assertThat("Header instance has expired", gitHub.lastRateLimit().isExpired(), is(true));
|
||||
|
||||
assertThat("rateLimit() will ask server when header instance expires and it has not called getRateLimit() yet",
|
||||
gitHub.rateLimit(), not(sameInstance(rateLimit)));
|
||||
gitHub.rateLimit(),
|
||||
not(sameInstance(rateLimit)));
|
||||
|
||||
assertThat("lastRateLimit() (header instance) is populated as part of internal call to getRateLimit()",
|
||||
gitHub.lastRateLimit(), not(sameInstance(rateLimit)));
|
||||
gitHub.lastRateLimit(),
|
||||
not(sameInstance(rateLimit)));
|
||||
|
||||
assertThat("After request, rateLimit() selects header instance since it has been refreshed", gitHub.rateLimit(),
|
||||
assertThat("After request, rateLimit() selects header instance since it has been refreshed",
|
||||
gitHub.rateLimit(),
|
||||
sameInstance(gitHub.lastRateLimit()));
|
||||
|
||||
headerRateLimit = gitHub.lastRateLimit();
|
||||
@@ -375,10 +381,12 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
// Using custom data to have a header instance that expires before the queried instance
|
||||
assertThat(
|
||||
"if header instance expires but queried instance is valid, ratelimit() uses it without asking server",
|
||||
gitHub.rateLimit(), not(sameInstance(gitHub.lastRateLimit())));
|
||||
gitHub.rateLimit(),
|
||||
not(sameInstance(gitHub.lastRateLimit())));
|
||||
|
||||
assertThat("ratelimit() should almost never return a return a GHRateLimit that is already expired",
|
||||
gitHub.rateLimit().isExpired(), is(false));
|
||||
gitHub.rateLimit().isExpired(),
|
||||
is(false));
|
||||
|
||||
assertThat("Header instance hasn't been reloaded", gitHub.lastRateLimit(), sameInstance(headerRateLimit));
|
||||
assertThat("Header instance has expired", gitHub.lastRateLimit().isExpired(), is(true));
|
||||
@@ -390,12 +398,15 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
headerRateLimit = gitHub.rateLimit();
|
||||
|
||||
assertThat("rateLimit() has asked server for new information", gitHub.rateLimit(),
|
||||
assertThat("rateLimit() has asked server for new information",
|
||||
gitHub.rateLimit(),
|
||||
not(sameInstance(rateLimit)));
|
||||
assertThat("rateLimit() has asked server for new information", gitHub.lastRateLimit(),
|
||||
assertThat("rateLimit() has asked server for new information",
|
||||
gitHub.lastRateLimit(),
|
||||
not(sameInstance(rateLimit)));
|
||||
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.rateLimit(),
|
||||
assertThat("rateLimit() selects header instance when not expired, does not ask server",
|
||||
gitHub.rateLimit(),
|
||||
sameInstance((gitHub.lastRateLimit())));
|
||||
|
||||
assertThat(mockGitHub.getRequestCount(), equalTo(3));
|
||||
|
||||
@@ -15,8 +15,12 @@ public class GistTest extends AbstractGitHubWireMockTest {
|
||||
@Test
|
||||
public void lifecycleTest() throws Exception {
|
||||
// CRUD operation
|
||||
GHGist gist = gitHub.createGist().public_(false).description("Test Gist").file("abc.txt", "abc")
|
||||
.file("def.txt", "def").create();
|
||||
GHGist gist = gitHub.createGist()
|
||||
.public_(false)
|
||||
.description("Test Gist")
|
||||
.file("abc.txt", "abc")
|
||||
.file("def.txt", "def")
|
||||
.create();
|
||||
|
||||
assertThat(gist.getCreatedAt(), is(notNullValue()));
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ public class GitHubConnectionTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
setupEnvironment(props);
|
||||
|
||||
GitHubBuilder builder = GitHubBuilder.fromEnvironment("customLogin", "customPassword", "customOauth",
|
||||
"customEndpoint");
|
||||
GitHubBuilder builder = GitHubBuilder
|
||||
.fromEnvironment("customLogin", "customPassword", "customOauth", "customEndpoint");
|
||||
|
||||
assertEquals("bogusLogin", builder.user);
|
||||
assertEquals("bogusOauth", builder.oauthToken);
|
||||
|
||||
@@ -98,7 +98,8 @@ public class GitHubStaticTest extends Assert {
|
||||
assertThat("Unknown should not replace worst record", GitHub.shouldReplace(unknown1, recordWorst), is(false));
|
||||
|
||||
assertThat("Earlier record should replace later worst", GitHub.shouldReplace(record0, recordWorst), is(true));
|
||||
assertThat("Later worst record should not replace earlier", GitHub.shouldReplace(recordWorst, record0),
|
||||
assertThat("Later worst record should not replace earlier",
|
||||
GitHub.shouldReplace(recordWorst, record0),
|
||||
is(false));
|
||||
|
||||
assertThat("Equivalent record should not replace", GitHub.shouldReplace(record0, record00), is(false));
|
||||
@@ -109,14 +110,17 @@ public class GitHubStaticTest extends Assert {
|
||||
|
||||
assertThat("Higher limit record should not replace lower", GitHub.shouldReplace(record1, record2), is(false));
|
||||
|
||||
assertThat("Higher limit record with later reset should replace lower", GitHub.shouldReplace(record3, record2),
|
||||
assertThat("Higher limit record with later reset should replace lower",
|
||||
GitHub.shouldReplace(record3, record2),
|
||||
is(true));
|
||||
|
||||
assertThat("Lower limit record with later reset should replace higher", GitHub.shouldReplace(record4, record1),
|
||||
assertThat("Lower limit record with later reset should replace higher",
|
||||
GitHub.shouldReplace(record4, record1),
|
||||
is(true));
|
||||
|
||||
assertThat("Lower limit record with earlier reset should not replace higher",
|
||||
GitHub.shouldReplace(record2, record4), is(false));
|
||||
GitHub.shouldReplace(record2, record4),
|
||||
is(false));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,12 @@ public class GitHubTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void searchContent() throws Exception {
|
||||
PagedSearchIterable<GHContent> r = gitHub.searchContent().q("addClass").in("file").language("js")
|
||||
.repo("jquery/jquery").list();
|
||||
PagedSearchIterable<GHContent> r = gitHub.searchContent()
|
||||
.q("addClass")
|
||||
.in("file")
|
||||
.language("js")
|
||||
.repo("jquery/jquery")
|
||||
.list();
|
||||
GHContent c = r.iterator().next();
|
||||
// System.out.println(c.getName());
|
||||
assertNotNull(c.getDownloadUrl());
|
||||
@@ -87,13 +91,13 @@ public class GitHubTest extends AbstractGitHubWireMockTest {
|
||||
assertEquals(19, meta.getWeb().size());
|
||||
|
||||
// Also test examples here
|
||||
Class[] examples = new Class[] { ReadOnlyObjects.GHMetaPublic.class, ReadOnlyObjects.GHMetaPackage.class,
|
||||
Class[] examples = new Class[]{ ReadOnlyObjects.GHMetaPublic.class, ReadOnlyObjects.GHMetaPackage.class,
|
||||
ReadOnlyObjects.GHMetaGettersUnmodifiable.class, ReadOnlyObjects.GHMetaGettersFinal.class,
|
||||
ReadOnlyObjects.GHMetaGettersFinalCreator.class, };
|
||||
|
||||
for (Class metaClass : examples) {
|
||||
ReadOnlyObjects.GHMetaExample metaExample = gitHub.retrieve().to("/meta",
|
||||
(Class<ReadOnlyObjects.GHMetaExample>) metaClass);
|
||||
ReadOnlyObjects.GHMetaExample metaExample = gitHub.retrieve()
|
||||
.to("/meta", (Class<ReadOnlyObjects.GHMetaExample>) metaClass);
|
||||
assertTrue(metaExample.isVerifiablePasswordAuthentication());
|
||||
assertEquals(19, metaExample.getApi().size());
|
||||
assertEquals(19, metaExample.getGit().size());
|
||||
|
||||
@@ -15,13 +15,13 @@ public class Github2faTest extends AbstractGitHubWireMockTest {
|
||||
public void test2faToken() throws IOException {
|
||||
assertFalse("Test only valid when not proxying", mockGitHub.isUseProxy());
|
||||
|
||||
List<String> asList = Arrays.asList("repo", "gist", "write:packages", "read:packages", "delete:packages",
|
||||
"user", "delete_repo");
|
||||
List<String> asList = Arrays
|
||||
.asList("repo", "gist", "write:packages", "read:packages", "delete:packages", "user", "delete_repo");
|
||||
String nameOfToken = "Test2faTokenCreate";// +timestamp;// use time stamp to ensure the token creations do not
|
||||
// collide with older tokens
|
||||
|
||||
GHAuthorization token = gitHub.createToken(asList, nameOfToken, "this is a test token created by a unit test",
|
||||
() -> {
|
||||
GHAuthorization token = gitHub
|
||||
.createToken(asList, nameOfToken, "this is a test token created by a unit test", () -> {
|
||||
String data = "111878";
|
||||
// TO UPDATE run this in debugger mode, put a breakpoint here, and enter the OTP you get into the
|
||||
// value of Data
|
||||
|
||||
@@ -104,7 +104,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(false);
|
||||
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client));
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -129,7 +130,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(true);
|
||||
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client), -1);
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -159,7 +161,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(true);
|
||||
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client), 3);
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -184,7 +187,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(true);
|
||||
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client));
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -204,7 +208,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
assertThat("Request Count", mockGitHub.getRequestCount(), is(networkRequestCount + userRequestCount));
|
||||
|
||||
// Rate limit must be under this value, but if it wiggles we don't care
|
||||
assertThat("Rate Limit Change", rateLimitBefore.remaining - rateLimitAfter.remaining,
|
||||
assertThat("Rate Limit Change",
|
||||
rateLimitBefore.remaining - rateLimitAfter.remaining,
|
||||
is(lessThanOrEqualTo(rateLimitUsed + userRequestCount)));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user