Skip to content

Commit 87d084a

Browse files
committed
Add support for listing issues per milestone
1 parent 3a6b01b commit 87d084a

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

lib/src/common/issues_service.dart

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,43 @@ class IssuesService extends Service {
1212
///
1313
/// API docs: https://developer.github.com/v3/issues/#list-issues
1414
Stream<Issue> listAll(
15-
{String state,
15+
{int milestoneNumber,
16+
String state,
1617
String direction,
1718
String sort,
1819
DateTime since,
1920
int perPage}) {
20-
return _listIssues("/issues", state, direction, sort, since, perPage);
21+
return _listIssues("/issues",
22+
milestoneNumber, state, direction, sort, since, perPage);
2123
}
2224

2325
/// List all issues across owned and member repositories for the authenticated
2426
/// user.
2527
///
2628
/// API docs: https://developer.github.com/v3/issues/#list-issues
2729
Stream<Issue> listByUser(
28-
{String state,
30+
{int milestoneNumber,
31+
String state,
2932
String direction,
3033
String sort,
3134
DateTime since,
3235
int perPage}) {
33-
return _listIssues("/user/issues", state, direction, sort, since, perPage);
36+
return _listIssues("/user/issues",
37+
milestoneNumber, state, direction, sort, since, perPage);
3438
}
3539

3640
/// List all issues for a given organization for the authenticated user.
3741
///
3842
/// API docs: https://developer.github.com/v3/issues/#list-issues
3943
Stream<Issue> listByOrg(String org,
40-
{String state,
44+
{int milestoneNumber,
45+
String state,
4146
String direction,
4247
String sort,
4348
DateTime since,
4449
int perPage}) {
45-
return _listIssues(
46-
"/orgs/${org}/issues", state, direction, sort, since, perPage);
50+
return _listIssues("/orgs/${org}/issues",
51+
milestoneNumber, state, direction, sort, since, perPage);
4752
}
4853

4954
/// Lists the issues for the specified repository.
@@ -52,23 +57,31 @@ class IssuesService extends Service {
5257
///
5358
/// API docs:https://developer.github.com/v3/issues/#list-issues-for-a-repository
5459
Stream<Issue> listByRepo(RepositorySlug slug,
55-
{String state,
60+
{int milestoneNumber,
61+
String state,
5662
String direction,
5763
String sort,
5864
DateTime since,
5965
int perPage}) {
60-
return _listIssues("/repos/${slug.fullName}/issues", state, direction, sort,
61-
since, perPage);
66+
return _listIssues("/repos/${slug.fullName}/issues",
67+
milestoneNumber, state, direction, sort, since, perPage);
6268
}
6369

64-
Stream<Issue> _listIssues(String pathSegment, String state, String direction,
65-
String sort, DateTime since, int perPage) {
70+
Stream<Issue> _listIssues(String pathSegment, int milestoneNumber,
71+
String state, String direction, String sort, DateTime since,
72+
int perPage) {
6673
var params = <String, String>{};
6774

6875
if (perPage != null) {
6976
params['per_page'] = perPage.toString();
7077
}
7178

79+
if (milestoneNumber != null) {
80+
// should be a milestone number (e.g. '34') not a milestone title
81+
// (e.g. '1.15')
82+
params['milestone'] = milestoneNumber;
83+
}
84+
7285
if (state != null) {
7386
// should be `open`, `closed` or `all`
7487
params['state'] = state;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy