Created
July 21, 2020 11:54
-
-
Save gistlyn/945ed92d5f2feb7076c321d522a32fdd to your computer and use it in GitHub Desktop.
text files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="ServiceStack.Text" Version="5.*" /> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public class GithubRepository | |
{ | |
public string Name { get; set; } | |
public string Description { get; set; } | |
public string Url { get; set; } | |
public string Homepage { get; set; } | |
public string Language { get; set; } | |
public int Watchers { get; set; } | |
public int Forks { get; set; } | |
public override string ToString() => Name; | |
} | |
public static class Program | |
{ | |
static void Main() | |
{ | |
//https://githubengineering.com/crypto-removal-notice/ | |
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; | |
var orgName = "ServiceStack"; | |
var orgRepos = $"https://api.github.com/orgs/{orgName}/repos" | |
.GetJsonFromUrl(httpReq => httpReq.UserAgent = "ServiceStack Demo") | |
.FromJson<GithubRepository[]>() | |
.OrderByDescending(x => x.Watchers) | |
.Take(5) | |
.ToList(); | |
"Top 5 {0} Github Repositories:".Print(orgName); | |
orgRepos.PrintDump(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment