public async Task <Product> GetProductDetailsAsync(int itemId) { RootObject searchDetails = null; HttpResponseMessage response = await new HttpClient().GetAsync(WalmartRestClient.ProductLookupApi(itemId)); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsStringAsync(); searchDetails = JsonConvert.DeserializeObject <RootObject>(result); } return(WalmartSearchQuery.ExtractRequiredProductDetails(searchDetails, itemId)); }
public async Task <List <Product> > SearchProductAsync(string searchItem) { RootObject searchDetails = null; HttpResponseMessage response = await new HttpClient().GetAsync(WalmartRestClient.SearchApiRequest(searchItem)); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsStringAsync(); searchDetails = JsonConvert.DeserializeObject <RootObject>(result); } return(WalmartSearchQuery.ExtractRequiredProductDetails(searchDetails).ToList()); }