Skip to content

Commit

Permalink
Allow changing title, body, and state of an Issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
azenla committed Aug 30, 2014
1 parent 2adc932 commit dabc32a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/src/common/issues.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,28 @@ class Issue {
Stream<IssueComment> comments() {
return new PaginationHelper(github).objects("GET", "${this.json['url']}/comments", IssueComment.fromJSON);
}

Future<Issue> changeBody(String newBody) {
return github.request("POST", json['url'], body: JSON.encode({ "body": newBody })).then((response) {
return Issue.fromJSON(github, JSON.decode(response.body));
});
}

Future<Issue> changeTitle(String title) {
return github.request("POST", json['url'], body: JSON.encode({ "title": title })).then((response) {
return Issue.fromJSON(github, JSON.decode(response.body));
});
}

Future<Issue> changeState(String state) {
return github.request("POST", json['url'], body: JSON.encode({ "state": state })).then((response) {
return Issue.fromJSON(github, JSON.decode(response.body));
});
}

Future<Issue> close() => changeState("closed");
Future<Issue> open() => changeState("open");
Future<Issue> reopen() => changeState("open");
}

/**
Expand Down

0 comments on commit dabc32a

Please sign in to comment.