edit method

Future<PullRequest> edit(
  1. RepositorySlug slug,
  2. int number, {
  3. String? title,
  4. String? body,
  5. String? state,
  6. String? base,
})

Edit a pull request.

API docs: https://developer.github.com/v3/pulls/#update-a-pull-request

Implementation

Future<PullRequest> edit(
  RepositorySlug slug,
  int number, {
  String? title,
  String? body,
  String? state,
  String? base,
}) {
  final map = <String, dynamic>{};
  putValue('title', title, map);
  putValue('body', body, map);
  putValue('state', state, map);
  putValue('base', base, map);

  return github
      .request(
        'POST',
        '/repos/${slug.fullName}/pulls/$number',
        body: GitHubJson.encode(map),
      )
      .then((response) {
        return PullRequest.fromJson(
          jsonDecode(response.body) as Map<String, dynamic>,
        );
      });
}