public async Task <AvailableGamesResponse> FetchGamesAsync(CancellationToken token) { var endpoint = configurationProvider.GetConnectionStringById(connectionStringKey); var response = await webGateway.GetResponseFromEndpoint <ResponseDao>(endpoint, token); if (response.Succeeded) { var games = response.Value.AvailableGames.Select(ConvertGameDao).ToList(); return(AvailableGamesResponse.Succeeded(games)); } return(AvailableGamesResponse.Failed(response.ResultMessage)); }
public async Task <AvailableGamesResponse> FetchGamesAsync(CancellationToken token) { var localStorageResponse = await storageProvider.Get(storageKey); if (!localStorageResponse.Succeeded) { return(await FetchAndUpdateGamesCache(token)); } var cachedGamesList = ((CachedGameList)localStorageResponse.Value); var cacheCheck = await cachChecker.IsCacheOutOfDate(cachedGamesList.TimeCachedUtc, token); if (!cacheCheck.IsOutOfDate) { return(AvailableGamesResponse.Succeeded(cachedGamesList.GamesList)); } return(await FetchAndUpdateGamesCache(token)); }