2020-05-15 19:06:24 +01:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web.Auth
|
|
|
|
{
|
|
|
|
public class ImplictGrantResponse
|
|
|
|
{
|
|
|
|
public ImplictGrantResponse(string accessToken, string tokenType, int expiresIn)
|
|
|
|
{
|
|
|
|
Ensure.ArgumentNotNullOrEmptyString(accessToken, nameof(accessToken));
|
|
|
|
Ensure.ArgumentNotNullOrEmptyString(tokenType, nameof(tokenType));
|
|
|
|
|
|
|
|
AccessToken = accessToken;
|
|
|
|
TokenType = tokenType;
|
|
|
|
ExpiresIn = expiresIn;
|
|
|
|
}
|
|
|
|
|
2020-05-25 17:00:38 +01:00
|
|
|
public string AccessToken { get; set; } = default!;
|
|
|
|
public string TokenType { get; set; } = default!;
|
2020-05-15 19:06:24 +01:00
|
|
|
public int ExpiresIn { get; set; }
|
2020-11-13 13:43:00 +00:00
|
|
|
public string? State { get; set; } = default!;
|
2020-05-15 19:06:24 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Auto-Initalized to UTC Now
|
|
|
|
/// </summary>
|
|
|
|
/// <value></value>
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
|
|
public bool IsExpired { get => CreatedAt.AddSeconds(ExpiresIn) <= DateTime.UtcNow; }
|
|
|
|
}
|
|
|
|
}
|