예제 #1
0
        private static IRestResponse MapResponse(global::RestSharp.IRestResponse response)
        {
            TrelloConfiguration.Log.Debug($"Status Code: {response.StatusCode} ({(int)response.StatusCode})\n" +
                                          $"Content: {response.Content}");
            var restResponse = new RestSharpResponse
            {
                Content    = response.Content,
                StatusCode = response.StatusCode
            };

            return(restResponse);
        }
예제 #2
0
 private void ValidateResponse(global::RestSharp.IRestResponse response)
 {
     if (response == null)
     {
         _log.Error(new WebException("Received null response from Trello."));
     }
     if (response.StatusCode != HttpStatusCode.OK)
     {
         _log.Error(new WebException($"Trello returned with an error.\nError Message: {response.ErrorMessage}\nContent: {response.Content}",
                                     response.ErrorException));
     }
 }
예제 #3
0
        private Rest.IRestResponse <T> MapResponse <T>(global::RestSharp.IRestResponse response)
            where T : class
        {
            TrelloConfiguration.Log.Debug($"Status Code: {response.StatusCode} ({(int) response.StatusCode})\n" +
                                          $"Content: {response.Content}");
            var restResponse = new RestSharpResponse <T>
            {
                Content    = response.Content,
                StatusCode = response.StatusCode
            };

            try
            {
                restResponse.Data = _deserializer.Deserialize <T>(response);
            }
            catch (Exception e)
            {
                restResponse.Exception = e;
            }
            return(restResponse);
        }