Skip to content

Commit

Permalink
Merge pull request #1049 from TattsGroup/enterprise-adminstats
Browse files Browse the repository at this point in the history
Implement Enterprise Admin Stats API
  • Loading branch information
shiftkey committed Feb 1, 2016
2 parents 829677c + 539fb8b commit 5f2cc4c
Show file tree
Hide file tree
Showing 45 changed files with 2,080 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
using System;
using System.Diagnostics.CodeAnalysis;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Enterprise Admin Stats API
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/enterprise/admin_stats/">Enterprise Admin Stats API documentation</a> for more information.
///</remarks>
public interface IObservableEnterpriseAdminStatsClient
{
/// <summary>
/// Gets GitHub Enterprise Issue statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsIssues"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsIssues> GetStatisticsIssues();

/// <summary>
/// Gets GitHub Enterprise Hook statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsHooks"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsHooks> GetStatisticsHooks();

/// <summary>
/// Gets GitHub Enterprise Milestone statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsMilestones"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsMilestones> GetStatisticsMilestones();

/// <summary>
/// Gets GitHub Enterprise Organization statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsOrgs"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsOrgs> GetStatisticsOrgs();

/// <summary>
/// Gets GitHub Enterprise Comment statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsComments"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsComments> GetStatisticsComments();

/// <summary>
/// Gets GitHub Enterprise Pages statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsPages"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsPages> GetStatisticsPages();

/// <summary>
/// Gets GitHub Enterprise User statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsUsers"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsUsers> GetStatisticsUsers();

/// <summary>
/// Gets GitHub Enterprise Gist statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsGists"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsGists> GetStatisticsGists();

/// <summary>
/// Gets GitHub Enterprise PullRequest statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsPulls"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsPulls> GetStatisticsPulls();

/// <summary>
/// Gets GitHub Enterprise Repository statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsRepos"/> statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStatsRepos> GetStatisticsRepos();

/// <summary>
/// Gets GitHub Enterprise statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStats"/> collection of statistics.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<AdminStats> GetStatisticsAll();
}
}
19 changes: 19 additions & 0 deletions Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Enterprise API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/enterprise/">Enterprise API documentation</a> for more information.
/// </remarks>
public interface IObservableEnterpriseClient
{
/// <summary>
/// A client for GitHub's Enterprise Admin Stats API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/enterprise/admin_stats/">Enterprise Admin Stats API documentation</a> for more information.
///</remarks>
IObservableEnterpriseAdminStatsClient AdminStats { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
using System;
using System.Reactive.Threading.Tasks;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Enterprise Admin Stats API
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/enterprise/admin_stats/">Enterprise Admin Stats API documentation</a> for more information.
///</remarks>
public class ObservableEnterpriseAdminStatsClient : IObservableEnterpriseAdminStatsClient
{
readonly IEnterpriseAdminStatsClient _client;

public ObservableEnterpriseAdminStatsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

_client = client.Enterprise.AdminStats;
}

/// <summary>
/// Gets GitHub Enterprise Issue statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsIssues"/> statistics.</returns>
public IObservable<AdminStatsIssues> GetStatisticsIssues()
{
return _client.GetStatisticsIssues().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Hook statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsHooks"/> statistics.</returns>
public IObservable<AdminStatsHooks> GetStatisticsHooks()
{
return _client.GetStatisticsHooks().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Milestone statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsMilestones"/> statistics.</returns>
public IObservable<AdminStatsMilestones> GetStatisticsMilestones()
{
return _client.GetStatisticsMilestones().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Organization statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsOrgs"/> statistics.</returns>
public IObservable<AdminStatsOrgs> GetStatisticsOrgs()
{
return _client.GetStatisticsOrgs().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Comment statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsComments"/> statistics.</returns>
public IObservable<AdminStatsComments> GetStatisticsComments()
{
return _client.GetStatisticsComments().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Pages statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsPages"/> statistics.</returns>
public IObservable<AdminStatsPages> GetStatisticsPages()
{
return _client.GetStatisticsPages().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise User statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsUsers"/> statistics.</returns>
public IObservable<AdminStatsUsers> GetStatisticsUsers()
{
return _client.GetStatisticsUsers().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Gist statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsGists"/> statistics.</returns>
public IObservable<AdminStatsGists> GetStatisticsGists()
{
return _client.GetStatisticsGists().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise PullRequest statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsPulls"/> statistics.</returns>
public IObservable<AdminStatsPulls> GetStatisticsPulls()
{
return _client.GetStatisticsPulls().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise Repository statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStatsRepos"/> statistics.</returns>
public IObservable<AdminStatsRepos> GetStatisticsRepos()
{
return _client.GetStatisticsRepos().ToObservable();
}

/// <summary>
/// Gets GitHub Enterprise statistics (must be Site Admin user).
/// </summary>
/// <remarks>
/// https://developer.github.com/v3/enterprise/admin_stats/#get-statistics
/// </remarks>
/// <returns>The <see cref="AdminStats"/> collection of statistics.</returns>
public IObservable<AdminStats> GetStatisticsAll()
{
return _client.GetStatisticsAll().ToObservable();
}
}
}
26 changes: 26 additions & 0 deletions Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Enterprise API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/enterprise/">Enterprise API documentation</a> for more information.
/// </remarks>
public class ObservableEnterpriseClient : IObservableEnterpriseClient
{
public ObservableEnterpriseClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

AdminStats = new ObservableEnterpriseAdminStatsClient(client);
}

/// <summary>
/// A client for GitHub's Enterprise Admin Stats API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/enterprise/admin_stats/">Enterprise Admin Stats API documentation</a> for more information.
///</remarks>
public IObservableEnterpriseAdminStatsClient AdminStats { get; private set; }
}
}
1 change: 1 addition & 0 deletions Octokit.Reactive/IObservableGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ public interface IObservableGitHubClient : IApiInfoProvider
[Obsolete("Use Git instead")]
IObservableGitDatabaseClient GitDatabase { get; }
IObservableSearchClient Search { get; }
IObservableEnterpriseClient Enterprise { get; }
}
}
2 changes: 2 additions & 0 deletions Octokit.Reactive/ObservableGitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public ObservableGitHubClient(IGitHubClient gitHubClient)
Git = new ObservableGitDatabaseClient(gitHubClient);
Gist = new ObservableGistsClient(gitHubClient);
Search = new ObservableSearchClient(gitHubClient);
Enterprise = new ObservableEnterpriseClient(gitHubClient);
}

public IConnection Connection
Expand All @@ -70,6 +71,7 @@ public IConnection Connection
public IObservableGitDatabaseClient GitDatabase { get { return Git; } }
public IObservableGitDatabaseClient Git { get; private set; }
public IObservableSearchClient Search { get; private set; }
public IObservableEnterpriseClient Enterprise { get; private set; }

/// <summary>
/// Gets the latest API Info - this will be null if no API calls have been made
Expand Down
4 changes: 4 additions & 0 deletions Octokit.Reactive/Octokit.Reactive-Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
<Compile Include="Clients\ObservableMergingClient.cs" />
<Compile Include="Clients\IObservableRepositoryPagesClient.cs" />
<Compile Include="Clients\ObservableRepositoryPagesClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@
<Compile Include="Clients\ObservableMergingClient.cs" />
<Compile Include="Clients\IObservableRepositoryPagesClient.cs" />
<Compile Include="Clients\ObservableRepositoryPagesClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@
<Compile Include="Clients\ObservableMergingClient.cs" />
<Compile Include="Clients\IObservableRepositoryPagesClient.cs" />
<Compile Include="Clients\ObservableRepositoryPagesClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseClient.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
<Compile Include="..\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="Clients\Enterprise\ObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseAdminStatsClient.cs" />
<Compile Include="Clients\Enterprise\IObservableEnterpriseClient.cs" />
<Compile Include="Clients\Enterprise\ObservableEnterpriseClient.cs" />
<Compile Include="Clients\IObservableMergingClient.cs" />
<Compile Include="Clients\IObservableOauthClient.cs" />
<Compile Include="Clients\IObservableRepositoryCommitsClients.cs" />
Expand Down
Loading

0 comments on commit 5f2cc4c

Please sign in to comment.