mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 23:16:28 +00:00
67cb3e42f1
* SpotifyHttpStatusCode A small supplementary enum for Spotify specific codes. Only contains TooManyRequests currently, but more can be added. * TooManyRequests Retry Handling Will now parse and wait the Spotify recommended wait time. Also has the option to not consume a retry attempt on this type of error * TryGetTooManyRequests refactored to GetTooManyRequests To keep the library consistent * Removed SpotifyHttpStatusCode
25 lines
605 B
C#
25 lines
605 B
C#
using Newtonsoft.Json;
|
|
using SpotifyAPI.Web.Enums;
|
|
using System;
|
|
using System.Net;
|
|
|
|
namespace SpotifyAPI.Web.Models
|
|
{
|
|
public abstract class BasicModel
|
|
{
|
|
[JsonProperty("error")]
|
|
public Error Error { get; set; }
|
|
|
|
private ResponseInfo _info;
|
|
|
|
public bool HasError() => Error != null;
|
|
|
|
internal void AddResponseInfo(ResponseInfo info) => _info = info;
|
|
|
|
public string Header(string key) => _info.Headers?.Get(key);
|
|
|
|
public WebHeaderCollection Headers() => _info.Headers;
|
|
|
|
public HttpStatusCode StatusCode() => _info.StatusCode;
|
|
}
|
|
} |