-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move mappings and AES to Fortnite Central
- Loading branch information
1 parent
ffedb2b
commit 88383c3
Showing
6 changed files
with
55 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
FModel/ViewModels/ApiEndpoints/FortniteCentralApiEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using FModel.Framework; | ||
using FModel.ViewModels.ApiEndpoints.Models; | ||
using RestSharp; | ||
using Serilog; | ||
|
||
namespace FModel.ViewModels.ApiEndpoints; | ||
|
||
public class FortniteCentralApiEndpoint : AbstractApiProvider | ||
{ | ||
public FortniteCentralApiEndpoint(RestClient client) : base(client) | ||
{ | ||
} | ||
|
||
public async Task<AesResponse> GetAesKeysAsync(CancellationToken token) | ||
{ | ||
var request = new FRestRequest("https://fortnitecentral.gmatrixgames.ga/api/v1/aes") | ||
{ | ||
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; } | ||
}; | ||
var response = await _client.ExecuteAsync<AesResponse>(request, token).ConfigureAwait(false); | ||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString); | ||
return response.Data; | ||
} | ||
|
||
public AesResponse GetAesKeys(CancellationToken token) | ||
{ | ||
return GetAesKeysAsync(token).GetAwaiter().GetResult(); | ||
} | ||
|
||
public async Task<MappingsResponse[]> GetMappingsAsync(CancellationToken token) | ||
{ | ||
var request = new FRestRequest("https://fortnitecentral.gmatrixgames.ga/api/v1/mappings") | ||
{ | ||
OnBeforeDeserialization = resp => { resp.ContentType = "application/json; charset=utf-8"; } | ||
}; | ||
var response = await _client.ExecuteAsync<MappingsResponse[]>(request, token).ConfigureAwait(false); | ||
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString); | ||
return response.Data; | ||
} | ||
|
||
public MappingsResponse[] GetMappings(CancellationToken token) | ||
{ | ||
return GetMappingsAsync(token).GetAwaiter().GetResult(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters