diff --git a/Octokit/Clients/IRepositoryDeployKeysClient.cs b/Octokit/Clients/IRepositoryDeployKeysClient.cs
index d5e5eea7..cf4af6bd 100644
--- a/Octokit/Clients/IRepositoryDeployKeysClient.cs
+++ b/Octokit/Clients/IRepositoryDeployKeysClient.cs
@@ -11,6 +11,9 @@ namespace Octokit
///
/// Get a single deploy key by number for a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
/// The id of the deploy key.
@@ -20,6 +23,9 @@ namespace Octokit
///
/// Get all deploy keys for a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
Task> GetForRepository(string owner, string name);
@@ -27,6 +33,9 @@ namespace Octokit
///
/// Creates a new deploy key for a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
/// The deploy key to create for the repository.
@@ -36,6 +45,9 @@ namespace Octokit
///
/// Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
///
+ ///
+ /// See the API documentation for more information.
+ ///
///
///
///
@@ -46,6 +58,9 @@ namespace Octokit
///
/// Deletes a deploy key from a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
/// The id of the deploy key to delete.
diff --git a/Octokit/Clients/RepositoryDeployKeysClient.cs b/Octokit/Clients/RepositoryDeployKeysClient.cs
index a9f6006e..fcb5a287 100644
--- a/Octokit/Clients/RepositoryDeployKeysClient.cs
+++ b/Octokit/Clients/RepositoryDeployKeysClient.cs
@@ -26,55 +26,92 @@ namespace Octokit
///
/// Get a single deploy key by number for a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
/// The id of the deploy key.
public Task Get(string owner, string name, int number)
{
- throw new NotImplementedException();
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(number, "number");
+
+ return ApiConnection.Get(ApiUrls.RepositoryDeployKey(owner, name, number));
}
///
/// Get all deploy keys for a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
public Task> GetForRepository(string owner, string name)
{
- throw new NotImplementedException();
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return ApiConnection.Get>(ApiUrls.RepositoryDeployKeys(owner, name));
}
///
/// Creates a new deploy key for a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
/// The deploy key to create for the repository.
///
public Task Create(string owner, string name, NewDeployKey newDeployKey)
{
- throw new NotImplementedException();
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(newDeployKey, "newDeployKey");
+
+ if (string.IsNullOrWhiteSpace(newDeployKey.Title))
+ throw new ArgumentException("The new deploy key's title must not be null.");
+
+ if (string.IsNullOrWhiteSpace(newDeployKey.Key))
+ throw new ArgumentException("The new deploy key's key must not be null.");
+
+ return ApiConnection.Post(ApiUrls.RepositoryDeployKeys(owner, name), newDeployKey);
}
///
/// Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.
///
+ ///
+ /// https://developer.github.com/v3/repos/keys/#edit
+ ///
///
///
///
///
///
/// Task Update(string owner, string name, int number, NewDeployKey newDeployKey);
+
///
/// Deletes a deploy key from a repository.
///
+ ///
+ /// See the API documentation for more information.
+ ///
/// The owner of the repository.
/// The name of the repository.
/// The id of the deploy key to delete.
///
public Task Delete(string owner, string name, int number)
{
- throw new NotImplementedException();
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(number, "number");
+
+ return ApiConnection.Delete(ApiUrls.RepositoryDeployKey(owner, name, number));
}
}
}
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index 984f159c..b5c03f0c 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -1112,6 +1112,29 @@ namespace Octokit
return "repos/{0}/{1}".FormatUri(owner, name);
}
+ ///
+ /// Returns the for a deploy key for a repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The id of the deploy key of the repository
+ ///
+ public static Uri RepositoryDeployKey(string owner, string name, int number)
+ {
+ return "repos/{0}/{1}/keys/{1}".FormatUri(owner, name, number);
+ }
+
+ ///
+ /// Returns the for deploy keys for a repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ ///
+ public static Uri RepositoryDeployKeys(string owner, string name)
+ {
+ return "repos/{0}/{1}/keys".FormatUri(owner, name);
+ }
+
///
/// Returns the for the Deployments API for the given repository.
///