added new overloads

This commit is contained in:
Alexander Efremov
2016-06-13 12:05:05 +07:00
parent 9d012f5e1d
commit dcac7b9305
4 changed files with 290 additions and 1 deletions

View File

@@ -19,6 +19,13 @@ namespace Octokit.Reactive
/// <returns>A list of <see cref="Contributor"/></returns>
IObservable<IEnumerable<Contributor>> GetContributors(string owner, string name);
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>A list of <see cref="Contributor"/></returns>
IObservable<IEnumerable<Contributor>> GetContributors(int repositoryId);
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
@@ -27,6 +34,13 @@ namespace Octokit.Reactive
/// <returns>The last year of <see cref="CommitActivity"/></returns>
IObservable<CommitActivity> GetCommitActivity(string owner, string name);
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>The last year of <see cref="CommitActivity"/></returns>
IObservable<CommitActivity> GetCommitActivity(int repositoryId);
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
@@ -35,6 +49,13 @@ namespace Octokit.Reactive
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
IObservable<CodeFrequency> GetCodeFrequency(string owner, string name);
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
IObservable<CodeFrequency> GetCodeFrequency(int repositoryId);
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
@@ -43,6 +64,13 @@ namespace Octokit.Reactive
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
IObservable<Participation> GetParticipation(string owner, string name);
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
IObservable<Participation> GetParticipation(int repositoryId);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
@@ -50,5 +78,12 @@ namespace Octokit.Reactive
/// <param name="name">The name of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
IObservable<PunchCard> GetPunchCard(string owner, string name);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
IObservable<PunchCard> GetPunchCard(int repositoryId);
}
}

View File

@@ -17,6 +17,7 @@ namespace Octokit.Reactive
public ObservableStatisticsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client;
}
@@ -34,6 +35,16 @@ namespace Octokit.Reactive
return _client.Repository.Statistics.GetContributors(owner, name).ToObservable();
}
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>A list of <see cref="Contributor"/></returns>
public IObservable<IEnumerable<Contributor>> GetContributors(int repositoryId)
{
return _client.Repository.Statistics.GetContributors(repositoryId).ToObservable();
}
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
@@ -48,6 +59,16 @@ namespace Octokit.Reactive
return _client.Repository.Statistics.GetCommitActivity(owner, name).ToObservable();
}
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>The last year of <see cref="CommitActivity"/></returns>
public IObservable<CommitActivity> GetCommitActivity(int repositoryId)
{
return _client.Repository.Statistics.GetCommitActivity(repositoryId).ToObservable();
}
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
@@ -62,6 +83,16 @@ namespace Octokit.Reactive
return _client.Repository.Statistics.GetCodeFrequency(owner, name).ToObservable();
}
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
public IObservable<CodeFrequency> GetCodeFrequency(int repositoryId)
{
return _client.Repository.Statistics.GetCodeFrequency(repositoryId).ToObservable();
}
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
@@ -76,6 +107,16 @@ namespace Octokit.Reactive
return _client.Repository.Statistics.GetParticipation(owner, name).ToObservable();
}
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
public IObservable<Participation> GetParticipation(int repositoryId)
{
return _client.Repository.Statistics.GetParticipation(repositoryId).ToObservable();
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
@@ -89,5 +130,15 @@ namespace Octokit.Reactive
return _client.Repository.Statistics.GetPunchCard(owner, name).ToObservable();
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
public IObservable<PunchCard> GetPunchCard(int repositoryId)
{
return _client.Repository.Statistics.GetPunchCard(repositoryId).ToObservable();
}
}
}

View File

@@ -20,6 +20,13 @@ namespace Octokit
/// <returns>A list of <see cref="Contributor"/></returns>
Task<IReadOnlyList<Contributor>> GetContributors(string owner, string name);
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>A list of <see cref="Contributor"/></returns>
Task<IReadOnlyList<Contributor>> GetContributors(int repositoryId);
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
@@ -29,6 +36,14 @@ namespace Octokit
/// <returns>A list of <see cref="Contributor"/></returns>
Task<IReadOnlyList<Contributor>> GetContributors(string owner, string name, CancellationToken cancellationToken);
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>A list of <see cref="Contributor"/></returns>
Task<IReadOnlyList<Contributor>> GetContributors(int repositoryId, CancellationToken cancellationToken);
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
@@ -37,6 +52,13 @@ namespace Octokit
/// <returns>The last year of <see cref="CommitActivity"/></returns>
Task<CommitActivity> GetCommitActivity(string owner, string name);
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>The last year of <see cref="CommitActivity"/></returns>
Task<CommitActivity> GetCommitActivity(int repositoryId);
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
@@ -46,6 +68,14 @@ namespace Octokit
/// <returns>The last year of <see cref="CommitActivity"/></returns>
Task<CommitActivity> GetCommitActivity(string owner, string name, CancellationToken cancellationToken);
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>The last year of <see cref="CommitActivity"/></returns>
Task<CommitActivity> GetCommitActivity(int repositoryId, CancellationToken cancellationToken);
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
@@ -54,6 +84,13 @@ namespace Octokit
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
Task<CodeFrequency> GetCodeFrequency(string owner, string name);
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
Task<CodeFrequency> GetCodeFrequency(int repositoryId);
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
@@ -63,6 +100,14 @@ namespace Octokit
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
Task<CodeFrequency> GetCodeFrequency(string owner, string name, CancellationToken cancellationToken);
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
Task<CodeFrequency> GetCodeFrequency(int repositoryId, CancellationToken cancellationToken);
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
@@ -71,6 +116,13 @@ namespace Octokit
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
Task<Participation> GetParticipation(string owner, string name);
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
Task<Participation> GetParticipation(int repositoryId);
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
@@ -80,6 +132,14 @@ namespace Octokit
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
Task<Participation> GetParticipation(string owner, string name, CancellationToken cancellationToken);
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
Task<Participation> GetParticipation(int repositoryId, CancellationToken cancellationToken);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
@@ -88,6 +148,13 @@ namespace Octokit
/// <returns>Returns commit counts per hour in each day</returns>
Task<PunchCard> GetPunchCard(string owner, string name);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
Task<PunchCard> GetPunchCard(int repositoryId);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
@@ -96,5 +163,13 @@ namespace Octokit
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns commit counts per hour in each day</returns>
Task<PunchCard> GetPunchCard(string owner, string name, CancellationToken cancellationToken);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns commit counts per hour in each day</returns>
Task<PunchCard> GetPunchCard(int repositoryId, CancellationToken cancellationToken);
}
}

