ObservableStats Client

This commit is contained in:
Amy Palamountain
2014-01-11 11:06:07 +13:00
parent c14acda095
commit fd7133574b
3 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
namespace Octokit.Reactive
{
public interface IObservableStatisticsClient
{
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="repositoryName">The name of the repository</param>
/// <returns>A list of <see cref="Contributor"/></returns>
IObservable<IEnumerable<Contributor>> GetContributors(string owner, string repositoryName);
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Reactive.Threading.Tasks;
namespace Octokit.Reactive
{
public class ObservableStatisticsClient : IObservableStatisticsClient
{
readonly IGitHubClient _client;
public ObservableStatisticsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client;
}
public IObservable<IEnumerable<Contributor>> GetContributors(string owner, string repositoryName)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
return _client.Statistics.GetContributors(owner, repositoryName).ToObservable();
}
}
}

View File

@@ -76,6 +76,7 @@
<Compile Include="Clients\IObservableUserEmailsClient.cs" /> <Compile Include="Clients\IObservableUserEmailsClient.cs" />
<Compile Include="Clients\IObservableWatchedClient.cs" /> <Compile Include="Clients\IObservableWatchedClient.cs" />
<Compile Include="Clients\IObservableFollowersClient.cs" /> <Compile Include="Clients\IObservableFollowersClient.cs" />
<Compile Include="Clients\IObservableStatisticsClient.cs" />
<Compile Include="Clients\ObservableSearchClient.cs" /> <Compile Include="Clients\ObservableSearchClient.cs" />
<Compile Include="Clients\IObservableBlobClient.cs" /> <Compile Include="Clients\IObservableBlobClient.cs" />
<Compile Include="Clients\IObservableGistCommentsClient.cs" /> <Compile Include="Clients\IObservableGistCommentsClient.cs" />
@@ -120,6 +121,7 @@
<Compile Include="Clients\ObservableRepositoriesClient.cs" /> <Compile Include="Clients\ObservableRepositoriesClient.cs" />
<Compile Include="Clients\ObservableSshKeysClient.cs" /> <Compile Include="Clients\ObservableSshKeysClient.cs" />
<Compile Include="Clients\ObservableStarredClient.cs" /> <Compile Include="Clients\ObservableStarredClient.cs" />
<Compile Include="Clients\ObservableStatisticsClient.cs" />
<Compile Include="Clients\ObservableTagsClient.cs" /> <Compile Include="Clients\ObservableTagsClient.cs" />
<Compile Include="Clients\ObservableTreesClient.cs" /> <Compile Include="Clients\ObservableTreesClient.cs" />
<Compile Include="Clients\ObservableFollowersClient.cs" /> <Compile Include="Clients\ObservableFollowersClient.cs" />