using System; using TINK.Services.CopriApi; namespace TINK.Model.Services.CopriApi { public class Result where T : class { /// /// Constructs a result object. /// /// Type of source (data provider). /// Requested data (bikes, station). /// General data (common to all responses). public Result( Type source, T response, GeneralData generalData, Exception exception = null) { Source = source ?? throw new ArgumentException(nameof(source)); Response = response ?? throw new ArgumentException(nameof(response)); GeneralData = generalData ?? new GeneralData(); Exception = exception; } /// Holds the requested data (bikes, stations and bikes). public T Response { get; } /// Holds the general purpose data (common to all responses). public GeneralData GeneralData { get; } /// Specifies the source (type of provider) of the copri response. public Type Source { get; } /// Holds the exception if a communication error occurred. public Exception Exception { get; private set; } } }