using Spectre.Console; namespace SpectreDemos; public static class Helpers { public static async Task FetchApiDataAsync(string apiUrl) { using var client = new HttpClient(); try { HttpResponseMessage response = await client.GetAsync(apiUrl); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); } catch (Exception ex) { AnsiConsole.MarkupLine($"[red]Error fetching data from API:[/]{ex.Message}"); return string.Empty; } } }