using System;
using System.Collections.Generic;
using System.Reactive.Threading.Tasks;
namespace Octokit.Reactive
{
///
/// A client for GitHub's Repository Statistics API.
///
///
/// See the Repository Statistics API documentation for more information.
///
public class ObservableStatisticsClient : IObservableStatisticsClient
{
readonly IGitHubClient _client;
public ObservableStatisticsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client;
}
///
/// Returns a list of for the given repository
///
/// The owner of the repository
/// The name of the repository
/// A list of
public IObservable> GetContributors(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.Repository.Statistics.GetContributors(owner, name).ToObservable();
}
///
/// Returns a list of for the given repository
///
/// The ID of the repository
/// A list of
public IObservable> GetContributors(int repositoryId)
{
return _client.Repository.Statistics.GetContributors(repositoryId).ToObservable();
}
///
/// Returns the last year of commit activity grouped by week.
///
/// The owner of the repository
/// The name of the repository
/// The last year of
public IObservable GetCommitActivity(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.Repository.Statistics.GetCommitActivity(owner, name).ToObservable();
}
///
/// Returns the last year of commit activity grouped by week.
///
/// The ID of the repository
/// The last year of
public IObservable GetCommitActivity(int repositoryId)
{
return _client.Repository.Statistics.GetCommitActivity(repositoryId).ToObservable();
}
///
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
///
/// The owner of the repository
/// The name of the repository
/// Returns a weekly aggregate of the number additions and deletion
public IObservable GetCodeFrequency(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.Repository.Statistics.GetCodeFrequency(owner, name).ToObservable();
}
///
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
///
/// The ID of the repository
/// Returns a weekly aggregate of the number additions and deletion
public IObservable GetCodeFrequency(int repositoryId)
{
return _client.Repository.Statistics.GetCodeFrequency(repositoryId).ToObservable();
}
///
/// Returns the total commit counts for the owner and total commit counts in total.
///
/// The owner of the repository
/// The name of the repository
/// Returns from oldest week to now
public IObservable GetParticipation(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.Repository.Statistics.GetParticipation(owner, name).ToObservable();
}
///
/// Returns the total commit counts for the owner and total commit counts in total.
///
/// The ID of the repository
/// Returns from oldest week to now
public IObservable GetParticipation(int repositoryId)
{
return _client.Repository.Statistics.GetParticipation(repositoryId).ToObservable();
}
///
/// Returns a list of the number of commits per hour in each day
///
/// The owner of the repository
/// The name of the repository
/// Returns commit counts per hour in each day
public IObservable GetPunchCard(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.Repository.Statistics.GetPunchCard(owner, name).ToObservable();
}
///
/// Returns a list of the number of commits per hour in each day
///
/// The ID of the repository
/// Returns commit counts per hour in each day
public IObservable GetPunchCard(int repositoryId)
{
return _client.Repository.Statistics.GetPunchCard(repositoryId).ToObservable();
}
}
}