xxxxxxxxxx
1
using System.Linq;
2
using ServiceStack;
3
using ServiceStack.Text;
4
5
var orgName = "ServiceStack";
6
7
var orgRepos = $"https://api.github.com/orgs/{orgName}/repos"
8
.GetJsonFromUrl(httpReq => httpReq.UserAgent = "Gistlyn")
9
.FromJson<GithubRepository[]>()
10
.OrderByDescending(x => x.Watchers)
11
.Take(5)
12
.ToList();
13
14
$"Top 5 {orgName} Github Repositories:".Print();
15
orgRepos.PrintDump();
16
17
public class GithubRepository
18
{
19
public string Name { get; set; }
20
public string Description { get; set; }
21
public string Url { get; set; }
22
public string Homepage { get; set; }
23
public string Language { get; set; }
24
public int Watchers { get; set; }
25
public int Forks { get; set; }
26
27
public override string ToString() => Name;
28
}
29
run