1- using System . Net . Http . Headers ;
2- using System . Text . Json ;
1+ using System . Text . Json ;
32using System . Text . Json . Serialization . Metadata ;
43using NGitLab ;
54using Ryujinx . Systems . Update . Server . Helpers . Http ;
@@ -10,7 +9,7 @@ public class GitLabService
109{
1110 private static readonly GitLabReleaseJsonResponseSerializerContext ReleaseSerializerContext =
1211 new ( ) ;
13-
12+
1413 private readonly IHttpClientProxy _http ;
1514 public GitLabClient Client { get ; }
1615
@@ -19,15 +18,16 @@ public class GitLabService
1918 public GitLabService ( IConfiguration config , ILogger < GitLabService > logger , DefaultHttpClientProxy httpClient )
2019 {
2120 _logger = logger ;
22-
21+
2322 var gitlabSection = config . GetSection ( "GitLab" ) ;
24-
23+
2524 if ( ! gitlabSection . Exists ( ) )
26- throw new Exception ( $ "The '{ gitlabSection . Key } ' section does not exist in your appsettings.json. You need to provide an 'Endpoint', 'AccessToken', and optionally 'RefreshIntervalMinutes' values.") ;
25+ throw new Exception (
26+ $ "The '{ gitlabSection . Key } ' section does not exist in your appsettings.json. You need to provide an 'Endpoint', 'AccessToken', and optionally 'RefreshIntervalMinutes' values.") ;
2727
2828 var host = gitlabSection . GetValue < string > ( "Endpoint" ) ! . TrimEnd ( '/' ) ;
2929 var accessToken = gitlabSection . GetValue < string > ( "AccessToken" ) ;
30-
30+
3131 Client = new GitLabClient ( host , accessToken ) ;
3232 _http = httpClient ;
3333 }
@@ -41,8 +41,8 @@ public GitLabService(IConfiguration config, ILogger<GitLabService> logger, Defau
4141
4242 return JsonSerializer . Deserialize ( contentString , typeInfo ) ;
4343 }
44-
45- public Task < GitLabReleaseJsonResponse ? > GetLatestReleaseAsync ( long projectId )
44+
45+ public Task < GitLabReleaseJsonResponse ? > GetLatestReleaseAsync ( long projectId )
4646 => GetReleaseAsync ( projectId , "permalink/latest" ) ;
4747
4848 public async Task < GitLabReleaseJsonResponse ? > GetReleaseAsync ( long projectId , string tagName ) =>
@@ -51,9 +51,14 @@ await _http.GetAsync($"api/v4/projects/{projectId}/releases/{tagName}"),
5151 ReleaseSerializerContext . GitLabReleaseJsonResponse
5252 ) ;
5353
54- public PaginatedEndpoint < GitLabReleaseJsonResponse > GetReleasesAsync ( long projectId )
55- => PaginatedEndpoint < GitLabReleaseJsonResponse > . Builder ( _http )
54+ public PaginatedEndpoint < GitLabReleaseJsonResponse > PageReleases ( long projectId )
55+ => _http . Paginate < GitLabReleaseJsonResponse > ( builder => builder
5656 . WithBaseUrl ( $ "api/v4/projects/{ projectId } /releases")
57+ . WithPerPageCount ( 100 )
5758 . WithJsonContentParser ( ReleaseSerializerContext . IEnumerableGitLabReleaseJsonResponse )
58- . WithQueryStringParameters ( QueryParams . Sort ( "desc" ) , QueryParams . OrderBy ( "created_at" ) ) ;
59+ . WithQueryStringParameters (
60+ QueryParams . Sort ( "desc" ) ,
61+ QueryParams . OrderBy ( "created_at" )
62+ )
63+ ) ;
5964}
0 commit comments