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