Exemple #1
0
        public IList <MaxPriceItemByName> GetHighestCostItems()
        {
            const string uri      = "/items/group/name/agg/max(price)";
            var          response = PollyFactory
                                    .CreateGetPolicy <IList <MaxPriceItemByName> >()
                                    .Execute(() => _client.Execute <IList <MaxPriceItemByName> >(new RestRequest(uri, Method.GET)));

            return(response.IsSuccessful ? response.Data : throw response.ErrorException);
        }
Exemple #2
0
        public MaxPriceItemByName GetHighestCostItemByName(string name)
        {
            var uri      = $"/items/group/name/agg/max(price)?name={name}";
            var response = PollyFactory
                           .CreateGetPolicy <MaxPriceItemByName>()
                           .Execute(() => _client.Execute <MaxPriceItemByName>(new RestRequest(uri, Method.GET)));

            return(response.IsSuccessful || response.StatusCode == HttpStatusCode.NotFound
                ? response.Data
                : throw response.ErrorException);
        }