create method

Creates a Pull Request based on the given request.

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

Implementation

Future<PullRequest> create(RepositorySlug slug, CreatePullRequest request) {
  return github.postJSON(
    '/repos/${slug.fullName}/pulls',
    convert: (dynamic i) => PullRequest.fromJson(i),
    body: GitHubJson.encode(request),
    preview: request.draft!
        ? 'application/vnd.github.shadow-cat-preview+json'
        : null,
  );
}