public virtual async Task <IEnumerable <PubgTelemetryEvent> > GetTelemetryAsync(PubgRegion region, string url, CancellationToken cancellationToken = default(CancellationToken)) { var collectionJson = await HttpRequestor.GetStringAsync(url, cancellationToken); return(JsonConvert.DeserializeObject <IEnumerable <PubgTelemetryEvent> >(collectionJson, new JsonSerializerSettings { ContractResolver = new TelemetryContractResolver(region.Serialize()) })); }
public async Task <PubgMatchSample> GetMatchSamplesAsync(PubgPlatform platform, GetSamplesRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var url = RequestBuilder.BuildRequestUrl(Api.Samples.SamplesEndpoint(platform), request); var apiKey = string.IsNullOrEmpty(request.ApiKey) ? ApiKey : request.ApiKey; var collectionJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <IEnumerable <PubgMatchSample> >(collectionJson, new JsonApiSerializerSettings()).FirstOrDefault()); }
public virtual async Task <IEnumerable <PubgPlayer> > GetPlayersAsync(PubgPlatform platform, GetPubgPlayersRequest filter, CancellationToken cancellationToken = default(CancellationToken)) { var url = RequestBuilder.BuildRequestUrl(Api.Players.PlayersEndpoint(platform), filter); var apiKey = string.IsNullOrEmpty(filter.ApiKey) ? ApiKey : filter.ApiKey; var collectionJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <IEnumerable <PubgPlayer> >(collectionJson, new JsonApiSerializerSettings())); }
public async virtual Task <PubgMatch> GetMatchAsync(PubgRegion region, string matchId, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = string.Format(Api.Matches.MatchesEndpoint + "/{1}", region.Serialize(), matchId); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var matchJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey); return(JsonConvert.DeserializeObject <IEnumerable <PubgMatch> >(matchJson, new JsonApiSerializerSettings()).FirstOrDefault()); }
/// <summary> /// Get a list of seasons for the specified region on Xbox /// </summary> /// <param name="platform">The platform you wish to get the seasons for</param> /// <param name="apiKey">Your api key (optional)</param> /// <returns>A list of seasons and their information</returns> /// <exception cref="Pubg.Net.Exceptions.PubgException">Exception thrown on the API side, details included on object</exception> /// <exception cref="Pubg.Net.Exceptions.PubgTooManyRequestsException">You have exceeded your rate limit</exception> /// <exception cref="Pubg.Net.Exceptions.PubgUnauthorizedException">Invalid API Key</exception> public async virtual Task <IEnumerable <PubgSeason> > GetSeasonsXboxAsync(PubgRegion region, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = Api.Seasons.SeasonsXboxEndpoint(region); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var seasonJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <IEnumerable <PubgSeason> >(seasonJson, new JsonApiSerializerSettings())); }
public virtual async Task <PubgStatEntity> GetPlayerLifetimeStatsAsync(PubgPlatform platform, string playerId, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = Api.Players.PlayerSeasonsEndpoint(platform, playerId, LIFETIME_SEASON_NAME); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var seasonJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <PubgStatEntity>(seasonJson, new JsonApiSerializerSettings())); }
public virtual async Task <PubgPlayer> GetPlayerAsync(PubgPlatform platform, string playerId, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = Api.Players.PlayersEndpoint(platform, playerId); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var playerJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <PubgPlayer>(playerJson, new JsonApiSerializerSettings())); }
public async virtual Task <PubgPlayerSeason> GetPlayerSeasonAsync(PubgRegion region, string playerId, string seasonId, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = string.Format(Api.Players.PlayerSeasonsEndpoint, region.Serialize(), playerId, seasonId); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var seasonJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey); return(JsonConvert.DeserializeObject <PubgPlayerSeason>(seasonJson, new JsonApiSerializerSettings())); }
public virtual async Task <PubgLeaderboard> GetGameModeLeaderboardAsync(PubgPlatform platform, PubgGameMode gameMode, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = Api.Leaderboard.LeaderboardEndpoint(platform, gameMode); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var leaderboardJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <PubgLeaderboard>(leaderboardJson, new JsonApiSerializerSettings())); }
public virtual async Task <PubgStatus> GetStatusAsync(string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = Api.Status.StatusEndpoint(); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var objectJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <PubgStatus>(objectJson, new JsonApiSerializerSettings())); }
public async virtual Task <PubgTournament> GetTournamentAsync(string tournamentId, string apiKey = null, CancellationToken cancellationToken = default(CancellationToken)) { var url = Api.Tournaments.TournamentsEndpoint(tournamentId); apiKey = string.IsNullOrEmpty(apiKey) ? ApiKey : apiKey; var matchJson = await HttpRequestor.GetStringAsync(url, cancellationToken, apiKey).ConfigureAwait(false); return(JsonConvert.DeserializeObject <PubgTournament>(matchJson, new JsonApiSerializerSettings())); }
public virtual async Task <IEnumerable <PubgTelemetryEvent> > GetTelemetryAsync(PubgRegion region, string url, CancellationToken cancellationToken = default(CancellationToken)) { var collectionJson = await HttpRequestor.GetStringAsync(url, cancellationToken).ConfigureAwait(false); return(JsonConvert.DeserializeObject <IEnumerable <PubgTelemetryEvent> >(collectionJson)); }