コード例 #1
0
        public async Task <IDStoriesResponse> GetStoriesIDs()
        {
            IDStoriesResponse ResponseIDs = new IDStoriesResponse();
            var suffix     = _config.GetValue <string>("sufix.url.listid.api", "v0/beststories.json");
            var urlApiBase = _config.GetValue <string>("base.url.api", "https://hacker-news.firebaseio.com/");

            var response = await _httpService.CallHttp(
                (url) => url
                .WithHeader("Accept", "application/json")
                .GetAsync()
                .ReceiveJson <List <long> >(),
                urlApiBase, string.Format(suffix));

            if (response.Result != null)
            {
                var first20 = response.Result.Take(20);
                ResponseIDs = new IDStoriesResponse {
                    IDStoriesList = first20.ToList()
                };
            }

            return(ResponseIDs);
        }