using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using isn.Abstract;

namespace isn
{
    public static class SourceHelpers
    {
        public static ApiIndexViewModel GetServerResources(string url)
        {
            HttpClient client = new HttpClient();
            ApiIndexViewModel result = null;
            // var json = await client.GetStringAsync(new System.Uri(url));
            
            Task.Run(async ()=> {
                var response = await client.GetStringAsync(url);
                    result = JsonConvert.DeserializeObject<ApiIndexViewModel>(response);
            }).Wait();
          
            return result;
        }
    }
}