Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Enterprise Admin Stats API #1049

Merged
merged 29 commits into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2f4b855
Add Enterprise base API stub
ryangribble Dec 24, 2015
4012061
compiler whinging about unused field
ryangribble Dec 24, 2015
c9026e4
add base Enterprise client to GitHubClient
ryangribble Dec 24, 2015
3f437eb
First cut of AdminStats client and tests
ryangribble Dec 24, 2015
18bb3fa
add new files to all projects
ryangribble Dec 26, 2015
53baabc
fix code analysis suppression
ryangribble Dec 26, 2015
e621f1e
fix unit test
ryangribble Dec 26, 2015
0424205
add default constructors to Response model classes
ryangribble Dec 26, 2015
91ca43b
add comments and tidy up
ryangribble Dec 26, 2015
f196631
Add Enterprise and EnterpriseAdminStats to Reactive project and tests
ryangribble Dec 26, 2015
feda6bc
tidy up
ryangribble Dec 26, 2015
dc1a03b
Add Enterprise to Reactive GitHubClient
ryangribble Dec 26, 2015
28934e1
fixup mono projects
ryangribble Dec 26, 2015
5a35b3c
Add DebuggerDisplay
ryangribble Dec 26, 2015
08581e6
complete integration tests
ryangribble Dec 26, 2015
bebf96b
Damn, it turns out that requests for specific stat types only provide…
ryangribble Dec 26, 2015
a2c8771
Reactive - dont forget to Init the Enterprise client in GitHubClient …
ryangribble Dec 26, 2015
5691c14
fix unit test now that each stats type calls a different Get<> method
ryangribble Dec 26, 2015
e7187cb
Merge remote-tracking branch 'upstream/master' into enterprise-admins…
ryangribble Jan 16, 2016
5739b25
Fix up async calls
ryangribble Jan 16, 2016
d2b7476
Implement individual methods for each AdminStats call
ryangribble Jan 26, 2016
1a90c16
Merge remote-tracking branch 'upstream/master' into enterprise-admins…
ryangribble Jan 26, 2016
b1f6c3a
Rename test class to be consistent with others
ryangribble Jan 29, 2016
e87f200
Rename test class to be consistent with others
ryangribble Jan 30, 2016
f2f24d4
Merge remote-tracking branch 'upstream/master' into enterprise-admins…
ryangribble Jan 30, 2016
fcfec94
Fix up tests now the ApiConnection has the proper Get() method
ryangribble Jan 30, 2016
5f64606
Fixup class name
ryangribble Jan 31, 2016
7e4848c
Another rename
ryangribble Jan 31, 2016
539fb8b
Remove redundant duplicate braces
ryangribble Feb 1, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

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 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 for the requested <see cref="AdminStatsType"/> type.</returns>
IObservable<AdminStats> GetStatistics(AdminStatsType type);
}
}
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,35 @@
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 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 for the requested <see cref="AdminStatsType"/> type.</returns>
public IObservable<AdminStats> GetStatistics(AdminStatsType type)
{
return _client.GetStatistics(type).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 @@ -20,5 +20,6 @@ public interface IObservableGitHubClient : IApiInfoProvider
IObservableNotificationsClient Notification { get; }
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 @@ -46,6 +46,7 @@ public ObservableGitHubClient(IGitHubClient gitHubClient)
GitDatabase = new ObservableGitDatabaseClient(gitHubClient);
Gist = new ObservableGistsClient(gitHubClient);
Search = new ObservableSearchClient(gitHubClient);
Enterprise = new ObservableEnterpriseClient(gitHubClient);
}

public IConnection Connection
Expand All @@ -68,6 +69,7 @@ public IConnection Connection
public IObservableNotificationsClient Notification { get; private set; }
public IObservableGitDatabaseClient GitDatabase { 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
6 changes: 5 additions & 1 deletion Octokit.Reactive/Octokit.Reactive-Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@
<Compile Include="Clients\ObservableRepositoryContentsClient.cs" />
<Compile Include="Clients\IObservableMergingClient.cs" />
<Compile Include="Clients\ObservableMergingClient.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 All @@ -165,4 +169,4 @@
<Name>Octokit-Mono</Name>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
6 changes: 5 additions & 1 deletion Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
<Compile Include="Clients\ObservableRepositoryContentsClient.cs" />
<Compile Include="Clients\IObservableMergingClient.cs" />
<Compile Include="Clients\ObservableMergingClient.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 All @@ -173,4 +177,4 @@
<Name>Octokit-MonoAndroid</Name>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
6 changes: 5 additions & 1 deletion Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@
<Compile Include="Clients\ObservableRepositoryContentsClient.cs" />
<Compile Include="Clients\IObservableMergingClient.cs" />
<Compile Include="Clients\ObservableMergingClient.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 All @@ -169,4 +173,4 @@
<Name>Octokit-Monotouch</Name>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
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