diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index 5f790486..e0261271 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -28,6 +28,23 @@ namespace Octokit return await Client.Create(endpoint, newRepository); } + /// + /// Creates a new repository in the specified organization. + /// + /// The login of the organization in which to create the repostiory + /// A instance describing the new repository to create + /// A instance for the created repository + public async Task Create(string organizationLogin, NewRepository newRepository) + { + Ensure.ArgumentNotNull(organizationLogin, "organizationLogin"); + Ensure.ArgumentNotNull(newRepository, "newRepository"); + if (string.IsNullOrEmpty(newRepository.Name)) + throw new ArgumentException("The new repository's name must not be null."); + + var endpoint = "orgs/{0}/repos".FormatUri(organizationLogin); + return await Client.Create(endpoint, newRepository); + } + public async Task Get(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); diff --git a/Octokit/IRepositoriesClient.cs b/Octokit/IRepositoriesClient.cs index 2d4929f0..8ae1c9e0 100644 --- a/Octokit/IRepositoriesClient.cs +++ b/Octokit/IRepositoriesClient.cs @@ -14,6 +14,14 @@ namespace Octokit /// A instance for the created repository Task Create(NewRepository newRepository); + /// + /// Creates a new repository in the specified organization. + /// + /// The login of the organization in which to create the repostiory + /// A instance describing the new repository to create + /// A instance for the created repository + Task Create(string organizationLogin, NewRepository newRepository); + /// /// Retrieves the for the specified owner and name. ///