예제 #1
0
        /// <summary>
        /// Fetch News from the API.
        /// </summary>
        /// <param name="request">Returns the top headlines from all sources for an entered request.</param>
        /// <returns><see cref="NewsResult"/> The result of the search with an IEnumerable collection of articles.</returns>
        public async Task <NewsResult> FetchNewsAsync(TopHeadlinesRequest request)
        {
            var baseUrl = Constants.BaseUrl;
            var query   = RequestFormat.CreateUrl(request, baseUrl);

            var response = await SendRequestAsync(query);

            return(GetResult(response));
        }