sharee.bike-App/TINKLib/Model/Connector/Query/BaseLoggedIn.cs
Anja Müller-Meißner 0468955d49 Version 3.0.338
2022-09-08 09:55:14 +02:00

40 lines
1.3 KiB
C#

using System;
using TINK.Repository;
namespace TINK.Model.Connector
{
/// <summary>Holds user infromation required for copri related commands/ query operations. </summary>
public class BaseLoggedIn : Base
{
/// <summary>Session cookie used to sign in to copri.</summary>
public string SessionCookie { get; }
/// <summary> Mail address of the user. </summary>
protected string Mail { get; }
/// <summary> Object which provides date time info. </summary>
protected readonly Func<DateTime> DateTimeProvider;
/// <summary>Constructs a copri query object.</summary>
/// <param name="copriServer">Server which implements communication.</param>
public BaseLoggedIn(ICopriServerBase copriServer,
string sessionCookie,
string mail,
Func<DateTime> p_oDateTimeProvider) : base(copriServer)
{
if (string.IsNullOrEmpty(sessionCookie))
throw new ArgumentException("Can not instantiate query object- object. Session cookie must never be null or emtpy.");
if (string.IsNullOrEmpty(mail))
throw new ArgumentException("Can not instantiate query object- object. Mail address must never be null or emtpy.");
DateTimeProvider = p_oDateTimeProvider
?? throw new ArgumentException("Can not instantiate connector- object. No date time provider object available.");
SessionCookie = sessionCookie;
Mail = mail;
}
}
}