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

22 lines
523 B
C#
Raw Normal View History

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