Refactor IPAM model classes to use records for Address, Subnetwork, Vlan, Vrf, Section, Tag, Domain, Nameserver, and Session; enhance documentation and implement value equality for records.
This commit is contained in:
@@ -1,33 +1,27 @@
|
||||
namespace PS.IPAM;
|
||||
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an authenticated session with phpIPAM API.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Session {
|
||||
public AuthType AuthType { get; }
|
||||
public string Token { get; set; }
|
||||
public string AppID { get; }
|
||||
public string URL { get; }
|
||||
public DateTime? Expires { get; set; }
|
||||
public object? Credentials { get; }
|
||||
public Session(
|
||||
AuthType authType,
|
||||
string token,
|
||||
string appId,
|
||||
string url,
|
||||
DateTime? expires,
|
||||
object? credentials
|
||||
) {
|
||||
AuthType = authType;
|
||||
Token = token;
|
||||
AppID = appId;
|
||||
URL = url;
|
||||
Expires = expires;
|
||||
Credentials = credentials;
|
||||
}
|
||||
public sealed record Session(
|
||||
AuthType AuthType,
|
||||
string Token,
|
||||
string AppID,
|
||||
string URL,
|
||||
DateTime? Expires,
|
||||
object? Credentials
|
||||
)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the current authentication token.
|
||||
/// </summary>
|
||||
public string Token { get; set; } = Token;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return base.ToString();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the token expiration time.
|
||||
/// </summary>
|
||||
public DateTime? Expires { get; set; } = Expires;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user