sharee.bike-App/TINKLib/Model/Connector/Query/BaseLoggedIn.cs

40 lines
1.5 KiB
C#
Raw Normal View History

2021-05-13 20:03:07 +02:00
using System;
2021-06-26 20:57:55 +02:00
using TINK.Repository;
2021-05-13 20:03:07 +02:00
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>
2022-01-04 18:59:16 +01:00
/// <param name="copriServer">Server which implements communication.</param>
public BaseLoggedIn(ICopriServerBase copriServer,
string sessionCookie,
string mail,
Func<DateTime> p_oDateTimeProvider) : base(copriServer)
2021-05-13 20:03:07 +02:00
{
2022-01-04 18:59:16 +01:00
if (string.IsNullOrEmpty(sessionCookie))
2021-05-13 20:03:07 +02:00
throw new ArgumentException("Can not instantiate query object- object. Session cookie must never be null or emtpy.");
2022-01-04 18:59:16 +01:00
if (string.IsNullOrEmpty(mail))
2021-05-13 20:03:07 +02:00
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.");
2022-01-04 18:59:16 +01:00
SessionCookie = sessionCookie;
2021-05-13 20:03:07 +02:00
2022-01-04 18:59:16 +01:00
Mail = mail;
2021-05-13 20:03:07 +02:00
}
}
}