public Task <EpisodeListResponse> ListEpisodesAsync(EpisodeListRequest request, ListPagination?pagination = null) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(GetListAsync <EpisodeListRequest, EpisodeListResponse>( _httpClient, Constants.Episodes.ListEndpointConfiguration, request, pagination )); }
public async Task <List <Episode> > List(int programId, DateRange dateRange) { var episodes = new List <Episode>(); var request = new EpisodeListRequest(programId) { FromDate = dateRange.FromDate, ToDate = dateRange.ToDate }; await foreach (var episode in _sverigesRadioApiClient.ListAllEpisodesAsync(request)) { episodes.Add(episode); } return(episodes); }
public static IAsyncEnumerable <Episode> ListAllEpisodesAsync(this ISverigesRadioApiClient apiClient, EpisodeListRequest request) { return(apiClient.ListAllAsync <Episode, EpisodeListRequest>(request, async(listRequest, pagination) => { var result = await apiClient.ListEpisodesAsync(request, pagination); return (result.Episodes, result.Pagination); })); }