Spotify.NET/SpotifyAPI.Web/Models/BasicModel.cs

23 lines
522 B
C#
Raw Normal View History

2016-07-07 20:23:36 +01:00
using System.Net;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models
{
public abstract class BasicModel
{
[JsonProperty("error")]
public Error Error { get; set; }
private ResponseInfo _info;
2016-07-07 20:23:36 +01:00
public bool HasError() => Error != null;
2016-07-07 20:23:36 +01:00
internal void AddResponseInfo(ResponseInfo info) => _info = info;
2016-07-07 20:23:36 +01:00
public string Header(string key) => _info.Headers?.Get(key);
2016-07-07 20:23:36 +01:00
public WebHeaderCollection Headers() => _info.Headers;
2017-05-31 17:17:07 +01:00
public HttpStatusCode StatusCode() => _info.StatusCode;
}
}