Updated comments on the API methods

This commit is contained in:
Emma Garland
2017-06-05 14:15:07 +01:00
parent 8ab087b23f
commit 61cbdeb96b
2 changed files with 16 additions and 5 deletions
@@ -15,6 +15,9 @@ namespace OurUmbraco.Community.Controllers
{
public class GitHubContributorController : SurfaceController
{
/// <summary>
/// Repositories to include in the combination
/// </summary>
private readonly string[] Repositories =
{
"Umbraco-CMS",
@@ -25,6 +28,11 @@ namespace OurUmbraco.Community.Controllers
"Umbraco.Deploy.ValueConnectors"
};
/// <summary>
/// Gets data for all GitHub contributors for all listed Umbraco repositories,
/// excluding the GitHub IDs of the HQ contributors from the text file list
/// </summary>
/// <returns></returns>
public ActionResult GitHubGetContributorsResult()
{
var model = new GitHubContributorsModel();
@@ -36,8 +44,7 @@ namespace OurUmbraco.Community.Controllers
LogHelper.Debug<GitHubContributorController>("Config file was not found: " + configPath);
return PartialView("~/Views/Partials/Home/GitHubContributors.cshtml", model);
}
// Get the GitHub ID of each HQ contributor
string[] login = System.IO.File.ReadAllLines(configPath).Where(x => x.Trim() != "").Distinct().ToArray();
var contributors = ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem<List<GitHubContributorModel>>("UmbracoGitHubContributors",
() =>
+7 -3
View File
@@ -5,17 +5,21 @@ using RestSharp;
namespace OurUmbraco.Our.Api
{
public class GitHubController
{
{
private const string RepositoryOwner = "Umbraco";
private const string GitHubApiClient = "https://api.github.com";
private const string UserAgent = "OurUmbraco";
/// <summary>
/// Get all contributors from GitHub Umbraco repositories
/// </summary>
/// <param name="repo"></param>
/// <returns></returns>
public IRestResponse<List<GitHubContributorModel>> GetAllRepoContributors(string repo)
{
var client = new RestClient("https://api.github.com");
var client = new RestClient(GitHubApiClient);
var request = new RestRequest(string.Format("/repos/{0}/{1}/stats/contributors", RepositoryOwner, repo), Method.GET);
client.UserAgent = "OurUmbraco";
client.UserAgent = UserAgent;
var response = client.Execute<List<GitHubContributorModel>>(request);
return response;
}