using System.Net.Http.Json; namespace MonkeyFinder.Services; public class MonkeyService { HttpClient httpClient; public MonkeyService() { httpClient = new HttpClient(); } List monkeyList = new(); public async Task> GetMonkeys() { if (monkeyList?.Count > 0) { return monkeyList; } var url = "https://montemagno.com/monkeys.json"; var response = await httpClient.GetAsync(url); if(response.IsSuccessStatusCode) { monkeyList = await response.Content.ReadFromJsonAsync>(); } return monkeyList; } }