/// <summary> /// Gets a Players Halo: Reach Game History /// </summary> /// <param name="gamertag">The players Xbox 360 Gamertag.</param> /// <param name="variantClass">The variant to get history from.</param> /// <param name="page">The pagination index.</param> /// <returns>Retuens a <see cref="GameHistory"/> model.</returns> public GameHistory GetPlayerGameHistory(string gamertag, VariantClass variantClass, uint page = 0) { const BlobType blobType = BlobType.PlayerGameHistory; var escapedGamertag = EscapeGamertag(gamertag); var gameHistoryNameFormat = string.Format("{0}-{1}-{2}", escapedGamertag, (int)variantClass, page); var blobContainerPath = GenerateBlobContainerPath(blobType, gameHistoryNameFormat); var blob = _storage.Blob.GetBlob(_storage.Blob.HReachBlobContainer, blobContainerPath); var blobValidity = CheckBlobValidity <GameHistory>(blob, new TimeSpan(0, 5, 0)); // Check if blob exists & expire date if (blobValidity.Item1) { return(blobValidity.Item2); } // Try and get new blob var endpoint = String.Format("player/gamehistory/{0}/{1}/{2}/{3}", ApiKey, gamertag, (int)variantClass, page); var gameHistoryRaw = ValidateResponseAndGetRawText(UnauthorizedRequest(endpoint)); var gameHistory = ParseJsonResponse <GameHistory>(gameHistoryRaw); if (gameHistory == null) { return(blobValidity.Item2); } _storage.Blob.UploadBlob(_storage.Blob.HReachBlobContainer, blobContainerPath, gameHistoryRaw); return(gameHistory); }
public HistoryViewModel(ServiceRecord serviceRecord, VariantClass variantClass, uint page, GameHistory gameHistory) : base(serviceRecord) { VariantClass = variantClass; Page = page; GameHistory = gameHistory; }
public HistoryViewModel(ServiceRecord serviceRecord, VariantClass variantClass, uint page, GameHistory gameHistory) : base(serviceRecord) { VariantClass = variantClass; Page = page; GameHistory = gameHistory; }