View File

@@ -29,9 +29,22 @@ namespace Octokit
/// <returns>A list of <see cref="Contributor"/></returns>
public Task<IReadOnlyList<Contributor>> GetContributors(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetContributors(owner, name, CancellationToken.None);
}
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>A list of <see cref="Contributor"/></returns>
public Task<IReadOnlyList<Contributor>> GetContributors(int repositoryId)
{
return GetContributors(repositoryId, CancellationToken.None);
}
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
@@ -47,6 +60,17 @@ namespace Octokit
return ApiConnection.GetQueuedOperation<Contributor>(ApiUrls.StatsContributors(owner, name), cancellationToken);
}
/// <summary>
/// Returns a list of <see cref="Contributor"/> for the given repository
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>A list of <see cref="Contributor"/></returns>
public Task<IReadOnlyList<Contributor>> GetContributors(int repositoryId, CancellationToken cancellationToken)
{
return ApiConnection.GetQueuedOperation<Contributor>(ApiUrls.StatsContributors(repositoryId), cancellationToken);
}
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
@@ -55,9 +79,22 @@ namespace Octokit
/// <returns>The last year of <see cref="CommitActivity"/></returns>
public Task<CommitActivity> GetCommitActivity(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetCommitActivity(owner, name, CancellationToken.None);
}
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>The last year of <see cref="CommitActivity"/></returns>
public Task<CommitActivity> GetCommitActivity(int repositoryId)
{
return GetCommitActivity(repositoryId, CancellationToken.None);
}
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
@@ -75,6 +112,19 @@ namespace Octokit
return new CommitActivity(activity);
}
/// <summary>
/// Returns the last year of commit activity grouped by week.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>The last year of <see cref="CommitActivity"/></returns>
public async Task<CommitActivity> GetCommitActivity(int repositoryId, CancellationToken cancellationToken)
{
var activity = await ApiConnection.GetQueuedOperation<WeeklyCommitActivity>(
ApiUrls.StatsCommitActivity(repositoryId), cancellationToken).ConfigureAwait(false);
return new CommitActivity(activity);
}
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
@@ -83,9 +133,22 @@ namespace Octokit
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
public Task<CodeFrequency> GetCodeFrequency(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetCodeFrequency(owner, name, CancellationToken.None);
}
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
public Task<CodeFrequency> GetCodeFrequency(int repositoryId)
{
return GetCodeFrequency(repositoryId, CancellationToken.None);
}
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
@@ -103,6 +166,19 @@ namespace Octokit
return new CodeFrequency(rawFrequencies);
}
/// <summary>
/// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
public async Task<CodeFrequency> GetCodeFrequency(int repositoryId, CancellationToken cancellationToken)
{
var rawFrequencies = await ApiConnection.GetQueuedOperation<long[]>(
ApiUrls.StatsCodeFrequency(repositoryId), cancellationToken).ConfigureAwait(false);
return new CodeFrequency(rawFrequencies);
}
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
@@ -111,9 +187,22 @@ namespace Octokit
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
public Task<Participation> GetParticipation(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetParticipation(owner, name, CancellationToken.None);
}
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
public Task<Participation> GetParticipation(int repositoryId)
{
return GetParticipation(repositoryId, CancellationToken.None);
}
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
@@ -131,6 +220,19 @@ namespace Octokit
return result.FirstOrDefault();
}
/// <summary>
/// Returns the total commit counts for the owner and total commit counts in total.
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
public async Task<Participation> GetParticipation(int repositoryId, CancellationToken cancellationToken)
{
var result = await ApiConnection.GetQueuedOperation<Participation>(
ApiUrls.StatsParticipation(repositoryId), cancellationToken).ConfigureAwait(false);
return result.FirstOrDefault();
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
@@ -139,9 +241,22 @@ namespace Octokit
/// <returns>Returns commit counts per hour in each day</returns>
public Task<PunchCard> GetPunchCard(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return GetPunchCard(owner, name, CancellationToken.None);
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
public Task<PunchCard> GetPunchCard(int repositoryId)
{
return GetPunchCard(repositoryId, CancellationToken.None);
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
@@ -158,5 +273,18 @@ namespace Octokit
ApiUrls.StatsPunchCard(owner, name), cancellationToken).ConfigureAwait(false);
return new PunchCard(punchCardData);
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
/// <returns>Returns commit counts per hour in each day</returns>
public async Task<PunchCard> GetPunchCard(int repositoryId, CancellationToken cancellationToken)
{
var punchCardData = await ApiConnection.GetQueuedOperation<int[]>(
ApiUrls.StatsPunchCard(repositoryId), cancellationToken).ConfigureAwait(false);
return new PunchCard(punchCardData);
}
}
}