added proper reactive client

This commit is contained in:
Brendan Forster
2014-03-08 19:22:12 +11:00
parent e6be0ad334
commit a1be7fefe7
8 changed files with 78 additions and 11 deletions
@@ -213,17 +213,6 @@ namespace Octokit.Reactive
/// <returns>The updated <see cref="T:Octokit.Repository"/></returns>
IObservable<Repository> Edit(string owner, string name, RepositoryUpdate update);
/// <summary>
/// Compare two references in a repository
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="base">The reference to use as the base commit</param>
/// <param name="head">The reference to use as the head commit</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
IObservable<CompareResult> Compare(string owner, string name, string @base, string @head);
/// <summary>
/// A client for GitHub's Repo Collaborators.
/// </summary>
@@ -232,6 +221,20 @@ namespace Octokit.Reactive
/// </remarks>
IObservableRepoCollaboratorsClient RepoCollaborators { get; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
IObservableRepositoryCommitsClient Commits { get; }
/// <summary>
/// Client for managing pull requests.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/pulls/">Pull Requests API documentation</a> for more details
/// </remarks>
IObservablePullRequestsClient PullRequest { get; }
}
}
@@ -0,0 +1,19 @@
using System;
using System.Diagnostics.CodeAnalysis;
namespace Octokit.Reactive
{
public interface IObservableRepositoryCommitsClient
{
/// <summary>
/// Compare two references in a repository
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="base">The reference to use as the base commit</param>
/// <param name="head">The reference to use as the head commit</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "base")]
IObservable<CompareResult> Compare(string owner, string name, string @base, string @head);
}
}
@@ -25,6 +25,7 @@ namespace Octokit.Reactive
Statistics = new ObservableStatisticsClient(client);
PullRequest = new ObservablePullRequestsClient(client);
RepositoryComments = new ObservableRepositoryCommentsClient(client);
Commits = new ObservableRepositoryCommitsClient(client);
}
/// <summary>
@@ -349,6 +350,14 @@ namespace Octokit.Reactive
/// </remarks>
public IObservableRepoCollaboratorsClient RepoCollaborators { get; private set; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
public IObservableRepositoryCommitsClient Commits { get; private set; }
/// <summary>
/// Client for managing pull requests.
/// </summary>
@@ -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;
}
/// <summary>
/// Compare two references in a repository
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="base">The reference to use as the base commit</param>
/// <param name="head">The reference to use as the head commit</param>
/// <returns></returns>
public IObservable<CompareResult> Compare(string owner, string name, string @base, string head)
{
return _client.Repository.Commits.Compare(owner, name, @base, head).ToObservable();
}
}
}
@@ -141,6 +141,8 @@
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\ObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommitsClients.cs" />
<Compile Include="Clients\ObservableRepositoryCommitsClients.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@@ -150,6 +150,8 @@
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\ObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommitsClients.cs" />
<Compile Include="Clients\ObservableRepositoryCommitsClients.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<ItemGroup>
@@ -145,6 +145,8 @@
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\ObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommitsClients.cs" />
<Compile Include="Clients\ObservableRepositoryCommitsClients.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
+2
View File
@@ -73,6 +73,7 @@
<Compile Include="..\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="Clients\IObservableRepositoryCommitsClients.cs" />
<Compile Include="Clients\ObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommentsClient.cs" />
<Compile Include="Clients\IObservableDeploymentsClient.cs" />
@@ -87,6 +88,7 @@
<Compile Include="Clients\IObservableStatisticsClient.cs" />
<Compile Include="Clients\ObservableFeedsClient.cs" />
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
<Compile Include="Clients\ObservableRepositoryCommitsClients.cs" />
<Compile Include="Clients\ObservableSearchClient.cs" />
<Compile Include="Clients\IObservableBlobsClient.cs" />
<Compile Include="Clients\IObservableGistCommentsClient.cs" />