示例#1
0
        public async Task <RestResponse <WpQueryHolder> > GetOneQueryHolderAsync(WpTitles wpTitles,
                                                                                 CancellationToken cancellationToken = default)
        {
            string baseUri    = "https://en.wikipedia.org/w/api.php?format=json&action=query";
            string requestUri = $"{baseUri}&prop=extracts&exintro=true&redirects=true&titles={wpTitles.Value}";

            return(await GetAsync <WpQueryHolder>(new Uri(requestUri), cancellationToken));
        }
示例#2
0
        private async Task <RestResponse <WpQueryHolder> > GetOneWpQueryHolderAsync(WdEntitiesHolder wdEntitiesHolder,
                                                                                    CancellationToken cancellationToken = default)
        {
            var wdEntity = wdEntitiesHolder?.Entities?.FirstOrDefault().Value;

            if (wdEntity != null)
            {
                var wpTitles = new WpTitles(wdEntity.EnSiteLink.Title);
                return(await _wpQueryRestClient.GetOneQueryHolderAsync(wpTitles, cancellationToken));
            }
            return(null);
        }