private static Task <TResult> GetDetailsAsync <TResult>(HttpClient httpClient, string url, DetailsRequestBase request, Dictionary <string, string?>?queryStringParams, AudioSettings defaultAudioSettings) { queryStringParams ??= new Dictionary <string, string?>(); if (request is IHasAudioSettings audioSettings) { UrlHelpers.AddAudioSettingsQueryStringParams(queryStringParams, audioSettings.AudioSettings, defaultAudioSettings); } var fullUrl = $"{url}/{request.Id:D}"; return(httpClient.GetAsync <TResult>(fullUrl, queryStringParams)); }
public Task <EpisodeDetailsResponse> GetLatestEpisodeAsync(EpisodeLatestDetailsRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } var queryStringParams = new Dictionary <string, string?>(); UrlHelpers.AddAudioSettingsQueryStringParams(queryStringParams, request.AudioSettings, _defaultAudioSettings); queryStringParams[Constants.Episodes.QueryString.ProgramId] = request.ProgramId.ToString("D"); return(_httpClient.GetAsync <EpisodeDetailsResponse>(Constants.Episodes.GetLatestUrl, queryStringParams)); }
private static Task <TResult> GetListAsync <TRequest, TResult>(HttpClient httpClient, ListEndpointConfiguration <TRequest> listEndpointConfiguration, TRequest request, ListPagination?pagination, AudioSettings defaultAudioSettings) where TRequest : ListRequestBase { var queryStringParams = new Dictionary <string, string?>(); UrlHelpers.AddPaginationQueryStringParams(queryStringParams, pagination); if (request is IHasAudioSettings audioSettings) { UrlHelpers.AddAudioSettingsQueryStringParams(queryStringParams, audioSettings.AudioSettings, defaultAudioSettings); } if (listEndpointConfiguration.QueryStringParamsResolver != null) { UrlHelpers.AddQueryStringParams(queryStringParams, request, listEndpointConfiguration.QueryStringParamsResolver); } return(httpClient.GetAsync <TResult>(listEndpointConfiguration.Url, queryStringParams)); }