createFork method

Future<Repository> createFork(
  1. RepositorySlug slug, [
  2. CreateFork? fork
])

Creates a fork for the authenticated user.

API docs: https://developer.github.com/v3/repos/forks/#create-a-fork

Implementation

Future<Repository> createFork(RepositorySlug slug, [CreateFork? fork]) async {
  ArgumentError.checkNotNull(slug);
  fork ??= CreateFork();
  return github.postJSON<Map<String, dynamic>, Repository>(
    '/repos/${slug.fullName}/forks',
    body: GitHubJson.encode(fork),
    convert: (i) => Repository.fromJson(i),
  );
}