From a1be7fefe7831b23daa4711129b5c7aeef502117 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sat, 8 Mar 2014 19:22:12 +1100 Subject: [PATCH] added proper reactive client --- .../Clients/IObservableRepositoriesClient.cs | 25 +++++++++-------- .../IObservableRepositoryCommitsClients.cs | 19 +++++++++++++ .../Clients/ObservableRepositoriesClient.cs | 9 ++++++ .../ObservableRepositoryCommitsClients.cs | 28 +++++++++++++++++++ Octokit.Reactive/Octokit.Reactive-Mono.csproj | 2 ++ .../Octokit.Reactive-MonoAndroid.csproj | 2 ++ .../Octokit.Reactive-Monotouch.csproj | 2 ++ Octokit.Reactive/Octokit.Reactive.csproj | 2 ++ 8 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs create mode 100644 Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs index 54ee223c..a861d404 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs @@ -213,17 +213,6 @@ namespace Octokit.Reactive /// The updated IObservable Edit(string owner, string name, RepositoryUpdate update); - /// - /// Compare two references in a repository - /// - /// The owner of the repository - /// The name of the repository - /// The reference to use as the base commit - /// The reference to use as the head commit - /// - [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")] - IObservable Compare(string owner, string name, string @base, string @head); - /// /// A client for GitHub's Repo Collaborators. /// @@ -232,6 +221,20 @@ namespace Octokit.Reactive /// IObservableRepoCollaboratorsClient RepoCollaborators { get; } + /// + /// Client for GitHub's Repository Commits API + /// + /// + /// See the Commits API documentation for more details + /// + IObservableRepositoryCommitsClient Commits { get; } + + /// + /// Client for managing pull requests. + /// + /// + /// See the Pull Requests API documentation for more details + /// IObservablePullRequestsClient PullRequest { get; } } } diff --git a/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs b/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs new file mode 100644 index 00000000..bf8bfe5f --- /dev/null +++ b/Octokit.Reactive/Clients/IObservableRepositoryCommitsClients.cs @@ -0,0 +1,19 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +namespace Octokit.Reactive +{ + public interface IObservableRepositoryCommitsClient + { + /// + /// Compare two references in a repository + /// + /// The owner of the repository + /// The name of the repository + /// The reference to use as the base commit + /// The reference to use as the head commit + /// + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")] + IObservable Compare(string owner, string name, string @base, string @head); + } +} diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index d84588c2..0a517a0f 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -25,6 +25,7 @@ namespace Octokit.Reactive Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); RepositoryComments = new ObservableRepositoryCommentsClient(client); + Commits = new ObservableRepositoryCommitsClient(client); } /// @@ -349,6 +350,14 @@ namespace Octokit.Reactive /// public IObservableRepoCollaboratorsClient RepoCollaborators { get; private set; } + /// + /// Client for GitHub's Repository Commits API + /// + /// + /// See the Commits API documentation for more details + /// + public IObservableRepositoryCommitsClient Commits { get; private set; } + /// /// Client for managing pull requests. /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs b/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs new file mode 100644 index 00000000..996e2491 --- /dev/null +++ b/Octokit.Reactive/Clients/ObservableRepositoryCommitsClients.cs @@ -0,0 +1,28 @@ +using System; +using System.Reactive.Threading.Tasks; + +namespace Octokit.Reactive +{ + public class ObservableRepositoryCommitsClient : IObservableRepositoryCommitsClient + { + readonly IGitHubClient _client; + + public ObservableRepositoryCommitsClient(IGitHubClient client) + { + _client = client; + } + + /// + /// Compare two references in a repository + /// + /// The owner of the repository + /// The name of the repository + /// The reference to use as the base commit + /// The reference to use as the head commit + /// + public IObservable Compare(string owner, string name, string @base, string head) + { + return _client.Repository.Commits.Compare(owner, name, @base, head).ToObservable(); + } + } +} \ No newline at end of file diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj index 5dc511fd..3882f838 100644 --- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj @@ -141,6 +141,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj index cd53c5a2..acf6bfb0 100644 --- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj +++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj @@ -150,6 +150,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj index c8657d7f..5996e3ff 100644 --- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj @@ -145,6 +145,8 @@ + + diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index f08540c7..801fbd70 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -73,6 +73,7 @@ Properties\SolutionInfo.cs + @@ -87,6 +88,7 @@ +