Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Last active November 22, 2023 03:34
Show Gist options
  • Save gistlyn/2a81ca4363a10c38d57cf95d66302253 to your computer and use it in GitHub Desktop.
Save gistlyn/2a81ca4363a10c38d57cf95d66302253 to your computer and use it in GitHub Desktop.
VB .NET 6 Console App
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ServiceStack.Common" Version="8.*" />
</ItemGroup>
</Project>
Imports System.Linq
Imports System.Net
Imports ServiceStack
Imports ServiceStack.Text
Module Program
Public Class GithubRepo
Public Property Name As String
Public Property Description As String
Public Property Url As String
Public Property Homepage As String
Public Property Language As String
Public Property Watchers As Integer
Public Property Forks As Integer
End Class
Sub Main(args As String())
Dim orgName As String = "dotnet"
Dim orgRepos = $"https://api.github.com/orgs/{orgName}/repos" _
.GetJsonFromUrl(Sub(c) c.With(Sub(x) x.UserAgent = "gist.cafe")) _
.FromJson(Of GithubRepo())() _
.OrderByDescending(Function(x) x.Watchers)
Console.WriteLine($"Top 3 '{orgName}' Github Repos:")
orgRepos.Take(3).ToList().PrintDump()
Console.WriteLine($"{vbCrLf}Top 10 {orgName} Github Repos:{vbCrLf}")
orgRepos.Take(10).Select(Function(x) _
New With { x.Name, x.Language, x.Watchers, x.Forks }).PrintDumpTable()
Inspect.vars(New With { orgRepos })
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment