@@ -89,7 +89,7 @@ class IssuesService extends Service {
89
89
if (milestoneNumber != null ) {
90
90
// should be a milestone number (e.g. '34') not a milestone title
91
91
// (e.g. '1.15')
92
- params['milestone' ] = milestoneNumber;
92
+ params['milestone' ] = milestoneNumber. toString () ;
93
93
}
94
94
95
95
if (state != null ) {
@@ -118,7 +118,8 @@ class IssuesService extends Service {
118
118
}
119
119
120
120
return new PaginationHelper (_github)
121
- .objects ("GET" , pathSegment, Issue .fromJSON, params: params);
121
+ .objects ("GET" , pathSegment, Issue .fromJSON, params: params)
122
+ as Stream <Issue >;
122
123
}
123
124
124
125
/// Edit an issue.
@@ -129,7 +130,8 @@ class IssuesService extends Service {
129
130
.request ("PATCH" , '/repos/${slug .fullName }/issues/${issueNumber }' ,
130
131
body: issue.toJSON ())
131
132
.then ((response) {
132
- return Issue .fromJSON (JSON .decode (response.body));
133
+ return Issue .fromJSON (JSON .decode (response.body) as Map <String , dynamic >)
134
+ as Future <Issue >;
133
135
});
134
136
}
135
137
@@ -138,7 +140,7 @@ class IssuesService extends Service {
138
140
/// API docs: https://developer.github.com/v3/issues/#get-a-single-issue
139
141
Future <Issue > get (RepositorySlug slug, int issueNumber) {
140
142
return _github.getJSON ("/repos/${slug .fullName }/issues/${issueNumber }" ,
141
- convert: Issue .fromJSON);
143
+ convert: Issue .fromJSON) as Future < Issue > ;
142
144
}
143
145
144
146
/// Create an issue.
@@ -154,7 +156,8 @@ class IssuesService extends Service {
154
156
throw new GitHubError (_github, response.body);
155
157
}
156
158
157
- return Issue .fromJSON (JSON .decode (response.body));
159
+ return Issue .fromJSON (JSON .decode (response.body) as Map <String , dynamic >)
160
+ as Future <Issue >;
158
161
}
159
162
160
163
/// Lists all available assignees (owners and collaborators) to which issues
@@ -163,7 +166,8 @@ class IssuesService extends Service {
163
166
/// API docs: https://developer.github.com/v3/issues/assignees/#list-assignees
164
167
Stream <User > listAssignees (RepositorySlug slug) {
165
168
return new PaginationHelper (_github)
166
- .objects ("GET" , "/repos/${slug .fullName }/assignees" , User .fromJSON);
169
+ .objects ("GET" , "/repos/${slug .fullName }/assignees" , User .fromJSON)
170
+ as Stream <User >;
167
171
}
168
172
169
173
/// Checks if a user is an assignee for the specified repository.
@@ -183,23 +187,25 @@ class IssuesService extends Service {
183
187
return new PaginationHelper (_github).objects (
184
188
'GET' ,
185
189
'/repos/${slug .fullName }/issues/${issueNumber }/comments' ,
186
- IssueComment .fromJSON);
190
+ IssueComment .fromJSON) as Stream < IssueComment > ;
187
191
}
188
192
189
193
/// Lists all comments in a repository.
190
194
///
191
195
/// API docs: https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
192
196
Stream <IssueComment > listCommentsByRepo (RepositorySlug slug) {
193
- return new PaginationHelper (_github).objects ('GET' ,
194
- '/repos/${slug .fullName }/issues/comments' , IssueComment .fromJSON);
197
+ return new PaginationHelper (_github).objects (
198
+ 'GET' ,
199
+ '/repos/${slug .fullName }/issues/comments' ,
200
+ IssueComment .fromJSON) as Stream <IssueComment >;
195
201
}
196
202
197
203
/// Fetches the specified issue comment.
198
204
///
199
205
/// API docs: https://developer.github.com/v3/issues/comments/#get-a-single-comment
200
206
Future <IssueComment > getComment (RepositorySlug slug, int id) {
201
207
return _github.getJSON ("/repos/${slug .fullName }/issues/comments/${id }" ,
202
- convert: IssueComment .fromJSON);
208
+ convert: IssueComment .fromJSON) as Future < IssueComment > ;
203
209
}
204
210
205
211
/// Creates a new comment on the specified issue
@@ -212,7 +218,7 @@ class IssuesService extends Service {
212
218
'/repos/${slug .fullName }/issues/${issueNumber }/comments' ,
213
219
body: it,
214
220
convert: IssueComment .fromJSON,
215
- statusCode: StatusCodes .CREATED );
221
+ statusCode: StatusCodes .CREATED ) as Future < IssueComment > ;
216
222
}
217
223
218
224
// TODO: Implement editComment: https://developer.github.com/v3/issues/comments/#edit-a-comment
@@ -232,16 +238,18 @@ class IssuesService extends Service {
232
238
///
233
239
/// API docs: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
234
240
Stream <IssueLabel > listLabels (RepositorySlug slug) {
235
- return new PaginationHelper (_github)
236
- .objects ("GET" , "/repos/${slug .fullName }/labels" , IssueLabel .fromJSON);
241
+ return new PaginationHelper (_github).objects (
242
+ "GET" , "/repos/${slug .fullName }/labels" , IssueLabel .fromJSON)
243
+ as Stream <IssueLabel >;
237
244
}
238
245
239
246
/// Fetches a single label.
240
247
///
241
248
/// API docs: https://developer.github.com/v3/issues/labels/#get-a-single-label
242
249
Future <IssueLabel > getLabel (RepositorySlug slug, String name) {
243
250
return _github.getJSON ("/repos/${slug .fullName }/labels/${name }" ,
244
- convert: IssueLabel .fromJSON, statusCode: StatusCodes .OK );
251
+ convert: IssueLabel .fromJSON,
252
+ statusCode: StatusCodes .OK ) as Future <IssueLabel >;
245
253
}
246
254
247
255
/// Creates a new label on the specified repository.
@@ -251,7 +259,7 @@ class IssuesService extends Service {
251
259
RepositorySlug slug, String name, String color) {
252
260
return _github.postJSON ("/repos/${slug .fullName }/labels" ,
253
261
body: JSON .encode ({"name" : name, "color" : color}),
254
- convert: IssueLabel .fromJSON);
262
+ convert: IssueLabel .fromJSON) as Future < IssueLabel > ;
255
263
}
256
264
257
265
/// Edits a label.
@@ -260,7 +268,7 @@ class IssuesService extends Service {
260
268
Future <IssueLabel > editLabel (RepositorySlug slug, String name, String color) {
261
269
return _github.postJSON ("/repos/${slug .fullName }/labels/${name }" ,
262
270
body: JSON .encode ({"name" : name, "color" : color}),
263
- convert: IssueLabel .fromJSON);
271
+ convert: IssueLabel .fromJSON) as Future < IssueLabel > ;
264
272
}
265
273
266
274
/// Deletes a label.
@@ -280,7 +288,7 @@ class IssuesService extends Service {
280
288
return new PaginationHelper (_github).objects (
281
289
"GET" ,
282
290
"/repos/${slug .fullName }/issues/${issueNumber }/labels" ,
283
- IssueLabel .fromJSON);
291
+ IssueLabel .fromJSON) as Stream < IssueLabel > ;
284
292
}
285
293
286
294
/// Adds labels to an issue.
@@ -289,9 +297,11 @@ class IssuesService extends Service {
289
297
Future <List <IssueLabel >> addLabelsToIssue (
290
298
RepositorySlug slug, int issueNumber, List <String > labels) {
291
299
return _github.postJSON (
292
- "/repos/${slug .fullName }/issues/${issueNumber }/labels" ,
293
- body: JSON .encode (labels),
294
- convert: (input) => input.map ((it) => IssueLabel .fromJSON (it)));
300
+ "/repos/${slug .fullName }/issues/${issueNumber }/labels" ,
301
+ body: JSON .encode (labels),
302
+ convert: (input) =>
303
+ input.map ((Map <String , dynamic > it) => IssueLabel .fromJSON (it)))
304
+ as Future <List <IssueLabel >>;
295
305
}
296
306
297
307
/// Replaces all labels for an issue.
@@ -303,7 +313,9 @@ class IssuesService extends Service {
303
313
.request ("PUT" , "/repos/${slug .fullName }/issues/${issueNumber }/labels" ,
304
314
body: JSON .encode (labels))
305
315
.then ((response) {
306
- return JSON .decode (response.body).map ((it) => IssueLabel .fromJSON (it));
316
+ return JSON
317
+ .decode (response.body)
318
+ .map ((Map <String , dynamic > it) => IssueLabel .fromJSON (it));
307
319
});
308
320
}
309
321
@@ -335,7 +347,8 @@ class IssuesService extends Service {
335
347
/// API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
336
348
Stream <Milestone > listMilestones (RepositorySlug slug) {
337
349
return new PaginationHelper (_github).objects (
338
- "GET" , "/repos/${slug .fullName }/milestones" , Milestone .fromJSON);
350
+ "GET" , "/repos/${slug .fullName }/milestones" , Milestone .fromJSON)
351
+ as Stream <Milestone >;
339
352
}
340
353
341
354
// TODO: Implement getMilestone: https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
@@ -346,7 +359,8 @@ class IssuesService extends Service {
346
359
Future <Milestone > createMilestone (
347
360
RepositorySlug slug, CreateMilestone request) {
348
361
return _github.postJSON ("/repos/${slug .fullName }/milestones" ,
349
- body: JSON .encode (request.toJSON ()), convert: Milestone .fromJSON);
362
+ body: JSON .encode (request.toJSON ()),
363
+ convert: Milestone .fromJSON) as Future <Milestone >;
350
364
}
351
365
352
366
// TODO: Implement editMilestone: https://developer.github.com/v3/issues/milestones/#update-a-milestone
0 commit comments