public virtual async Task <IRockResponse <List <T> > > SearchHttp(BaseQO qo) { using (var http = CreateClient()) { var searchUrl = SearchUrl + "?" + qo.ToQueryString(); var response = await http.GetAsync(searchUrl); var rockresponse = new RockResponse <List <T> >(); rockresponse.StatusCode = response.StatusCode; rockresponse.JsonResponse = await response.Content.ReadAsStringAsync(); rockresponse.Data = JsonConvert.DeserializeObject <List <T> >(rockresponse.JsonResponse); return(rockresponse); } }
public virtual IRockResponse <S> Search <S>(BaseQO qo) where S : new() { if (string.IsNullOrWhiteSpace(SearchUrl)) { throw new NotImplementedException("The property SearchUrl has no value on the ApiSet."); } var request = CreateRestRequest(Method.GET, SearchUrl); foreach (var pair in qo.ToDictionary()) { request.AddQueryParameter(pair.Key, pair.Value); } var list = ExecuteCustomRequest <S>(request); return(list.ToRockResponse <S>()); }
public virtual IRockResponse <RockCollection <S> > FindBy <S>(BaseQO qo, string url = null) where S : new() { var collection = new RockCollection <S>(); if (string.IsNullOrEmpty(url)) { if (string.IsNullOrWhiteSpace(SearchUrl)) { throw new NotImplementedException("The property SearchUrl has no value on the ApiSet."); } url = SearchUrl; } var request = CreateRestRequest(Method.GET, url); foreach (var pair in qo.ToDictionary()) { request.AddParameter(pair.Key, pair.Value); } var item = ExecuteCustomRequest <List <S> >(request); return(item.ToRockCollectionResponse()); }
public virtual IRockResponse <RockCollection <T> > FindBy(BaseQO qo) { return(FindBy <T>(qo)); }
public virtual IRockResponse <RockCollection <T> > FindBy(string parentID, BaseQO qo) { return(FindBy <T>(qo, string.Format(SearchUrl, parentID))); }