Added commits per hour each day

Not enjoying this api. Will sort out all of these response types arrays
with secret meanings elsewhere. What is even a list of list of int.
Sanity. It's coming....
This commit is contained in:
Amy Palamountain
2014-02-02 14:20:03 +13:00
parent dd7149c3e0
commit 71263c349a
2 changed files with 30 additions and 0 deletions
+8
View File
@@ -36,5 +36,13 @@ namespace Octokit
/// <param name="repositoryName">The name of the repository</param>
/// <returns>Returns <see cref="WeeklyCommitCounts"/>from oldest week to now</returns>
Task<WeeklyCommitCounts> GetCommitCountsPerWeek(string owner, string repositoryName);
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="repositoryName">The name of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
Task<IEnumerable<int[]>> GetCommitPerHour(string owner, string repositoryName);
}
}
+22
View File
@@ -101,5 +101,27 @@ namespace Octokit
}
return response.BodyAsObject;
}
/// <summary>
/// Returns a list of the number of commits per hour in each day
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="repositoryName">The name of the repository</param>
/// <returns>Returns commit counts per hour in each day</returns>
public async Task<IEnumerable<int[]>> 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<IEnumerable<int[]>>(endpoint, null, null);
if (response.StatusCode == HttpStatusCode.Accepted)
{
return await GetCommitPerHour(owner, repositoryName);
}
return response.BodyAsObject;
}
}
}