diff --git a/Octokit.Reactive/Clients/IObservableUserKeysClient.cs b/Octokit.Reactive/Clients/IObservableUserKeysClient.cs new file mode 100644 index 00000000..a26686e0 --- /dev/null +++ b/Octokit.Reactive/Clients/IObservableUserKeysClient.cs @@ -0,0 +1,31 @@ +using System; + +namespace Octokit.Reactive +{ + /// + /// A client for GitHub's User Keys API. + /// + /// + /// See the User Keys API documentation for more information. + /// + public interface IObservableUserKeysClient + { + /// + /// Gets all public keys for the authenticated user. + /// + /// + /// https://developer.github.com/v3/users/keys/#list-your-public-keys + /// + /// The s for the authenticated user. + IObservable GetAll(); + + /// + /// Gets all verified public keys for a user. + /// + /// + /// https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user + /// + /// The s for the user. + IObservable GetAll(string userName); + } +} diff --git a/Octokit.Reactive/Clients/IObservableUsersClient.cs b/Octokit.Reactive/Clients/IObservableUsersClient.cs index 2cc3ceb0..20ab684d 100644 --- a/Octokit.Reactive/Clients/IObservableUsersClient.cs +++ b/Octokit.Reactive/Clients/IObservableUsersClient.cs @@ -43,5 +43,13 @@ namespace Octokit.Reactive /// See the Emails API documentation for more information. /// IObservableUserEmailsClient Email { get; } + + /// + /// A client for GitHub's User Keys API + /// + /// + /// See the Keys API documentation for more information. + /// + IObservableUserKeysClient Keys { get; } } } diff --git a/Octokit.Reactive/Clients/ObservableUserKeysClient.cs b/Octokit.Reactive/Clients/ObservableUserKeysClient.cs new file mode 100644 index 00000000..2ec1de04 --- /dev/null +++ b/Octokit.Reactive/Clients/ObservableUserKeysClient.cs @@ -0,0 +1,28 @@ +using System; +using System.Reactive.Linq; +using System.Reactive.Threading.Tasks; + +namespace Octokit.Reactive +{ + public class ObservableUserKeysClient : IObservableUserKeysClient + { + readonly IUserKeysClient _client; + + public ObservableUserKeysClient(IGitHubClient client) + { + Ensure.ArgumentNotNull(client, "client"); + + _client = client.User.Keys; + } + + public IObservable GetAll() + { + return _client.GetAll().ToObservable().SelectMany(k => k); + } + + public IObservable GetAll(string userName) + { + return _client.GetAll(userName).ToObservable().SelectMany(k => k); + } + } +} \ No newline at end of file diff --git a/Octokit.Reactive/Clients/ObservableUsersClient.cs b/Octokit.Reactive/Clients/ObservableUsersClient.cs index 4b8f7ace..1d6b9c6e 100644 --- a/Octokit.Reactive/Clients/ObservableUsersClient.cs +++ b/Octokit.Reactive/Clients/ObservableUsersClient.cs @@ -15,6 +15,7 @@ namespace Octokit.Reactive Followers = new ObservableFollowersClient(client); Email = new ObservableUserEmailsClient(client); + Keys = new ObservableUserKeysClient(client); } /// @@ -66,5 +67,13 @@ namespace Octokit.Reactive /// See the Emails API documentation for more information. /// public IObservableUserEmailsClient Email { get; private set; } + + /// + /// A client for GitHub's User Keys API + /// + /// + /// See the Keys API documentation for more information. + /// + public IObservableUserKeysClient Keys { get; private set; } } } diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index fd8288d4..18f89bee 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -76,6 +76,7 @@ + @@ -144,6 +145,7 @@ + diff --git a/Octokit/Clients/IUserKeysClient.cs b/Octokit/Clients/IUserKeysClient.cs index 4c369862..d04c9546 100644 --- a/Octokit/Clients/IUserKeysClient.cs +++ b/Octokit/Clients/IUserKeysClient.cs @@ -3,9 +3,30 @@ using System.Threading.Tasks; namespace Octokit { + /// + /// A client for GitHub's User Keys API. + /// + /// + /// See the User Keys API documentation for more information. + /// public interface IUserKeysClient { + /// + /// Gets all public keys for the authenticated user. + /// + /// + /// https://developer.github.com/v3/users/keys/#list-your-public-keys + /// + /// The s for the authenticated user. Task> GetAll(); + + /// + /// Gets all verified public keys for a user. + /// + /// + /// https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user + /// + /// The s for the user. Task> GetAll(string userName); } } diff --git a/Octokit/Clients/UserKeysClient.cs b/Octokit/Clients/UserKeysClient.cs index da6cc736..15df5bbe 100644 --- a/Octokit/Clients/UserKeysClient.cs +++ b/Octokit/Clients/UserKeysClient.cs @@ -3,6 +3,12 @@ using System.Threading.Tasks; namespace Octokit { + /// + /// A client for GitHub's User Keys API. + /// + /// + /// See the User Keys API documentation for more information. + /// public class UserKeysClient : ApiClient, IUserKeysClient { public UserKeysClient(IApiConnection apiConnection) @@ -10,11 +16,25 @@ namespace Octokit { } + /// + /// Gets all public keys for the authenticated user. + /// + /// + /// https://developer.github.com/v3/users/keys/#list-your-public-keys + /// + /// The s for the authenticated user. public Task> GetAll() { return null; } + /// + /// Gets all verified public keys for a user. + /// + /// + /// https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user + /// + /// The s for the user. public Task> GetAll(string userName) { return null;