public async Task <string> GetEmplemImageUrl(string gamertag, ImageSize size = ImageSize.ExtraSmall) { gamertag = gamertag.ToUpper(); var data = await _db.FindAsync <EmblemImageData>(gamertag); if (data == null || (DateTime.UtcNow - data.Timestamp.ToUniversalTime()).TotalDays > 3) { var query = new GetEmblemImage().ForPlayer(gamertag).Size((int)size); var image = await _session.Query(query); if (image == null) { return(null); } if (data == null) { data = new EmblemImageData(gamertag, image.Uri, DateTime.UtcNow); _db.InsertAsync(data); } else { data.Data = image.Uri; data.Timestamp = DateTime.UtcNow; //await _db.UpdateAsync(data); } } return(data.Data); }
public async Task <MatchSet> GetMatchesForPlayer(string gamertag, int start = 0, int count = 10, params Enumeration.GameMode[] gameModes) { var query = new GetMatches().ForPlayer(gamertag).Skip(start).Take(count); if (gameModes != null && gameModes.Length > 0) { if (gameModes.Length == 1) { query.InGameMode(gameModes[0]); } else { query.InGameModes(gameModes.ToList()); } } var matches = await _session.Query(query); foreach (var match in matches.Results) { match.Map = await _metadataRepository.GetMap(match.MapId); if (match.MapVariant != null && match.MapVariant.ResourceType == Enumeration.ResourceType.MapVariant && match.MapVariant.OwnerType == Enumeration.OwnerType.Official) { match.MapVariantInfo = await _metadataRepository.GetMapVariant(match.MapVariant.ResourceId); } match.GameBaseVariant = await _metadataRepository.GetGameBaseVariant(match.GameBaseVariantId); if (match.GameVariant != null && match.GameVariant.ResourceType == Enumeration.ResourceType.GameVariant && match.GameVariant.OwnerType == Enumeration.OwnerType.Official) { match.GameVariantInfo = await _metadataRepository.GetGameVariant(match.GameVariant.ResourceId); } if (match.HopperId.HasValue) { match.Playlist = await _metadataRepository.GetPlaylist(match.HopperId.Value); } if (match.SeasonId.HasValue) { match.Season = await _metadataRepository.GetSeason(match.SeasonId); } if (match.Teams != null) { foreach (var team in match.Teams) { team.TeamColor = await _metadataRepository.GetTeamColor(team.Id); } } } return(matches); }
private async Task PrintHalo5MatchHistoryForPlayer(string player) { var query = new Query.Halo5.Stats.GetMatchHistory(player); var matchSet = await _haloSession.Query(query); foreach (var match in matchSet.Results) { Print($" Halo 5: {match.Id.MatchId}", ConsoleColor.Cyan); } }
public async Task Query_DoesNotThrow(string guid) { var query = new GetMapVariant(new Guid(guid)); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MapVariant), result); Assert.AreEqual(_mapVariant, result); }
public async Task Query_DoesNotThrow(string guid) { var query = new GetRequisition(new Guid(guid)); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(Requisition), result); Assert.AreEqual(_requisition, result); }
public async Task Query_DoesNotThrow(string guid) { var query = new GetMatchEvents(new Guid(guid)) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MatchEventSummary), result); Assert.AreEqual(_matchEventSummary, result); }
public async Task Query_DoesNotThrow() { var query = new GetArenaMatchDetails() .ForMatchId(Guid.Empty); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(ArenaMatch), result); Assert.AreEqual(_arenaMatch, result); }
public async Task Query_DoesNotThrow(string player) { var query = new GetMatchHistory(player) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MatchSet <Model.HaloWars2.Stats.PlayerMatch>), result); Assert.AreEqual(_response, result); }
public async Task Query_DoesNotThrow() { var query = new HaloSharp.Query.HaloWars2.Metadata.GetCompetitiveSkillRankDesignations() .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(PagedResponse <ContentItemTypeA <Model.HaloWars2.Metadata.CompetitiveSkillRankDesignation.View> >), result); Assert.AreEqual(_response, result); }
public async Task Query_DoesNotThrow() { var query = new GetFlexibleStats() .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(List <FlexibleStat>), result); Assert.AreEqual(_flexibleStats, result); }
public async Task Query_DoesNotThrow() { var query = new GetWarzoneServiceRecord("Player") .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(WarzoneServiceRecord), result); Assert.AreEqual(_warzoneServiceRecord, result); }
public async Task Query_DoesNotThrow() { var query = new GetMatches() .ForPlayer("Player"); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MatchSet), result); Assert.AreEqual(_matchSet, result); }
public async Task Query_DoesNotThrow() { var query = new HaloSharp.Query.HaloWars2.Metadata.GetGameObjectCategories() .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(PagedResponse <ContentItemTypeA <Model.HaloWars2.Metadata.GameObjectCategory.View> >), result); Assert.AreEqual(_response, result); }
public async Task Query_DoesNotThrow() { var query = new GetRequisition() .ForRequisitionId(Guid.Empty); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(Requisition), result); Assert.AreEqual(_requisition, result); }
public async Task Query_DoesNotThrow() { var query = new GetMapVariant() .ForMapVariantId(Guid.Empty); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MapVariant), result); Assert.AreEqual(_mapVariant, result); }
public async Task Query_DoesNotThrow(string gamertag, string guid) { var query = new GetGameVariant(gamertag, new Guid(guid)) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(GameVariant), result); Assert.AreEqual(_gameVariant, result); }
public async Task Query_DoesNotThrow(string gamertag) { var query = new ListMapVariants(gamertag) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MapVariantResult), result); Assert.AreEqual(_mapVariantResult, result); }
public async Task Query_DoesNotThrow(string seasonId, string playlistId) { var query = new GetLeaderboard(new Guid(seasonId), new Guid(playlistId)) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(Leaderboard), result); Assert.AreEqual(_leaderboard, result); }
public async Task Query_DoesNotThrow(string gamertag) { var query = new GetCampaignSummary(gamertag) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(CampaignSummary), result); Assert.AreEqual(_response, result); }
public async Task Query_DoesNotThrow(string gamertag) { var query = new GetPlayerAppearance(gamertag) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(PlayerAppearance), result); Assert.AreEqual(_playerAppearance, result); }
public async Task Query_DoesNotThrow(string guid) { var query = new GetCampaignMatchDetails(new Guid(guid)) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(CampaignMatch), result); Assert.AreEqual(_campaignMatch, result); }
public async Task Query_DoesNotThrow() { var query = new GetGameBaseVariants() .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(List <GameBaseVariant>), result); Assert.AreEqual(_gameBaseVariants, result); }
public async Task Query_DoesNotThrow() { var query = new GetCompetitiveSkillRankDesignations() .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(List <CompetitiveSkillRankDesignation>), result); Assert.AreEqual(_competitiveSkillRankDesignations, result); }
public async Task Query_DoesNotThrow() { var query = new GetCustomServiceRecord() .ForPlayer("Player"); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(CustomServiceRecord), result); Assert.AreEqual(_customServiceRecord, result); }
public async Task Query_DoesNotThrow(string gamertag) { var query = new GetMatchHistory(gamertag) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MatchSet <PlayerMatch>), result); Assert.AreEqual(_matchSet, result); }
public async Task Query_DoesNotThrow() { var query = new GetSeasons() .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(List <Season>), result); Assert.AreEqual(_seasons, result); }
public async Task Query_DoesNotThrow() { var query = new GetMatchEvents() .ForMatchId(Guid.Empty) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MatchEvents), result); Assert.AreEqual(_matchEvents, result); }
public async Task Query_DoesNotThrow(string gamertag, string guid) { var query = new GetMapVariant() .ForPlayer(gamertag) .ForMapVariantId(new Guid(guid)) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(MapVariant), result); Assert.AreEqual(_mapVariant, result); }
public async Task Query_DoesNotThrow(string companyID) { Guid companyId = new Guid(companyID); var query = new GetSpartanCompany(companyId) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(SpartanCompany), result); Assert.AreEqual(_spartanCompany, result); }
public async Task Query_DoesNotThrow(string guid) { var matchId = new Guid(guid); var query = new GetMatchDetails(matchId) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(Match), result); Assert.AreEqual(_response, result); }