@@ -5,13 +5,12 @@ namespace Tesla.NET.Models
55{
66 using System ;
77 using System . Diagnostics ;
8- using Newtonsoft . Json ;
98
109 /// <summary>
1110 /// The response to an access token or refresh token request.
1211 /// </summary>
1312 [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
14- public class AccessTokenResponse
13+ public class AccessTokenResponse : IAccessTokenResponse
1514 {
1615 /// <summary>
1716 /// Initializes a new instance of the <see cref="AccessTokenResponse"/> class.
@@ -40,49 +39,41 @@ public AccessTokenResponse(
4039 /// <summary>
4140 /// Gets the access token.
4241 /// </summary>
43- [ JsonProperty ( "access_token" ) ]
4442 public string AccessToken { get ; }
4543
4644 /// <summary>
4745 /// Gets the type of the <see cref="AccessToken"/>.
4846 /// </summary>
49- [ JsonProperty ( "token_type" ) ]
5047 public string TokenType { get ; }
5148
5249 /// <summary>
5350 /// Gets the expiry duration in seconds of the <see cref="AccessToken"/>.
5451 /// </summary>
55- [ JsonProperty ( "expires_in" ) ]
5652 public long ExpiresIn { get ; }
5753
5854 /// <summary>
5955 /// Gets the expiry duration of the <see cref="AccessToken"/>.
6056 /// </summary>
61- [ JsonIgnore ]
6257 public TimeSpan ExpiresInTimespan => TimeSpan . FromSeconds ( ExpiresIn ) ;
6358
6459 /// <summary>
6560 /// Gets the UTC <see cref="DateTime"/> when the <see cref="AccessToken"/> expires.
6661 /// </summary>
67- [ JsonIgnore ]
6862 public DateTime ExpiresUtc => EpochConversion . FromSeconds ( CreatedAt + ExpiresIn ) ;
6963
7064 /// <summary>
7165 /// Gets the Epoch timestamp when the <see cref="AccessToken"/> was issued.
7266 /// </summary>
73- [ JsonProperty ( "created_at" ) ]
7467 public long CreatedAt { get ; }
7568
7669 /// <summary>
7770 /// Gets the UTC <see cref="DateTime"/> when the <see cref="AccessToken"/> was issued.
7871 /// </summary>
79- [ JsonIgnore ]
8072 public DateTime CreatedUtc => EpochConversion . FromSeconds ( CreatedAt ) ;
8173
8274 /// <summary>
8375 /// Gets the refresh token that can be used to acquire a new <see cref="AccessToken"/>.
8476 /// </summary>
85- [ JsonProperty ( "refresh_token" ) ]
8677 public string RefreshToken { get ; }
8778
8879 private string DebuggerDisplay => $ "{ GetType ( ) . Name } : { AccessToken . Substring ( 0 , 6 ) } … Expires { ExpiresUtc : R} ";
0 commit comments