mirror of
https://github.com/4sval/FModel.git
synced 2026-04-19 16:17:44 -05:00
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using FModel.Framework;
|
|
using RestSharp;
|
|
using Serilog;
|
|
|
|
namespace FModel.ViewModels.ApiEndpoints;
|
|
|
|
public class FortniteCentralApiEndpoint : AbstractApiProvider
|
|
{
|
|
public FortniteCentralApiEndpoint(RestClient client) : base(client) { }
|
|
|
|
public async Task<Dictionary<string, Dictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en")
|
|
{
|
|
var request = new FRestRequest("https://fortnitecentral.genxgames.gg/api/v1/hotfixes")
|
|
{
|
|
Interceptors = [_interceptor]
|
|
};
|
|
request.AddParameter("lang", language);
|
|
var response = await _client.ExecuteAsync<Dictionary<string, Dictionary<string, string>>>(request, token).ConfigureAwait(false);
|
|
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
|
|
return response.Data;
|
|
}
|
|
|
|
public Dictionary<string, Dictionary<string, string>> GetHotfixes(CancellationToken token, string language = "en")
|
|
{
|
|
return GetHotfixesAsync(token, language).GetAwaiter().GetResult();
|
|
}
|
|
}
|