Correct JSON
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
All checks were successful
Build, Push and Run Container / build (push) Successful in 24s
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ProofOfConcept.Models;
|
||||
|
||||
public record Token
|
||||
{
|
||||
public string AccessToken { get; init; }
|
||||
public DateTimeOffset Expires { get; init; }
|
||||
public string TokenType { get; init; }
|
||||
|
||||
public Token(string AccessToken, int ExpiresIn, string TokenType, DateTimeOffset? received = null)
|
||||
{
|
||||
this.AccessToken = AccessToken;
|
||||
this.Expires = received?.AddSeconds(ExpiresIn) ?? DateTimeOffset.Now.AddSeconds(ExpiresIn);
|
||||
this.TokenType = TokenType;
|
||||
}
|
||||
public string AccessToken { get; init; } = String.Empty;
|
||||
public DateTimeOffset Expires { get; init; } = DateTimeOffset.Now;
|
||||
public string TokenType { get; init; } = String.Empty;
|
||||
|
||||
//For JSON deserialization
|
||||
public int ExpiresIn { get => (int)DateTimeOffset.Now.Subtract(Expires).TotalSeconds; init => Expires = DateTimeOffset.Now.AddSeconds(value); }
|
||||
}
|
||||
Reference in New Issue
Block a user