mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 12:26:18 +00:00
1e474f8556
* Unskip pagination convention tests and rework exclusion property names Also exclude Obsolete methods from pagination convention tests * Reaction APIs appear to support pagination, flag to exclude for now and mark a TODO that they need implementing * Repository invitation APIs need pagination implemented * Exclude methods that use an alternative pagination approach * Migrations, Licenses and References all need pagination implemented * Pagination not supported for these methods (determined by API doc and poking the API) so exclude them from convention tests * These methods need renaming to GetAll * Rename offending RepositoryTrafficClient GetReferrers and GetPaths to GetAllReferrers and GetAllPaths * Rename offending RepositoryBranchesClient methods from Get to GetAll
171 lines
7.5 KiB
C#
171 lines
7.5 KiB
C#
using System;
|
|
using System.Reactive.Linq;
|
|
using System.Reactive.Threading.Tasks;
|
|
|
|
namespace Octokit.Reactive
|
|
{
|
|
public class ObservableRepositoryTrafficClient : IObservableRepositoryTrafficClient
|
|
{
|
|
readonly IRepositoryTrafficClient _client;
|
|
|
|
public ObservableRepositoryTrafficClient(IGitHubClient client)
|
|
{
|
|
Ensure.ArgumentNotNull(client, "client");
|
|
|
|
_client = client.Repository.Traffic;
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 popular contents over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-paths</remarks>
|
|
/// <param name="repositoryId">The owner of the repository</param>
|
|
[Obsolete("Please use GetAllPaths instead")]
|
|
public IObservable<RepositoryTrafficPath> GetPaths(long repositoryId)
|
|
{
|
|
return GetAllPaths(repositoryId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 popular contents over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-paths</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
[Obsolete("Please use GetAllPaths instead")]
|
|
public IObservable<RepositoryTrafficPath> GetPaths(string owner, string name)
|
|
{
|
|
return GetAllPaths(owner, name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 popular contents over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-paths</remarks>
|
|
/// <param name="repositoryId">The owner of the repository</param>
|
|
public IObservable<RepositoryTrafficPath> GetAllPaths(long repositoryId)
|
|
{
|
|
return _client.GetAllPaths(repositoryId).ToObservable().SelectMany(x => x);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 popular contents over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-paths</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
public IObservable<RepositoryTrafficPath> GetAllPaths(string owner, string name)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
|
|
|
return _client.GetAllPaths(owner, name).ToObservable().SelectMany(x => x);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 referrers over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-referrers</remarks>
|
|
/// <param name="repositoryId">The owner of the repository</param>
|
|
[Obsolete("Please use GetAllReferrers instead")]
|
|
public IObservable<RepositoryTrafficReferrer> GetReferrers(long repositoryId)
|
|
{
|
|
return GetAllReferrers(repositoryId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 referrers over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-referrers</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
[Obsolete("Please use GetAllReferrers instead")]
|
|
public IObservable<RepositoryTrafficReferrer> GetReferrers(string owner, string name)
|
|
{
|
|
return GetAllReferrers(owner, name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 referrers over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-referrers</remarks>
|
|
/// <param name="repositoryId">The owner of the repository</param>
|
|
public IObservable<RepositoryTrafficReferrer> GetAllReferrers(long repositoryId)
|
|
{
|
|
return _client.GetAllReferrers(repositoryId).ToObservable().SelectMany(x => x);
|
|
}
|
|
|
|
/// <summary>
|
|
/// List the top 10 referrers over the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#list-referrers</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
public IObservable<RepositoryTrafficReferrer> GetAllReferrers(string owner, string name)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
|
|
|
return _client.GetAllReferrers(owner, name).ToObservable().SelectMany(x => x);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the total number of clones and breakdown per day or week for the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#clones</remarks>
|
|
/// <param name="repositoryId">The owner of the repository</param>
|
|
/// <param name="per">Breakdown per day or week</param>
|
|
public IObservable<RepositoryTrafficCloneSummary> GetClones(long repositoryId, RepositoryTrafficRequest per)
|
|
{
|
|
Ensure.ArgumentNotNull(per, "per");
|
|
|
|
return _client.GetClones(repositoryId, per).ToObservable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the total number of clones and breakdown per day or week for the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#clones</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
/// <param name="per">Breakdown per day or week</param>
|
|
public IObservable<RepositoryTrafficCloneSummary> GetClones(string owner, string name, RepositoryTrafficRequest per)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
|
Ensure.ArgumentNotNull(per, "per");
|
|
|
|
return _client.GetClones(owner, name, per).ToObservable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the total number of views and breakdown per day or week for the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#views</remarks>
|
|
/// <param name="repositoryId">The owner of the repository</param>
|
|
/// <param name="per">Breakdown per day or week</param>
|
|
public IObservable<RepositoryTrafficViewSummary> GetViews(long repositoryId, RepositoryTrafficRequest per)
|
|
{
|
|
Ensure.ArgumentNotNull(per, "per");
|
|
|
|
return _client.GetViews(repositoryId, per).ToObservable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the total number of views and breakdown per day or week for the last 14 days
|
|
/// </summary>
|
|
/// <remarks>https://developer.github.com/v3/repos/traffic/#views</remarks>
|
|
/// <param name="owner">The owner of the repository</param>
|
|
/// <param name="name">The name of the repository</param>
|
|
/// <param name="per">Breakdown per day or week</param>
|
|
public IObservable<RepositoryTrafficViewSummary> GetViews(string owner, string name, RepositoryTrafficRequest per)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
|
Ensure.ArgumentNotNull(per, "per");
|
|
|
|
return _client.GetViews(owner, name, per).ToObservable();
|
|
}
|
|
}
|
|
}
|