private T Execute <T>(RestRequest request) where T : new() { var client = new RestClient(); client.BaseUrl = _baseUrl; var response = client.Execute <T>(request); _lastResponse = new RestResponseDto(response); if (response.ErrorException != null) { const string message = "Error retrieving response. Check inner details for more info."; throw new ApplicationException(message, response.ErrorException); } return(response.Data); }
public void Publish(string topic) { var request = new RestRequest(Method.POST) { Resource = "publish" }; request.AddParameter("hub.url", topic, ParameterType.GetOrPost); request.AddParameter("hub.mode", "publish", ParameterType.GetOrPost); var client = new RestClient(); client.BaseUrl = _baseUrl; var response = client.Execute(request); _lastResponse = new RestResponseDto(response); if (response.ErrorException != null) { const string message = "Error retrieving response. Check inner details for more info."; throw new ApplicationException(message, response.ErrorException); } }
public void ClearLastResponse() { _lastResponse = null; }