public async Task <InplayEventsResponse> GetInplayEventsAsync(int sportId, string token) { var result = await _retryPolicy.ExecuteAndCaptureAsync(() => _betsApiClient.GetInplayEventsAsync(sportId, token)); return(result.Result); }
private async Task <List <int> > GetInplayGameIds() { var result = new List <int>(); var response = await _betsApiClient.GetInplayEventsAsync((int)SportId.TableTennis, _configuration.BetsApiAccessToken); if (response?.Results == null) { return(result); } foreach (var e in response.Results) { var wasRetrieved = await _eventsRepository.ExistsAsync(e.Id); if (wasRetrieved) { continue; } result.Add(e.Id); await _eventsRepository.AddAsync(e.Id); } return(result); }