mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 15:16:34 +01:00
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using System;
|
|
using TINK.Services.CopriApi;
|
|
|
|
namespace TINK.Model.Services.CopriApi
|
|
{
|
|
public class Result<T> where T : class
|
|
{
|
|
/// <summary>
|
|
/// Constructs a result object.
|
|
/// </summary>
|
|
/// <param name="source">Type of source (data provider).</param>
|
|
/// <param name="response">Requested data (bikes, station).</param>
|
|
/// <param name="generalData">General data (common to all respones).</param>
|
|
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;
|
|
}
|
|
|
|
/// <summary> Holds the requested data (bikes, stations and bikes).</summary>
|
|
public T Response { get; }
|
|
|
|
/// <summary> Holds the general purpose data (common to all responses).</summary>
|
|
public GeneralData GeneralData { get; }
|
|
|
|
/// <summary> Specifies the source (type of provider) of the copri response.</summary>
|
|
public Type Source { get; }
|
|
|
|
/// <summary> Holds the exception if a communication error occurred.</summary>
|
|
public Exception Exception { get; private set; }
|
|
}
|
|
}
|