add more properties to GHCheckRun

This commit is contained in:
XiongKezhi
2020-02-28 15:40:51 +08:00
parent 46a141db9c
commit 10cc79f737
3 changed files with 126 additions and 7 deletions

View File

@@ -21,8 +21,18 @@ public class GHCheckRun extends GHObject {
private String conclusion;
private String name;
private String headSha;
private String nodeId;
private String externalId;
private String startedAt;
private String completedAt;
private URL url;
private URL htmlUrl;
private URL detailsUrl;
private GHApp app;
private GHPullRequest[] pullRequests;
// TODO: Add Output object, Check Suite object
GHCheckRun wrap(GHRepository owner) {
this.owner = owner;
this.root = owner.root;
@@ -41,14 +51,30 @@ public class GHCheckRun extends GHObject {
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() {
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() {
return conclusion;
}
/**
* Gets the custom name of this check run.
*
* @return Name of the check run
*/
public String getName() {
return name;
}
@@ -62,6 +88,12 @@ public class GHCheckRun extends GHObject {
return headSha;
}
/**
* Gets the pull requests participated in this check run.
*
* @return Pull requests of this check run
*/
GHPullRequest[] getPullRequests() throws IOException {
if (pullRequests != null && pullRequests.length != 0) {
for (GHPullRequest singlePull : pullRequests) {
@@ -72,11 +104,78 @@ 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
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 api URL: https://api.github.com/[owner]/[repo-name]/check-runs/[check-run-id].
*
* @return Api URL
**/
@Override
public URL getUrl() {
return url;
}
/**
* 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 String getStartedAt() {
return 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 String getCompletedAt() {
return completedAt;
}
/**
* Gets the GitHub app this check run belongs to, included in response.
*
* @retrurn GitHub App
*/
public GHApp getApp() {
return app;
}
}