public APIDataModel Get( string request, string keyword = "", int runningAvg = 0, int interval = 0, long sinceID = 0, string id = "", string unit = "", string date = "", string source = "" ) { int keyID = -1; APIDataModel data = new APIDataModel(); if (request == "TOTAL") { if (runningAvg > 1) { d = ChartManager.collectAverages(keyword, runningAvg); } else { data = ChartManager.CollectRawValues(keyword); data.chartDiv = data.keyword.Replace(" ", String.Empty) + "ChartDiv"; } } else if (request == "FIVE_MINUTES") { keyID = DatabaseAccessLayer.Instance.GetKeywordID(keyword); data = DatabaseAccessLayer.Instance.Get5Min(keyID); } else if (request == "USER_INFO") { data.keywords = AccountManager.GetUserKeywords(Guid.Parse(id)); data.accounts = new Account[1]; data.accounts[0] = AccountManager.GetAccountInfo(Guid.Parse(id)); } else if (request == "USER_LIST") { data.accounts = AccountManager.GetAccounts().ToArray(); } else if (request == "CLASSIFY_SENTIMENT") { data.ourSentiment = SentimentClassificationService.Instance.Classify(keyword); data.viralSentiment = "none";//json["mood"]; } else if (request == "GET_ANNOTATIONS") { data = DatabaseAccessLayer.Instance.GetAnnotations(keyword); } else if (request == "TIME_RANGE") { keyID = DatabaseAccessLayer.Instance.GetKeywordID(keyword); if (unit == "5min") { data = DatabaseAccessLayer.Instance.Get5Min(keyID); } else if (unit == "1min") { d = DatabaseAccessLayer.Instance.GetLastMinute(keyID); } else if (unit == "10sec") { data = DatabaseAccessLayer.Instance.GetTenSeconds(keyID, source); } else { data = DatabaseAccessLayer.Instance.GetTimeRange(keyID, unit); if (data.dates.Count() > 0) { data.sentimentList = DatabaseAccessLayer.Instance.GetHistoryPage(keyword, 0, DateTime.Parse(data.dates[0])).sentimentList; } } } else if (request == "PAGE") { data = DatabaseAccessLayer.Instance.GetHistoryPage(keyword, interval - 1, DateTime.Parse(date)); } else if (request == "DAY_VALUES") { data = DatabaseAccessLayer.Instance.GetDayValues(keyword, DateTime.Parse(date)); } else if (request == "WIDGET") { data = DatabaseAccessLayer.Instance.GetWidgetData(keyword); } return(data); }