Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a74cfd4

Browse filesBrowse files
committed
Added support for getting issues by milestone and state.
rework AppTest to work better for people other than kohsuke This patch was originally from @evanchooly. Reworked to avoid whitespace changes.
1 parent a360f65 commit a74cfd4
Copy full SHA for a74cfd4

File tree

Expand file treeCollapse file tree

5 files changed

+190
-43
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+190
-43
lines changed

‎pom.xml

Copy file name to clipboardExpand all lines: pom.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<dependency>
6262
<groupId>junit</groupId>
6363
<artifactId>junit</artifactId>
64-
<version>3.8.1</version>
64+
<version>4.11</version>
6565
<scope>test</scope>
6666
</dependency>
6767
<dependency>

‎src/main/java/org/kohsuke/github/GHMilestone.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHMilestone.java
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.kohsuke.github;
22

3+
import java.io.IOException;
34
import java.util.Date;
45
import java.util.Locale;
56

@@ -65,6 +66,21 @@ public GHMilestoneState getState() {
6566
return Enum.valueOf(GHMilestoneState.class, state.toUpperCase(Locale.ENGLISH));
6667
}
6768

69+
/**
70+
* Closes this issue.
71+
*/
72+
public void close() throws IOException {
73+
edit("state", "closed");
74+
}
75+
76+
private void edit(String key, Object value) throws IOException {
77+
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
78+
}
79+
80+
protected String getApiRoute() {
81+
return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/milestones/"+number;
82+
}
83+
6884
public GHMilestone wrap(GHRepository repo) {
6985
this.owner = repo;
7086
this.root = repo.root;

‎src/main/java/org/kohsuke/github/GHMyself.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHMyself.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public List<GHKey> getPublicKeys() throws IOException {
4545
}
4646

4747
/**
48-
* Returns the read-only list of all the pulic verified keys of the current user.
48+
* Returns the read-only list of all the public verified keys of the current user.
4949
*
5050
* Differently from the getPublicKeys() method, the retrieval of the user's
5151
* verified public keys does not require any READ/WRITE OAuth Scope to the

‎src/main/java/org/kohsuke/github/GHRepository.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRepository.java
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ public List<GHIssue> getIssues(GHIssueState state) throws IOException {
150150
return listIssues(state).asList();
151151
}
152152

153+
public List<GHIssue> getIssues(GHIssueState state, GHMilestone milestone) throws IOException {
154+
return Arrays.asList(GHIssue.wrap(root.retrieve()
155+
.to(String.format("/repos/%s/%s/issues?state=%s&milestone=%s", owner.login, name,
156+
state.toString().toLowerCase(), milestone == null ? "none" : "" + milestone.getNumber()),
157+
GHIssue[].class), this));
158+
}
159+
153160
/**
154161
* Lists up all the issues in this repository.
155162
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.