public async Task <ItemMarketPrice> GetItemPriceAsync(uint appId, string hashName) { var url = _steamUrlService.GetItemPriceUrl(appId, hashName); var response = await _requestService.GetRequestAsync <ItemPriceResponseModel>(url); _logger.LogDebug($"Got lowest price '{response.LowestPriceString}' for '{hashName}'"); return(response.ToModel(appId, hashName)); }
public async Task <List <InventoryItem> > GetInventoryAsync() { var url = _steamUrlService.GetCurrentInventoryUrl(); var responseModel = await _requestService.GetRequestAsync <InventoryResponseModel>(url); var result = InventoryHelper.MapAssets(responseModel.Assets, responseModel.Descriptions) .Select(x => x.asset.ToModel(x.description)) .ToList(); return(result); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { var url = _steamUrlService.GetNotificationsCountUrl(); while (!stoppingToken.IsCancellationRequested) { try { await _requestService.GetRequestAsync(url); } catch (InternalException ex) { if (ex.Error == InternalError.RequestBadRequest) { _logger.LogInformation("Token is invalid, please refresh it."); } } await Task.Delay(CheckDelay, stoppingToken); } }