createRepository method
Creates a repository with repository. If an org is specified, the new
repository will be created under that organization. If no org is
specified, it will be created for the authenticated user.
Implementation
Future<Repository> createRepository(
CreateRepository repository, {
String? org,
}) async {
ArgumentError.checkNotNull(repository);
if (org != null) {
return github.postJSON<Map<String, dynamic>, Repository>(
'/orgs/$org/repos',
body: GitHubJson.encode(repository),
convert: Repository.fromJson,
);
} else {
return github.postJSON<Map<String, dynamic>, Repository>(
'/user/repos',
body: GitHubJson.encode(repository),
convert: Repository.fromJson,
);
}
}