diff --git a/Octokit/Clients/IStatisticsClient.cs b/Octokit/Clients/IStatisticsClient.cs index 3ba9d887..7c256da0 100644 --- a/Octokit/Clients/IStatisticsClient.cs +++ b/Octokit/Clients/IStatisticsClient.cs @@ -36,5 +36,13 @@ namespace Octokit /// The name of the repository /// Returns from oldest week to now Task GetCommitCountsPerWeek(string owner, string repositoryName); + + /// + /// Returns a list of the number of commits per hour in each day + /// + /// The owner of the repository + /// The name of the repository + /// Returns commit counts per hour in each day + Task> GetCommitPerHour(string owner, string repositoryName); } } \ No newline at end of file diff --git a/Octokit/Clients/StatisticsClient.cs b/Octokit/Clients/StatisticsClient.cs index 92216ab8..4f782224 100644 --- a/Octokit/Clients/StatisticsClient.cs +++ b/Octokit/Clients/StatisticsClient.cs @@ -101,5 +101,27 @@ namespace Octokit } return response.BodyAsObject; } + + /// + /// Returns a list of the number of commits per hour in each day + /// + /// The owner of the repository + /// The name of the repository + /// Returns commit counts per hour in each day + public async Task> GetCommitPerHour(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + var endpoint = "/repos/{0}/{1}/stats/punch_card".FormatUri(owner, repositoryName); + + var response = await Connection.GetAsync>(endpoint, null, null); + + if (response.StatusCode == HttpStatusCode.Accepted) + { + return await GetCommitPerHour(owner, repositoryName); + } + return response.BodyAsObject; + } } } \ No newline at end of file