From 61cbdeb96b4aac809456bd4a268e86d736aa9d18 Mon Sep 17 00:00:00 2001 From: Emma Garland Date: Mon, 5 Jun 2017 14:15:07 +0100 Subject: [PATCH] Updated comments on the API methods --- .../Controllers/GitHubContributorController.cs | 11 +++++++++-- OurUmbraco/Our/Api/GithubController.cs | 10 +++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/OurUmbraco/Community/Controllers/GitHubContributorController.cs b/OurUmbraco/Community/Controllers/GitHubContributorController.cs index 9db085c2..6eeb4207 100644 --- a/OurUmbraco/Community/Controllers/GitHubContributorController.cs +++ b/OurUmbraco/Community/Controllers/GitHubContributorController.cs @@ -15,6 +15,9 @@ namespace OurUmbraco.Community.Controllers { public class GitHubContributorController : SurfaceController { + /// + /// Repositories to include in the combination + /// private readonly string[] Repositories = { "Umbraco-CMS", @@ -25,6 +28,11 @@ namespace OurUmbraco.Community.Controllers "Umbraco.Deploy.ValueConnectors" }; + /// + /// Gets data for all GitHub contributors for all listed Umbraco repositories, + /// excluding the GitHub IDs of the HQ contributors from the text file list + /// + /// public ActionResult GitHubGetContributorsResult() { var model = new GitHubContributorsModel(); @@ -36,8 +44,7 @@ namespace OurUmbraco.Community.Controllers LogHelper.Debug("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>("UmbracoGitHubContributors", () => diff --git a/OurUmbraco/Our/Api/GithubController.cs b/OurUmbraco/Our/Api/GithubController.cs index 7c327595..471a27c1 100644 --- a/OurUmbraco/Our/Api/GithubController.cs +++ b/OurUmbraco/Our/Api/GithubController.cs @@ -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"; + /// /// Get all contributors from GitHub Umbraco repositories /// + /// /// public IRestResponse> 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>(request); return response; }