Skip to content

Commit

Permalink
net7.0 :^)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Apr 23, 2023
1 parent 5c17763 commit e99cfef
Show file tree
Hide file tree
Showing 82 changed files with 3,400 additions and 3,724 deletions.
58 changes: 29 additions & 29 deletions StreamingClient.Base/Model/OAuth/OAuthShortCodeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@

namespace StreamingClient.Base.Model.OAuth
{
/// <summary>
/// A Short Code used for getting a token from an OAuth service.
/// </summary>
public class OAuthShortCodeModel
{
/// <summary>
/// The code that the user must enter to approve the authentication.
/// </summary>
public string code { get; set; }
/// <summary>
/// The end-URL identifier to use when opening the authentication webpage.
/// </summary>
public string handle { get; set; }
/// <summary>
/// The expiration time of the short code in seconds from when it was obtained.
/// </summary>
[JsonProperty("expires_in")]
public int expiresIn { get; set; }
/// <summary>
/// A Short Code used for getting a token from an OAuth service.
/// </summary>
public class OAuthShortCodeModel
{
/// <summary>
/// The code that the user must enter to approve the authentication.
/// </summary>
public string code { get; set; }
/// <summary>
/// The end-URL identifier to use when opening the authentication webpage.
/// </summary>
public string handle { get; set; }
/// <summary>
/// The expiration time of the short code in seconds from when it was obtained.
/// </summary>
[JsonProperty("expires_in")]
public int expiresIn { get; set; }

/// <summary>
/// The time when the token was obtained.
/// </summary>
[DataMember]
public DateTimeOffset AcquiredDateTime { get; set; }
/// <summary>
/// The time when the token was obtained.
/// </summary>
[DataMember]
public DateTimeOffset AcquiredDateTime { get; set; }

/// <summary>
/// The expiration time of the token.
/// </summary>
[JsonIgnore]
public DateTimeOffset ExpirationDateTime { get { return this.AcquiredDateTime.AddSeconds(this.expiresIn); } }
}
/// <summary>
/// The expiration time of the token.
/// </summary>
[JsonIgnore]
public DateTimeOffset ExpirationDateTime => AcquiredDateTime.AddSeconds(expiresIn);
}
}
127 changes: 62 additions & 65 deletions StreamingClient.Base/Model/OAuth/OAuthTokenModel.cs
Original file line number Diff line number Diff line change
@@ -1,82 +1,79 @@
using System;
using System;
using System.Runtime.Serialization;

using Newtonsoft.Json;

namespace StreamingClient.Base.Model.OAuth
{
/// <summary>
/// A token received from an OAuth authentication service.
/// </summary>
[DataContract]
public class OAuthTokenModel
{
/// <summary>
/// The ID of the client service.
/// </summary>
[DataMember]
public string clientID { get; set; }
/// <summary>
/// A token received from an OAuth authentication service.
/// </summary>
[DataContract]
public class OAuthTokenModel
{
/// <summary>
/// The ID of the client service.
/// </summary>
[DataMember]
public string clientID { get; set; }

/// <summary>
/// The secret of the client service.
/// </summary>
[DataMember]
public string clientSecret { get; set; }
/// <summary>
/// The secret of the client service.
/// </summary>
[DataMember]
public string clientSecret { get; set; }

/// <summary>
/// The authorization code sent when authenticating against the OAuth service.
/// </summary>
[DataMember]
public string authorizationCode { get; set; }
/// <summary>
/// The authorization code sent when authenticating against the OAuth service.
/// </summary>
[DataMember]
public string authorizationCode { get; set; }

/// <summary>
/// The token used for refreshing the authentication.
/// </summary>
[JsonProperty("refresh_token"), DataMember]
public string refreshToken { get; set; }
/// <summary>
/// The token used for refreshing the authentication.
/// </summary>
[JsonProperty("refresh_token"), DataMember]
public string refreshToken { get; set; }

/// <summary>
/// The token used for accessing the OAuth service.
/// </summary>
[JsonProperty("access_token"), DataMember]
public string accessToken { get; set; }
/// <summary>
/// The token used for accessing the OAuth service.
/// </summary>
[JsonProperty("access_token"), DataMember]
public string accessToken { get; set; }

/// <summary>
/// The expiration time of the token in seconds from when it was obtained.
/// </summary>
[JsonProperty("expires_in"), DataMember]
public long expiresIn { get; set; }
/// <summary>
/// The expiration time of the token in seconds from when it was obtained.
/// </summary>
[JsonProperty("expires_in"), DataMember]
public long expiresIn { get; set; }

/// <summary>
/// The timestamp of the expiration, if supported by the service, in seconds from Unix Epoch
/// </summary>
[JsonIgnore]
public long expiresTimeStamp { get; set; }
/// <summary>
/// The timestamp of the expiration, if supported by the service, in seconds from Unix Epoch
/// </summary>
[JsonIgnore]
public long expiresTimeStamp { get; set; }

/// <summary>
/// The redirect URL used as part of the token.
/// </summary>
[DataMember]
public string redirectUrl { get; set; }
/// <summary>
/// The redirect URL used as part of the token.
/// </summary>
[DataMember]
public string redirectUrl { get; set; }

/// <summary>
/// The time when the token was obtained.
/// </summary>
[DataMember]
public DateTimeOffset AcquiredDateTime { get; set; }
/// <summary>
/// The time when the token was obtained.
/// </summary>
[DataMember]
public DateTimeOffset AcquiredDateTime { get; set; }

/// <summary>
/// The expiration time of the token.
/// </summary>
[JsonIgnore]
public DateTimeOffset ExpirationDateTime { get { return (this.expiresTimeStamp > 0) ? DateTimeOffset.FromUnixTimeSeconds(this.expiresTimeStamp) : this.AcquiredDateTime.AddSeconds(this.expiresIn); } }
/// <summary>
/// The expiration time of the token.
/// </summary>
[JsonIgnore]
public DateTimeOffset ExpirationDateTime => (expiresTimeStamp > 0) ? DateTimeOffset.FromUnixTimeSeconds(expiresTimeStamp) : AcquiredDateTime.AddSeconds(expiresIn);

/// <summary>
/// Creates a new instance of an OAuth token.
/// </summary>
public OAuthTokenModel()
{
this.AcquiredDateTime = DateTimeOffset.Now;
}
}
/// <summary>
/// Creates a new instance of an OAuth token.
/// </summary>
public OAuthTokenModel() => AcquiredDateTime = DateTimeOffset.Now;
}
}
Loading

0 comments on commit e99cfef

Please sign in to comment.