Exemplo n.º 1
0
        public RestRequest GetRequest(StashObjectEnum objectType, Dictionary <String, String> parameters,
                                      Dictionary <String, String> keys)
        {
            if (!_methods.ContainsKey(objectType))
            {
                throw new NotImplementedException();
            }

            return(GetRequest(_methods[objectType], parameters, keys));
        }
Exemplo n.º 2
0
        public T Execute <T>(StashObjectEnum objectType, Dictionary <String, String> parameters = null, Dictionary <String, String> keys = null) where T : new()
        {
            IRestResponse <T> response = Client.Execute <T>(GetRequest(objectType, parameters ?? new Dictionary <String, String>(), keys ?? new Dictionary <String, String>()));

            if (response.ErrorException != null)
            {
                throw response.ErrorException;
            }
            if (response.ResponseStatus != ResponseStatus.Completed)
            {
                throw new Exception(response.ErrorMessage);
            }

            return(response.Data);
        }
Exemplo n.º 3
0
 protected List <T> GetList <T>(StashObjectEnum objectType, Dictionary <String, String> parameters = null, Dictionary <String, String> keys = null) where T : new()
 {
     return(Execute <List <T> >(objectType, parameters, keys));
 }