Last active
November 13, 2023 04:48
-
-
Save gistlyn/c71b3f0123b3d9d08c1b11c98c2ff379 to your computer and use it in GitHub Desktop.
Simple C# .NET 6 Console App
This file contains hidden or 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"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net6.0</TargetFramework> | |
<NoWarn>1591</NoWarn> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="ServiceStack.Common" Version="6.*" /> | |
</ItemGroup> | |
</Project> |
This file contains hidden or 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; | |
var orgName = "dotnet"; | |
var orgRepos = $"https://api.github.com/orgs/{orgName}/repos" | |
.GetJsonFromUrl(req => req.With(x => x.UserAgent = "gist.cafe")) | |
.FromJson<GithubRepo[]>() | |
.OrderByDescending(x => x.Watchers); | |
$"Top 3 '{orgName}' Github Repos:".Print(); | |
orgRepos.Take(3).ToList().PrintDump(); | |
$"\nTop 10 {orgName} Github Repos:\n".Print(); | |
orgRepos.Take(10).Map(x => new { | |
x.Name, x.Language, x.Watchers, x.Forks }).PrintDumpTable(); | |
Inspect.vars(new { orgRepos }); | |
public class GithubRepo | |
{ | |
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; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment