Example #1
0
        private string GetResultString(Type type, string query, int start, int limit)
        {
            var client           = CreateClient();
            var requestGenerator = new FTSRequestGenerator(_uri);
            var request          = requestGenerator.GenerateRequestUrl(type, query, start, limit);
            var resultString     = client.GetStringAsync(request).Result;

            return(resultString);
        }
Example #2
0
        public IEnumerable <T> SearchFTS <T>(string query, int start = 0, int limit = 0) where T : BaseE3SEntity
        {
            var requestGenerator = new FTSRequestGenerator(_baseAddress);

            Uri request = requestGenerator.GenerateRequestUrl <T>(query, start, limit);

            string resultString = _httpClient.GetStringAsync(request).Result;

            return(JsonConvert.DeserializeObject <FTSResponse <T> >(resultString).Items.Select(t => t.Data));
        }
Example #3
0
        public IEnumerable SearchFTS(Type type, string query, int start = 0, int limit = 0)
        {
            var requestGenerator = new FTSRequestGenerator(_baseAddress);

            Uri request = requestGenerator.GenerateRequestUrl(type, query, start, limit);

            string resultString = _httpClient.GetStringAsync(request).Result;
            Type   endType      = typeof(FTSResponse <>).MakeGenericType(type);
            object result       = JsonConvert.DeserializeObject(resultString, endType);

            var list = Activator.CreateInstance(typeof(List <>).MakeGenericType(type)) as IList;

            foreach (object item in (IEnumerable)endType.GetProperty("items").GetValue(result))
            {
                list.Add(item.GetType().GetProperty("data").GetValue(item));
            }

            return(list);
        }