-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
Fixes issue #105
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,29 +52,17 @@ public class GHIssue extends GHObject { | |
protected String closed_at; | ||
protected int comments; | ||
protected String body; | ||
protected List<Label> labels; | ||
protected List<GHLabel> labels; | ||
protected GHUser user; | ||
protected String title, html_url; | ||
protected GHIssue.PullRequest pull_request; | ||
protected GHMilestone milestone; | ||
protected GHUser closed_by; | ||
|
||
public static class Label { | ||
private String url; | ||
private String name; | ||
private String color; | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getColor() { | ||
return color; | ||
} | ||
/** | ||
* @deprecated use {@link GHLabel} | ||
*/ | ||
public static class Label extends GHLabel { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
/*package*/ GHIssue wrap(GHRepository owner) { | ||
|
@@ -134,9 +122,9 @@ public GHIssueState getState() { | |
return Enum.valueOf(GHIssueState.class, state.toUpperCase(Locale.ENGLISH)); | ||
} | ||
|
||
public Collection<Label> getLabels() throws IOException { | ||
public Collection<GHLabel> getLabels() throws IOException { | ||
This comment has been minimized.
Sorry, something went wrong.
KostyaSha
Contributor
|
||
if(labels == null){ | ||
return Collections.EMPTY_LIST; | ||
return Collections.emptyList(); | ||
} | ||
return Collections.unmodifiableList(labels); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* @author Kohsuke Kawaguchi | ||
* @see GHIssue#getLabels() | ||
* @see GHRepository#listLabels() | ||
*/ | ||
public class GHLabel { | ||
private String url, name, color; | ||
private GHRepository repo; | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Color code without leading '#', such as 'f29513' | ||
*/ | ||
public String getColor() { | ||
return color; | ||
} | ||
|
||
/*package*/ GHLabel wrapUp(GHRepository repo) { | ||
this.repo = repo; | ||
return this; | ||
} | ||
|
||
public void delete() throws IOException { | ||
repo.root.retrieve().method("DELETE").to(url); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ public Date getMergedAt() { | |
} | ||
|
||
@Override | ||
public Collection<Label> getLabels() throws IOException { | ||
public Collection<GHLabel> getLabels() throws IOException { | ||
This comment has been minimized.
Sorry, something went wrong.
KostyaSha
Contributor
|
||
fetchIssue(); | ||
return super.getLabels(); | ||
} | ||
|
Maybe GHLabel extends Label? :)