public async Task <List <Session> > GetLiveSessionsAsync()
        {
            _logger.Info("Querying live sessions...");

            var utcNow = DateTime.UtcNow;

            var request = _client
                          .NewRequest(SessionOccurrence)
                          .WithField(Session.UIDField)
                          .WithField(Session.NameField)
                          .WithField(Session.SessionNameField)
                          .WithField(Session.StatusField)
                          .WithField(Session.StartTimeField)
                          .WithField(Session.EndTimeField)
                          .WithField(Session.EventOccurrenceUrlField)
                          .WithField(Session.SeriesUrlField)
                          .WithFilter(Session.StartTimeField, LarkFilterType.LessThan, utcNow.AddDays(1).ToString("yyyy-MM-ddTHH:mm:ss"))
                          .WithFilter(Session.EndTimeField, LarkFilterType.GreaterThan, utcNow.AddDays(-1).ToString("yyyy-MM-ddTHH:mm:ss"))
                          .OrderBy(Session.StartTimeField, LarkSortDirection.Descending)
            ;

            var sessions = (await _client.GetCollectionAsync <Session>(request)).Objects;

            _logger.Info($"Found {sessions.Count} live sessions.");

            return(sessions);
        }
Exemple #2
0
        public async Task <List <Season> > GetRaceSeasonsAsync()
        {
            _logger.Info("Querying race seasons...");

            var request = _f1tvClient
                          .NewRequest(RaceSeason)
                          .WithField(Season.UIDField)
                          .WithField(Season.NameField)
                          .WithField(Season.HasContentField)
                          .WithField(Season.YearField)
                          .WithField(Season.EventOccurrenceUrlsField)
                          .WithFilter(Season.YearField, LarkFilterType.GreaterThan, "2017")
                          .WithFilter(Season.HasContentField, LarkFilterType.Equals, "true")
                          .OrderBy(Season.YearField, LarkSortDirection.Descending)
            ;

            var seasons = (await _f1tvClient.GetCollectionAsync <Season>(request)).Objects;

            _logger.Info($"Found {seasons.Count} race seasons.");

            return(seasons);
        }