Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
Extend query search from 30 to 100 entries
Browse files Browse the repository at this point in the history
Resolves immediate inconsistency due to reaching previous cap of 30 mods.
  • Loading branch information
Aceba1 committed May 9, 2021
1 parent 95383a4 commit f8f8385
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions TerraTech Mod Manager/Github Downloader/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ public static bool MorePagesAvailable
get => Counted < TotalCount;
}

public static string SearchReposURL(string search, double page = 0) => "https://api.github.com/search/repositories" +
$"?per_page=100&page:{page}&q=topic:ttqmm{(string.IsNullOrEmpty(search) ? "" : "+" + search)}";

public static GithubRepoItem GetOneRepo(string CloudName)
{
return WebClientHandler.DeserializeApiCall<GithubRepoItem>("https://api.github.com/repos/" + CloudName);
}

public static GithubRepoItem[] GetFirstPage(string Search = "")
public static GithubRepoItem[] GetFirstPage(string search = "")
{
GetRepos.Search = Uri.EscapeUriString(Search);
var repos = WebClientHandler.DeserializeApiCall<GithubRepos>("https://api.github.com/search/repositories?q=topic:ttqmm" + (GetRepos.Search != "" ? "+" + Search : ""));
Search = Uri.EscapeUriString(search);
var repos = WebClientHandler.DeserializeApiCall<GithubRepos>(SearchReposURL(Search));
Counted = repos.items.Length;
Page = 0;
TotalCount = repos.total_count;
Expand All @@ -54,7 +57,7 @@ public static GithubRepoItem[] GetFirstPage(string Search = "")
public static GithubRepoItem[] GetNextPage()
{
Page++;
var repos = WebClientHandler.DeserializeApiCall<GithubRepos>("https://api.github.com/search/repositories?q=topic:ttqmm" + (Search != "" ? "+" + Search : "") + "&page:" + Page.ToString());
var repos = WebClientHandler.DeserializeApiCall<GithubRepos>(SearchReposURL(Search, Page));
Counted += repos.items.Length;
if (TotalCount != repos.total_count)
{
Expand Down

0 comments on commit f8f8385

Please sign in to comment.