Exemplo n.º 1
0
        public async Task <List <int> > GetStoriesByType(HackerNewsEnums.StoryType type)
        {
            try
            {
                var response = await Client.GetAsync(type + ".json");

                response.EnsureSuccessStatusCode();

                var json = await response.Content.ReadAsStringAsync();

                List <int> storyList = JsonSerializer.Deserialize <List <int> >(json);

                return(storyList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public async Task <List <int> > GetHackerNewsStories(HackerNewsEnums.StoryType type) =>
 await _client.GetStoriesByType(type);