Example #1
0
        public async Task <ValueOrError <T> > Get <T>(string uri)
        {
            if (string.IsNullOrEmpty(uri))
            {
                return(ValueOrError <T> .CreateFromError("Empty Uri"));
            }

            var res = await _server.Get(uri);

            if (res.IsError)
            {
                return(ValueOrError <T> .CreateFromError(res.ErrorMessage));
            }

            var model = JsonConvert.DeserializeObject <T>(res.Value);

            return(ValueOrError <T> .CreateFromValue(model));
        }