Skip to content

Commit

Permalink
Fix Gist getId() and add getGistId()
Browse files Browse the repository at this point in the history
Fixes hub4j#682
  • Loading branch information
bitwiseman committed Apr 26, 2020
1 parent cc2d14a commit 44dcbe7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/org/kohsuke/github/GHGist.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,30 @@ private GHGist(@JacksonInject GitHub root,
this.owner = root.getUser(owner);
}

/**
* Unlike most other GitHub objects, the id for Gists can be non-numeric, such as "aa5a315d61ae9438b18d". If the id
* is numeric, this method will get it. If id is not numeric, this will throw a runtime
* {@link NumberFormatException}.
*
* @return id of the Gist.
* @deprecated Use {@link #getGistId()} instead.
*/
@Deprecated
@Override
public long getId() {
return Long.parseLong(getGistId());
}

/**
* Gets the id for this Gist. Unlike most other GitHub objects, the id for Gists can be non-numeric, such as
* "aa5a315d61ae9438b18d". This should be used instead of {@link #getId()}.
*
* @return id of this Gist
*/
public String getGistId() {
return this.id;
}

/**
* Gets owner.
*
Expand Down Expand Up @@ -97,6 +121,11 @@ public String getGitPushUrl() {
return git_push_url;
}

/**
* Get the html url.
*
* @return the github html url
*/
public URL getHtmlUrl() {
return GitHubClient.parseURL(html_url);
}
Expand Down

0 comments on commit 44dcbe7

Please sign in to comment.