private static List <Startup> GetStartups(IEnumerable <int> id) { try { const int MAX = 50; if (id.Count() > MAX) { int nbLoop = id.Count() / MAX; bool addLoop = id.Count() % MAX != 0; if (addLoop) { nbLoop++; } List <Startup> feeds = new List <Startup>(); for (int i = 0; i < nbLoop; i++) { string res = WebAccess.GetRequestResult(@"https://api.angel.co/1/startups/batch?ids=" + string.Join(",", id.Skip(i * MAX).Take(MAX))); List <Startup> feed = JsonConvert.DeserializeObject <List <Startup> >(res); feeds.AddRange(feed); } return(feeds); } else { string res = WebAccess.GetRequestResult(@"https://api.angel.co/1/startups/batch?ids=" + string.Join(",", id)); var feed = JsonConvert.DeserializeObject <List <Startup> >(res); return(feed); } } catch (Exception ex) { Log.Error("GetStartups", "error", ex); throw; } }
private static Feeds GetFeeds(int id = 0) { string res = WebAccess.GetRequestResult(string.Format(@"https://api.angel.co/1/feed?page={0}", id)); var feed = JsonConvert.DeserializeObject <Feeds>(res); return(feed); }
private static StartupRole GetStartups(int id) { try { string res = WebAccess.GetRequestResult(@"https://api.angel.co/1/startup_roles?v=1&startup_id=" + id); var startupRole = JsonConvert.DeserializeObject <StartupRole>(res); return(startupRole); } catch (Exception ex) { Log.Error("GetStartups", "error", id.ToString()); throw; } }