chore: init commit from GitHub
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using SWAD.API.Services.MusicAPI.Auth;
|
||||
|
||||
namespace SWAD.API.Models.JsonStructures.MusicAPI;
|
||||
|
||||
public abstract class DefaultAuthResponse : IAuthResponse
|
||||
{
|
||||
private int? _expire;
|
||||
private DateTime? _revokedAt;
|
||||
|
||||
[JsonPropertyName("access_token")]
|
||||
|
||||
// ReSharper disable once NullableWarningSuppressionIsUsed
|
||||
public string Token { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("expires_in")]
|
||||
public int? ExpireTime
|
||||
{
|
||||
get => _expire;
|
||||
set
|
||||
{
|
||||
_expire = value;
|
||||
_revokedAt = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime? ExpireAt => _revokedAt?.AddSeconds(ExpireTime ?? 0);
|
||||
}
|
||||
Reference in New Issue
Block a user