public async Task <Event> GetEventAsync(string eventUID) { _logger.Info($"Querying event with UID '{eventUID}'..."); var request = _f1tvClient .NewRequest(EventOccurrence, eventUID) .WithField(Event.UIDField) .WithField(Event.NameField) .WithField(Event.OfficialNameField) .WithField(Event.SessionOccurrenceUrlsField) .WithField(Event.StartDateField) .WithField(Event.EndDateField) ; var evt = await _f1tvClient.GetItemAsync <Event>(request); if (evt != null) { _logger.Info($"Found event '{evt}'."); } else { _logger.Info("Event not found."); } return(evt); }
public async Task <List <Channel> > GetChannelsForSessionAsync(string sessionUID) { _logger.Info($"Querying channels for session with UID '{sessionUID}'..."); var request = _client .NewRequest(SessionOccurrence, sessionUID) .WithField(Session.ChannelUrlsField, true) .WithSubField(Session.ChannelUrlsField, Channel.UIDField) .WithSubField(Session.ChannelUrlsField, Channel.SelfField) .WithSubField(Session.ChannelUrlsField, Channel.NameField) .WithSubField(Session.ChannelUrlsField, Channel.ChannelTypeField) .WithSubField(Session.ChannelUrlsField, Channel.DriverOccurrenceUrlsField) ; var channels = (await _client.GetItemAsync <Session>(request)).ChannelUrls; _logger.Info($"Found {channels.Count} channels."); return(channels); }
public async Task <List <Channel> > GetChannelsForSessionAsync(string sessionUID) { _logger.Info($"Querying channels for session with UID '{sessionUID}'..."); var request = _client .NewRequest(SessionOccurrence, sessionUID) .WithField(Session.ChannelUrlsField, true) .WithSubField(Session.ChannelUrlsField, Channel.UIDField) .WithSubField(Session.ChannelUrlsField, Channel.SelfField) .WithSubField(Session.ChannelUrlsField, Channel.NameField) .WithSubField(Session.ChannelUrlsField, Channel.ChannelTypeField) .WithSubField(Session.ChannelUrlsField, Channel.DriverOccurrenceUrlsField) ; return((await _cache.GetOrAddAsync($"{nameof(ApiService)}-{nameof(GetChannelsForSessionAsync)}-{sessionUID}", () => _client.GetItemAsync <Session>(request), DateTimeOffset.Now.AddMinutes(1))).ChannelUrls); }