mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-14 08:21:22 +00:00
Compare commits
71 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5667d2473 | ||
|
|
a42305dd59 | ||
|
|
c22a718d14 | ||
|
|
d0b23c79e2 | ||
|
|
76da04afd8 | ||
|
|
768f60709f | ||
|
|
8cd3acd318 | ||
|
|
ce7cfc0648 | ||
|
|
8b6cf55473 | ||
|
|
75d95d844c | ||
|
|
f54bfd3fb5 | ||
|
|
f8a8ee9b9d | ||
|
|
16faaae199 | ||
|
|
375417527b | ||
|
|
10b01ca6b3 | ||
|
|
f9006af04c | ||
|
|
57f947576e | ||
|
|
5a8f8c345b | ||
|
|
e96067e3c8 | ||
|
|
2242174515 | ||
|
|
73179c118b | ||
|
|
5b575134fc | ||
|
|
c11c06b896 | ||
|
|
ba8d2a251f | ||
|
|
c9589b73f4 | ||
|
|
32f4425100 | ||
|
|
05e81484f1 | ||
|
|
10cc79f737 | ||
|
|
957d9b180d | ||
|
|
883204fc43 | ||
|
|
6d3904fbbd | ||
|
|
56a51f18e7 | ||
|
|
307508b7a0 | ||
|
|
66fce79427 | ||
|
|
5e5708d8d4 | ||
|
|
944d92bbb4 | ||
|
|
0155d5aa39 | ||
|
|
fe4f45c2b0 | ||
|
|
1b63a58e63 | ||
|
|
46a141db9c | ||
|
|
66de06956c | ||
|
|
713dd62bd1 | ||
|
|
5ac65aafad | ||
|
|
4aef92e6fe | ||
|
|
a1b0e771e5 | ||
|
|
5baeac4706 | ||
|
|
87aa9bd673 | ||
|
|
2ec5ca56d5 | ||
|
|
b5c7f83ec8 | ||
|
|
eb3ebdbf52 | ||
|
|
c60698ff7e | ||
|
|
f8c2cda257 | ||
|
|
48f6c195e0 | ||
|
|
804fa60317 | ||
|
|
d77b99d3d4 | ||
|
|
006f1271d6 | ||
|
|
0d14514712 | ||
|
|
f25e5f9488 | ||
|
|
9e8bbfd175 | ||
|
|
3d11c96e23 | ||
|
|
a670737ca5 | ||
|
|
9fdd982e73 | ||
|
|
8024918e08 | ||
|
|
816c83c80a | ||
|
|
d34881aa25 | ||
|
|
b8ad48997b | ||
|
|
77754b7246 | ||
|
|
6d5bf49a51 | ||
|
|
f53b4e959c | ||
|
|
6716d156bb | ||
|
|
d7bb171c1e |
16
pom.xml
16
pom.xml
@@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.kohsuke</groupId>
|
<groupId>org.kohsuke</groupId>
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.107</version>
|
<version>1.108</version>
|
||||||
<name>GitHub API for Java</name>
|
<name>GitHub API for Java</name>
|
||||||
<url>https://github-api.kohsuke.org/</url>
|
<url>https://github-api.kohsuke.org/</url>
|
||||||
<description>GitHub API for Java</description>
|
<description>GitHub API for Java</description>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
|
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
|
||||||
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
|
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
|
||||||
<url>https://${project.artifactId}.kohsuke.org/</url>
|
<url>https://github.com/github-api/github-api/</url>
|
||||||
<tag>github-api-1.107</tag>
|
<tag>github-api-1.108</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
|
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
|
||||||
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
|
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
|
||||||
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
|
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
|
||||||
<jacoco.coverage.target.bundle.method>0.556</jacoco.coverage.target.bundle.method>
|
<jacoco.coverage.target.bundle.method>0.60</jacoco.coverage.target.bundle.method>
|
||||||
<jacoco.coverage.target.class.method>0.25</jacoco.coverage.target.class.method>
|
<jacoco.coverage.target.class.method>0.25</jacoco.coverage.target.class.method>
|
||||||
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
|
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
|
||||||
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
|
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
|
||||||
@@ -146,14 +146,12 @@
|
|||||||
<exclude>org.kohsuke.github.example.*</exclude>
|
<exclude>org.kohsuke.github.example.*</exclude>
|
||||||
|
|
||||||
<!-- No methods -->
|
<!-- No methods -->
|
||||||
<exclude>org.kohsuke.github.DeleteToken</exclude>
|
|
||||||
<exclude>org.kohsuke.github.Previews</exclude>
|
<exclude>org.kohsuke.github.Previews</exclude>
|
||||||
|
|
||||||
<!-- Deprecated -->
|
<!-- Deprecated -->
|
||||||
<exclude>org.kohsuke.github.extras.OkHttp3Connector</exclude>
|
<exclude>org.kohsuke.github.extras.OkHttp3Connector</exclude>
|
||||||
<exclude>org.kohsuke.github.EnforcementLevel</exclude>
|
<exclude>org.kohsuke.github.EnforcementLevel</exclude>
|
||||||
<exclude>org.kohsuke.github.GHPerson.1</exclude>
|
<exclude>org.kohsuke.github.GHPerson.1</exclude>
|
||||||
<exclude>org.kohsuke.github.GHPerson.1.1</exclude>
|
|
||||||
|
|
||||||
<!-- These fail coverage on windows because tests are disabled -->
|
<!-- These fail coverage on windows because tests are disabled -->
|
||||||
<exclude>org.kohsuke.github.GHAsset</exclude>
|
<exclude>org.kohsuke.github.GHAsset</exclude>
|
||||||
@@ -161,7 +159,6 @@
|
|||||||
<exclude>org.kohsuke.github.GHRelease</exclude>
|
<exclude>org.kohsuke.github.GHRelease</exclude>
|
||||||
|
|
||||||
<!-- TODO: These still need test coverage -->
|
<!-- TODO: These still need test coverage -->
|
||||||
<exclude>org.kohsuke.github.GitHubClient.GHApiInfo</exclude>
|
|
||||||
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
|
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
|
||||||
<exclude>org.kohsuke.github.GHBranchProtectionBuilder.Restrictions</exclude>
|
<exclude>org.kohsuke.github.GHBranchProtectionBuilder.Restrictions</exclude>
|
||||||
<exclude>org.kohsuke.github.GHBranchProtection.Restrictions</exclude>
|
<exclude>org.kohsuke.github.GHBranchProtection.Restrictions</exclude>
|
||||||
@@ -202,7 +199,6 @@
|
|||||||
<exclude>org.kohsuke.github.GHTeam.Role</exclude>
|
<exclude>org.kohsuke.github.GHTeam.Role</exclude>
|
||||||
<exclude>org.kohsuke.github.GHUserSearchBuilder.Sort</exclude>
|
<exclude>org.kohsuke.github.GHUserSearchBuilder.Sort</exclude>
|
||||||
<exclude>org.kohsuke.github.GHVerifiedKey</exclude>
|
<exclude>org.kohsuke.github.GHVerifiedKey</exclude>
|
||||||
<exclude>org.kohsuke.github.GitHubBuilder.1</exclude>
|
|
||||||
</excludes>
|
</excludes>
|
||||||
</rule>
|
</rule>
|
||||||
</rules>
|
</rules>
|
||||||
@@ -495,7 +491,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>3.2.4</version>
|
<version>3.3.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -507,7 +503,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.tomakehurst</groupId>
|
<groupId>com.github.tomakehurst</groupId>
|
||||||
<artifactId>wiremock-jre8-standalone</artifactId>
|
<artifactId>wiremock-jre8-standalone</artifactId>
|
||||||
<version>2.26.0</version>
|
<version>2.26.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.net.HttpURLConnection;
|
|||||||
/**
|
/**
|
||||||
* Pluggable strategy to determine what to do when the API abuse limit is hit.
|
* Pluggable strategy to determine what to do when the API abuse limit is hit.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler) GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
|
* @see GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler) GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
|
||||||
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
|
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
|
||||||
* @see RateLimitHandler
|
* @see RateLimitHandler
|
||||||
@@ -31,6 +32,7 @@ public abstract class AbuseLimitHandler {
|
|||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits">Dealing
|
* "https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits">Dealing
|
||||||
* with abuse rate limits</a>
|
* with abuse rate limits</a>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
|
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* The MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010, Kohsuke Kawaguchi
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
package org.kohsuke.github;
|
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
|
|
||||||
justification = "Being constructed by JSON deserialization")
|
|
||||||
class DeleteToken {
|
|
||||||
public String delete_token;
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,8 @@ import java.util.Locale;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This was added during preview API period but it has changed since then.
|
* This was added during preview API period but it has changed since then.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public enum EnforcementLevel {
|
public enum EnforcementLevel {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import static org.kohsuke.github.Previews.MACHINE_MAN;
|
|||||||
/**
|
/**
|
||||||
* A Github App.
|
* A Github App.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GitHub#getApp() GitHub#getApp()
|
* @see GitHub#getApp() GitHub#getApp()
|
||||||
*/
|
*/
|
||||||
public class GHApp extends GHObject {
|
public class GHApp extends GHObject {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import static org.kohsuke.github.Previews.MACHINE_MAN;
|
|||||||
/**
|
/**
|
||||||
* Creates a access token for a GitHub App Installation
|
* Creates a access token for a GitHub App Installation
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
||||||
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
|
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import static org.kohsuke.github.Previews.GAMBIT;
|
|||||||
/**
|
/**
|
||||||
* A Github App Installation.
|
* A Github App Installation.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHApp#listInstallations() GHApp#listInstallations()
|
* @see GHApp#listInstallations() GHApp#listInstallations()
|
||||||
* @see GHApp#getInstallationById(long) GHApp#getInstallationById(long)
|
* @see GHApp#getInstallationById(long) GHApp#getInstallationById(long)
|
||||||
* @see GHApp#getInstallationByOrganization(String) GHApp#getInstallationByOrganization(String)
|
* @see GHApp#getInstallationByOrganization(String) GHApp#getInstallationByOrganization(String)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* A Github App Installation Token.
|
* A Github App Installation Token.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
||||||
*/
|
*/
|
||||||
public class GHAppInstallationToken {
|
public class GHAppInstallationToken {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Generated OAuth token
|
* Generated OAuth token
|
||||||
*
|
*
|
||||||
|
* @author janinko
|
||||||
* @see GitHub#createToken(Collection, String, String) GitHub#createToken(Collection, String, String)
|
* @see GitHub#createToken(Collection, String, String) GitHub#createToken(Collection, String, String)
|
||||||
* @see <a href="http://developer.github.com/v3/oauth/#create-a-new-authorization">API documentation</a>
|
* @see <a href="http://developer.github.com/v3/oauth/#create-a-new-authorization">API documentation</a>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.Base64;
|
|||||||
/**
|
/**
|
||||||
* The type GHBlob.
|
* The type GHBlob.
|
||||||
*
|
*
|
||||||
|
* @author Kanstantsin Shautsou
|
||||||
* @author Kohsuke Kawaguchi
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHTreeEntry#asBlob() GHTreeEntry#asBlob()
|
* @see GHTreeEntry#asBlob() GHTreeEntry#asBlob()
|
||||||
* @see GHRepository#getBlob(String) GHRepository#getBlob(String)
|
* @see GHRepository#getBlob(String) GHRepository#getBlob(String)
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import java.util.Objects;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A branch in a repository.
|
* A branch in a repository.
|
||||||
|
*
|
||||||
|
* @author Yusuke Kokubo
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(
|
@SuppressFBWarnings(
|
||||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a check run.
|
* Represents a check run.
|
||||||
*
|
*
|
||||||
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
|
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" },
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" },
|
||||||
justification = "JSON API")
|
justification = "JSON API")
|
||||||
public class GHCheckRun extends GHObject {
|
public class GHCheckRun extends GHObject {
|
||||||
@@ -21,7 +21,16 @@ public class GHCheckRun extends GHObject {
|
|||||||
private String conclusion;
|
private String conclusion;
|
||||||
private String name;
|
private String name;
|
||||||
private String headSha;
|
private String headSha;
|
||||||
|
private String nodeId;
|
||||||
|
private String externalId;
|
||||||
|
private String startedAt;
|
||||||
|
private String completedAt;
|
||||||
|
private URL htmlUrl;
|
||||||
|
private URL detailsUrl;
|
||||||
|
private Output output;
|
||||||
|
private GHApp app;
|
||||||
private GHPullRequest[] pullRequests;
|
private GHPullRequest[] pullRequests;
|
||||||
|
private GHCheckSuite checkSuite;
|
||||||
|
|
||||||
GHCheckRun wrap(GHRepository owner) {
|
GHCheckRun wrap(GHRepository owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
@@ -41,14 +50,30 @@ public class GHCheckRun extends GHObject {
|
|||||||
return pullRequests;
|
return pullRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets status of the check run. It can be one of "queue", "in_progress", or "completed"
|
||||||
|
*
|
||||||
|
* @return Status of the check run
|
||||||
|
*/
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets conclusion of a completed check run. It can be one of "success", "failure", "neutral", "cancelled",
|
||||||
|
* "time_out", or "action_required".
|
||||||
|
*
|
||||||
|
* @return Status of the check run
|
||||||
|
*/
|
||||||
public String getConclusion() {
|
public String getConclusion() {
|
||||||
return conclusion;
|
return conclusion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the custom name of this check run.
|
||||||
|
*
|
||||||
|
* @return Name of the check run
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -62,6 +87,11 @@ public class GHCheckRun extends GHObject {
|
|||||||
return headSha;
|
return headSha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the pull requests participated in this check run.
|
||||||
|
*
|
||||||
|
* @return Pull requests of this check run
|
||||||
|
*/
|
||||||
GHPullRequest[] getPullRequests() throws IOException {
|
GHPullRequest[] getPullRequests() throws IOException {
|
||||||
if (pullRequests != null && pullRequests.length != 0) {
|
if (pullRequests != null && pullRequests.length != 0) {
|
||||||
for (GHPullRequest singlePull : pullRequests) {
|
for (GHPullRequest singlePull : pullRequests) {
|
||||||
@@ -72,11 +102,145 @@ public class GHCheckRun extends GHObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated This object has no HTML URL.
|
* Gets the HTML URL: https://github.com/[owner]/[repo-name]/runs/[check-run-id], usually an GitHub Action page of
|
||||||
|
* the check run.
|
||||||
|
*
|
||||||
|
* @return HTML URL
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public URL getHtmlUrl() {
|
public URL getHtmlUrl() {
|
||||||
return null;
|
return htmlUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the global node id to access most objects in GitHub.
|
||||||
|
*
|
||||||
|
* @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">documentation</a>
|
||||||
|
* @return Global node id
|
||||||
|
*/
|
||||||
|
public String getNodeId() {
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a reference for the check run on the integrator's system.
|
||||||
|
*
|
||||||
|
* @return Reference id
|
||||||
|
*/
|
||||||
|
public String getExternalId() {
|
||||||
|
return externalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the details URL from which to find full details of the check run on the integrator's site.
|
||||||
|
*
|
||||||
|
* @return Details URL
|
||||||
|
*/
|
||||||
|
public URL getDetailsUrl() {
|
||||||
|
return detailsUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the start time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
||||||
|
*
|
||||||
|
* @return Timestamp of the start time
|
||||||
|
*/
|
||||||
|
public Date getStartedAt() {
|
||||||
|
return GitHubClient.parseDate(startedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the completed time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
||||||
|
*
|
||||||
|
* @return Timestamp of the completed time
|
||||||
|
*/
|
||||||
|
public Date getCompletedAt() {
|
||||||
|
return GitHubClient.parseDate(completedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the GitHub app this check run belongs to, included in response.
|
||||||
|
*
|
||||||
|
* @return GitHub App
|
||||||
|
*/
|
||||||
|
public GHApp getApp() {
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the check suite this check run belongs to
|
||||||
|
*
|
||||||
|
* @return Check suite
|
||||||
|
*/
|
||||||
|
public GHCheckSuite getCheckSuite() {
|
||||||
|
return checkSuite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an output for a check run.
|
||||||
|
*
|
||||||
|
* @return Output of a check run
|
||||||
|
*/
|
||||||
|
public Output getOutput() {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an output in a check run to include summary and other results.
|
||||||
|
*
|
||||||
|
* @see <a href="https://developer.github.com/v3/checks/runs/#output-object">documentation</a>
|
||||||
|
*/
|
||||||
|
public static class Output {
|
||||||
|
private String title;
|
||||||
|
private String summary;
|
||||||
|
private String text;
|
||||||
|
private int annotationsCount;
|
||||||
|
private URL annotationsUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the title of check run.
|
||||||
|
*
|
||||||
|
* @return title of check run
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the summary of the check run, note that it supports Markdown.
|
||||||
|
*
|
||||||
|
* @return summary of check run
|
||||||
|
*/
|
||||||
|
public String getSummary() {
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the details of the check run, note that it supports Markdown.
|
||||||
|
*
|
||||||
|
* @return Details of the check run
|
||||||
|
*/
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the annotation count of a check run.
|
||||||
|
*
|
||||||
|
* @return annotation count of a check run
|
||||||
|
*/
|
||||||
|
public int getAnnotationsCount() {
|
||||||
|
return annotationsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL of annotations.
|
||||||
|
*
|
||||||
|
* @return URL of annotations
|
||||||
|
*/
|
||||||
|
public URL getAnnotationsUrl() {
|
||||||
|
return annotationsUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
239
src/main/java/org/kohsuke/github/GHCheckSuite.java
Normal file
239
src/main/java/org/kohsuke/github/GHCheckSuite.java
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
package org.kohsuke.github;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a check suite.
|
||||||
|
*
|
||||||
|
* @see <a href="https://developer.github.com/v3/checks/suites/">documentation</a>
|
||||||
|
*/
|
||||||
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" },
|
||||||
|
justification = "JSON API")
|
||||||
|
public class GHCheckSuite extends GHObject {
|
||||||
|
GHRepository owner;
|
||||||
|
GitHub root;
|
||||||
|
|
||||||
|
private String nodeId;
|
||||||
|
private String headBranch;
|
||||||
|
private String headSha;
|
||||||
|
private String status;
|
||||||
|
private String conclusion;
|
||||||
|
private String before;
|
||||||
|
private String after;
|
||||||
|
private int latestCheckRunsCount;
|
||||||
|
private URL checkRunsUrl;
|
||||||
|
private HeadCommit headCommit;
|
||||||
|
private GHApp app;
|
||||||
|
private GHPullRequest[] pullRequests;
|
||||||
|
|
||||||
|
GHCheckSuite wrap(GHRepository owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
this.root = owner.root;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
GHCheckSuite wrap(GitHub root) {
|
||||||
|
this.root = root;
|
||||||
|
if (owner != null) {
|
||||||
|
owner.wrap(root);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
GHPullRequest[] wrap() {
|
||||||
|
return pullRequests;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the global node id to access most objects in GitHub.
|
||||||
|
*
|
||||||
|
* @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">documentation</a>
|
||||||
|
* @return global node id
|
||||||
|
*/
|
||||||
|
public String getNodeId() {
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The head branch name the changes are on.
|
||||||
|
*
|
||||||
|
* @return head branch name
|
||||||
|
*/
|
||||||
|
public String getHeadBranch() {
|
||||||
|
return headBranch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the HEAD SHA.
|
||||||
|
*
|
||||||
|
* @return sha for the HEAD commit
|
||||||
|
*/
|
||||||
|
public String getHeadSha() {
|
||||||
|
return headSha;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets status of the check suite. It can be one of request, in_progress, or completed.
|
||||||
|
*
|
||||||
|
* @return status of the check suite
|
||||||
|
*/
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets conclusion of a completed check suite. It can be one of success, failure, neutral, cancelled, time_out,
|
||||||
|
* action_required, or stale. The check suite will report the highest priority check run conclusion in the check
|
||||||
|
* suite's conclusion.
|
||||||
|
*
|
||||||
|
* @return conclusion of the check suite
|
||||||
|
*/
|
||||||
|
public String getConclusion() {
|
||||||
|
return conclusion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SHA of the most recent commit on ref before the push.
|
||||||
|
*
|
||||||
|
* @return sha of a commit
|
||||||
|
*/
|
||||||
|
public String getBefore() {
|
||||||
|
return before;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SHA of the most recent commit on ref after the push.
|
||||||
|
*
|
||||||
|
* @return sha of a commit
|
||||||
|
*/
|
||||||
|
public String getAfter() {
|
||||||
|
return after;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The quantity of check runs that had run as part of the latest push.
|
||||||
|
*
|
||||||
|
* @return sha of the most recent commit
|
||||||
|
*/
|
||||||
|
public int getLatestCheckRunsCount() {
|
||||||
|
return latestCheckRunsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The url used to list all the check runs belonged to this suite.
|
||||||
|
*
|
||||||
|
* @return url containing all check runs
|
||||||
|
*/
|
||||||
|
public URL getCheckRunsUrl() {
|
||||||
|
return checkRunsUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The commit of current head.
|
||||||
|
*
|
||||||
|
* @return head commit
|
||||||
|
*/
|
||||||
|
public HeadCommit getHeadCommit() {
|
||||||
|
return headCommit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the GitHub app this check suite belongs to, included in response.
|
||||||
|
*
|
||||||
|
* @return GitHub App
|
||||||
|
*/
|
||||||
|
public GHApp getApp() {
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the pull requests participated in this check suite.
|
||||||
|
*
|
||||||
|
* @return Pull requests
|
||||||
|
*/
|
||||||
|
GHPullRequest[] getPullRequests() throws IOException {
|
||||||
|
if (pullRequests != null && pullRequests.length != 0) {
|
||||||
|
for (GHPullRequest singlePull : pullRequests) {
|
||||||
|
singlePull.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pullRequests;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check suite doesn't have a HTML URL.
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public URL getHtmlUrl() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HeadCommit {
|
||||||
|
private String id;
|
||||||
|
private String treeId;
|
||||||
|
private String message;
|
||||||
|
private String timestamp;
|
||||||
|
private GitUser author;
|
||||||
|
private GitUser committer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets id of the commit, used by {@link GHCheckSuite} when a {@link GHEvent#CHECK_SUITE} comes
|
||||||
|
*
|
||||||
|
* @return id of the commit
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets id of the tree.
|
||||||
|
*
|
||||||
|
* @return id of the tree
|
||||||
|
*/
|
||||||
|
public String getTreeId() {
|
||||||
|
return treeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets message.
|
||||||
|
*
|
||||||
|
* @return commit message.
|
||||||
|
*/
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets timestamp of the commit.
|
||||||
|
*
|
||||||
|
* @return timestamp of the commit
|
||||||
|
*/
|
||||||
|
public Date getTimestamp() {
|
||||||
|
return GitHubClient.parseDate(timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets author.
|
||||||
|
*
|
||||||
|
* @return the author
|
||||||
|
*/
|
||||||
|
public GitUser getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets committer.
|
||||||
|
*
|
||||||
|
* @return the committer
|
||||||
|
*/
|
||||||
|
public GitUser getCommitter() {
|
||||||
|
return committer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* How is an user associated with a repository?
|
* How is an user associated with a repository?
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public enum GHCommentAuthorAssociation {
|
public enum GHCommentAuthorAssociation {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* A commit in a repository.
|
* A commit in a repository.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#getCommit(String) GHRepository#getCommit(String)
|
* @see GHRepository#getCommit(String) GHRepository#getCommit(String)
|
||||||
* @see GHCommitComment#getCommit() GHCommitComment#getCommit()
|
* @see GHCommitComment#getCommit() GHCommitComment#getCommit()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
/**
|
/**
|
||||||
* A comment attached to a commit (or a specific line in a specific file of a commit.)
|
* A comment attached to a commit (or a specific line in a specific file of a commit.)
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#listCommitComments() GHRepository#listCommitComments()
|
* @see GHRepository#listCommitComments() GHRepository#listCommitComments()
|
||||||
* @see GHCommit#listComments() GHCommit#listComments()
|
* @see GHCommit#listComments() GHCommit#listComments()
|
||||||
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
|
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import java.io.IOException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies a commit in {@link GHPullRequest}.
|
* Identifies a commit in {@link GHPullRequest}.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHCommitPointer {
|
public class GHCommitPointer {
|
||||||
private String ref, sha, label;
|
private String ref, sha, label;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.Date;
|
|||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#queryCommits() GHRepository#queryCommits()
|
* @see GHRepository#queryCommits() GHRepository#queryCommits()
|
||||||
*/
|
*/
|
||||||
public class GHCommitQueryBuilder {
|
public class GHCommitQueryBuilder {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Search commits.
|
* Search commits.
|
||||||
*
|
*
|
||||||
|
* @author Marc de Verdelhan
|
||||||
* @see GitHub#searchCommits() GitHub#searchCommits()
|
* @see GitHub#searchCommits() GitHub#searchCommits()
|
||||||
*/
|
*/
|
||||||
@Preview
|
@Preview
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Represents the state of commit
|
* Represents the state of commit
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHCommitStatus
|
* @see GHCommitStatus
|
||||||
*/
|
*/
|
||||||
public enum GHCommitState {
|
public enum GHCommitState {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* Represents a status of a commit.
|
* Represents a status of a commit.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#getLastCommitStatus(String) GHRepository#getLastCommitStatus(String)
|
* @see GHRepository#getLastCommitStatus(String) GHRepository#getLastCommitStatus(String)
|
||||||
* @see GHCommit#getLastStatus() GHCommit#getLastStatus()
|
* @see GHCommit#getLastStatus() GHCommit#getLastStatus()
|
||||||
* @see GHRepository#createCommitStatus(String, GHCommitState, String, String) GHRepository#createCommitStatus(String,
|
* @see GHRepository#createCommitStatus(String, GHCommitState, String, String) GHRepository#createCommitStatus(String,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.net.URL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The model user for comparing 2 commits in the GitHub API.
|
* The model user for comparing 2 commits in the GitHub API.
|
||||||
|
*
|
||||||
|
* @author Michael Clarke
|
||||||
*/
|
*/
|
||||||
public class GHCompare {
|
public class GHCompare {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.Base64;
|
|||||||
/**
|
/**
|
||||||
* A Content of a repository.
|
* A Content of a repository.
|
||||||
*
|
*
|
||||||
|
* @author Alexandre COLLIGNON
|
||||||
* @see GHRepository#getFileContent(String) GHRepository#getFileContent(String)
|
* @see GHRepository#getFileContent(String) GHRepository#getFileContent(String)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
@@ -387,22 +388,6 @@ public class GHContent implements Refreshable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrap gh content [ ].
|
|
||||||
*
|
|
||||||
* @param contents
|
|
||||||
* the contents
|
|
||||||
* @param repository
|
|
||||||
* the repository
|
|
||||||
* @return the gh content [ ]
|
|
||||||
*/
|
|
||||||
public static GHContent[] wrap(GHContent[] contents, GHRepository repository) {
|
|
||||||
for (GHContent unwrappedContent : contents) {
|
|
||||||
unwrappedContent.wrap(repository);
|
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fully populate the data by retrieving missing data.
|
* Fully populate the data by retrieving missing data.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.Base64;
|
|||||||
* <p>
|
* <p>
|
||||||
* Call various methods to build up parameters, then call {@link #commit()} to make the change effective.
|
* Call various methods to build up parameters, then call {@link #commit()} to make the change effective.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#createContent() GHRepository#createContent()
|
* @see GHRepository#createContent() GHRepository#createContent()
|
||||||
*/
|
*/
|
||||||
public final class GHContentBuilder {
|
public final class GHContentBuilder {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Search code for {@link GHContent}.
|
* Search code for {@link GHContent}.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHub#searchContent() GitHub#searchContent()
|
* @see GitHub#searchContent() GitHub#searchContent()
|
||||||
*/
|
*/
|
||||||
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
|
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* {@link GHContent} with license information.
|
* {@link GHContent} with license information.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see <a href="https://developer.github.com/v3/licenses/#get-a-repositorys-license">documentation</a>
|
* @see <a href="https://developer.github.com/v3/licenses/#get-a-repositorys-license">documentation</a>
|
||||||
* @see GHRepository#getLicense()
|
* @see GHRepository#getLicense()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.net.URL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a repository
|
* Creates a repository
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHCreateRepositoryBuilder {
|
public class GHCreateRepositoryBuilder {
|
||||||
private final GitHub root;
|
private final GitHub root;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public class GHDeploymentStatusBuilder {
|
|||||||
* the state
|
* the state
|
||||||
* @deprecated Use {@link GHDeployment#createStatus(GHDeploymentState)}
|
* @deprecated Use {@link GHDeployment#createStatus(GHDeploymentState)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) {
|
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) {
|
||||||
this(repo, (long) deploymentId, state);
|
this(repo, (long) deploymentId, state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort direction
|
* Sort direction
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public enum GHDirection {
|
public enum GHDirection {
|
||||||
ASC, DESC
|
ASC, DESC
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an email of GitHub.
|
* Represents an email of GitHub.
|
||||||
|
*
|
||||||
|
* @author Kelly Campbell
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(
|
@SuppressFBWarnings(
|
||||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* Hook event type.
|
* Hook event type.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHEventInfo
|
* @see GHEventInfo
|
||||||
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
|
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an event.
|
* Represents an event.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||||
public class GHEventInfo {
|
public class GHEventInfo {
|
||||||
@@ -142,7 +144,7 @@ public class GHEventInfo {
|
|||||||
* if payload cannot be parsed
|
* if payload cannot be parsed
|
||||||
*/
|
*/
|
||||||
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
|
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
|
||||||
T v = GitHubClient.MAPPER.readValue(payload.traverse(), type);
|
T v = GitHubClient.getMappingObjectReader(root).readValue(payload.traverse(), type);
|
||||||
v.wrapUp(root);
|
v.wrapUp(root);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ public abstract class GHEventPayload {
|
|||||||
* @return the repository
|
* @return the repository
|
||||||
*/
|
*/
|
||||||
public GHRepository getRepository() {
|
public GHRepository getRepository() {
|
||||||
|
repository.root = root;
|
||||||
return repository;
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +151,48 @@ public abstract class GHEventPayload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A check suite event has been requested, rerequested or completed.
|
||||||
|
*
|
||||||
|
* @see <a href="https://developer.github.com/v3/activity/events/types/#checkrunevent">authoritative source</a>
|
||||||
|
*/
|
||||||
|
@SuppressFBWarnings(
|
||||||
|
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||||
|
justification = "JSON API")
|
||||||
|
public static class CheckSuite extends GHEventPayload {
|
||||||
|
private String action;
|
||||||
|
private GHCheckSuite checkSuite;
|
||||||
|
private GHRepository repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets action.
|
||||||
|
*
|
||||||
|
* @return the action
|
||||||
|
*/
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Check Suite object
|
||||||
|
*
|
||||||
|
* @return the Check Suite object
|
||||||
|
*/
|
||||||
|
public GHCheckSuite getCheckSuite() {
|
||||||
|
return checkSuite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets repository.
|
||||||
|
*
|
||||||
|
* @return the repository
|
||||||
|
*/
|
||||||
|
public GHRepository getRepository() {
|
||||||
|
repository.root = root;
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pull request status has changed.
|
* A pull request status has changed.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHException.
|
* The type GHException.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHException extends RuntimeException {
|
public class GHException extends RuntimeException {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import javax.annotation.Nonnull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
||||||
|
*
|
||||||
|
* @author Kanstantsin Shautsou
|
||||||
*/
|
*/
|
||||||
public class GHFileNotFoundException extends FileNotFoundException {
|
public class GHFileNotFoundException extends FileNotFoundException {
|
||||||
protected Map<String, List<String>> responseHeaderFields;
|
protected Map<String, List<String>> responseHeaderFields;
|
||||||
|
|||||||
@@ -1,26 +1,29 @@
|
|||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gist
|
* Gist
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHUser#listGists() GHUser#listGists()
|
* @see GHUser#listGists() GHUser#listGists()
|
||||||
* @see GitHub#getGist(String) GitHub#getGist(String)
|
* @see GitHub#getGist(String) GitHub#getGist(String)
|
||||||
* @see GitHub#createGist() GitHub#createGist()
|
* @see GitHub#createGist() GitHub#createGist()
|
||||||
* @see <a href="https://developer.github.com/v3/gists/">documentation</a>
|
* @see <a href="https://developer.github.com/v3/gists/">documentation</a>
|
||||||
*/
|
*/
|
||||||
public class GHGist extends GHObject {
|
public class GHGist extends GHObject {
|
||||||
/* package almost final */ GHUser owner;
|
|
||||||
/* package almost final */ GitHub root;
|
final GHUser owner;
|
||||||
|
final GitHub root;
|
||||||
|
|
||||||
private String forks_url, commits_url, id, git_pull_url, git_push_url, html_url;
|
private String forks_url, commits_url, id, git_pull_url, git_push_url, html_url;
|
||||||
|
|
||||||
@@ -33,7 +36,19 @@ public class GHGist extends GHObject {
|
|||||||
|
|
||||||
private String comments_url;
|
private String comments_url;
|
||||||
|
|
||||||
private Map<String, GHGistFile> files = new HashMap<String, GHGistFile>();
|
private final Map<String, GHGistFile> files;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
private GHGist(@JacksonInject GitHub root,
|
||||||
|
@JsonProperty("owner") GHUser owner,
|
||||||
|
@JsonProperty("files") Map<String, GHGistFile> files) {
|
||||||
|
this.root = root;
|
||||||
|
for (Entry<String, GHGistFile> e : files.entrySet()) {
|
||||||
|
e.getValue().fileName = e.getKey();
|
||||||
|
}
|
||||||
|
this.files = Collections.unmodifiableMap(files);
|
||||||
|
this.owner = root.getUser(owner);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets owner.
|
* Gets owner.
|
||||||
@@ -43,7 +58,7 @@ public class GHGist extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public GHUser getOwner() throws IOException {
|
public GHUser getOwner() throws IOException {
|
||||||
return root.intern(owner);
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,31 +154,7 @@ public class GHGist extends GHObject {
|
|||||||
* @return the files
|
* @return the files
|
||||||
*/
|
*/
|
||||||
public Map<String, GHGistFile> getFiles() {
|
public Map<String, GHGistFile> getFiles() {
|
||||||
return Collections.unmodifiableMap(files);
|
return files;
|
||||||
}
|
|
||||||
|
|
||||||
GHGist wrapUp(GHUser owner) {
|
|
||||||
this.owner = owner;
|
|
||||||
this.root = owner.root;
|
|
||||||
wrapUp();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used when caller obtains {@link GHGist} without knowing its owner. A partially constructed owner object is
|
|
||||||
* interned.
|
|
||||||
*/
|
|
||||||
GHGist wrapUp(GitHub root) {
|
|
||||||
this.owner = root.getUser(owner);
|
|
||||||
this.root = root;
|
|
||||||
wrapUp();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void wrapUp() {
|
|
||||||
for (Entry<String, GHGistFile> e : files.entrySet()) {
|
|
||||||
e.getValue().fileName = e.getKey();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getApiTailUrl(String tail) {
|
String getApiTailUrl(String tail) {
|
||||||
@@ -213,7 +204,7 @@ public class GHGist extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public GHGist fork() throws IOException {
|
public GHGist fork() throws IOException {
|
||||||
return root.createRequest().method("POST").withUrlPath(getApiTailUrl("forks")).fetch(GHGist.class).wrapUp(root);
|
return root.createRequest().method("POST").withUrlPath(getApiTailUrl("forks")).fetch(GHGist.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,9 +213,7 @@ public class GHGist extends GHObject {
|
|||||||
* @return the paged iterable
|
* @return the paged iterable
|
||||||
*/
|
*/
|
||||||
public PagedIterable<GHGist> listForks() {
|
public PagedIterable<GHGist> listForks() {
|
||||||
return root.createRequest()
|
return root.createRequest().withUrlPath(getApiTailUrl("forks")).toIterable(GHGist[].class, null);
|
||||||
.withUrlPath(getApiTailUrl("forks"))
|
|
||||||
.toIterable(GHGist[].class, item -> item.wrapUp(root));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -263,10 +252,4 @@ public class GHGist extends GHObject {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHGist wrap(GHUser owner) {
|
|
||||||
this.owner = owner;
|
|
||||||
this.root = owner.root;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.LinkedHashMap;
|
|||||||
/**
|
/**
|
||||||
* Builder pattern for creating a new Gist.
|
* Builder pattern for creating a new Gist.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHub#createGist() GitHub#createGist()
|
* @see GitHub#createGist() GitHub#createGist()
|
||||||
*/
|
*/
|
||||||
public class GHGistBuilder {
|
public class GHGistBuilder {
|
||||||
@@ -72,6 +73,6 @@ public class GHGistBuilder {
|
|||||||
*/
|
*/
|
||||||
public GHGist create() throws IOException {
|
public GHGist create() throws IOException {
|
||||||
req.with("files", files);
|
req.with("files", files);
|
||||||
return req.withUrlPath("/gists").fetch(GHGist.class).wrapUp(root);
|
return req.withUrlPath("/gists").fetch(GHGist.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* A file inside {@link GHGist}
|
* A file inside {@link GHGist}
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHGist#getFile(String) GHGist#getFile(String)
|
* @see GHGist#getFile(String) GHGist#getFile(String)
|
||||||
* @see GHGist#getFiles() GHGist#getFiles()
|
* @see GHGist#getFiles() GHGist#getFiles()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder pattern for updating a Gist.
|
* Builder pattern for updating a Gist.
|
||||||
|
*
|
||||||
|
* @author Martin van Zijl
|
||||||
*/
|
*/
|
||||||
public class GHGistUpdater {
|
public class GHGistUpdater {
|
||||||
private final GHGist base;
|
private final GHGist base;
|
||||||
@@ -94,6 +96,6 @@ public class GHGistUpdater {
|
|||||||
*/
|
*/
|
||||||
public GHGist update() throws IOException {
|
public GHGist update() throws IOException {
|
||||||
builder.with("files", files);
|
builder.with("files", files);
|
||||||
return builder.method("PATCH").withUrlPath(base.getApiTailUrl("")).fetch(GHGist.class).wrap(base.owner);
|
return builder.method("PATCH").withUrlPath(base.getApiTailUrl("")).fetch(GHGist.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHHook.
|
* The type GHHook.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||||
justification = "JSON API")
|
justification = "JSON API")
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import javax.annotation.Nonnull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
||||||
|
*
|
||||||
|
* @author Kanstantsin Shautsou
|
||||||
*/
|
*/
|
||||||
public class GHIOException extends IOException {
|
public class GHIOException extends IOException {
|
||||||
protected Map<String, List<String>> responseHeaderFields;
|
protected Map<String, List<String>> responseHeaderFields;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
|
|||||||
/**
|
/**
|
||||||
* Represents an issue on GitHub.
|
* Represents an issue on GitHub.
|
||||||
*
|
*
|
||||||
|
* @author Eric Maupin
|
||||||
* @author Kohsuke Kawaguchi
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#getIssue(int) GHRepository#getIssue(int)
|
* @see GHRepository#getIssue(int) GHRepository#getIssue(int)
|
||||||
* @see GitHub#searchIssues() GitHub#searchIssues()
|
* @see GitHub#searchIssues() GitHub#searchIssues()
|
||||||
@@ -63,8 +64,7 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
protected int comments;
|
protected int comments;
|
||||||
@SkipFromToString
|
@SkipFromToString
|
||||||
protected String body;
|
protected String body;
|
||||||
// for backward compatibility with < 1.63, this collection needs to hold instances of Label, not GHLabel
|
protected List<GHLabel> labels;
|
||||||
protected List<Label> labels;
|
|
||||||
protected GHUser user;
|
protected GHUser user;
|
||||||
protected String title, html_url;
|
protected String title, html_url;
|
||||||
protected GHIssue.PullRequest pull_request;
|
protected GHIssue.PullRequest pull_request;
|
||||||
@@ -72,14 +72,6 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
protected GHUser closed_by;
|
protected GHUser closed_by;
|
||||||
protected boolean locked;
|
protected boolean locked;
|
||||||
|
|
||||||
/**
|
|
||||||
* The type Label.
|
|
||||||
*
|
|
||||||
* @deprecated use {@link GHLabel}
|
|
||||||
*/
|
|
||||||
public static class Label extends GHLabel {
|
|
||||||
}
|
|
||||||
|
|
||||||
GHIssue wrap(GHRepository owner) {
|
GHIssue wrap(GHRepository owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
if (milestone != null)
|
if (milestone != null)
|
||||||
@@ -100,12 +92,6 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GHIssue[] wrap(GHIssue[] issues, GHRepository owner) {
|
|
||||||
for (GHIssue i : issues)
|
|
||||||
i.wrap(owner);
|
|
||||||
return issues;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository to which the issue belongs.
|
* Repository to which the issue belongs.
|
||||||
*
|
*
|
||||||
@@ -178,7 +164,7 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
if (labels == null) {
|
if (labels == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return Collections.<GHLabel>unmodifiableList(labels);
|
return Collections.unmodifiableList(labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -434,7 +420,7 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
* @see #listComments() #listComments()
|
* @see #listComments() #listComments()
|
||||||
*/
|
*/
|
||||||
public List<GHIssueComment> getComments() throws IOException {
|
public List<GHIssueComment> getComments() throws IOException {
|
||||||
return listComments().asList();
|
return listComments().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHIssueBuilder.
|
* The type GHIssueBuilder.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHIssueBuilder {
|
public class GHIssueBuilder {
|
||||||
private final GHRepository repo;
|
private final GHRepository repo;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
/**
|
/**
|
||||||
* Comment to the issue
|
* Comment to the issue
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHIssue#comment(String) GHIssue#comment(String)
|
* @see GHIssue#comment(String) GHIssue#comment(String)
|
||||||
* @see GHIssue#listComments() GHIssue#listComments()
|
* @see GHIssue#listComments() GHIssue#listComments()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHIssueEvent.
|
* The type GHIssueEvent.
|
||||||
|
*
|
||||||
|
* @author Martin van Zijl
|
||||||
*/
|
*/
|
||||||
public class GHIssueEvent {
|
public class GHIssueEvent {
|
||||||
private GitHub root;
|
private GitHub root;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Search issues.
|
* Search issues.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHub#searchIssues() GitHub#searchIssues()
|
* @see GitHub#searchIssues() GitHub#searchIssues()
|
||||||
*/
|
*/
|
||||||
public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
|
public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* SSH public key.
|
* SSH public key.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||||
public class GHKey {
|
public class GHKey {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* The type GHLabel.
|
* The type GHLabel.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHIssue#getLabels() GHIssue#getLabels()
|
* @see GHIssue#getLabels() GHIssue#getLabels()
|
||||||
* @see GHRepository#listLabels() GHRepository#listLabels()
|
* @see GHRepository#listLabels() GHRepository#listLabels()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* The GitHub Preview API's license information
|
* The GitHub Preview API's license information
|
||||||
*
|
*
|
||||||
|
* @author Duncan Dickinson
|
||||||
* @see GitHub#getLicense(String) GitHub#getLicense(String)
|
* @see GitHub#getLicense(String) GitHub#getLicense(String)
|
||||||
* @see GHRepository#getLicense() GHRepository#getLicense()
|
* @see GHRepository#getLicense() GHRepository#getLicense()
|
||||||
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
|
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* Base class for Github Marketplace Account.
|
* Base class for Github Marketplace Account.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GitHub#getMyMarketplacePurchases()
|
* @see GitHub#getMyMarketplacePurchases()
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace Account Plan.
|
* A Github Marketplace Account Plan.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplaceAccountPlan extends GHMarketplaceAccount {
|
public class GHMarketplaceAccountPlan extends GHMarketplaceAccount {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* GitHub Marketplace Account type.
|
* GitHub Marketplace Account type.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHMarketplaceAccount
|
* @see GHMarketplaceAccount
|
||||||
*/
|
*/
|
||||||
public enum GHMarketplaceAccountType {
|
public enum GHMarketplaceAccountType {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Returns any accounts associated with a plan, including free plans
|
* Returns any accounts associated with a plan, including free plans
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHMarketplacePlan#listAccounts()
|
* @see GHMarketplacePlan#listAccounts()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplaceListAccountBuilder {
|
public class GHMarketplaceListAccountBuilder {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace purchase pending change.
|
* A Github Marketplace purchase pending change.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplacePendingChange {
|
public class GHMarketplacePendingChange {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace plan.
|
* A Github Marketplace plan.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GitHub#listMarketplacePlans()
|
* @see GitHub#listMarketplacePlans()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplacePlan {
|
public class GHMarketplacePlan {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
|||||||
/**
|
/**
|
||||||
* GitHub Marketplace plan pricing model.
|
* GitHub Marketplace plan pricing model.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHMarketplacePlan
|
* @see GHMarketplacePlan
|
||||||
*/
|
*/
|
||||||
public enum GHMarketplacePriceModel {
|
public enum GHMarketplacePriceModel {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace purchase.
|
* A Github Marketplace purchase.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest() GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest() GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplacePurchase {
|
public class GHMarketplacePurchase {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* Github Marketplace User Purchase
|
* Github Marketplace User Purchase
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GitHub#getMyMarketplacePurchases()
|
* @see GitHub#getMyMarketplacePurchases()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplaceUserPurchase {
|
public class GHMarketplaceUserPurchase {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* Represents a membership of a user in an organization.
|
* Represents a membership of a user in an organization.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHMyself#listOrgMemberships() GHMyself#listOrgMemberships()
|
* @see GHMyself#listOrgMemberships() GHMyself#listOrgMemberships()
|
||||||
*/
|
*/
|
||||||
public class GHMembership /* extends GHObject --- but it doesn't have id, created_at, etc. */ {
|
public class GHMembership /* extends GHObject --- but it doesn't have id, created_at, etc. */ {
|
||||||
@@ -83,11 +84,6 @@ public class GHMembership /* extends GHObject --- but it doesn't have id, create
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wrap(GHMembership[] page, GitHub root) {
|
|
||||||
for (GHMembership m : page)
|
|
||||||
m.wrap(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Role of a user in an organization.
|
* Role of a user in an organization.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Class that wraps the list of GitHub's IP addresses.
|
* Class that wraps the list of GitHub's IP addresses.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GitHub#getMeta() GitHub#getMeta()
|
* @see GitHub#getMeta() GitHub#getMeta()
|
||||||
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
|
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.util.Locale;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHMilestone.
|
* The type GHMilestone.
|
||||||
|
*
|
||||||
|
* @author Yusuke Kokubo
|
||||||
*/
|
*/
|
||||||
public class GHMilestone extends GHObject {
|
public class GHMilestone extends GHObject {
|
||||||
GitHub root;
|
GitHub root;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The enum GHMilestoneState.
|
* The enum GHMilestoneState.
|
||||||
|
*
|
||||||
|
* @author Yusuke Kokubo
|
||||||
*/
|
*/
|
||||||
public enum GHMilestoneState {
|
public enum GHMilestoneState {
|
||||||
OPEN, CLOSED
|
OPEN, CLOSED
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -12,6 +11,8 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the account that's logging into GitHub.
|
* Represents the account that's logging into GitHub.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHMyself extends GHUser {
|
public class GHMyself extends GHUser {
|
||||||
|
|
||||||
@@ -69,8 +70,7 @@ public class GHMyself extends GHUser {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public List<GHEmail> getEmails2() throws IOException {
|
public List<GHEmail> getEmails2() throws IOException {
|
||||||
GHEmail[] addresses = root.createRequest().withUrlPath("/user/emails").fetchArray(GHEmail[].class);
|
return root.createRequest().withUrlPath("/user/emails").toIterable(GHEmail[].class, null).toList();
|
||||||
return Collections.unmodifiableList(Arrays.asList(addresses));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,8 +84,7 @@ public class GHMyself extends GHUser {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public List<GHKey> getPublicKeys() throws IOException {
|
public List<GHKey> getPublicKeys() throws IOException {
|
||||||
return Collections.unmodifiableList(
|
return root.createRequest().withUrlPath("/user/keys").toIterable(GHKey[].class, null).toList();
|
||||||
Arrays.asList(root.createRequest().withUrlPath("/user/keys").fetchArray(GHKey[].class)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,8 +98,10 @@ public class GHMyself extends GHUser {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public List<GHVerifiedKey> getPublicVerifiedKeys() throws IOException {
|
public List<GHVerifiedKey> getPublicVerifiedKeys() throws IOException {
|
||||||
return Collections.unmodifiableList(Arrays.asList(
|
return root.createRequest()
|
||||||
root.createRequest().withUrlPath("/users/" + getLogin() + "/keys").fetchArray(GHVerifiedKey[].class)));
|
.withUrlPath("/users/" + getLogin() + "/keys")
|
||||||
|
.toIterable(GHVerifiedKey[].class, null)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,7 +114,10 @@ public class GHMyself extends GHUser {
|
|||||||
public GHPersonSet<GHOrganization> getAllOrganizations() throws IOException {
|
public GHPersonSet<GHOrganization> getAllOrganizations() throws IOException {
|
||||||
GHPersonSet<GHOrganization> orgs = new GHPersonSet<GHOrganization>();
|
GHPersonSet<GHOrganization> orgs = new GHPersonSet<GHOrganization>();
|
||||||
Set<String> names = new HashSet<String>();
|
Set<String> names = new HashSet<String>();
|
||||||
for (GHOrganization o : root.createRequest().withUrlPath("/user/orgs").fetchArray(GHOrganization[].class)) {
|
for (GHOrganization o : root.createRequest()
|
||||||
|
.withUrlPath("/user/orgs")
|
||||||
|
.toIterable(GHOrganization[].class, null)
|
||||||
|
.toArray()) {
|
||||||
if (names.add(o.getLogin())) // in case of rumoured duplicates in the data
|
if (names.add(o.getLogin())) // in case of rumoured duplicates in the data
|
||||||
orgs.add(root.getOrganization(o.getLogin()));
|
orgs.add(root.getOrganization(o.getLogin()));
|
||||||
}
|
}
|
||||||
@@ -187,6 +191,7 @@ public class GHMyself extends GHUser {
|
|||||||
* @return the paged iterable
|
* @return the paged iterable
|
||||||
* @deprecated Use {@link #listRepositories()}
|
* @deprecated Use {@link #listRepositories()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public PagedIterable<GHRepository> listAllRepositories() {
|
public PagedIterable<GHRepository> listAllRepositories() {
|
||||||
return listRepositories();
|
return listRepositories();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.util.NoSuchElementException;
|
|||||||
* In the non-blocking mode, the iterator will only report the set of notifications initially retrieved from GitHub,
|
* In the non-blocking mode, the iterator will only report the set of notifications initially retrieved from GitHub,
|
||||||
* then quit. This is useful for a batch application to process the current set of notifications.
|
* then quit. This is useful for a batch application to process the current set of notifications.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHub#listNotifications() GitHub#listNotifications()
|
* @see GitHub#listNotifications() GitHub#listNotifications()
|
||||||
* @see GHRepository#listNotifications() GHRepository#listNotifications()
|
* @see GHRepository#listNotifications() GHRepository#listNotifications()
|
||||||
*/
|
*/
|
||||||
@@ -181,7 +182,7 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
|||||||
|
|
||||||
Requester requester = req.withUrlPath(apiUrl);
|
Requester requester = req.withUrlPath(apiUrl);
|
||||||
GitHubResponse<GHThread[]> response = ((GitHubPageContentsIterable<GHThread>) requester
|
GitHubResponse<GHThread[]> response = ((GitHubPageContentsIterable<GHThread>) requester
|
||||||
.toIterable(requester.client, GHThread[].class, null)).toResponse();
|
.toIterable(GHThread[].class, null)).toResponse();
|
||||||
threads = response.body();
|
threads = response.body();
|
||||||
|
|
||||||
if (threads == null) {
|
if (threads == null) {
|
||||||
@@ -207,10 +208,6 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
|||||||
long seconds = Integer.parseInt(v);
|
long seconds = Integer.parseInt(v);
|
||||||
return System.currentTimeMillis() + seconds * 1000;
|
return System.currentTimeMillis() + seconds * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when GitHub is requesting an OTP from the user
|
* This exception is thrown when GitHub is requesting an OTP from the user
|
||||||
|
*
|
||||||
|
* @author Kevin Harrington mad.hephaestus@gmail.com
|
||||||
*/
|
*/
|
||||||
public class GHOTPRequiredException extends GHIOException {
|
public class GHOTPRequiredException extends GHIOException {
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||||
@@ -33,6 +34,19 @@ public abstract class GHObject {
|
|||||||
GHObject() {
|
GHObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by Jackson
|
||||||
|
*
|
||||||
|
* @param responseInfo
|
||||||
|
* the {@link GitHubResponse.ResponseInfo} to get headers from.
|
||||||
|
*/
|
||||||
|
@JacksonInject
|
||||||
|
protected void setResponseHeaderFields(@CheckForNull GitHubResponse.ResponseInfo responseInfo) {
|
||||||
|
if (responseInfo != null) {
|
||||||
|
responseHeaderFields = responseInfo.headers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HTTP response headers given along with the state of this object.
|
* Returns the HTTP response headers given along with the state of this object.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import static org.kohsuke.github.Previews.INERTIA;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHOrganization.
|
* The type GHOrganization.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHOrganization extends GHPerson {
|
public class GHOrganization extends GHPerson {
|
||||||
GHOrganization wrapUp(GitHub root) {
|
GHOrganization wrapUp(GitHub root) {
|
||||||
@@ -38,6 +40,7 @@ public class GHOrganization extends GHPerson {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
|
* @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHRepository createRepository(String name,
|
public GHRepository createRepository(String name,
|
||||||
String description,
|
String description,
|
||||||
String homepage,
|
String homepage,
|
||||||
@@ -67,6 +70,7 @@ public class GHOrganization extends GHPerson {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
|
* @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHRepository createRepository(String name,
|
public GHRepository createRepository(String name,
|
||||||
String description,
|
String description,
|
||||||
String homepage,
|
String homepage,
|
||||||
@@ -253,7 +257,7 @@ public class GHOrganization extends GHPerson {
|
|||||||
* @deprecated use {@link #listMembers()}
|
* @deprecated use {@link #listMembers()}
|
||||||
*/
|
*/
|
||||||
public List<GHUser> getMembers() throws IOException {
|
public List<GHUser> getMembers() throws IOException {
|
||||||
return listMembers().asList();
|
return listMembers().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -279,7 +283,7 @@ public class GHOrganization extends GHPerson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PagedIterable<GHUser> listMembers(String suffix) throws IOException {
|
private PagedIterable<GHUser> listMembers(String suffix) throws IOException {
|
||||||
return listMembers(suffix, null);
|
return listMembers(suffix, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,13 +296,28 @@ public class GHOrganization extends GHPerson {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public PagedIterable<GHUser> listMembersWithFilter(String filter) throws IOException {
|
public PagedIterable<GHUser> listMembersWithFilter(String filter) throws IOException {
|
||||||
return listMembers("members", filter);
|
return listMembers("members", filter, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PagedIterable<GHUser> listMembers(final String suffix, final String filter) throws IOException {
|
/**
|
||||||
String filterParams = (filter == null) ? "" : ("?filter=" + filter);
|
* List members with specified role paged iterable.
|
||||||
|
*
|
||||||
|
* @param role
|
||||||
|
* the role
|
||||||
|
* @return the paged iterable
|
||||||
|
* @throws IOException
|
||||||
|
* the io exception
|
||||||
|
*/
|
||||||
|
public PagedIterable<GHUser> listMembersWithRole(String role) throws IOException {
|
||||||
|
return listMembers("members", null, role);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PagedIterable<GHUser> listMembers(final String suffix, final String filter, String role)
|
||||||
|
throws IOException {
|
||||||
return root.createRequest()
|
return root.createRequest()
|
||||||
.withUrlPath(String.format("/orgs/%s/%s%s", login, suffix, filterParams))
|
.withUrlPath(String.format("/orgs/%s/%s", login, suffix))
|
||||||
|
.with("filter", filter)
|
||||||
|
.with("role", role)
|
||||||
.toIterable(GHUser[].class, item -> item.wrapUp(root));
|
.toIterable(GHUser[].class, item -> item.wrapUp(root));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The enum GHPermissionType.
|
* The enum GHPermissionType.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public enum GHPermissionType {
|
public enum GHPermissionType {
|
||||||
ADMIN, WRITE, READ, NONE
|
ADMIN, WRITE, READ, NONE
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -14,12 +14,14 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Common part of {@link GHUser} and {@link GHOrganization}.
|
* Common part of {@link GHUser} and {@link GHOrganization}.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public abstract class GHPerson extends GHObject {
|
public abstract class GHPerson extends GHObject {
|
||||||
/* package almost final */ GitHub root;
|
/* package almost final */ GitHub root;
|
||||||
|
|
||||||
// core data fields that exist even for "small" user data (such as the user info in pull request)
|
// core data fields that exist even for "small" user data (such as the user info in pull request)
|
||||||
protected String login, avatar_url, gravatar_id;
|
protected String login, avatar_url;
|
||||||
|
|
||||||
// other fields (that only show up in full data)
|
// other fields (that only show up in full data)
|
||||||
protected String location, blog, email, name, company, type;
|
protected String location, blog, email, name, company, type;
|
||||||
@@ -114,29 +116,27 @@ public abstract class GHPerson extends GHObject {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
|
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
|
||||||
return new Iterable<List<GHRepository>>() {
|
return () -> {
|
||||||
public Iterator<List<GHRepository>> iterator() {
|
final PagedIterator<GHRepository> pager;
|
||||||
final Iterator<GHRepository[]> pager = GitHubPageIterator.create(root.getClient(),
|
try {
|
||||||
|
GitHubPageIterator<GHRepository[]> iterator = GitHubPageIterator.create(root.getClient(),
|
||||||
GHRepository[].class,
|
GHRepository[].class,
|
||||||
root.createRequest().withUrlPath("users", login, "repos").withPageSize(pageSize));
|
root.createRequest().withUrlPath("users", login, "repos").build(),
|
||||||
|
pageSize);
|
||||||
return new Iterator<List<GHRepository>>() {
|
pager = new PagedIterator<>(iterator, item -> item.wrap(root));
|
||||||
public boolean hasNext() {
|
} catch (MalformedURLException e) {
|
||||||
return pager.hasNext();
|
throw new GHException("Unable to build GitHub API URL", e);
|
||||||
}
|
|
||||||
|
|
||||||
public List<GHRepository> next() {
|
|
||||||
GHRepository[] batch = pager.next();
|
|
||||||
for (GHRepository r : batch)
|
|
||||||
r.root = root;
|
|
||||||
return Arrays.asList(batch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void remove() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Iterator<List<GHRepository>>() {
|
||||||
|
public boolean hasNext() {
|
||||||
|
return pager.hasNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GHRepository> next() {
|
||||||
|
return pager.nextPage();
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,22 +175,18 @@ public abstract class GHPerson extends GHObject {
|
|||||||
* @return the gravatar id
|
* @return the gravatar id
|
||||||
* @deprecated No longer available in the v3 API.
|
* @deprecated No longer available in the v3 API.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getGravatarId() {
|
public String getGravatarId() {
|
||||||
return gravatar_id;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string like 'https://secure.gravatar.com/avatar/0cb9832a01c22c083390f3c5dcb64105' that indicates the
|
* Returns a string of the avatar image URL.
|
||||||
* avatar image URL.
|
|
||||||
*
|
*
|
||||||
* @return the avatar url
|
* @return the avatar url
|
||||||
*/
|
*/
|
||||||
public String getAvatarUrl() {
|
public String getAvatarUrl() {
|
||||||
if (avatar_url != null)
|
return avatar_url;
|
||||||
return avatar_url;
|
|
||||||
if (gravatar_id != null)
|
|
||||||
return "https://secure.gravatar.com/avatar/" + gravatar_id;
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.HashSet;
|
|||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* the type parameter
|
* the type parameter
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHPersonSet<T extends GHPerson> extends HashSet<T> {
|
public class GHPersonSet<T extends GHPerson> extends HashSet<T> {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static org.kohsuke.github.Previews.INERTIA;
|
|||||||
/**
|
/**
|
||||||
* A GitHub project.
|
* A GitHub project.
|
||||||
*
|
*
|
||||||
|
* @author Martin van Zijl
|
||||||
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
||||||
*/
|
*/
|
||||||
public class GHProject extends GHObject {
|
public class GHProject extends GHObject {
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import static org.kohsuke.github.Previews.INERTIA;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHProjectCard.
|
* The type GHProjectCard.
|
||||||
|
*
|
||||||
|
* @author Gunnar Skjold
|
||||||
*/
|
*/
|
||||||
public class GHProjectCard extends GHObject {
|
public class GHProjectCard extends GHObject {
|
||||||
private GitHub root;
|
private GitHub root;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import static org.kohsuke.github.Previews.INERTIA;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHProjectColumn.
|
* The type GHProjectColumn.
|
||||||
|
*
|
||||||
|
* @author Gunnar Skjold
|
||||||
*/
|
*/
|
||||||
public class GHProjectColumn extends GHObject {
|
public class GHProjectColumn extends GHObject {
|
||||||
protected GitHub root;
|
protected GitHub root;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import static org.kohsuke.github.Previews.SHADOW_CAT;
|
|||||||
/**
|
/**
|
||||||
* A pull request.
|
* A pull request.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#getPullRequest(int) GHRepository#getPullRequest(int)
|
* @see GHRepository#getPullRequest(int) GHRepository#getPullRequest(int)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
@@ -452,6 +453,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@link #createReview()}
|
* @deprecated Use {@link #createReview()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHPullRequestReview createReview(String body,
|
public GHPullRequestReview createReview(String body,
|
||||||
@CheckForNull GHPullRequestReviewState event,
|
@CheckForNull GHPullRequestReviewState event,
|
||||||
GHPullRequestReviewComment... comments) throws IOException {
|
GHPullRequestReviewComment... comments) throws IOException {
|
||||||
@@ -472,6 +474,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@link #createReview()}
|
* @deprecated Use {@link #createReview()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHPullRequestReview createReview(String body,
|
public GHPullRequestReview createReview(String body,
|
||||||
@CheckForNull GHPullRequestReviewState event,
|
@CheckForNull GHPullRequestReviewState event,
|
||||||
List<GHPullRequestReviewComment> comments) throws IOException {
|
List<GHPullRequestReviewComment> comments) throws IOException {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* Commit detail inside a {@link GHPullRequest}.
|
* Commit detail inside a {@link GHPullRequest}.
|
||||||
*
|
*
|
||||||
|
* @author Luca Milanesio
|
||||||
* @see GHPullRequest#listCommits() GHPullRequest#listCommits()
|
* @see GHPullRequest#listCommits() GHPullRequest#listCommits()
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(
|
@SuppressFBWarnings(
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* File detail inside a {@link GHPullRequest}.
|
* File detail inside a {@link GHPullRequest}.
|
||||||
*
|
*
|
||||||
|
* @author Julien Henry
|
||||||
* @see GHPullRequest#listFiles() GHPullRequest#listFiles()
|
* @see GHPullRequest#listFiles() GHPullRequest#listFiles()
|
||||||
*/
|
*/
|
||||||
public class GHPullRequestFileDetail {
|
public class GHPullRequestFileDetail {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import static org.kohsuke.github.Previews.SHADOW_CAT;
|
|||||||
/**
|
/**
|
||||||
* Lists up pull requests with some filtering and sorting.
|
* Lists up pull requests with some filtering and sorting.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#queryPullRequests() GHRepository#queryPullRequests()
|
* @see GHRepository#queryPullRequests() GHRepository#queryPullRequests()
|
||||||
*/
|
*/
|
||||||
public class GHPullRequestQueryBuilder extends GHQueryBuilder<GHPullRequest> {
|
public class GHPullRequestQueryBuilder extends GHQueryBuilder<GHPullRequest> {
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ public class GHPullRequestReview extends GHObject {
|
|||||||
* @deprecated Former preview method that changed when it got public. Left here for backward compatibility. Use
|
* @deprecated Former preview method that changed when it got public. Left here for backward compatibility. Use
|
||||||
* {@link #submit(String, GHPullRequestReviewEvent)}
|
* {@link #submit(String, GHPullRequestReviewEvent)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void submit(String body, GHPullRequestReviewState state) throws IOException {
|
public void submit(String body, GHPullRequestReviewState state) throws IOException {
|
||||||
submit(body, state.toEvent());
|
submit(body, state.toEvent());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Builds up a creation of new {@link GHPullRequestReview}.
|
* Builds up a creation of new {@link GHPullRequestReview}.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHPullRequest#createReview() GHPullRequest#createReview()
|
* @see GHPullRequest#createReview() GHPullRequest#createReview()
|
||||||
*/
|
*/
|
||||||
public class GHPullRequestReviewBuilder {
|
public class GHPullRequestReviewBuilder {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
/**
|
/**
|
||||||
* Review comment to the pull request
|
* Review comment to the pull request
|
||||||
*
|
*
|
||||||
|
* @author Julien Henry
|
||||||
* @see GHPullRequest#listReviewComments() GHPullRequest#listReviewComments()
|
* @see GHPullRequest#listReviewComments() GHPullRequest#listReviewComments()
|
||||||
* @see GHPullRequest#createReviewComment(String, String, String, int) GHPullRequest#createReviewComment(String, String,
|
* @see GHPullRequest#createReviewComment(String, String, String, int) GHPullRequest#createReviewComment(String, String,
|
||||||
* String, int)
|
* String, int)
|
||||||
@@ -59,6 +60,7 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
|
|||||||
* @return the gh pull request review comment
|
* @return the gh pull request review comment
|
||||||
* @deprecated You should be using {@link GHPullRequestReviewBuilder#comment(String, String, int)}
|
* @deprecated You should be using {@link GHPullRequestReviewBuilder#comment(String, String, int)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static GHPullRequestReviewComment draft(String body, String path, int position) {
|
public static GHPullRequestReviewComment draft(String body, String path, int position) {
|
||||||
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
|
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
|
||||||
result.body = body;
|
result.body = body;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package org.kohsuke.github;
|
|||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* the type parameter
|
* the type parameter
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public abstract class GHQueryBuilder<T> {
|
public abstract class GHQueryBuilder<T> {
|
||||||
protected final GitHub root;
|
protected final GitHub root;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
@@ -19,6 +20,8 @@ import static java.util.logging.Level.FINEST;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Rate limit.
|
* Rate limit.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||||
public class GHRateLimit {
|
public class GHRateLimit {
|
||||||
@@ -289,14 +292,11 @@ public class GHRateLimit {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The time at which the rate limit will reset. This value is calculated based on
|
* The time at which the rate limit will reset. This value is calculated based on
|
||||||
* {@link #getResetEpochSeconds()} by calling {@link #recalculateResetDate}. If the clock on the local machine
|
* {@link #getResetEpochSeconds()} by calling {@link #calculateResetDate}. If the clock on the local machine not
|
||||||
* not synchronized with the server clock, this time value will be adjusted to match the local machine's clock.
|
* synchronized with the server clock, this time value will be adjusted to match the local machine's clock.
|
||||||
* <p>
|
|
||||||
* Recalculated by calling {@link #recalculateResetDate}.
|
|
||||||
* </p>
|
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private Date resetDate;
|
private final Date resetDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new Record.
|
* Instantiates a new Record.
|
||||||
@@ -308,7 +308,6 @@ public class GHRateLimit {
|
|||||||
* @param resetEpochSeconds
|
* @param resetEpochSeconds
|
||||||
* the reset epoch seconds
|
* the reset epoch seconds
|
||||||
*/
|
*/
|
||||||
@JsonCreator
|
|
||||||
public Record(@JsonProperty(value = "limit", required = true) int limit,
|
public Record(@JsonProperty(value = "limit", required = true) int limit,
|
||||||
@JsonProperty(value = "remaining", required = true) int remaining,
|
@JsonProperty(value = "remaining", required = true) int remaining,
|
||||||
@JsonProperty(value = "reset", required = true) long resetEpochSeconds) {
|
@JsonProperty(value = "reset", required = true) long resetEpochSeconds) {
|
||||||
@@ -316,7 +315,7 @@ public class GHRateLimit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new Record.
|
* Instantiates a new Record. Called by Jackson data binding or during header parsing.
|
||||||
*
|
*
|
||||||
* @param limit
|
* @param limit
|
||||||
* the limit
|
* the limit
|
||||||
@@ -324,15 +323,22 @@ public class GHRateLimit {
|
|||||||
* the remaining
|
* the remaining
|
||||||
* @param resetEpochSeconds
|
* @param resetEpochSeconds
|
||||||
* the reset epoch seconds
|
* the reset epoch seconds
|
||||||
* @param updatedAt
|
* @param responseInfo
|
||||||
* the updated at
|
* the response info
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "Deprecated")
|
@JsonCreator
|
||||||
public Record(int limit, int remaining, long resetEpochSeconds, @CheckForNull String updatedAt) {
|
Record(@JsonProperty(value = "limit", required = true) int limit,
|
||||||
|
@JsonProperty(value = "remaining", required = true) int remaining,
|
||||||
|
@JsonProperty(value = "reset", required = true) long resetEpochSeconds,
|
||||||
|
@JacksonInject @CheckForNull GitHubResponse.ResponseInfo responseInfo) {
|
||||||
this.limit = limit;
|
this.limit = limit;
|
||||||
this.remaining = remaining;
|
this.remaining = remaining;
|
||||||
this.resetEpochSeconds = resetEpochSeconds;
|
this.resetEpochSeconds = resetEpochSeconds;
|
||||||
this.resetDate = recalculateResetDate(updatedAt);
|
String updatedAt = null;
|
||||||
|
if (responseInfo != null) {
|
||||||
|
updatedAt = responseInfo.headerField("Date");
|
||||||
|
}
|
||||||
|
this.resetDate = calculateResetDate(updatedAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -362,7 +368,8 @@ public class GHRateLimit {
|
|||||||
* a string date in RFC 1123
|
* a string date in RFC 1123
|
||||||
* @return reset date based on the passed date
|
* @return reset date based on the passed date
|
||||||
*/
|
*/
|
||||||
Date recalculateResetDate(@CheckForNull String updatedAt) {
|
@Nonnull
|
||||||
|
private Date calculateResetDate(@CheckForNull String updatedAt) {
|
||||||
long updatedAtEpochSeconds = createdAtEpochSeconds;
|
long updatedAtEpochSeconds = createdAtEpochSeconds;
|
||||||
if (!StringUtils.isBlank(updatedAt)) {
|
if (!StringUtils.isBlank(updatedAt)) {
|
||||||
try {
|
try {
|
||||||
@@ -379,7 +386,7 @@ public class GHRateLimit {
|
|||||||
// This may seem odd but it results in an accurate or slightly pessimistic reset date
|
// This may seem odd but it results in an accurate or slightly pessimistic reset date
|
||||||
// based on system time rather than assuming the system time synchronized with the server
|
// based on system time rather than assuming the system time synchronized with the server
|
||||||
long calculatedSecondsUntilReset = resetEpochSeconds - updatedAtEpochSeconds;
|
long calculatedSecondsUntilReset = resetEpochSeconds - updatedAtEpochSeconds;
|
||||||
return resetDate = new Date((createdAtEpochSeconds + calculatedSecondsUntilReset) * 1000);
|
return new Date((createdAtEpochSeconds + calculatedSecondsUntilReset) * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
/**
|
/**
|
||||||
* Reaction to issue, comment, PR, and so on.
|
* Reaction to issue, comment, PR, and so on.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see Reactable
|
* @see Reactable
|
||||||
*/
|
*/
|
||||||
@Preview
|
@Preview
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.net.URL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides information on a Git ref from GitHub.
|
* Provides information on a Git ref from GitHub.
|
||||||
|
*
|
||||||
|
* @author Michael Clarke
|
||||||
*/
|
*/
|
||||||
public class GHRef {
|
public class GHRef {
|
||||||
/* package almost final */ GitHub root;
|
/* package almost final */ GitHub root;
|
||||||
@@ -88,13 +90,6 @@ public class GHRef {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GHRef[] wrap(GHRef[] in, GitHub root) {
|
|
||||||
for (GHRef r : in) {
|
|
||||||
r.wrap(root);
|
|
||||||
}
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHObject.
|
* The type GHObject.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -72,6 +71,7 @@ public class GHRelease extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@link #update()}
|
* @deprecated Use {@link #update()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHRelease setDraft(boolean draft) throws IOException {
|
public GHRelease setDraft(boolean draft) throws IOException {
|
||||||
return update().draft(draft).update();
|
return update().draft(draft).update();
|
||||||
}
|
}
|
||||||
@@ -258,8 +258,9 @@ public class GHRelease extends GHObject {
|
|||||||
public List<GHAsset> getAssets() throws IOException {
|
public List<GHAsset> getAssets() throws IOException {
|
||||||
Requester builder = owner.root.createRequest();
|
Requester builder = owner.root.createRequest();
|
||||||
|
|
||||||
GHAsset[] assets = builder.withUrlPath(getApiTailUrl("assets")).fetchArray(GHAsset[].class);
|
return builder.withUrlPath(getApiTailUrl("assets"))
|
||||||
return Arrays.asList(GHAsset.wrap(assets, this));
|
.toIterable(GHAsset[].class, item -> item.wrap(this))
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Modifies {@link GHRelease}.
|
* Modifies {@link GHRelease}.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRelease#update() GHRelease#update()
|
* @see GHRelease#update() GHRelease#update()
|
||||||
*/
|
*/
|
||||||
public class GHReleaseUpdater {
|
public class GHReleaseUpdater {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import java.io.Reader;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.AbstractSet;
|
import java.util.AbstractSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -57,6 +56,8 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A repository on GitHub.
|
* A repository on GitHub.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||||
@@ -81,6 +82,8 @@ public class GHRepository extends GHObject {
|
|||||||
private boolean allow_merge_commit;
|
private boolean allow_merge_commit;
|
||||||
private boolean allow_rebase_merge;
|
private boolean allow_rebase_merge;
|
||||||
|
|
||||||
|
private boolean delete_branch_on_merge;
|
||||||
|
|
||||||
@JsonProperty("private")
|
@JsonProperty("private")
|
||||||
private boolean _private;
|
private boolean _private;
|
||||||
private int forks_count, stargazers_count, watchers_count, size, open_issues_count, subscribers_count;
|
private int forks_count, stargazers_count, watchers_count, size, open_issues_count, subscribers_count;
|
||||||
@@ -116,6 +119,7 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@code getDeployment(id).listStatuses()}
|
* @deprecated Use {@code getDeployment(id).listStatuses()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public PagedIterable<GHDeploymentStatus> getDeploymentStatuses(final int id) throws IOException {
|
public PagedIterable<GHDeploymentStatus> getDeploymentStatuses(final int id) throws IOException {
|
||||||
return getDeployment(id).listStatuses();
|
return getDeployment(id).listStatuses();
|
||||||
}
|
}
|
||||||
@@ -171,6 +175,7 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
* @deprecated Use {@code getDeployment(deploymentId).createStatus(ghDeploymentState)}
|
* @deprecated Use {@code getDeployment(deploymentId).createStatus(ghDeploymentState)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public GHDeploymentStatusBuilder createDeployStatus(int deploymentId, GHDeploymentState ghDeploymentState)
|
public GHDeploymentStatusBuilder createDeployStatus(int deploymentId, GHDeploymentState ghDeploymentState)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return getDeployment(deploymentId).createStatus(ghDeploymentState);
|
return getDeployment(deploymentId).createStatus(ghDeploymentState);
|
||||||
@@ -216,16 +221,6 @@ public class GHRepository extends GHObject {
|
|||||||
return clone_url;
|
return clone_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Git http transport url string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
* @deprecated Typo of {@link #getHttpTransportUrl()}
|
|
||||||
*/
|
|
||||||
public String gitHttpTransportUrl() {
|
|
||||||
return clone_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Subversion URL to access this repository: https://github.com/rails/rails
|
* Gets the Subversion URL to access this repository: https://github.com/rails/rails
|
||||||
*
|
*
|
||||||
@@ -358,7 +353,7 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public List<GHIssue> getIssues(GHIssueState state) throws IOException {
|
public List<GHIssue> getIssues(GHIssueState state) throws IOException {
|
||||||
return listIssues(state).asList();
|
return listIssues(state).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -376,8 +371,9 @@ public class GHRepository extends GHObject {
|
|||||||
Requester requester = root.createRequest()
|
Requester requester = root.createRequest()
|
||||||
.with("state", state)
|
.with("state", state)
|
||||||
.with("milestone", milestone == null ? "none" : "" + milestone.getNumber());
|
.with("milestone", milestone == null ? "none" : "" + milestone.getNumber());
|
||||||
return Arrays
|
return requester.withUrlPath(getApiTailUrl("issues"))
|
||||||
.asList(GHIssue.wrap(requester.withUrlPath(getApiTailUrl("issues")).fetchArray(GHIssue[].class), this));
|
.toIterable(GHIssue[].class, item -> item.wrap(this))
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -436,7 +432,7 @@ public class GHRepository extends GHObject {
|
|||||||
* @deprecated use {@link #listReleases()}
|
* @deprecated use {@link #listReleases()}
|
||||||
*/
|
*/
|
||||||
public List<GHRelease> getReleases() throws IOException {
|
public List<GHRelease> getReleases() throws IOException {
|
||||||
return listReleases().asList();
|
return listReleases().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -605,13 +601,34 @@ public class GHRepository extends GHObject {
|
|||||||
return allow_rebase_merge;
|
return allow_rebase_merge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically deleting head branches when pull requests are merged
|
||||||
|
*
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
|
public boolean isDeleteBranchOnMerge() {
|
||||||
|
return delete_branch_on_merge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of all forks of this repository. This not only counts direct forks, but also forks of forks,
|
||||||
|
* and so on.
|
||||||
|
*
|
||||||
|
* @return the forks
|
||||||
|
* @deprecated use {@link #getForksCount()} instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getForks() {
|
||||||
|
return getForksCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of all forks of this repository. This not only counts direct forks, but also forks of forks,
|
* Returns the number of all forks of this repository. This not only counts direct forks, but also forks of forks,
|
||||||
* and so on.
|
* and so on.
|
||||||
*
|
*
|
||||||
* @return the forks
|
* @return the forks
|
||||||
*/
|
*/
|
||||||
public int getForks() {
|
public int getForksCount() {
|
||||||
return forks_count;
|
return forks_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,8 +672,19 @@ public class GHRepository extends GHObject {
|
|||||||
* Gets watchers.
|
* Gets watchers.
|
||||||
*
|
*
|
||||||
* @return the watchers
|
* @return the watchers
|
||||||
|
* @deprecated use {@link #getWatchersCount()} instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public int getWatchers() {
|
public int getWatchers() {
|
||||||
|
return getWatchersCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the count of watchers.
|
||||||
|
*
|
||||||
|
* @return the watchers
|
||||||
|
*/
|
||||||
|
public int getWatchersCount() {
|
||||||
return watchers_count;
|
return watchers_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,16 +697,6 @@ public class GHRepository extends GHObject {
|
|||||||
return open_issues_count;
|
return open_issues_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets network count.
|
|
||||||
*
|
|
||||||
* @return the network count
|
|
||||||
* @deprecated This no longer exists in the official API documentation. Use {@link #getForks()}
|
|
||||||
*/
|
|
||||||
public int getNetworkCount() {
|
|
||||||
return forks_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets subscribers count.
|
* Gets subscribers count.
|
||||||
*
|
*
|
||||||
@@ -712,6 +730,7 @@ public class GHRepository extends GHObject {
|
|||||||
* @return the master branch
|
* @return the master branch
|
||||||
* @deprecated Renamed to {@link #getDefaultBranch()}
|
* @deprecated Renamed to {@link #getDefaultBranch()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getMasterBranch() {
|
public String getMasterBranch() {
|
||||||
return default_branch;
|
return default_branch;
|
||||||
}
|
}
|
||||||
@@ -734,7 +753,7 @@ public class GHRepository extends GHObject {
|
|||||||
*/
|
*/
|
||||||
@WithBridgeMethods(Set.class)
|
@WithBridgeMethods(Set.class)
|
||||||
public GHPersonSet<GHUser> getCollaborators() throws IOException {
|
public GHPersonSet<GHUser> getCollaborators() throws IOException {
|
||||||
return new GHPersonSet<GHUser>(listCollaborators().asList());
|
return new GHPersonSet<GHUser>(listCollaborators().toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -784,11 +803,14 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public Set<String> getCollaboratorNames() throws IOException {
|
public Set<String> getCollaboratorNames() throws IOException {
|
||||||
Set<String> r = new HashSet<String>();
|
Set<String> r = new HashSet<>();
|
||||||
for (GHUser u : GHUser.wrap(
|
// no initializer - we just want to the logins
|
||||||
root.createRequest().withUrlPath(getApiTailUrl("collaborators")).fetchArray(GHUser[].class),
|
PagedIterable<GHUser> users = root.createRequest()
|
||||||
root))
|
.withUrlPath(getApiTailUrl("collaborators"))
|
||||||
|
.toIterable(GHUser[].class, null);
|
||||||
|
for (GHUser u : users.toArray()) {
|
||||||
r.add(u.login);
|
r.add(u.login);
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,9 +852,11 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public Set<GHTeam> getTeams() throws IOException {
|
public Set<GHTeam> getTeams() throws IOException {
|
||||||
return Collections.unmodifiableSet(new HashSet<GHTeam>(Arrays.asList(
|
GHOrganization org = root.getOrganization(getOwnerName());
|
||||||
GHTeam.wrapUp(root.createRequest().withUrlPath(getApiTailUrl("teams")).fetchArray(GHTeam[].class),
|
return root.createRequest()
|
||||||
root.getOrganization(getOwnerName())))));
|
.withUrlPath(getApiTailUrl("teams"))
|
||||||
|
.toIterable(GHTeam[].class, item -> item.wrapUp(org))
|
||||||
|
.toSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1084,6 +1108,18 @@ public class GHRepository extends GHObject {
|
|||||||
edit("allow_rebase_merge", Boolean.toString(value));
|
edit("allow_rebase_merge", Boolean.toString(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After pull requests are merged, you can have head branches deleted automatically.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* the value
|
||||||
|
* @throws IOException
|
||||||
|
* the io exception
|
||||||
|
*/
|
||||||
|
public void deleteBranchOnMerge(boolean value) throws IOException {
|
||||||
|
edit("delete_branch_on_merge", Boolean.toString(value));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes this repository.
|
* Deletes this repository.
|
||||||
*
|
*
|
||||||
@@ -1238,7 +1274,7 @@ public class GHRepository extends GHObject {
|
|||||||
* @see #listPullRequests(GHIssueState) #listPullRequests(GHIssueState)
|
* @see #listPullRequests(GHIssueState) #listPullRequests(GHIssueState)
|
||||||
*/
|
*/
|
||||||
public List<GHPullRequest> getPullRequests(GHIssueState state) throws IOException {
|
public List<GHPullRequest> getPullRequests(GHIssueState state) throws IOException {
|
||||||
return queryPullRequests().state(state).list().asList();
|
return queryPullRequests().state(state).list().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1249,6 +1285,7 @@ public class GHRepository extends GHObject {
|
|||||||
* @return the paged iterable
|
* @return the paged iterable
|
||||||
* @deprecated Use {@link #queryPullRequests()}
|
* @deprecated Use {@link #queryPullRequests()}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public PagedIterable<GHPullRequest> listPullRequests(GHIssueState state) {
|
public PagedIterable<GHPullRequest> listPullRequests(GHIssueState state) {
|
||||||
return queryPullRequests().state(state).list();
|
return queryPullRequests().state(state).list();
|
||||||
}
|
}
|
||||||
@@ -1449,9 +1486,7 @@ public class GHRepository extends GHObject {
|
|||||||
* on failure communicating with GitHub
|
* on failure communicating with GitHub
|
||||||
*/
|
*/
|
||||||
public GHRef[] getRefs() throws IOException {
|
public GHRef[] getRefs() throws IOException {
|
||||||
return GHRef.wrap(root.createRequest()
|
return listRefs().toArray();
|
||||||
.withUrlPath(String.format("/repos/%s/%s/git/refs", getOwnerName(), name))
|
|
||||||
.fetchArray(GHRef[].class), root);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1476,9 +1511,7 @@ public class GHRepository extends GHObject {
|
|||||||
* on failure communicating with GitHub, potentially due to an invalid ref type being requested
|
* on failure communicating with GitHub, potentially due to an invalid ref type being requested
|
||||||
*/
|
*/
|
||||||
public GHRef[] getRefs(String refType) throws IOException {
|
public GHRef[] getRefs(String refType) throws IOException {
|
||||||
return GHRef.wrap(root.createRequest()
|
return listRefs(refType).toArray();
|
||||||
.withUrlPath(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType))
|
|
||||||
.fetchArray(GHRef[].class), root);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1736,7 +1769,7 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public GHCommitStatus getLastCommitStatus(String sha1) throws IOException {
|
public GHCommitStatus getLastCommitStatus(String sha1) throws IOException {
|
||||||
List<GHCommitStatus> v = listCommitStatuses(sha1).asList();
|
List<GHCommitStatus> v = listCommitStatuses(sha1).toList();
|
||||||
return v.isEmpty() ? null : v.get(0);
|
return v.isEmpty() ? null : v.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1975,14 +2008,6 @@ public class GHRepository extends GHObject {
|
|||||||
return createWebHook(url, null);
|
return createWebHook(url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is no different from getPullRequests(OPEN)
|
|
||||||
// /**
|
|
||||||
// * Retrieves all the pull requests.
|
|
||||||
// */
|
|
||||||
// public List<GHPullRequest> getPullRequests() throws IOException {
|
|
||||||
// return root.retrieveWithAuth("/pulls/"+owner+'/'+name,JsonPullRequests.class).wrap(root);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set that represents the post-commit hook URLs. The returned set is live, and changes made to them are
|
* Returns a set that represents the post-commit hook URLs. The returned set is live, and changes made to them are
|
||||||
* reflected to GitHub.
|
* reflected to GitHub.
|
||||||
@@ -1992,6 +2017,7 @@ public class GHRepository extends GHObject {
|
|||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
|
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
|
||||||
justification = "It causes a performance degradation, but we have already exposed it to the API")
|
justification = "It causes a performance degradation, but we have already exposed it to the API")
|
||||||
|
@Deprecated
|
||||||
public Set<URL> getPostCommitHooks() {
|
public Set<URL> getPostCommitHooks() {
|
||||||
return postCommitHooks;
|
return postCommitHooks;
|
||||||
}
|
}
|
||||||
@@ -2005,7 +2031,7 @@ public class GHRepository extends GHObject {
|
|||||||
private final Set<URL> postCommitHooks = new AbstractSet<URL>() {
|
private final Set<URL> postCommitHooks = new AbstractSet<URL>() {
|
||||||
private List<URL> getPostCommitHooks() {
|
private List<URL> getPostCommitHooks() {
|
||||||
try {
|
try {
|
||||||
List<URL> r = new ArrayList<URL>();
|
List<URL> r = new ArrayList<>();
|
||||||
for (GHHook h : getHooks()) {
|
for (GHHook h : getHooks()) {
|
||||||
if (h.getName().equals("web")) {
|
if (h.getName().equals("web")) {
|
||||||
r.add(new URL(h.getConfig().get("url")));
|
r.add(new URL(h.getConfig().get("url")));
|
||||||
@@ -2071,8 +2097,10 @@ public class GHRepository extends GHObject {
|
|||||||
*/
|
*/
|
||||||
public Map<String, GHBranch> getBranches() throws IOException {
|
public Map<String, GHBranch> getBranches() throws IOException {
|
||||||
Map<String, GHBranch> r = new TreeMap<String, GHBranch>();
|
Map<String, GHBranch> r = new TreeMap<String, GHBranch>();
|
||||||
for (GHBranch p : root.createRequest().withUrlPath(getApiTailUrl("branches")).fetchArray(GHBranch[].class)) {
|
for (GHBranch p : root.createRequest()
|
||||||
p.wrap(this);
|
.withUrlPath(getApiTailUrl("branches"))
|
||||||
|
.toIterable(GHBranch[].class, item -> item.wrap(this))
|
||||||
|
.toArray()) {
|
||||||
r.put(p.getName(), p);
|
r.put(p.getName(), p);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
@@ -2203,11 +2231,10 @@ public class GHRepository extends GHObject {
|
|||||||
}
|
}
|
||||||
String target = getApiTailUrl("contents/" + path);
|
String target = getApiTailUrl("contents/" + path);
|
||||||
|
|
||||||
GHContent[] files = requester.with("ref", ref).withUrlPath(target).fetchArray(GHContent[].class);
|
return requester.with("ref", ref)
|
||||||
|
.withUrlPath(target)
|
||||||
GHContent.wrap(files, this);
|
.toIterable(GHContent[].class, item -> item.wrap(this))
|
||||||
|
.toList();
|
||||||
return Arrays.asList(files);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2361,11 +2388,10 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public List<GHDeployKey> getDeployKeys() throws IOException {
|
public List<GHDeployKey> getDeployKeys() throws IOException {
|
||||||
List<GHDeployKey> list = new ArrayList<GHDeployKey>(
|
return root.createRequest()
|
||||||
Arrays.asList(root.createRequest().withUrlPath(getApiTailUrl("keys")).fetchArray(GHDeployKey[].class)));
|
.withUrlPath(getApiTailUrl("keys"))
|
||||||
for (GHDeployKey h : list)
|
.toIterable(GHDeployKey[].class, item -> item.wrap(this))
|
||||||
h.wrap(this);
|
.toList();
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Search repositories.
|
* Search repositories.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHub#searchRepositories() GitHub#searchRepositories()
|
* @see GitHub#searchRepositories() GitHub#searchRepositories()
|
||||||
*/
|
*/
|
||||||
public class GHRepositorySearchBuilder extends GHSearchBuilder<GHRepository> {
|
public class GHRepositorySearchBuilder extends GHSearchBuilder<GHRepository> {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* App installation repository selection.
|
* App installation repository selection.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHAppInstallation
|
* @see GHAppInstallation
|
||||||
*/
|
*/
|
||||||
public enum GHRepositorySelection {
|
public enum GHRepositorySelection {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import java.util.NoSuchElementException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Statistics for a GitHub repository.
|
* Statistics for a GitHub repository.
|
||||||
|
*
|
||||||
|
* @author Martin van Zijl
|
||||||
*/
|
*/
|
||||||
public class GHRepositoryStatistics {
|
public class GHRepositoryStatistics {
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ import java.net.MalformedURLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for various search builders.
|
* Base class for various search builders.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* the type parameter
|
* the type parameter
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
||||||
protected final List<String> terms = new ArrayList<String>();
|
protected final List<String> terms = new ArrayList<String>();
|
||||||
@@ -25,6 +24,7 @@ public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
|||||||
GHSearchBuilder(GitHub root, Class<? extends SearchResult<T>> receiverType) {
|
GHSearchBuilder(GitHub root, Class<? extends SearchResult<T>> receiverType) {
|
||||||
super(root);
|
super(root);
|
||||||
this.receiverType = receiverType;
|
this.receiverType = receiverType;
|
||||||
|
req.withUrlPath(getApiUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,20 +47,7 @@ public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
|||||||
|
|
||||||
req.set("q", StringUtils.join(terms, " "));
|
req.set("q", StringUtils.join(terms, " "));
|
||||||
try {
|
try {
|
||||||
final GitHubRequest baseRequest = req.build();
|
return new PagedSearchIterable<>(root, req.build(), receiverType);
|
||||||
return new PagedSearchIterable<T>(root) {
|
|
||||||
@Nonnull
|
|
||||||
public PagedIterator<T> _iterator(int pageSize) {
|
|
||||||
return new PagedIterator<T>(adapt(GitHubPageIterator.create(root.getClient(),
|
|
||||||
receiverType,
|
|
||||||
baseRequest.toBuilder().withUrlPath(getApiUrl()).withPageSize(pageSize)))) {
|
|
||||||
protected void wrapUp(T[] page) {
|
|
||||||
// PagedSearchIterable
|
|
||||||
// SearchResult.getItems() should do it
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
throw new GHException("", e);
|
throw new GHException("", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A stargazer at a repository on GitHub.
|
* A stargazer at a repository on GitHub.
|
||||||
|
*
|
||||||
|
* @author noctarius
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||||
public class GHStargazer {
|
public class GHStargazer {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* Represents your subscribing to a repository / conversation thread..
|
* Represents your subscribing to a repository / conversation thread..
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#getSubscription() GHRepository#getSubscription()
|
* @see GHRepository#getSubscription() GHRepository#getSubscription()
|
||||||
* @see GHThread#getSubscription() GHThread#getSubscription()
|
* @see GHThread#getSubscription() GHThread#getSubscription()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* App installation target type.
|
* App installation target type.
|
||||||
*
|
*
|
||||||
|
* @author Paulo Miguel Almeida
|
||||||
* @see GHAppInstallation
|
* @see GHAppInstallation
|
||||||
*/
|
*/
|
||||||
public enum GHTargetType {
|
public enum GHTargetType {
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A team in GitHub organization.
|
* A team in GitHub organization.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHTeam implements Refreshable {
|
public class GHTeam implements Refreshable {
|
||||||
private String name;
|
private String name;
|
||||||
@@ -52,13 +53,6 @@ public class GHTeam implements Refreshable {
|
|||||||
return wrapUp(organization);
|
return wrapUp(organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GHTeam[] wrapUp(GHTeam[] teams, GHOrganization owner) {
|
|
||||||
for (GHTeam t : teams) {
|
|
||||||
t.wrapUp(owner);
|
|
||||||
}
|
|
||||||
return teams;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GHTeam[] wrapUp(GHTeam[] teams, GHPullRequest owner) {
|
static GHTeam[] wrapUp(GHTeam[] teams, GHPullRequest owner) {
|
||||||
for (GHTeam t : teams) {
|
for (GHTeam t : teams) {
|
||||||
t.root = owner.root;
|
t.root = owner.root;
|
||||||
@@ -163,7 +157,7 @@ public class GHTeam implements Refreshable {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public Set<GHUser> getMembers() throws IOException {
|
public Set<GHUser> getMembers() throws IOException {
|
||||||
return Collections.unmodifiableSet(listMembers().asSet());
|
return listMembers().toSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* A conversation in the notification API.
|
* A conversation in the notification API.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see <a href="https://developer.github.com/v3/activity/notifications/">documentation</a>
|
* @see <a href="https://developer.github.com/v3/activity/notifications/">documentation</a>
|
||||||
* @see GHNotificationStream
|
* @see GHNotificationStream
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Provides information for Git Trees https://developer.github.com/v3/git/trees/
|
* Provides information for Git Trees https://developer.github.com/v3/git/trees/
|
||||||
*
|
*
|
||||||
|
* @author Daniel Teixeira - https://github.com/ddtxra
|
||||||
* @see GHCommit#getTree() GHCommit#getTree()
|
* @see GHCommit#getTree() GHCommit#getTree()
|
||||||
* @see GHRepository#getTree(String) GHRepository#getTree(String)
|
* @see GHRepository#getTree(String) GHRepository#getTree(String)
|
||||||
* @see GHTreeEntry#asTree() GHTreeEntry#asTree()
|
* @see GHTreeEntry#asTree() GHTreeEntry#asTree()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* Provides information for Git Trees https://developer.github.com/v3/git/trees/
|
* Provides information for Git Trees https://developer.github.com/v3/git/trees/
|
||||||
*
|
*
|
||||||
|
* @author Daniel Teixeira - https://github.com/ddtxra
|
||||||
* @see GHTree
|
* @see GHTree
|
||||||
*/
|
*/
|
||||||
public class GHTreeEntry {
|
public class GHTreeEntry {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import java.util.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an user of GitHub.
|
* Represents an user of GitHub.
|
||||||
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
*/
|
*/
|
||||||
public class GHUser extends GHPerson {
|
public class GHUser extends GHPerson {
|
||||||
|
|
||||||
@@ -41,8 +43,7 @@ public class GHUser extends GHPerson {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public List<GHKey> getKeys() throws IOException {
|
public List<GHKey> getKeys() throws IOException {
|
||||||
return Collections.unmodifiableList(
|
return root.createRequest().withUrlPath(getApiTailUrl("keys")).toIterable(GHKey[].class, null).toList();
|
||||||
Arrays.asList(root.createRequest().withUrlPath(getApiTailUrl("keys")).fetchArray(GHKey[].class)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +75,7 @@ public class GHUser extends GHPerson {
|
|||||||
*/
|
*/
|
||||||
@WithBridgeMethods(Set.class)
|
@WithBridgeMethods(Set.class)
|
||||||
public GHPersonSet<GHUser> getFollows() throws IOException {
|
public GHPersonSet<GHUser> getFollows() throws IOException {
|
||||||
return new GHPersonSet<GHUser>(listFollows().asList());
|
return new GHPersonSet<GHUser>(listFollows().toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +96,7 @@ public class GHUser extends GHPerson {
|
|||||||
*/
|
*/
|
||||||
@WithBridgeMethods(Set.class)
|
@WithBridgeMethods(Set.class)
|
||||||
public GHPersonSet<GHUser> getFollowers() throws IOException {
|
public GHPersonSet<GHUser> getFollowers() throws IOException {
|
||||||
return new GHPersonSet<GHUser>(listFollowers().asList());
|
return new GHPersonSet<GHUser>(listFollowers().toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +192,8 @@ public class GHUser extends GHPerson {
|
|||||||
Set<String> names = new HashSet<String>();
|
Set<String> names = new HashSet<String>();
|
||||||
for (GHOrganization o : root.createRequest()
|
for (GHOrganization o : root.createRequest()
|
||||||
.withUrlPath("/users/" + login + "/orgs")
|
.withUrlPath("/users/" + login + "/orgs")
|
||||||
.fetchArray(GHOrganization[].class)) {
|
.toIterable(GHOrganization[].class, null)
|
||||||
|
.toArray()) {
|
||||||
if (names.add(o.getLogin())) // I've seen some duplicates in the data
|
if (names.add(o.getLogin())) // I've seen some duplicates in the data
|
||||||
orgs.add(root.getOrganization(o.getLogin()));
|
orgs.add(root.getOrganization(o.getLogin()));
|
||||||
}
|
}
|
||||||
@@ -217,7 +219,7 @@ public class GHUser extends GHPerson {
|
|||||||
public PagedIterable<GHGist> listGists() throws IOException {
|
public PagedIterable<GHGist> listGists() throws IOException {
|
||||||
return root.createRequest()
|
return root.createRequest()
|
||||||
.withUrlPath(String.format("/users/%s/gists", login))
|
.withUrlPath(String.format("/users/%s/gists", login))
|
||||||
.toIterable(GHGist[].class, item -> item.wrapUp(this));
|
.toIterable(GHGist[].class, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Search users.
|
* Search users.
|
||||||
*
|
*
|
||||||
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GitHub#searchUsers() GitHub#searchUsers()
|
* @see GitHub#searchUsers() GitHub#searchUsers()
|
||||||
*/
|
*/
|
||||||
public class GHUserSearchBuilder extends GHSearchBuilder<GHUser> {
|
public class GHUserSearchBuilder extends GHSearchBuilder<GHUser> {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user