Repository navigation
Expand file tree
/
Copy pathGHMilestoneQueryBuilder.java
More file actions
79 lines (71 loc) · 1.78 KB
/
Copy pathGHMilestoneQueryBuilder.java
File metadata and controls
79 lines (71 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package org.kohsuke.github;
/**
* Lists up milestones with filtering and sorting.
*
* @see GHRepository#queryMilestones() GHRepository#queryMilestones()
*/
public class GHMilestoneQueryBuilder extends GHQueryBuilder<GHMilestone> {
/**
* The enum Sort.
*/
public enum Sort {
/** Sort by completeness (percentage of issues closed). */
COMPLETENESS,
/** Sort by due date. */
DUE_ON
}
private final GHRepository repo;
/**
* Instantiates a new GH milestone query builder.
*
* @param repo
* the repo
*/
GHMilestoneQueryBuilder(GHRepository repo) {
super(repo.root());
this.repo = repo;
}
/**
* Direction gh milestone query builder.
*
* @param d
* the d
* @return the gh milestone query builder
*/
public GHMilestoneQueryBuilder direction(GHDirection d) {
req.with("direction", d);
return this;
}
/**
* List.
*
* @return the paged iterable
*/
@Override
public PagedIterable<GHMilestone> list() {
return req.withUrlPath(repo.getApiTailUrl("milestones"))
.toIterable(GHMilestone[].class, item -> item.lateBind(repo));
}
/**
* Sort gh milestone query builder.
*
* @param sort
* the sort
* @return the gh milestone query builder
*/
public GHMilestoneQueryBuilder sort(Sort sort) {
req.with("sort", sort);
return this;
}
/**
* State gh milestone query builder.
*
* @param state
* the state
* @return the gh milestone query builder
*/
public GHMilestoneQueryBuilder state(GHIssueState state) {
req.with("state", state);
return this;
}
}