create method
Create an issue.
API docs: https://developer.github.com/v3/issues/#create-an-issue
Implementation
Future<Issue> create(RepositorySlug slug, IssueRequest issue) async {
final response = await github.request(
'POST',
'/repos/${slug.fullName}/issues',
body: GitHubJson.encode(issue),
);
if (StatusCodes.isClientError(response.statusCode)) {
//TODO: throw a more friendly error – better this than silent failure
throw GitHubError(github, response.body);
}
return Issue.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
}