Skip to content

Commit

Permalink
Update Urls /
Browse files Browse the repository at this point in the history
  • Loading branch information
TheR00st3r committed Nov 3, 2023
1 parent fc37b7c commit ec6f0ea
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions PugSharp.ApiStats/ApiStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public class ApiStats : IDisposable
public ApiStats(string apiStatsUrl, string apiStatsKey)
{
_Logger.LogInformation("Create Api Stats with BaseUrl: {url}", apiStatsUrl);

if (!apiStatsUrl.EndsWith('/'))
{
apiStatsUrl += "/";
}

_HttpClient = new HttpClient()
{
BaseAddress = new Uri(apiStatsUrl),
Expand All @@ -30,7 +36,7 @@ public async Task SendGoingLiveAsync(GoingLiveParams goingLiveParams, Cancellati
{ApiStatsConstants.StatsMapName, goingLiveParams.MapName}
};

var uri = QueryHelpers.AddQueryString($"/golive/{goingLiveParams.MapNumber}", queryParams);
var uri = QueryHelpers.AddQueryString($"golive/{goingLiveParams.MapNumber}", queryParams);

var response = await _HttpClient.PostAsync(uri, null, cancellationToken).ConfigureAwait(false);

Expand All @@ -46,7 +52,7 @@ public async Task SendMapResultAsync(MapResultParams mapResultParams, Cancellati
{ApiStatsConstants.StatsMapWinner, mapResultParams.WinnerTeamName}
};

var uri = QueryHelpers.AddQueryString($"/finalize/{mapResultParams.MapNumber}", queryParams);
var uri = QueryHelpers.AddQueryString($"finalize/{mapResultParams.MapNumber}", queryParams);

var response = await _HttpClient.PostAsync(uri, null, cancellationToken).ConfigureAwait(false);

Expand All @@ -61,7 +67,7 @@ public async Task SendRoundStatsUpdateAsync(RoundStatusUpdateParams roundStatusU
{"team2score", CreateIntParam(roundStatusUpdateParams.CurrentMap.Team2.Score)},
};

var uri = QueryHelpers.AddQueryString($"/updateround/{roundStatusUpdateParams.MapNumber}", queryParams);
var uri = QueryHelpers.AddQueryString($"updateround/{roundStatusUpdateParams.MapNumber}", queryParams);

var response = await _HttpClient.PostAsync(uri, null, cancellationToken).ConfigureAwait(false);

Expand Down Expand Up @@ -127,7 +133,7 @@ private async Task UpdatePlayerStatsInternalAsync(int mapNumber, TeamInfo teamIn
{ApiStatsConstants.StatsMvp, CreateIntParam(playerStatistics.Mvp)},
};

var uri = QueryHelpers.AddQueryString($"/updateplayer/{mapNumber}", queryParams);
var uri = QueryHelpers.AddQueryString($"updateplayer/{mapNumber}", queryParams);

var response = await _HttpClient.PostAsync(uri, null, cancellationToken).ConfigureAwait(false);

Expand All @@ -149,7 +155,7 @@ public async Task SendSeriesResultAsync(SeriesResultParams seriesResultParams, C
{ApiStatsConstants.StatsSeriesForfeit, CreateIntParam(Convert.ToInt32(seriesResultParams.Forfeit))},
};

var uri = QueryHelpers.AddQueryString($"/finalize", queryParams);
var uri = QueryHelpers.AddQueryString($"finalize", queryParams);

var response = await _HttpClient.PostAsync(uri, null, cancellationToken).ConfigureAwait(false);

Expand All @@ -163,7 +169,7 @@ public async Task SendSeriesResultAsync(SeriesResultParams seriesResultParams, C

internal async Task SendFreeServerInternalAsync(CancellationToken cancellationToken)
{
var response = await _HttpClient.PostAsync(new Uri("/freeserver"), null, cancellationToken).ConfigureAwait(false);
var response = await _HttpClient.PostAsync(new Uri("freeserver"), null, cancellationToken).ConfigureAwait(false);

await HandleResponseAsync(response, cancellationToken).ConfigureAwait(false);
}
Expand Down

0 comments on commit ec6f0ea

Please sign in to comment.