Updated comments on the API methods
This commit is contained in:
@@ -15,6 +15,9 @@ namespace OurUmbraco.Community.Controllers
|
|||||||
{
|
{
|
||||||
public class GitHubContributorController : SurfaceController
|
public class GitHubContributorController : SurfaceController
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Repositories to include in the combination
|
||||||
|
/// </summary>
|
||||||
private readonly string[] Repositories =
|
private readonly string[] Repositories =
|
||||||
{
|
{
|
||||||
"Umbraco-CMS",
|
"Umbraco-CMS",
|
||||||
@@ -25,6 +28,11 @@ namespace OurUmbraco.Community.Controllers
|
|||||||
"Umbraco.Deploy.ValueConnectors"
|
"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()
|
public ActionResult GitHubGetContributorsResult()
|
||||||
{
|
{
|
||||||
var model = new GitHubContributorsModel();
|
var model = new GitHubContributorsModel();
|
||||||
@@ -36,8 +44,7 @@ namespace OurUmbraco.Community.Controllers
|
|||||||
LogHelper.Debug<GitHubContributorController>("Config file was not found: " + configPath);
|
LogHelper.Debug<GitHubContributorController>("Config file was not found: " + configPath);
|
||||||
return PartialView("~/Views/Partials/Home/GitHubContributors.cshtml", model);
|
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();
|
string[] login = System.IO.File.ReadAllLines(configPath).Where(x => x.Trim() != "").Distinct().ToArray();
|
||||||
var contributors = ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem<List<GitHubContributorModel>>("UmbracoGitHubContributors",
|
var contributors = ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem<List<GitHubContributorModel>>("UmbracoGitHubContributors",
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@@ -5,17 +5,21 @@ using RestSharp;
|
|||||||
namespace OurUmbraco.Our.Api
|
namespace OurUmbraco.Our.Api
|
||||||
{
|
{
|
||||||
public class GitHubController
|
public class GitHubController
|
||||||
{
|
{
|
||||||
private const string RepositoryOwner = "Umbraco";
|
private const string RepositoryOwner = "Umbraco";
|
||||||
|
private const string GitHubApiClient = "https://api.github.com";
|
||||||
|
private const string UserAgent = "OurUmbraco";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all contributors from GitHub Umbraco repositories
|
/// Get all contributors from GitHub Umbraco repositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="repo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IRestResponse<List<GitHubContributorModel>> GetAllRepoContributors(string repo)
|
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);
|
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);
|
var response = client.Execute<List<GitHubContributorModel>>(request);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user