URL Api Smash + Slug in HTML
All checks were successful
Build App / Build (push) Successful in 1m36s

This commit is contained in:
2025-03-07 10:56:24 +01:00
parent fba822a0af
commit a9150ff58c
5 changed files with 15 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
{
public class SmashProvider : ISmashProvider
{
private static string API_FQDN = "api.start.gg";
public string ApiKey { get; set; }
//public SmashProvider(string apiKey)
//{
@@ -34,7 +35,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
private async Task<T> QuerySmash<T>(GraphQLRequest req)
{
var graphQLClient = new GraphQLHttpClient("https://api.smash.gg/gql/alpha", new NewtonsoftJsonSerializer());
var graphQLClient = new GraphQLHttpClient($"https://{API_FQDN}/gql/alpha", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
var graphQLResponse = await graphQLClient.SendQueryAsync<T>(req);
@@ -346,7 +347,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
public async Task<TournamentResponse> GetNames(string slug)
{
var graphQLClient = new GraphQLHttpClient("https://api.smash.gg/gql/alpha", new NewtonsoftJsonSerializer());
var graphQLClient = new GraphQLHttpClient($"https://{API_FQDN}/gql/alpha", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
var Event = new GraphQLRequest
{
@@ -412,7 +413,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
public async Task<TournamentResponse> GetTournament(string slug)
{
var graphQLClient = new GraphQLHttpClient("https://api.smash.gg/gql/alpha", new NewtonsoftJsonSerializer());
var graphQLClient = new GraphQLHttpClient($"https://{API_FQDN}/gql/alpha", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
var Event = new GraphQLRequest
{

View File

@@ -148,10 +148,14 @@ namespace LaDOSE.Business.Service
players = players.Concat(e.Tournaments.SelectMany(e => e.Results.Select(e => e.Player)).Distinct().ToList()).ToList();
cevent.Tournaments = cevent.Tournaments.Concat(e.Tournaments).ToList();
}
var games = _context.Game.ToList();
TournamentsResult result = new TournamentsResult();
if (id.Count == 1)
{
result.Slug = _context.Event.Where(e=> e.Id == id.First()).First().SmashSlug;
}
result.Results = new List<Result>();
result.Games = new List<Game>();
result.Participents = new List<ChallongeParticipent>();