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