public async Task <IEnumerable <StateCount> > GetTopStateByPhrase(string phrase, PagingState page = null, string sort = "count", SearchParameters searchParams = null)
 {
     return(await GetTopEntityByPhrase <StateCount>("state", phrase, page, sort, searchParams));
 }
 public async Task <IEnumerable <PhraseCount> > GetTopPhrasesByLegislator(string legislator, int wordCount = 1, PagingState page = null, string sort = "count desc")
 {
     return(await GetTopPhrases("legislator", legislator, wordCount, page, sort));
 }
        private async Task <IEnumerable <PhraseCount> > GetTopPhrases(string entityType, string entityValue, int wordCount, PagingState page, string sort)
        {
            Debug.Assert(wordCount >= 1 && wordCount <= 5);

            var parms = new Dictionary <string, object>();

            parms.Add("entity_type", entityType);
            parms.Add("entity_value", entityValue);
            parms.Add("n", wordCount);
            parms.Add("page", page != null ? page.Page : 0);
            parms.Add("sort", sort);

            return(await _service.Get <IEnumerable <PhraseCount> >("phrases.json", parms));
        }
 public async Task <IEnumerable <PhraseCount> > GetTopPhrasesByMonth(DateTime month, int wordCount = 1, PagingState page = null, string sort = "count desc")
 {
     return(await GetTopPhrases("month", month.ToString("yyyyMM"), wordCount, page, sort));
 }
 public async Task <IEnumerable <PhraseCount> > GetTopPhrasesByDate(DateTime date, int wordCount = 1, PagingState page = null, string sort = "count desc")
 {
     return(await GetTopPhrases("date", date.ToString("yyyy-MM-dd"), wordCount, page, sort));
 }
 public async Task <IEnumerable <PhraseCount> > GetTopPhrasesByState(string state, int wordCount = 1, PagingState page = null, string sort = "count desc")
 {
     return(await GetTopPhrases("state", state, wordCount, page, sort));
 }
        public async Task <FullTextSearchResultList> FullTextSearch(string phrase, string title = null, string bioGuideId = null, string cr_pages = null, PagingState page = null, SearchParameters searchParams = null)
        {
            var parms = new Dictionary <string, object>();

            parms.Add("phrase", phrase);
            parms.Add("title", title);
            parms.Add("bioGuideId", bioGuideId);
            parms.Add("cr_pages", cr_pages);
            parms.Add("page", page != null ? page.Page : 0);
            parms.AddProperties(searchParams);

            return(await _service.Get <FullTextSearchResultList>("text.json", parms));
        }
        private async Task <IEnumerable <T> > GetTopEntityByPhrase <T>(string entity, string phrase, PagingState page, string sort, SearchParameters searchParams)
        {
            var parms = new Dictionary <string, object>();

            parms.Add("phrase", phrase);
            parms.Add("page", page != null ? page.Page : 0);
            parms.Add("per_page", 50);
            parms.Add("sort", sort);
            parms.AddProperties(searchParams);

            var results = await _service.Get <ResultsWrapper <T> >(string.Format("phrases/{0}.json", entity), parms);

            return(results.results);
        }