URL Api Smash + Slug in HTML
All checks were successful
Build App / Build (push) Successful in 1m36s
All checks were successful
Build App / Build (push) Successful in 1m36s
This commit is contained in:
@@ -27,6 +27,8 @@ namespace LaDOSE.DTO
|
|||||||
public List<GameDTO> Games { get; set; }
|
public List<GameDTO> Games { get; set; }
|
||||||
|
|
||||||
public List<ResultDTO> Results { get; set; }
|
public List<ResultDTO> Results { get; set; }
|
||||||
|
|
||||||
|
public string Slug { get; set; }
|
||||||
}
|
}
|
||||||
public class ResultDTO
|
public class ResultDTO
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -223,8 +223,8 @@ namespace LaDOSE.DesktopApp.Avalonia.ViewModels
|
|||||||
this.To = new DateTimeOffset(DateTime.Now);
|
this.To = new DateTimeOffset(DateTime.Now);
|
||||||
this.From = new DateTimeOffset(DateTime.Now.AddMonths(-1));
|
this.From = new DateTimeOffset(DateTime.Now.AddMonths(-1));
|
||||||
this.SelectRegex = "Ranking";
|
this.SelectRegex = "Ranking";
|
||||||
this.SelectEventRegex = @"Ranking #10\d{2}";
|
this.SelectEventRegex = @"Ranking #13\d{2}";
|
||||||
this.Slug = "ranking-1001";
|
this.Slug = "ranking-130";
|
||||||
|
|
||||||
LoadTournaments();
|
LoadTournaments();
|
||||||
LoadEvents();
|
LoadEvents();
|
||||||
@@ -472,7 +472,7 @@ namespace LaDOSE.DesktopApp.Avalonia.ViewModels
|
|||||||
string url = enumerable.FirstOrDefault()?.TournamentUrl;
|
string url = enumerable.FirstOrDefault()?.TournamentUrl;
|
||||||
url = url.Replace(" ", "-");
|
url = url.Replace(" ", "-");
|
||||||
url = url.Replace(".", "-");
|
url = url.Replace(".", "-");
|
||||||
sb.AppendLine($"<a href=\"https://smash.gg/tournament/ranking-1002/event/{url}\" target=\"_blank\">Voir le Bracket</p></td>");
|
sb.AppendLine($"<a href=\"https://start.gg/tournament/{Results.Slug}/event/{url}\" target=\"_blank\">Voir le Bracket</p></td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace LaDOSE.Entity.Challonge
|
|||||||
public List<Game> Games{ get; set; }
|
public List<Game> Games{ get; set; }
|
||||||
|
|
||||||
public List<Result> Results { get; set; }
|
public List<Result> Results { get; set; }
|
||||||
|
public string Slug { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Result
|
public class Result
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
{
|
{
|
||||||
public class SmashProvider : ISmashProvider
|
public class SmashProvider : ISmashProvider
|
||||||
{
|
{
|
||||||
|
private static string API_FQDN = "api.start.gg";
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
//public SmashProvider(string apiKey)
|
//public SmashProvider(string apiKey)
|
||||||
//{
|
//{
|
||||||
@@ -34,7 +35,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
|
|
||||||
private async Task<T> QuerySmash<T>(GraphQLRequest req)
|
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}");
|
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
|
||||||
|
|
||||||
var graphQLResponse = await graphQLClient.SendQueryAsync<T>(req);
|
var graphQLResponse = await graphQLClient.SendQueryAsync<T>(req);
|
||||||
@@ -346,7 +347,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
public async Task<TournamentResponse> GetNames(string slug)
|
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}");
|
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
|
||||||
var Event = new GraphQLRequest
|
var Event = new GraphQLRequest
|
||||||
{
|
{
|
||||||
@@ -412,7 +413,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
public async Task<TournamentResponse> GetTournament(string slug)
|
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}");
|
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
|
||||||
var Event = new GraphQLRequest
|
var Event = new GraphQLRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,6 +152,10 @@ namespace LaDOSE.Business.Service
|
|||||||
var games = _context.Game.ToList();
|
var games = _context.Game.ToList();
|
||||||
|
|
||||||
TournamentsResult result = new TournamentsResult();
|
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.Results = new List<Result>();
|
||||||
result.Games = new List<Game>();
|
result.Games = new List<Game>();
|
||||||
result.Participents = new List<ChallongeParticipent>();
|
result.Participents = new List<ChallongeParticipent>();
|
||||||
|
|||||||
Reference in New Issue
Block a user