sharee.bike-App/TINKLib/Services/CopriApi/ICachedCopriServer.cs

53 lines
2.4 KiB
C#
Raw Normal View History

2023-04-19 12:14:14 +02:00
2023-11-06 12:23:09 +01:00
using System;
2021-05-13 20:03:07 +02:00
using System.Threading.Tasks;
2021-06-26 20:57:55 +02:00
using TINK.Repository;
using TINK.Repository.Response;
2023-04-19 12:14:14 +02:00
using TINK.Repository.Response.Stations;
2021-05-13 20:03:07 +02:00
namespace TINK.Model.Services.CopriApi
{
2022-09-06 16:08:19 +02:00
/// <summary> Manages cache which holds copri data.</summary>
public interface ICachedCopriServer : ICopriServerBase
{
/// <summary> Get list of stations. </summary>
/// <returns>List of all stations.</returns>
Task<Result<StationsAvailableResponse>> GetStations(bool fromCache = false);
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary> Gets a list of bikes from Copri. </summary>
2023-11-06 12:23:09 +01:00
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
2023-11-21 15:26:57 +01:00
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
2022-09-06 16:08:19 +02:00
/// <returns>Response holding list of bikes.</returns>
2023-11-21 15:26:57 +01:00
Task<Result<BikesAvailableResponse>> GetBikesAvailable(
bool fromCache = false,
Uri operatorUri = null,
string stationId = null,
string bikeId = null);
2021-05-13 20:03:07 +02:00
2023-04-19 12:14:14 +02:00
/// <summary> Gets a list of bikes reserved/ booked by active user from Copri.</summary>
2022-09-06 16:08:19 +02:00
/// <returns>Response holding list of bikes.</returns>
Task<Result<BikesReservedOccupiedResponse>> GetBikesOccupied(bool fromCache = false);
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>Adds https--response to cache if response is ok. </summary>
/// <param name="response">Response to add to cache.</param>
void AddToCache(Result<StationsAvailableResponse> result);
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>Adds https--response to cache if response is ok. </summary>
2023-11-21 15:26:57 +01:00
/// <param name="result">Response to add to cache.</param>
2023-11-06 12:23:09 +01:00
/// <param name="operatorUri">Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.</param>
2023-11-21 15:26:57 +01:00
/// <param name="stationId"> Id of station which is used for filtering bikes. Null if no filtering should be applied.</param>
/// <param name="bikeId"> Id of bike which is used for filtering bikes. Null if no filtering should be applied.</param>
void AddToCache(
Result<BikesAvailableResponse> result,
Uri operatorUri = null,
string stationId = null,
string bikeId = null);
2021-05-13 20:03:07 +02:00
2022-09-06 16:08:19 +02:00
/// <summary>Adds https--response to cache if response is ok. </summary>
/// <param name="response">Response to add to cache.</param>
/// <returns></returns>
void AddToCache(Result<BikesReservedOccupiedResponse> result);
}
2021-05-13 20:03:07 +02:00
}