using System; using System.Net; using Kreta.Client.ClientBase.Interface; using RestSharp; namespace Kreta.Client.ClientBase { internal class RestResult : IRestResult { public string Result { get; set; } public HttpStatusCode StatusCode { get; set; } public string StatusDescription { get; set; } public Exception Exception { get; set; } public string ErrorMessage { get; set; } public byte[] RawBytes { get; set; } public static IRestResult Convert(IRestResponse restResponse) => new RestResult { Result = restResponse.Content, StatusCode = restResponse.StatusCode, StatusDescription = restResponse.StatusDescription, Exception = restResponse.ErrorException, ErrorMessage = restResponse.ErrorMessage, RawBytes = restResponse.RawBytes }; } internal class RestResult : RestResult, IRestResult { public TResponse Result { get; set; } public static IRestResult Convert(IRestResponse restResponse) => new RestResult { Result = restResponse.Data, StatusCode = restResponse.StatusCode, StatusDescription = restResponse.StatusDescription, Exception = restResponse.ErrorException, ErrorMessage = restResponse.ErrorMessage, RawBytes = restResponse.RawBytes }; } }