Frontend Update

This commit is contained in:
Connor Drahoss 2022-09-10 11:35:05 -07:00
parent c52eb760e7
commit 6df3188b02
17 changed files with 129 additions and 131 deletions

View File

@ -9,6 +9,7 @@ namespace ExtensiblePortfolioSite.SDK.Git
public static void Register(String Service, IGitProvider Provider) public static void Register(String Service, IGitProvider Provider)
{ {
Console.WriteLine($"Registering service {Service}");
if (Providers.TryGetValue(Service, out GitService? GitService)) if (Providers.TryGetValue(Service, out GitService? GitService))
{ {
GitService.addProvider(Provider); GitService.addProvider(Provider);

View File

@ -20,5 +20,10 @@ namespace ExtensiblePortfolioSite.SDK.Git
/// List of files modified in the commit /// List of files modified in the commit
/// </summary> /// </summary>
public IReadOnlyCollection<String> ModifiedFiles { get; } public IReadOnlyCollection<String> ModifiedFiles { get; }
/// <summary>
/// URL to the commit author's avatar
/// </summary>
public string AuthorAvatarUrl { get; }
} }
} }

View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace ExtensiblePortfolioSite.SDK namespace ExtensiblePortfolioSite.SDK
{ {
internal static class Json public static class Json
{ {
private static class DefaultConverters private static class DefaultConverters
{ {
@ -40,7 +40,7 @@ namespace ExtensiblePortfolioSite.SDK
IncludeFields = true, IncludeFields = true,
MaxDepth = 64, MaxDepth = 64,
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals | JsonNumberHandling.AllowReadingFromString, NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals | JsonNumberHandling.AllowReadingFromString,
PropertyNameCaseInsensitive = false, PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
ReadCommentHandling = JsonCommentHandling.Skip, ReadCommentHandling = JsonCommentHandling.Skip,
UnknownTypeHandling = JsonUnknownTypeHandling.JsonElement, UnknownTypeHandling = JsonUnknownTypeHandling.JsonElement,
@ -61,6 +61,7 @@ namespace ExtensiblePortfolioSite.SDK
public static T? Deserialize<T>(String String) => JsonSerializer.Deserialize<T>(String, Options); public static T? Deserialize<T>(String String) => JsonSerializer.Deserialize<T>(String, Options);
public static T? Deserialize<T>(Stream STM) => JsonSerializer.Deserialize<T>(STM, Options); public static T? Deserialize<T>(Stream STM) => JsonSerializer.Deserialize<T>(STM, Options);
public static T? Deserialize<T>(ref Utf8JsonReader Reader) => JsonSerializer.Deserialize<T>(ref Reader, Options); public static T? Deserialize<T>(ref Utf8JsonReader Reader) => JsonSerializer.Deserialize<T>(ref Reader, Options);
public static T? Deserialize<T>(JsonElement Element) => JsonSerializer.Deserialize<T>(Element, Options);
public static ValueTask<T?> DeserializeAsync<T>(Stream STM) => JsonSerializer.DeserializeAsync<T>(STM, Options); public static ValueTask<T?> DeserializeAsync<T>(Stream STM) => JsonSerializer.DeserializeAsync<T>(STM, Options);
public static ValueTask<T?> DeserializeAsync<T>(Stream STM, CancellationToken cancellationToken) => JsonSerializer.DeserializeAsync<T>(STM, Options, cancellationToken); public static ValueTask<T?> DeserializeAsync<T>(Stream STM, CancellationToken cancellationToken) => JsonSerializer.DeserializeAsync<T>(STM, Options, cancellationToken);

View File

@ -31,6 +31,7 @@ namespace ExtensiblePortfolioSite.SDK.Plugins
List<Byte[]> PublicKeyTokens = new(); List<Byte[]> PublicKeyTokens = new();
PublicKeyTokens.Add(typeof(String).Assembly.GetName().GetPublicKeyToken()!); // Framework Libraries PublicKeyTokens.Add(typeof(String).Assembly.GetName().GetPublicKeyToken()!); // Framework Libraries
PublicKeyTokens.Add(new byte[8] { 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a }); // System.Runtime PublicKeyTokens.Add(new byte[8] { 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a }); // System.Runtime
PublicKeyTokens.Add(new byte[8] { 0xcc, 0x7b, 0x13, 0xff, 0xcd, 0x2d, 0xdd, 0x51 }); // System.Text.Json
KnownPublicKeyTokens = PublicKeyTokens.ToArray(); KnownPublicKeyTokens = PublicKeyTokens.ToArray();
} }

View File

@ -68,6 +68,10 @@ namespace ExtensiblePortfolioSite
[JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public string[] Description { get; set; } = Array.Empty<String>(); public string[] Description { get; set; } = Array.Empty<String>();
[JsonPropertyName("Biography")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public string[] Biography { get; set; } = Array.Empty<String>();
[JsonPropertyName("Languages")] [JsonPropertyName("Languages")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public LanguageObject[] Languages { get; set; } = Array.Empty<LanguageObject>(); public LanguageObject[] Languages { get; set; } = Array.Empty<LanguageObject>();

View File

@ -27,14 +27,10 @@
<None Include="Pages\Projects\Index.cshtml" /> <None Include="Pages\Projects\Index.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Plugins\" />
</ItemGroup>
<Target Name="IncludePlugins" BeforeTargets="AfterBuild"> <Target Name="IncludePlugins" BeforeTargets="AfterBuild">
<MSBuild Projects="..\GithubPlugin\GithubPlugin.csproj" BuildInParallel="$(BuildInParallel)" Targets="Build"> <MSBuild Projects="..\GithubPlugin\GithubPlugin.csproj" BuildInParallel="$(BuildInParallel)" Targets="Build">
</MSBuild> </MSBuild>
<Copy SourceFiles="$(SolutionDir)GithubPlugin\bin\$(Configuration)\net6.0\GithubPlugin.dll" DestinationFolder="Plugins/" /> <Copy SourceFiles="$(SolutionDir)GithubPlugin\bin\$(Configuration)\net6.0\GithubPlugin.dll" DestinationFolder="Plugins/" SkipUnchangedFiles="true" />
</Target> </Target>
</Project> </Project>

View File

@ -22,8 +22,10 @@
</div> </div>
<div class="about-me-container" style="display: flex; flex-direction: column; flex: 1; align-items: center; min-width: 60%; min-height: 40vh;"> <div class="about-me-container" style="display: flex; flex-direction: column; flex: 1; align-items: center; min-width: 60%; min-height: 40vh;">
<h2>About Me</h2> <h2>About Me</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce commodo imperdiet hendrerit. Vestibulum pretium mauris eu sagittis tristique. Sed tellus nulla, facilisis in molestie id, fermentum facilisis nulla. Nullam vel tristique neque. Nam accumsan arcu vel nulla efficitur, posuere convallis diam rhoncus. Mauris mollis at sapien eu gravida. Nullam viverra velit porttitor ex mattis, in iaculis justo tincidunt. Morbi pulvinar odio nec mauris luctus facilisis. Phasellus aliquam commodo turpis. Quisque in tincidunt tellus, vel facilisis massa.</p> @foreach(String s in Config.GetConfig().ProfileSection.Biography)
<p>Pellentesque auctor eros vitae pretium ornare. Donec quam erat, tempor id elit eu, aliquet suscipit mi. Morbi facilisis nisi vel dapibus facilisis. Phasellus efficitur ac odio id ultricies. Cras ullamcorper lacinia posuere. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Vivamus lobortis, arcu a mollis venenatis, nisi libero cursus risus, ut sodales felis erat quis lorem. Praesent nisl turpis, egestas ac auctor et, tempor ac mauris. Donec aliquam lacus nisi, id hendrerit neque aliquam ut. Nullam maximus velit nulla, quis euismod lacus porttitor ac. Nullam lacinia non arcu vitae scelerisque. Nulla nisl nibh, vestibulum eget ex sit amet, viverra vulputate purus. Nullam non arcu ac diam sagittis consectetur.</p> {
<p>@s</p>
}
</div> </div>
<div class="personals-container" style="min-width: 20%;"> <div class="personals-container" style="min-width: 20%;">
<div style="display: flex; flex-direction: row; align-items: center; padding: 0.25em 0; "> <div style="display: flex; flex-direction: row; align-items: center; padding: 0.25em 0; ">

View File

@ -9,84 +9,69 @@
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<div class="container repo-container"> <div class="container repo-container">
@{ @{
//var githubService = GitManager.GetService("github.com"); foreach(Config.ConfigObject.GitRepoObject repo in Config.GetConfig().GitRepos)
//var user = githubService.GetUser(new Uri("https://github.com/KoromaruKoruko")); {
//Console.WriteLine("FOUND USER"); IRepository repository = GitManager.GetService(repo.ServiceProvider).GetRepository(repo.Repository);
//Console.WriteLine(user.Name);
//var repos = user.GetUserRepositories();
//Console.WriteLine("REPOSITORIES");
//foreach(var repo in repos)
// Console.WriteLine(repo.Name);
var client = new HttpClient();
client.DefaultRequestHeaders.Add("User-Agent", "KoromaruKoruko");
client.DefaultRequestHeaders.Add("Authorization", "Bearer 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");
HttpResponseMessage response = await client.GetAsync("https://api.github.com/users/KoromaruKoruko/repos");
JsonDocument json = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
foreach(JsonElement elem in json.RootElement.EnumerateArray()) repository.TryGetCommit(0, out ICommit commit);
{ String[] lastCommitMessage = commit!.Description.Split("\n").Where(s => s != "").ToArray();
int popout_id = Random.Shared.Next();
HttpResponseMessage commitResponse = await client.GetAsync(elem.GetProperty("commits_url").GetString()!.Split('{')[0]);
JsonDocument commitInfo = await JsonDocument.ParseAsync(await commitResponse.Content.ReadAsStreamAsync());
JsonElement commitJson = commitInfo.RootElement.EnumerateArray().First();
String[] lastCommitMessage = commitJson.GetProperty("commit").GetProperty("message")!.GetString()!.Split("\n").Where(s => s != "").ToArray();
// Begin repo // Begin repo
<div class="repo"> <div class="repo">
<div class="repo-title"> <div class="repo-title">
<span class="eps-lineclamp-1">KoromaruKoruko/</span> <span class="eps-lineclamp-1">@repository.Owner.Name/</span>
<span class="eps-lineclamp-1">@elem.GetProperty("name")</span> <span class="eps-lineclamp-1">@repository.Name</span>
</div>
<div class="repo-description eps-lineclamp-2">
@repo.Description.Aggregate((a, b) => a + "\n" + b)
</div>
<div class="popout">
<span class="popout-title">@repo.Description.Aggregate((a, b) => a + "\n" + b)</span>
</div>
<div class="commit">
<img class="commit-author" src="@commit.AuthorAvatarUrl"/>
<div class="commit-info">
<div class="commit-title eps-lineclamp-1">
@if(lastCommitMessage.Length > 0)
{
@lastCommitMessage[0]
}
</div>
<div class="commit-description eps-lineclamp-1">
@if(lastCommitMessage.Length > 1)
{
@lastCommitMessage[1]
}
</div>
</div>
<div class="popout popout-commit">
@if (lastCommitMessage.Length > 0)
{
<span class="popout-title">@lastCommitMessage[0]</span>
<br />
var commitDescription = lastCommitMessage.Skip(1).ToHashSet();
<div class="popout-content">
@if(commitDescription.Count > 0)
@commitDescription.Aggregate((a, b) => a + "\n" + b)
</div>
}
</div> </div>
<div class="repo-description eps-lineclamp-2"> </div>
@elem.GetProperty("description") <div class="repo-footer">
</div> <a class="repo-link" href="@repo.Repository.OriginalString">
<div class="popout"> <span>visit repo >></span>
<span class="popout-title">@elem.GetProperty("description")</span> </a>
</div> <img class="repo-icon" src="/content/img/logos/@repo.ServiceProvider/light.png"/>
<div class="commit">
<img class="commit-author" src="@commitJson.GetProperty("author").GetProperty("avatar_url").GetString()"/>
<div class="commit-info">
<div class="commit-title eps-lineclamp-1">
@if(lastCommitMessage.Length > 0)
{
@lastCommitMessage[0]
}
</div>
<div class="commit-description eps-lineclamp-1">
@if(lastCommitMessage.Length > 1)
{
@lastCommitMessage[1]
}
</div> </div>
</div> </div>
<div class="popout popout-commit">
@if (lastCommitMessage.Length > 0)
{
<span class="popout-title">@lastCommitMessage[0]</span>
<br />
var commitDescription = lastCommitMessage.Skip(1).ToHashSet();
<div class="popout-content">
@if(commitDescription.Count > 0)
@commitDescription.Aggregate((a, b) => a + "\n" + b)
</div>
}
</div>
</div>
<div class="repo-footer">
<a class="repo-link" href="@elem.GetProperty("html_url").GetString()">
<span>visit repo >></span>
</a>
<img class="repo-icon" src="/img/logos/github/Light-64px.png"/>
</div>
</div>
// End repo // End repo
} }
<script> <script>
function processMarkdown(element) { function processMarkdown(element) {
element.getElementsByClassName('popout-content')[0].innerHTML = marked.parse(element.getElementsByClassName('popout-content')[0].innerHTML); element.getElementsByClassName('popout-content')[0].innerHTML = marked.parse(element.getElementsByClassName('popout-content')[0].innerHTML);
} }
Array.from(document.getElementsByClassName('popout-commit')).forEach(processMarkdown); Array.from(document.getElementsByClassName('popout-commit')).forEach(processMarkdown);
</script> </script>
} }
</div> </div>

View File

@ -86,6 +86,9 @@ namespace ExtensiblePortfolioSite
// Load Plugins // Load Plugins
PluginManager.LoadPlugins(Path.GetFullPath("Plugins/")); PluginManager.LoadPlugins(Path.GetFullPath("Plugins/"));
//Initialize Plugins
PluginManager.InitializePlugins();
// TODO: [Resource] File Provider // TODO: [Resource] File Provider
// TODO: [Plugin] Web Static Files Provider // TODO: [Plugin] Web Static Files Provider
// TODO: [Plugin] Web Hook Provider // TODO: [Plugin] Web Hook Provider

View File

@ -13,6 +13,11 @@
"I'm a c# Programmer who prides herself in making things configurable and highly optimized." "I'm a c# Programmer who prides herself in making things configurable and highly optimized."
], ],
// Multi paragraph biography for About Me page
"Biography": [
"I'm a c# Programmer who prides herself in making things configurable and highly optimized."
],
// Languages you'd like to advertise // Languages you'd like to advertise
"Languages": [ "Languages": [
{ {

View File

@ -70,7 +70,7 @@ main .text-center {
} }
.repo-container { .repo-container {
border: solid 1px #444; /*border: solid 1px #444;*/
border-radius: .25em; border-radius: .25em;
width: 81.5em; width: 81.5em;
display: flex; display: flex;

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -20,11 +20,16 @@ namespace GithubPlugin
[JsonIgnore] [JsonIgnore]
public IGitProvider? Provider { get; internal set; } public IGitProvider? Provider { get; internal set; }
[JsonPropertyName("sha")] [JsonIgnore]
public string? Hash { get; private set; } public string? AuthorAvatarUrl { get; internal set; }
[JsonInclude]
[JsonPropertyName("sha")]
public string? Hash { get; init; }
[JsonInclude]
[JsonPropertyName("message")] [JsonPropertyName("message")]
public string? Description { get; private set; } public string? Description { get; init; }
public GitReference GetReference() public GitReference GetReference()
{ {

View File

@ -1,4 +1,5 @@
using ExtensiblePortfolioSite.SDK.Git; using ExtensiblePortfolioSite.SDK;
using ExtensiblePortfolioSite.SDK.Git;
using ExtensiblePortfolioSite.SDK.Plugins; using ExtensiblePortfolioSite.SDK.Plugins;
using System.Text.Json; using System.Text.Json;
@ -6,7 +7,7 @@ using System.Text.RegularExpressions;
namespace GithubPlugin namespace GithubPlugin
{ {
[GitProvider("github.com")] [GitProvider("Github")]
[Serializable] [Serializable]
public class GithubProvider : IGitProvider public class GithubProvider : IGitProvider
{ {
@ -69,7 +70,7 @@ namespace GithubPlugin
public bool TryGetRepositoryByName(IUser User, string RepositoryName, out IRepository? Repository) public bool TryGetRepositoryByName(IUser User, string RepositoryName, out IRepository? Repository)
{ {
if(User.GetType() == typeof(GithubUser)) if(User is GithubUser _user)
{ {
if (Repositories.TryGetValue(RepositoryName, out GithubRepo? _repo)) if (Repositories.TryGetValue(RepositoryName, out GithubRepo? _repo))
{ {
@ -77,15 +78,15 @@ namespace GithubPlugin
return true; return true;
} else } else
{ {
var response = httpClient.GetAsync($"repos/{User.Name}/{RepositoryName}").Result; var response = httpClient.GetAsync($"repos/{_user.Name}/{RepositoryName}").Result;
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
Repository = null; Repository = null;
return false; return false;
} }
GithubRepo tempRepo = JsonSerializer.Deserialize<GithubRepo>(response.Content.ReadAsStream())!; GithubRepo tempRepo = Json.Deserialize<GithubRepo>(response.Content.ReadAsStream())!;
tempRepo.Provider = this; tempRepo.Provider = this;
tempRepo.Owner = User; tempRepo.Owner = _user;
Repository = tempRepo; Repository = tempRepo;
return true; return true;
} }
@ -108,7 +109,7 @@ namespace GithubPlugin
User = null; User = null;
return false; return false;
} }
GithubUser tempUser = JsonSerializer.Deserialize<GithubUser>(response.Content.ReadAsStream())!; GithubUser tempUser = Json.Deserialize<GithubUser>(response.Content.ReadAsStringAsync().Result)!;
tempUser.Provider = this; tempUser.Provider = this;
User = tempUser; User = tempUser;
return true; return true;

View File

@ -1,4 +1,5 @@
using ExtensiblePortfolioSite.SDK.Git; using ExtensiblePortfolioSite.SDK;
using ExtensiblePortfolioSite.SDK.Git;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
@ -7,14 +8,17 @@ namespace GithubPlugin
[Serializable] [Serializable]
public class GithubRepo : IRepository public class GithubRepo : IRepository
{ {
[JsonInclude]
[JsonPropertyName("name")] [JsonPropertyName("name")]
public string Name { get; private set; } public string Name { get; init; }
[JsonInclude]
[JsonPropertyName("description")] [JsonPropertyName("description")]
public string Description { get; private set; } public string Description { get; init; }
[JsonIgnore] [JsonInclude]
public IUser Owner { get; internal set; } [JsonPropertyName("owner")]
public GithubUser Owner { get; internal set; }
[JsonIgnore] [JsonIgnore]
public GithubProvider Provider { get; internal set; } public GithubProvider Provider { get; internal set; }
@ -22,29 +26,16 @@ namespace GithubPlugin
[JsonIgnore] [JsonIgnore]
IGitProvider IGitObject.Provider => this.Provider; IGitProvider IGitObject.Provider => this.Provider;
[JsonIgnore]
IUser IRepository.Owner => this.Owner;
public ICommit? GetCommit(uint HeadOffset = 0) public ICommit? GetCommit(uint HeadOffset = 0)
{ {
var response = Provider.GetAPIResource($"repos/{Owner.Name}/{Name}/commits"); var response = Provider.GetAPIResource($"repos/{Owner.Name}/{Name}/commits");
if(response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ return GetCommitByRef(JsonDocument.Parse(response.Content.ReadAsStream()).RootElement.EnumerateArray().Skip((int)HeadOffset).First().GetProperty("sha").GetString());
JsonDocument json = JsonDocument.Parse(response.Content.ReadAsStream()); else
JsonElement commitObject = json.RootElement.EnumerateArray().Skip((int)HeadOffset).First();
GithubCommit commit = JsonSerializer.Deserialize<GithubCommit>(commitObject.GetProperty("commit"))!;
commit.Provider = Provider;
commit.Repository = this;
List<string> tempFiles = new();
JsonElement files = commitObject.GetProperty("files");
foreach(JsonElement file in files.EnumerateArray())
{
tempFiles.Add(file.GetProperty("filename").GetString()!);
}
commit.ModifiedFiles = tempFiles;
return commit;
} else
{
return null; return null;
}
} }
public ICommit? GetCommitByRef(string reference) public ICommit? GetCommitByRef(string reference)
@ -54,7 +45,8 @@ namespace GithubPlugin
{ {
JsonDocument json = JsonDocument.Parse(response.Content.ReadAsStream()); JsonDocument json = JsonDocument.Parse(response.Content.ReadAsStream());
JsonElement commitObject = json.RootElement; JsonElement commitObject = json.RootElement;
GithubCommit commit = JsonSerializer.Deserialize<GithubCommit>(commitObject.GetProperty("commit"))!; GithubCommit commit = Json.Deserialize<GithubCommit>(commitObject.GetProperty("commit"))!;
commit.AuthorAvatarUrl = commitObject.GetProperty("author").GetProperty("avatar_url").GetString();
commit.Provider = Provider; commit.Provider = Provider;
commit.Repository = this; commit.Repository = this;
List<string> tempFiles = new(); List<string> tempFiles = new();

View File

@ -1,25 +1,24 @@
using ExtensiblePortfolioSite.SDK.Git; using ExtensiblePortfolioSite.SDK;
using System; using ExtensiblePortfolioSite.SDK.Git;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace GithubPlugin namespace GithubPlugin
{ {
[Serializable] [Serializable]
public class GithubUser : IUser public class GithubUser : IUser
{ {
[JsonInclude]
[JsonPropertyName("login")] [JsonPropertyName("login")]
public string Name { get; private set; } public string Name { get; init; }
[JsonInclude]
[JsonPropertyName("id")] [JsonPropertyName("id")]
public int Identifier { get; private set; } public int Identifier { get; init; }
[JsonInclude]
[JsonPropertyName("avatar_url")] [JsonPropertyName("avatar_url")]
public string AvatarURL { get; private set; } public string AvatarURL { get; init; }
[JsonIgnore] [JsonIgnore]
public GithubProvider Provider { get; internal set; } public GithubProvider Provider { get; internal set; }
@ -37,15 +36,13 @@ namespace GithubPlugin
var response = Provider.GetAPIResource($"users/{Name}/repos"); var response = Provider.GetAPIResource($"users/{Name}/repos");
if(response.IsSuccessStatusCode) if(response.IsSuccessStatusCode)
{ {
JsonDocument json = JsonDocument.Parse(response.Content.ReadAsStream()); using Stream STM = response.Content.ReadAsStream();
List<IRepository> ret = new(json.RootElement.GetArrayLength()); foreach (GithubRepo repo in Json.Deserialize<GithubRepo[]>(STM) ?? Array.Empty<GithubRepo>())
foreach(JsonElement repo in json.RootElement.EnumerateArray())
{ {
ret.Add(JsonSerializer.Deserialize<GithubRepo>(repo)!); repo.Provider = this.Provider;
yield return repo;
} }
return ret;
} }
return new List<IRepository>();
} }
} }
} }