using System; using Newtonsoft.Json; namespace Unity.Pipeline.Models { /// /// Base class for all responses. Serve also as the base class for all errors. /// [Serializable] public class BaseResponse { /// /// Response message if no error /// [JsonProperty("message")] public string Message { get; set; } /// /// Error message if the command failed. /// [JsonProperty("error")] public string Error { get; set; } /// /// Additional error details for debugging. /// [JsonProperty("errorDetails")] public string ErrorDetails { get; set; } /// /// When was the response created. /// [JsonProperty("executedAt")] public DateTime ExecutedAt { get; set; } /// /// Create a failed execution response. /// public static BaseResponse Failure(string error, string errorDetails) { return new BaseResponse { ExecutedAt = DateTime.UtcNow, Error = error, ErrorDetails = errorDetails }; } } }