diff --git a/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseLicenseClientTests.cs b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseLicenseClientTests.cs
new file mode 100644
index 00000000..81cd97b4
--- /dev/null
+++ b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseLicenseClientTests.cs
@@ -0,0 +1,23 @@
+using System.Threading.Tasks;
+using Octokit;
+using Octokit.Tests.Integration;
+using Xunit;
+
+public class EnterpriseLicenseClientTests
+{
+ readonly IGitHubClient _github;
+
+ public EnterpriseLicenseClientTests()
+ {
+ _github = EnterpriseHelper.GetAuthenticatedClient();
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanGetLicense()
+ {
+ var licenseInfo = await
+ _github.Enterprise.License.Get();
+
+ Assert.NotNull(licenseInfo);
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
index 2be66be3..0c17edb4 100644
--- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
+++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
@@ -77,6 +77,7 @@
+
diff --git a/Octokit.Tests/Clients/Enterprise/EnterpriseLicenseClientTests.cs b/Octokit.Tests/Clients/Enterprise/EnterpriseLicenseClientTests.cs
new file mode 100644
index 00000000..947fa4a2
--- /dev/null
+++ b/Octokit.Tests/Clients/Enterprise/EnterpriseLicenseClientTests.cs
@@ -0,0 +1,23 @@
+using System;
+using NSubstitute;
+using Xunit;
+
+namespace Octokit.Tests.Clients
+{
+ public class EnterpriseLicenseClientTests
+ {
+ public class TheGetMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new EnterpriseLicenseClient(connection);
+
+ string expectedUri = "enterprise/settings/license";
+ client.Get();
+ connection.Received().Get(Arg.Is(u => u.ToString() == expectedUri));
+ }
+ }
+ }
+}
diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj
index 5af19254..68886206 100644
--- a/Octokit.Tests/Octokit.Tests.csproj
+++ b/Octokit.Tests/Octokit.Tests.csproj
@@ -86,6 +86,7 @@
+
diff --git a/Octokit/Clients/Enterprise/EnterpriseClient.cs b/Octokit/Clients/Enterprise/EnterpriseClient.cs
index 42e1763a..70b74a5b 100644
--- a/Octokit/Clients/Enterprise/EnterpriseClient.cs
+++ b/Octokit/Clients/Enterprise/EnterpriseClient.cs
@@ -15,6 +15,7 @@
public EnterpriseClient(IApiConnection apiConnection) : base(apiConnection)
{
AdminStats = new EnterpriseAdminStatsClient(apiConnection);
+ License = new EnterpriseLicenseClient(apiConnection);
}
///
@@ -24,5 +25,13 @@
/// See the Enterprise Admin Stats API documentation for more information.
///
public IEnterpriseAdminStatsClient AdminStats { get; private set; }
+
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ public IEnterpriseLicenseClient License { get; private set; }
}
}
diff --git a/Octokit/Clients/Enterprise/EnterpriseLicenseClient.cs b/Octokit/Clients/Enterprise/EnterpriseLicenseClient.cs
new file mode 100644
index 00000000..46638883
--- /dev/null
+++ b/Octokit/Clients/Enterprise/EnterpriseLicenseClient.cs
@@ -0,0 +1,32 @@
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ public class EnterpriseLicenseClient : ApiClient, IEnterpriseLicenseClient
+ {
+ public EnterpriseLicenseClient(IApiConnection apiConnection)
+ : base(apiConnection)
+ { }
+
+ ///
+ /// Gets GitHub Enterprise License Information (must be Site Admin user).
+ ///
+ ///
+ /// https://developer.github.com/v3/enterprise/license/#get-license-information
+ ///
+ /// The statistics.
+ public async Task Get()
+ {
+ var endpoint = ApiUrls.EnterpriseLicense();
+
+ return await ApiConnection.Get(endpoint)
+ .ConfigureAwait(false);
+ }
+ }
+}
diff --git a/Octokit/Clients/Enterprise/IEnterpriseClient.cs b/Octokit/Clients/Enterprise/IEnterpriseClient.cs
index e5eff83a..1d685013 100644
--- a/Octokit/Clients/Enterprise/IEnterpriseClient.cs
+++ b/Octokit/Clients/Enterprise/IEnterpriseClient.cs
@@ -15,5 +15,13 @@
/// See the Enterprise Admin Stats API documentation for more information.
///
IEnterpriseAdminStatsClient AdminStats { get; }
+
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ IEnterpriseLicenseClient License { get; }
}
}
diff --git a/Octokit/Clients/Enterprise/IEnterpriseLicenseClient.cs b/Octokit/Clients/Enterprise/IEnterpriseLicenseClient.cs
new file mode 100644
index 00000000..6e067e65
--- /dev/null
+++ b/Octokit/Clients/Enterprise/IEnterpriseLicenseClient.cs
@@ -0,0 +1,24 @@
+using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ public interface IEnterpriseLicenseClient
+ {
+ ///
+ /// Gets GitHub Enterprise License Information (must be Site Admin user).
+ ///
+ ///
+ /// https://developer.github.com/v3/enterprise/license/#get-license-information
+ ///
+ /// The statistics.
+ [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
+ Task Get();
+ }
+}
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index efc680b3..b2ee1b6b 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -1652,5 +1652,10 @@ namespace Octokit
{
return EnterpriseAdminStats("all");
}
+
+ public static Uri EnterpriseLicense()
+ {
+ return "enterprise/settings/license".FormatUri();
+ }
}
}
diff --git a/Octokit/Models/Response/Enterprise/LicenseInfo.cs b/Octokit/Models/Response/Enterprise/LicenseInfo.cs
new file mode 100644
index 00000000..14fe6667
--- /dev/null
+++ b/Octokit/Models/Response/Enterprise/LicenseInfo.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Diagnostics;
+using System.Globalization;
+
+namespace Octokit
+{
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class LicenseInfo
+ {
+ public LicenseInfo() { }
+
+ public LicenseInfo(int seats, int seatsUsed, int seatsAvailable, string kind, int daysUntilExpiration, DateTimeOffset expireAt)
+ {
+ Seats = seats;
+ SeatsUsed = seatsUsed;
+ SeatsAvailable = seatsAvailable;
+ Kind = kind;
+ DaysUntilExpiration = daysUntilExpiration;
+ ExpireAt = expireAt;
+ }
+
+
+ public int Seats
+ {
+ get;
+ private set;
+ }
+
+ public int SeatsUsed
+ {
+ get;
+ private set;
+ }
+
+ public int SeatsAvailable
+ {
+ get;
+ private set;
+ }
+
+ public string Kind
+ {
+ get;
+ private set;
+ }
+
+ public int DaysUntilExpiration
+ {
+ get;
+ private set;
+ }
+
+ public DateTimeOffset ExpireAt
+ {
+ get;
+ private set;
+ }
+
+ internal string DebuggerDisplay
+ {
+ get
+ {
+ return String.Format(CultureInfo.InvariantCulture, "Seats: {0} SeatsUsed: {1} DaysUntilExpiration: {2}", Seats, SeatsUsed, DaysUntilExpiration);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj
index 549f391f..fb7cade8 100644
--- a/Octokit/Octokit.csproj
+++ b/Octokit/Octokit.csproj
@@ -59,7 +59,9 @@
+
+
@@ -140,6 +142,7 @@
+