Skip to content

Commit

Permalink
Added lock/unlock op and additional properties
Browse files Browse the repository at this point in the history
Issue #355
  • Loading branch information
kohsuke committed Sep 10, 2017
1 parent d440471 commit b443e86
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/kohsuke/github/GHIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class GHIssue extends GHObject implements Reactable{
protected GHIssue.PullRequest pull_request;
protected GHMilestone milestone;
protected GHUser closed_by;
protected boolean locked;

/**
* @deprecated use {@link GHLabel}
Expand Down Expand Up @@ -129,6 +130,10 @@ public String getTitle() {
return title;
}

public boolean isLocked() {
return locked;
}

public GHIssueState getState() {
return Enum.valueOf(GHIssueState.class, state.toUpperCase(Locale.ENGLISH));
}
Expand All @@ -148,6 +153,14 @@ public URL getApiURL(){
return GitHub.parseURL(url);
}

public void lock() throws IOException {
new Requester(root).method("PUT").to(getApiRoute()+"/lock");
}

public void unlock() throws IOException {
new Requester(root).method("PUT").to(getApiRoute()+"/lock");
}

/**
* Updates the issue by adding a comment.
*
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/org/kohsuke/github/GHPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public class GHPullRequest extends GHIssue {

// details that are only available when obtained from ID
private GHUser merged_by;
private int review_comments, additions;
private boolean merged;
private int review_comments, additions, commits;
private boolean merged, maintainer_can_modify;
private Boolean mergeable;
private int deletions;
private String mergeable_state;
Expand Down Expand Up @@ -167,11 +167,21 @@ public int getAdditions() throws IOException {
return additions;
}

public int getCommits() throws IOException {
populate();
return commits;
}

public boolean isMerged() throws IOException {
populate();
return merged;
}

public boolean canMaintainerModify() throws IOException {
populate();
return maintainer_can_modify;
}

public Boolean getMergeable() throws IOException {
populate();
return mergeable;
Expand Down

0 comments on commit b443e86

Please sign in to comment.